import{u as L,r as n,m as s,aC as f,aD as v,aE as N,aF as E,n as x,o as p,p as g,aG as b,aH as y,H as F,a3 as R,aI as W,aJ as U,aK as P,aL as D,aM as G,aN as $,aO as B,j as a,M as V,N as J,a9 as S}from"./index-CE-9RlbR.js";import{C as i}from"./CheckboxField-BPvsXluL.js";import{N as j}from"./NumberField-XGSCkVuy.js";import{S as q}from"./SelectField-BPXpeItQ.js";import"./envs-CRUy-_iG.js";function te(){const{t}=L(["settings","navbar","network","common"]),[r,w]=n.useState(s.get(f,254)),[l,C]=n.useState(s.get(v,3)),[c,T]=n.useState(s.get(N,"")),[m,k]=n.useState(s.get(E,!1)),[_,O]=n.useState(s.get(x,!0)),[d,I]=n.useState(s.get(p,!0)),[u,A]=n.useState(s.get(g,!0)),[h,K]=n.useState(s.get(b,!0));n.useEffect(()=>{s.set(f,r)},[r]),n.useEffect(()=>{s.set(v,l)},[l]),n.useEffect(()=>{s.set(N,c)},[c]),n.useEffect(()=>{s.set(E,m)},[m]),n.useEffect(()=>{s.set(x,_)},[_]),n.useEffect(()=>{s.set(p,d)},[d]),n.useEffect(()=>{s.set(g,u)},[u]),n.useEffect(()=>{s.set(b,h)},[h]);const Y=n.useCallback(()=>{const e=s.keys();s.remove(y),s.remove(f),s.remove(v),s.remove(E),s.remove(F),s.remove(x),s.remove(p),s.remove(g),s.remove(R),s.remove(W),s.remove(b),s.remove(U);for(const o of e)(o.startsWith(P)||o.startsWith(D)||o.startsWith(G))&&s.remove(o);window.location.reload()},[]),H=n.useCallback(()=>{const e=s.keys();for(const o of e)(o.startsWith($)||o.startsWith(B))&&s.remove(o);window.location.reload()},[]),M=n.useCallback(()=>{s.clearAll(),window.location.reload()},[]);return a.jsxs(a.Fragment,{children:[a.jsx(J,{children:a.jsxs("div",{className:"flex flex-row flex-wrap flex-1 gap-1.5",children:[a.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)}),a.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)}),a.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)})]})}),a.jsx("div",{className:"alert alert-info alert-vertical sm:alert-horizontal",children:t(e=>e.frontend_notice)}),a.jsxs("div",{className:"flex flex-row flex-wrap gap-4 mt-3",children:[a.jsx(j,{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!==""&&w(e)}),a.jsx(j,{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)}),a.jsxs(q,{name:"default_page",label:t(e=>e.default_page),value:c,onChange:e=>{e.target.validationMessage||T(e.target.value)},children:[a.jsx("option",{value:"",children:t(e=>e.home,{ns:"navbar"})}),a.jsx("option",{value:"/dashboard",children:t(e=>e.dashboard,{ns:"navbar"})}),a.jsx("option",{value:"/devices",children:t(e=>e.devices,{ns:"navbar"})}),a.jsx("option",{value:"/groups",children:t(e=>e.groups,{ns:"navbar"})}),a.jsx("option",{value:"/reporting",children:t(e=>e.reporting,{ns:"navbar"})}),a.jsx("option",{value:"/bindings",children:t(e=>e.bindings,{ns:"navbar"})}),a.jsx("option",{value:"/ota",children:t(e=>e.ota,{ns:"navbar"})}),a.jsx("option",{value:"/touchlink",children:t(e=>e.touchlink,{ns:"navbar"})}),a.jsx("option",{value:"/network",children:t(e=>e.network,{ns:"navbar"})}),a.jsx("option",{value:"/logs",children:t(e=>e.logs,{ns:"navbar"})}),a.jsx("option",{value:"/activity",children:t(e=>e.activity,{ns:"navbar"})}),a.jsx("option",{value:"/settings",children:t(e=>e.settings,{ns:"navbar"})})]}),a.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})]}),a.jsx("h2",{className:"text-lg mt-2",children:t(e=>e.home,{ns:"navbar"})}),a.jsxs("div",{className:"flex flex-row flex-wrap gap-4",children:[a.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:_}),a.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}),a.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:u})]}),V&&a.jsxs(a.Fragment,{children:[a.jsx("h2",{className:"text-lg mt-2",children:t(e=>e.multi_instance,{ns:"common"})}),a.jsx("div",{className:"flex flex-row flex-wrap gap-4",children:a.jsx(i,{name:"show_source_name",label:t(e=>e.show_source_name,{ns:"common"}),onChange:e=>K(e.target.checked),defaultChecked:h})})]})]})}export{te as default};
