const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Devices-B1Wz8goW.js","./index-vDL8KyrI.js","./index-KcXdcCUK.css","./RecallRemove-DchDgS_I.js","./DashboardFeatureWrapper-CotxeSO1.js","./Feature-Dn8iv4tk.js","./DisplayValue-CvjefE6V.js","./_createCompounder-Bmfmbzn9.js","./capitalize-Cw1mPDhM.js","./InputField-B5sOh_uD.js","./SelectField-apZm61cq.js","./DevicePicker-CGedN3DH.js","./EndpointPicker-DOVgHugJ.js","./DeviceCard-C0AcffeR.js","./LastSeen-BB0rwxhg.js","./Lqi-C8sPb_IK.js","./PowerSource-DFW6CjuU.js","./snakeCase-B_0CeYWc.js","./DeviceImage-BpknBFw1.js","./index-C4Y7ujGQ.js","./GroupSettings-2ilNn-oq.js","./SettingsList-D3Urvwh_.js","./CheckboxField-m1WCeVZk.js"])))=>i.map(i=>d[i]);
import{r,b as g,j as e,L as f,P as j,F as m,f as v,u as b,e as h,a as _,N as p,p as N,l as w,_ as x}from"./index-vDL8KyrI.js";const y=r.memo(l=>{const{groups:n,currentGroup:s,tab:o="devices"}=l,[c,u]=r.useState(""),{t}=g("common"),d=r.useMemo(()=>n.filter(a=>a.friendly_name.toLowerCase().includes(c.toLowerCase())&&a.id!==(s==null?void 0:s.id)).map(a=>e.jsx("li",{children:e.jsx(f,{to:`/group/${a.id}/${o}`,onClick:()=>u(""),className:"dropdown-item",children:a.friendly_name})},a.id)),[n,c,s,o]);return e.jsxs(j,{name:"header-group-selector",buttonChildren:`${s?`#${s.id} - ${s.friendly_name}`:t("unknown_group")}`,dropdownStyle:"dropdown-start",children:[e.jsxs("label",{className:"input",children:[e.jsx(m,{icon:v}),e.jsx("input",{type:"search",placeholder:t("type_to_filter"),onChange:a=>u(a.target.value),value:c})]},"search"),d]})}),T=r.lazy(async()=>await x(()=>import("./Devices-B1Wz8goW.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]),import.meta.url)),$=r.lazy(async()=>await x(()=>import("./GroupSettings-2ilNn-oq.js"),__vite__mapDeps([20,1,2,21,22,9,10]),import.meta.url));function L(){const l=b(),{t:n}=g(["groups","common"]),{groupId:s,tab:o}=h(),c=_(i=>i.groups),u=Number.parseInt(s,10),t=s?c.find(i=>i.id===u):void 0;r.useEffect(()=>{!o&&t&&l(`/group/${t.id}/devices`,{replace:!0})},[o,t,l]);const d=({isActive:i})=>i?"tab tab-active":"tab",a=r.useMemo(()=>{if(!t)return e.jsx("div",{className:"flex-auto justify-center items-center",children:n("common:unknown_group")});switch(o){case"devices":return e.jsx(T,{group:t});case"settings":return e.jsx($,{group:t})}},[o,t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(y,{groups:c,currentGroup:t,tab:o}),e.jsxs("div",{className:"tabs tabs-border mt-2",children:[e.jsxs(p,{to:`/group/${s}/devices`,className:d,children:[e.jsx(m,{icon:N,className:"me-2"}),n("common:devices")]}),e.jsxs(p,{to:`/group/${s}/settings`,className:d,children:[e.jsx(m,{icon:w,className:"me-2"}),n("settings")]})]}),e.jsx("div",{className:"tab-content block h-full bg-base-100 p-3",children:a})]})}export{L as default};
