import{b as P,r as o,s as e,H as x,v as g,bV as h,bW as f,E as b,aL as E,aM as N,aN as w,aO as j,bX as F,bY as H,D as W,bZ as q,b_ as B,j as t,R as k}from"./index-DtyjNqrf.js";import{C as G}from"./CheckboxField-DKhAwA85.js";import{I as y}from"./InputField-CYbmpJqW.js";import{N as T}from"./NumberField-DVRroIAm.js";import{S as n}from"./SelectField-DfdnxD7O.js";import"./envs-DFlyG_dH.js";function Q(){const{t:s}=P(["settings","navbar","network","common"]),[r,S]=o.useState(e.get(x,"devices")),[l,M]=o.useState(e.get(g,!1)),[i,D]=o.useState(e.get(h,254)),[c,C]=o.useState(e.get(f,4)),[m,O]=o.useState(e.get(b,"data")),[d,A]=o.useState(e.get(E,"forceDirected2d")),[u,K]=o.useState(e.get(N,"all")),[p,Y]=o.useState(e.get(w,-750)),[_,L]=o.useState(e.get(j,50));o.useEffect(()=>{e.set(x,r)},[r]),o.useEffect(()=>{e.set(g,l)},[l]),o.useEffect(()=>{e.set(h,i)},[i]),o.useEffect(()=>{e.set(f,c)},[c]),o.useEffect(()=>{e.set(b,m)},[m]),o.useEffect(()=>{e.set(E,d)},[d]),o.useEffect(()=>{e.set(N,u)},[u]),o.useEffect(()=>{e.set(w,p)},[p]),o.useEffect(()=>{e.set(j,_)},[_]);const I=o.useCallback(()=>{e.remove(F),e.remove(x),e.remove(g),e.remove(h),e.remove(f),e.remove(b),e.remove(E),e.remove(N),e.remove(w),e.remove(j),e.remove(H),e.remove(W),e.remove("all-devices-column-visibility"),e.remove("all-groups-column-visibility"),e.remove("ota-devices-column-visibility"),e.remove("touchlink-devices-column-visibility"),e.remove("health-devices-column-visibility"),window.location.reload()},[]),R=o.useCallback(()=>{e.remove(q),e.remove(B),window.location.reload()},[]);return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"alert alert-info alert-vertical sm:alert-horizontal",children:[s("frontend_notice"),t.jsxs("div",{className:"flex flex-row flex-wrap gap-2",children:[t.jsx(k,{className:"btn btn-sm btn-error",onClick:I,title:s("reset_settings"),modalDescription:s("common:dialog_confirmation_prompt"),modalCancelLabel:s("common:cancel"),children:s("reset_settings")}),t.jsx(k,{className:"btn btn-sm btn-error",onClick:R,title:s("reset_auth"),modalDescription:s("common:dialog_confirmation_prompt"),modalCancelLabel:s("common:cancel"),children:s("reset_auth")})]})]}),t.jsxs("div",{className:"flex flex-row flex-wrap gap-4 mt-3",children:[t.jsxs(n,{name:"homepage",label:s("homepage"),onChange:a=>!a.target.validationMessage&&S(a.target.value),value:r,required:!0,children:[t.jsx("option",{value:"devices",children:s("navbar:devices")}),t.jsx("option",{value:"dashboard",children:s("navbar:dashboard")})]}),t.jsx(G,{name:"dashboard_column_display",label:s("dashboard_column_display"),checked:l,onChange:a=>M(a.target.checked)}),t.jsx(y,{type:"number",name:"permit_join_time",label:s("permit_join_time"),min:10,max:254,required:!0,value:i,onChange:a=>!a.target.validationMessage&&!!a.target.value&&D(a.target.valueAsNumber)}),t.jsx(y,{type:"number",name:"max_on_screen_notifications",label:s("max_on_screen_notifications"),min:1,max:5,required:!0,value:c,onChange:a=>!a.target.validationMessage&&!!a.target.value&&C(a.target.valueAsNumber)})]}),t.jsx("h2",{className:"text-lg mt-2",children:s("network_raw")}),t.jsx("div",{className:"flex flex-row flex-wrap gap-4",children:t.jsxs(n,{name:"network:display_type",label:s("network:display_type"),onChange:a=>!a.target.validationMessage&&O(a.target.value),value:m,required:!0,children:[t.jsx("option",{value:"data",children:s("network:data")}),t.jsx("option",{value:"map",children:s("network:map")})]})}),t.jsx("h2",{className:"text-lg mt-2",children:s("network_map")}),t.jsxs("div",{className:"flex flex-row flex-wrap gap-4",children:[t.jsxs(n,{name:"network:layout_type",label:s("network:layout_type"),onChange:a=>!a.target.validationMessage&&A(a.target.value),value:d,required:!0,children:[t.jsx("option",{value:"forceDirected2d",children:"forceDirected2d"}),t.jsx("option",{value:"forceDirected3d",children:"forceDirected3d"}),t.jsx("option",{value:"radialOut2d",children:"radialOut2d"}),t.jsx("option",{value:"radialOut3d",children:"radialOut3d"})]}),t.jsxs(n,{name:"network:label_type",label:s("network:label_type"),onChange:a=>!a.target.validationMessage&&K(a.target.value),value:u,required:!0,children:[t.jsx("option",{value:"all",children:"all"}),t.jsx("option",{value:"auto",children:"auto"}),t.jsx("option",{value:"none",children:"none"}),t.jsx("option",{value:"nodes",children:"nodes"}),t.jsx("option",{value:"edges",children:"edges"})]}),t.jsx("div",{className:"min-w-xs",children:t.jsx(T,{name:"network:node_strength",label:s("network:node_strength"),onSubmit:(a,v)=>v&&typeof a=="number"&&Y(a),min:-1e3,max:-100,step:10,defaultValue:p})}),t.jsx("div",{className:"min-w-xs",children:t.jsx(T,{name:"network:link_distance",label:s("network:link_distance"),onSubmit:(a,v)=>v&&typeof a=="number"&&L(a),min:10,max:200,step:5,defaultValue:_})})]})]})}export{Q as default};
