const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Devices-BXMoCKuc.js","./index-BeDhuS24.js","./envs-DFlyG_dH.js","./index-sQ1gk-WC.css","./RecallRemove-BT61_xFm.js","./DashboardFeatureWrapper-QO-XFtKk.js","./Feature-B18PTY7Z.js","./DisplayValue-y4u-p3TF.js","./_createCompounder-HA4t3BbU.js","./InputField-E2g5qJCn.js","./SelectField-CgXiODUe.js","./DevicePicker-DIWryjuN.js","./EndpointPicker-Cni8eLro.js","./DeviceCard-D2ifb9S1.js","./LastSeen-Tt-X3bir.js","./format-LeabZw87.js","./Lqi-Bexjv2VI.js","./PowerSource-M8I2qqUm.js","./snakeCase-DF3cbatb.js","./DeviceImage-CGx5yo8m.js","./index-CIWfMo3U.js","./GroupSettings-Wbczyt9u.js","./SettingsList-wPZC4AYF.js","./CheckboxField-BhwpagjA.js","./NumberField-CH6-YRbT.js"])))=>i.map(i=>d[i]);
import{r as n,b as g,j as e,L as f,P as j,F as m,f as v,u as b,d as h,a as _,N as p,o as N,k as w,_ as x}from"./index-BeDhuS24.js";import"./envs-DFlyG_dH.js";const y=n.memo(u=>{const{groups:r,currentGroup:t,tab:o="devices"}=u,[c,l]=n.useState(""),{t:s}=g("common"),d=n.useMemo(()=>r.filter(a=>a.friendly_name.toLowerCase().includes(c.toLowerCase())&&a.id!==t?.id).map(a=>e.jsx("li",{children:e.jsx(f,{to:`/group/${a.id}/${o}`,onClick:()=>l(""),className:"dropdown-item",children:a.friendly_name})},a.id)),[r,c,t,o]);return e.jsxs(j,{name:"header-group-selector",buttonChildren:`${t?`#${t.id} - ${t.friendly_name}`:s("unknown_group")}`,dropdownStyle:"dropdown-start",children:[e.jsxs("label",{className:"input",children:[e.jsx(m,{icon:v}),e.jsx("input",{type:"search",placeholder:s("type_to_filter"),onChange:a=>l(a.target.value),value:c})]},"search"),d]})}),T=n.lazy(async()=>await x(()=>import("./Devices-BXMoCKuc.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]),import.meta.url)),$=n.lazy(async()=>await x(()=>import("./GroupSettings-Wbczyt9u.js"),__vite__mapDeps([21,1,2,3,22,23,9,24,10]),import.meta.url));function G(){const u=b(),{t:r}=g(["groups","common"]),{groupId:t,tab:o}=h(),c=_(i=>i.groups),l=Number.parseInt(t,10),s=t?c.find(i=>i.id===l):void 0;n.useEffect(()=>{!o&&s&&u(`/group/${s.id}/devices`,{replace:!0})},[o,s,u]);const d=({isActive:i})=>i?"tab tab-active":"tab",a=n.useMemo(()=>{if(!s)return e.jsx("div",{className:"flex-auto justify-center items-center",children:r("common:unknown_group")});switch(o){case"devices":return e.jsx(T,{group:s});case"settings":return e.jsx($,{group:s})}},[o,s,r]);return e.jsxs(e.Fragment,{children:[e.jsx(y,{groups:c,currentGroup:s,tab:o}),e.jsxs("div",{className:"tabs tabs-border mt-2",children:[e.jsxs(p,{to:`/group/${t}/devices`,className:d,children:[e.jsx(m,{icon:N,className:"me-2"}),r("common:devices")]}),e.jsxs(p,{to:`/group/${t}/settings`,className:d,children:[e.jsx(m,{icon:w,className:"me-2"}),r("settings")]})]}),e.jsx("div",{className:"tab-content block h-full bg-base-100 p-3",children:a})]})}export{G as default};
