import{dG as L,dq as n,dy as a,U as f,M as v,D as w,H as E,s as x,q as p,r as b,K as g,a4 as y,p as R,P as F,O as W,I as U,a1 as P,a2 as D,a3 as G,c as $,b as B,dm as s,J as V,R as q,l as S}from"./index-DjbVAZHL.js";import{C as i}from"./CheckboxField-h2bgaDmU.js";import{N}from"./NumberField-QiXHex0z.js";import{S as J}from"./SelectField-XDAy-a1R.js";import"./envs-CRUy-_iG.js";function te(){const{t}=L(["settings","navbar","network","common"]),[r,j]=n.useState(a.get(f,254)),[l,C]=n.useState(a.get(v,3)),[c,T]=n.useState(a.get(w,"")),[m,k]=n.useState(a.get(E,!1)),[_,O]=n.useState(a.get(x,!0)),[d,I]=n.useState(a.get(p,!0)),[h,A]=n.useState(a.get(b,!0)),[u,K]=n.useState(a.get(g,!0));n.useEffect(()=>{a.set(f,r)},[r]),n.useEffect(()=>{a.set(v,l)},[l]),n.useEffect(()=>{a.set(w,c)},[c]),n.useEffect(()=>{a.set(E,m)},[m]),n.useEffect(()=>{a.set(x,_)},[_]),n.useEffect(()=>{a.set(p,d)},[d]),n.useEffect(()=>{a.set(b,h)},[h]),n.useEffect(()=>{a.set(g,u)},[u]);const Y=n.useCallback(()=>{const e=a.keys();a.remove(y),a.remove(f),a.remove(v),a.remove(E),a.remove(R),a.remove(x),a.remove(p),a.remove(b),a.remove(F),a.remove(W),a.remove(g),a.remove(U);for(const o of e)(o.startsWith(P)||o.startsWith(D)||o.startsWith(G))&&a.remove(o);window.location.reload()},[]),H=n.useCallback(()=>{const e=a.keys();for(const o of e)(o.startsWith($)||o.startsWith(B))&&a.remove(o);window.location.reload()},[]),M=n.useCallback(()=>{a.clearAll(),window.location.reload()},[]);return s.jsxs(s.Fragment,{children:[s.jsx(q,{children:s.jsxs("div",{className:"flex flex-row flex-wrap flex-1 gap-1.5",children:[s.jsx(S,{className:"btn btn-sm btn-outline btn-error tooltip-bottom",onClick:Y,title:t(e=>e.reset_settings),modalDescription:t(e=>e.dialog_confirmation_prompt,{ns:"common"}),modalCancelLabel:t(e=>e.cancel,{ns:"common"}),children:t(e=>e.reset_settings)}),s.jsx(S,{className:"btn btn-sm btn-outline btn-error tooltip-bottom",onClick:H,title:t(e=>e.reset_auth),modalDescription:t(e=>e.dialog_confirmation_prompt,{ns:"common"}),modalCancelLabel:t(e=>e.cancel,{ns:"common"}),children:t(e=>e.reset_auth)}),s.jsx(S,{className:"btn btn-sm btn-outline btn-error tooltip-bottom",onClick:M,title:t(e=>e.reset_all),modalDescription:t(e=>e.dialog_confirmation_prompt,{ns:"common"}),modalCancelLabel:t(e=>e.cancel,{ns:"common"}),children:t(e=>e.reset_all)})]})}),s.jsx("div",{className:"alert alert-info alert-vertical sm:alert-horizontal",children:t(e=>e.frontend_notice)}),s.jsxs("div",{className:"flex flex-row flex-wrap gap-4 mt-3",children:[s.jsx(N,{type:"number",name:"permit_join_time",label:t(e=>e.permit_join_time),min:10,max:254,required:!0,minimal:!0,initialValue:r,onSubmit:(e,o)=>o&&e!==""&&j(e)}),s.jsx(N,{type:"number",name:"max_on_screen_notifications",label:t(e=>e.max_on_screen_notifications),min:1,max:5,required:!0,minimal:!0,initialValue:l,onSubmit:(e,o)=>o&&e!==""&&C(e)}),s.jsxs(J,{name:"default_page",label:t(e=>e.default_page),value:c,onChange:e=>{e.target.validationMessage||T(e.target.value)},children:[s.jsx("option",{value:"",children:t(e=>e.home,{ns:"navbar"})}),s.jsx("option",{value:"/dashboard",children:t(e=>e.dashboard,{ns:"navbar"})}),s.jsx("option",{value:"/devices",children:t(e=>e.devices,{ns:"navbar"})}),s.jsx("option",{value:"/groups",children:t(e=>e.groups,{ns:"navbar"})}),s.jsx("option",{value:"/reporting",children:t(e=>e.reporting,{ns:"navbar"})}),s.jsx("option",{value:"/bindings",children:t(e=>e.bindings,{ns:"navbar"})}),s.jsx("option",{value:"/ota",children:t(e=>e.ota,{ns:"navbar"})}),s.jsx("option",{value:"/touchlink",children:t(e=>e.touchlink,{ns:"navbar"})}),s.jsx("option",{value:"/network",children:t(e=>e.network,{ns:"navbar"})}),s.jsx("option",{value:"/logs",children:t(e=>e.logs,{ns:"navbar"})}),s.jsx("option",{value:"/activity",children:t(e=>e.activity,{ns:"navbar"})}),s.jsx("option",{value:"/settings",children:t(e=>e.settings,{ns:"navbar"})})]}),s.jsx(i,{name:"hide_static_info_alerts",label:t(e=>e.hide_static_info_alerts,{ns:"common"}),onChange:e=>k(e.target.checked),defaultChecked:m})]}),s.jsx("h2",{className:"text-lg mt-2",children:t(e=>e.home,{ns:"navbar"})}),s.jsxs("div",{className:"flex flex-row flex-wrap gap-4",children:[s.jsx(i,{name:"show_overview",label:`${t(e=>e.show,{ns:"common"})}: ${t(e=>e.overview,{ns:"common"})}`,onChange:e=>O(e.target.checked),defaultChecked:_}),s.jsx(i,{name:"show_activity",label:`${t(e=>e.show,{ns:"common"})}: ${t(e=>e.activity,{ns:"navbar"})}`,onChange:e=>I(e.target.checked),defaultChecked:d}),s.jsx(i,{name:"show_group_scenes",label:`${t(e=>e.show,{ns:"common"})}: ${t(e=>e.group_scenes,{ns:"common"})}`,onChange:e=>A(e.target.checked),defaultChecked:h})]}),V&&s.jsxs(s.Fragment,{children:[s.jsx("h2",{className:"text-lg mt-2",children:t(e=>e.multi_instance,{ns:"common"})}),s.jsx("div",{className:"flex flex-row flex-wrap gap-4",children:s.jsx(i,{name:"show_source_name",label:t(e=>e.show_source_name,{ns:"common"}),onChange:e=>K(e.target.checked),defaultChecked:u})})]})]})}export{te as default};
