@camstack/addon-admin-ui 0.1.24 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CV-R_rHB.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DlcNv4jc.js} +1 -1
  2. package/dist/assets/devices-Ccad-MYH.js +1 -0
  3. package/dist/assets/{hostInit-DcknmeNu.js → hostInit-BpDp2mzG.js} +1 -1
  4. package/dist/assets/index-CAlT1MNc.css +1 -0
  5. package/dist/assets/index-CO8Odo2q.js +1103 -0
  6. package/dist/assets/index-CaiMG86U.js +80 -0
  7. package/dist/assets/{index-F3MAsf-9.js → index-D9kg0e9y.js} +1 -1
  8. package/dist/assets/index-DDPTeM3J.js +80 -0
  9. package/dist/assets/index-DMrjJViX.js +1 -0
  10. package/dist/assets/{index-CvVlJEP5.js → index-DOXiszQ-.js} +1 -1
  11. package/dist/assets/{index-Dq_5fsAQ.js → index-DV9irWJe.js} +1 -1
  12. package/dist/assets/index-bCeHA7pg.js +1 -0
  13. package/dist/assets/index-ihiza8WC.js +1 -0
  14. package/dist/assets/index-vWF3glDx.js +1 -0
  15. package/dist/assets/index-zk-hwOKE.js +1 -0
  16. package/dist/assets/method-access-map-DAzkqn3U.js +1 -0
  17. package/dist/assets/{remoteEntry-D1zRuKvw.js → remoteEntry-DcLH2pUv.js} +1 -1
  18. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DItyrftX.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CJWQPV3f.js} +2 -2
  19. package/dist/index.html +6 -6
  20. package/dist/mf-entry-bootstrap-0.js +2 -2
  21. package/dist/sw.js +1 -1
  22. package/package.json +1 -1
  23. package/dist/assets/auth-records-DLqosdE2.js +0 -1
  24. package/dist/assets/capability-router-map-UNVkwZU9.js +0 -1
  25. package/dist/assets/devices-BUM64diU.js +0 -1
  26. package/dist/assets/index-B95gHp6V.js +0 -1
  27. package/dist/assets/index-DVf1U7c4.js +0 -1
  28. package/dist/assets/index-De6hr8eY.js +0 -1
  29. package/dist/assets/index-DvrBfik_.js +0 -1
  30. package/dist/assets/index-agmLjvC2.js +0 -80
  31. package/dist/assets/index-bZcruxoE.js +0 -80
  32. package/dist/assets/index-k_vr1qwb.js +0 -1098
  33. package/dist/assets/index-uOUrSD7R.css +0 -1
@@ -1,80 +0,0 @@
1
- import{e as S,h as I,c as H,f as re,d as Ae,b as Ze,i as q,j as Te,R as Ji,l as Ct,m as el,k as $t,g as Pn,a as ds}from"./__mfe_internal__admin_ui_host__loadShare__react__loadShare__.mjs-Dl4u0xYE.js";import{c as o,d as m,e as Ne,a as us}from"./__mfe_internal__admin_ui_host__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-C_6K4VBY.js";import{b as kr,a as ps}from"./__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.mjs-CzO_Esxm.js";import{b as tl,a as fs}from"./__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-DNpf5SLz.js";import{n as Rn,m as ms,h as rl,o as nl,p as ol,_ as hs}from"./__mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-CeLhKMin.js";import{c as gs,s as bs,B as sl,F as al,n as il,_ as vs}from"./__mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.mjs-DIkg6-MH.js";import{a as ll,_ as ys}from"./__mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-OcRSBqRe.js";import{E as V,A as cl}from"./capability-router-map-UNVkwZU9.js";import{c as dl}from"./auth-records-DLqosdE2.js";import{c as ul}from"./devices-BUM64diU.js";import"./__mfe_internal__admin_ui_host__loadShare__react__loadShare__.mjs_commonjs-proxy-CSyOECfO.js";import"./__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-xw6c6JeS.js";import"./schemas-XgIEoUz3.js";var xs={frigate:"#3b82f6",scrypted:"#a855f7",reolink:"#06b6d4",homeAssistant:"#22d3ee",rtsp:"#78716c"},pl={primary:"#f59e42",primaryForeground:"#0c0a09",background:"#0c0a09",backgroundElevated:"#1c1917",surface:"#1c1917",surfaceHover:"#292524",border:"#292524",borderSubtle:"#1c1917",foreground:"#fafaf9",foregroundMuted:"#a8a29e",foregroundSubtle:"#78716c",foregroundDisabled:"#57534e",success:"#4ade80",warning:"#fbbf24",danger:"#f87171",info:"#60a5fa",provider:xs},fl={primary:"#e67e22",primaryForeground:"#ffffff",background:"#fafaf9",backgroundElevated:"#ffffff",surface:"#f5f5f4",surfaceHover:"#e7e5e4",border:"#d6d3d1",borderSubtle:"#e7e5e4",foreground:"#1c1917",foregroundMuted:"#57534e",foregroundSubtle:"#78716c",foregroundDisabled:"#a8a29e",success:"#16a34a",warning:"#d97706",danger:"#dc2626",info:"#2563eb",provider:xs},eo={colors:{dark:pl,light:fl},spacing:{xs:2,sm:4,md:8,lg:12,xl:16,"2xl":24,"3xl":32},radius:{sm:4,md:6,lg:8,xl:12},typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',sizes:{xs:{fontSize:10,lineHeight:14},sm:{fontSize:11,lineHeight:16},base:{fontSize:12,lineHeight:18},lg:{fontSize:13,lineHeight:18},xl:{fontSize:14,lineHeight:20},"2xl":{fontSize:16,lineHeight:22},"3xl":{fontSize:20,lineHeight:28}},weights:{regular:400,medium:500,semibold:600,bold:700}},table:{rowHeight:28,headerHeight:24,cellPaddingX:8,cellPaddingY:6},sidebar:{width:176,itemHeight:28,iconSize:14}};function ws(e,t){const r={...e};for(const n in t){const s=t[n],a=e[n];s!==void 0&&typeof s=="object"&&s!==null&&!Array.isArray(s)&&typeof a=="object"&&a!==null?r[n]=ws(a,s):s!==void 0&&(r[n]=s)}return r}function Ag(e){return e?ws(structuredClone(eo),e):structuredClone(eo)}function ks(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function ml(e){return`--color-${ks(e)}`}function to(e){const t=[];for(const[r,n]of Object.entries(e))r!=="provider"&&t.push(` ${ml(r)}: ${n};`);return t.join(`
2
- `)}function hl(e){const t=[];for(const[r,n]of Object.entries(e))t.push(` --color-provider-${ks(r)}: ${n};`);return t.join(`
3
- `)}function gl(e){const t=[];for(const[r,n]of Object.entries(e))t.push(` --spacing-${r}: ${n}px;`);return t.join(`
4
- `)}function bl(e){const t=[];for(const[r,n]of Object.entries(e))t.push(` --radius-${r}: ${n}px;`);return t.join(`
5
- `)}function Pg(e){const t=to(e.colors.dark),r=to(e.colors.light);return`@theme {
6
- ${hl(e.colors.dark.provider)}
7
- ${gl(e.spacing)}
8
- ${bl(e.radius)}
9
- }
10
-
11
- .dark {
12
- ${t}
13
- }
14
-
15
- .light {
16
- ${r}
17
- }
18
-
19
- @media (prefers-color-scheme: dark) {
20
- :root {
21
- ${t.replace(/^ {2}/gm," ")}
22
- }
23
- }
24
-
25
- @media (prefers-color-scheme: light) {
26
- :root {
27
- ${r.replace(/^ {2}/gm," ")}
28
- }
29
- }
30
- `}var Ns=Ze(null),Dr=["dark","light","system"];function Ss(){return typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function vl(e,t){if(typeof window>"u")return t;const r=localStorage.getItem(e);return r==="dark"||r==="light"||r==="system"?r:t}function ro(e){return e==="system"?Ss():e}function no({children:e,defaultMode:t="system",storageKey:r="camstack-theme-mode"}){const[n,s]=S(()=>vl(r,t)),[a,i]=S(()=>ro(n)),l=I(u=>{s(u),i(ro(u)),typeof window<"u"&&localStorage.setItem(r,u)},[r]),c=I(()=>{l(Dr[(Dr.indexOf(n)+1)%Dr.length]??"dark")},[n,l]);H(()=>{if(typeof document>"u")return;const u=document.documentElement;u.classList.remove("dark","light"),u.classList.add(a)},[n,a]),H(()=>{if(typeof window>"u"||n!=="system")return;const u=window.matchMedia("(prefers-color-scheme: dark)"),f=()=>{i(Ss())};return u.addEventListener("change",f),()=>u.removeEventListener("change",f)},[n]);const d=re(()=>({mode:n,resolvedMode:a,setMode:l,toggleMode:c}),[n,a,l,c]);return o(Ns.Provider,{value:d,children:e})}function yl(){const e=Ae(Ns);if(!e)throw new Error("useThemeMode must be used within a ThemeProvider");return e}var Lr={};function Cs(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=Cs(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Ms(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Cs(e))&&(n&&(n+=" "),n+=t);return n}var xl=(e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r},wl=(e,t)=>({classGroupId:e,validator:t}),Es=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),br="-",oo=[],kl="arbitrary..",Nl=e=>{const t=Cl(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Sl(i);const l=i.split(br);return As(l,l[0]===""&&l.length>1?1:0,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=n[i],d=r[i];return c?d?xl(d,c):c:d||oo}return r[i]||oo}}},As=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],s=r.nextPart.get(n);if(s){const c=As(e,t+1,s);if(c)return c}const a=r.validators;if(a===null)return;const i=t===0?e.join(br):e.slice(t).join(br),l=a.length;for(let c=0;c<l;c++){const d=a[c];if(d.validator(i))return d.classGroupId}},Sl=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?kl+n:void 0})(),Cl=e=>{const{theme:t,classGroups:r}=e;return Ml(r,t)},Ml=(e,t)=>{const r=Es();for(const n in e){const s=e[n];_n(s,r,n,t)}return r},_n=(e,t,r,n)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];El(i,t,r,n)}},El=(e,t,r,n)=>{if(typeof e=="string"){Al(e,t,r);return}if(typeof e=="function"){Pl(e,t,r,n);return}Rl(e,t,r,n)},Al=(e,t,r)=>{const n=e===""?t:Ps(t,e);n.classGroupId=r},Pl=(e,t,r,n)=>{if(_l(e)){_n(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(wl(r,e))},Rl=(e,t,r,n)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[l,c]=s[i];_n(c,Ps(t,l),r,n)}},Ps=(e,t)=>{let r=e;const n=t.split(br),s=n.length;for(let a=0;a<s;a++){const i=n[a];let l=r.nextPart.get(i);l||(l=Es(),r.nextPart.set(i,l)),r=l}return r},_l=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Il=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const s=(a,i)=>{r[a]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(a){let i=r[a];if(i!==void 0)return i;if((i=n[a])!==void 0)return s(a,i),i},set(a,i){a in r?r[a]=i:s(a,i)}}},on="!",so=":",Tl=[],ao=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),Dl=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let i=0,l=0,c=0,d;const u=s.length;for(let v=0;v<u;v++){const x=s[v];if(i===0&&l===0){if(x===so){a.push(s.slice(c,v)),c=v+1;continue}if(x==="/"){d=v;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const f=a.length===0?s:s.slice(c);let h=f,g=!1;f.endsWith(on)?(h=f.slice(0,-1),g=!0):f.startsWith(on)&&(h=f.slice(1),g=!0);const b=d&&d>c?d-c:void 0;return ao(a,g,h,b)};if(t){const s=t+so,a=n;n=i=>i.startsWith(s)?a(i.slice(s.length)):ao(Tl,!1,i,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},Ll=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,n)=>{t.set(r,1e6+n)}),r=>{const n=[];let s=[];for(let a=0;a<r.length;a++){const i=r[a],l=i[0]==="[",c=t.has(i);l||c?(s.length>0&&(s.sort(),n.push(...s),s=[]),n.push(i)):s.push(i)}return s.length>0&&(s.sort(),n.push(...s)),n}},Ol=e=>({cache:Il(e.cacheSize),parseClassName:Dl(e),sortModifiers:Ll(e),...Nl(e)}),$l=/\s+/,Bl=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],l=e.trim().split($l);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:f,modifiers:h,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:v}=r(u);if(f){c=u+(c.length>0?" "+c:c);continue}let x=!!v,y=n(x?b.substring(0,v):b);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=n(b),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}const w=h.length===0?"":h.length===1?h[0]:a(h).join(":"),k=g?w+on:w,M=k+y;if(i.indexOf(M)>-1)continue;i.push(M);const C=s(y,x);for(let A=0;A<C.length;++A){const _=C[A];i.push(k+_)}c=u+(c.length>0?" "+c:c)}return c},zl=(...e)=>{let t=0,r,n,s="";for(;t<e.length;)(r=e[t++])&&(n=Rs(r))&&(s&&(s+=" "),s+=n);return s},Rs=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=Rs(e[n]))&&(r&&(r+=" "),r+=t);return r},Fl=(e,...t)=>{let r,n,s,a;const i=c=>(r=Ol(t.reduce((d,u)=>u(d),e())),n=r.cache.get,s=r.cache.set,a=l,l(c)),l=c=>{const d=n(c);if(d)return d;const u=Bl(c,r);return s(c,u),u};return a=i,(...c)=>a(zl(...c))},jl=[],Ee=e=>{const t=r=>r[e]||jl;return t.isThemeGetter=!0,t},_s=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Is=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Gl=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ql=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Hl=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ul=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Vl=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ql=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xe=e=>Gl.test(e),ce=e=>!!e&&!Number.isNaN(Number(e)),Je=e=>!!e&&Number.isInteger(Number(e)),Or=e=>e.endsWith("%")&&ce(e.slice(0,-1)),Ke=e=>Ql.test(e),Ts=()=>!0,Wl=e=>Hl.test(e)&&!Ul.test(e),In=()=>!1,Kl=e=>Vl.test(e),Zl=e=>ql.test(e),Yl=e=>!F(e)&&!j(e),Xl=e=>nt(e,Os,In),F=e=>_s.test(e),lt=e=>nt(e,$s,Wl),io=e=>nt(e,ac,ce),Jl=e=>nt(e,zs,Ts),ec=e=>nt(e,Bs,In),lo=e=>nt(e,Ds,In),tc=e=>nt(e,Ls,Zl),Zt=e=>nt(e,Fs,Kl),j=e=>Is.test(e),_t=e=>ut(e,$s),rc=e=>ut(e,Bs),co=e=>ut(e,Ds),nc=e=>ut(e,Os),oc=e=>ut(e,Ls),Yt=e=>ut(e,Fs,!0),sc=e=>ut(e,zs,!0),nt=(e,t,r)=>{const n=_s.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},ut=(e,t,r=!1)=>{const n=Is.exec(e);return n?n[1]?t(n[1]):r:!1},Ds=e=>e==="position"||e==="percentage",Ls=e=>e==="image"||e==="url",Os=e=>e==="length"||e==="size"||e==="bg-size",$s=e=>e==="length",ac=e=>e==="number",Bs=e=>e==="family-name",zs=e=>e==="number"||e==="weight",Fs=e=>e==="shadow",ic=()=>{const e=Ee("color"),t=Ee("font"),r=Ee("text"),n=Ee("font-weight"),s=Ee("tracking"),a=Ee("leading"),i=Ee("breakpoint"),l=Ee("container"),c=Ee("spacing"),d=Ee("radius"),u=Ee("shadow"),f=Ee("inset-shadow"),h=Ee("text-shadow"),g=Ee("drop-shadow"),b=Ee("blur"),v=Ee("perspective"),x=Ee("aspect"),y=Ee("ease"),w=Ee("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...M(),j,F],A=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],P=()=>[j,F,c],Q=()=>[Xe,"full","auto",...P()],oe=()=>[Je,"none","subgrid",j,F],le=()=>["auto",{span:["full",Je,j,F]},Je,j,F],ge=()=>[Je,"auto",j,F],de=()=>["auto","min","max","fr",j,F],pe=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ie=()=>["start","end","center","stretch","center-safe","end-safe"],ne=()=>["auto",...P()],W=()=>[Xe,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],ye=()=>[Xe,"screen","full","dvw","lvw","svw","min","max","fit",...P()],me=()=>[Xe,"screen","full","lh","dvh","lvh","svh","min","max","fit",...P()],T=()=>[e,j,F],z=()=>[...M(),co,lo,{position:[j,F]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],se=()=>["auto","cover","contain",nc,Xl,{size:[j,F]}],U=()=>[Or,_t,lt],K=()=>["","none","full",d,j,F],Z=()=>["",ce,_t,lt],G=()=>["solid","dashed","dotted","double"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>[ce,Or,co,lo],Pe=()=>["","none",b,j,F],Re=()=>["none",ce,j,F],X=()=>["none",ce,j,F],fe=()=>[ce,j,F],xe=()=>[Xe,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ke],breakpoint:[Ke],color:[Ts],container:[Ke],"drop-shadow":[Ke],ease:["in","out","in-out"],font:[Yl],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ke],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ke],shadow:[Ke],spacing:["px",ce],text:[Ke],"text-shadow":[Ke],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Xe,F,j,x]}],container:["container"],columns:[{columns:[ce,F,j,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Q()}],"inset-x":[{"inset-x":Q()}],"inset-y":[{"inset-y":Q()}],start:[{"inset-s":Q(),start:Q()}],end:[{"inset-e":Q(),end:Q()}],"inset-bs":[{"inset-bs":Q()}],"inset-be":[{"inset-be":Q()}],top:[{top:Q()}],right:[{right:Q()}],bottom:[{bottom:Q()}],left:[{left:Q()}],visibility:["visible","invisible","collapse"],z:[{z:[Je,"auto",j,F]}],basis:[{basis:[Xe,"full","auto",l,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ce,Xe,"auto","initial","none",F]}],grow:[{grow:["",ce,j,F]}],shrink:[{shrink:["",ce,j,F]}],order:[{order:[Je,"first","last","none",j,F]}],"grid-cols":[{"grid-cols":oe()}],"col-start-end":[{col:le()}],"col-start":[{"col-start":ge()}],"col-end":[{"col-end":ge()}],"grid-rows":[{"grid-rows":oe()}],"row-start-end":[{row:le()}],"row-start":[{"row-start":ge()}],"row-end":[{"row-end":ge()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":de()}],"auto-rows":[{"auto-rows":de()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...pe(),"normal"]}],"justify-items":[{"justify-items":[...ie(),"normal"]}],"justify-self":[{"justify-self":["auto",...ie()]}],"align-content":[{content:["normal",...pe()]}],"align-items":[{items:[...ie(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ie(),{baseline:["","last"]}]}],"place-content":[{"place-content":pe()}],"place-items":[{"place-items":[...ie(),"baseline"]}],"place-self":[{"place-self":["auto",...ie()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pbs:[{pbs:P()}],pbe:[{pbe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:ne()}],mx:[{mx:ne()}],my:[{my:ne()}],ms:[{ms:ne()}],me:[{me:ne()}],mbs:[{mbs:ne()}],mbe:[{mbe:ne()}],mt:[{mt:ne()}],mr:[{mr:ne()}],mb:[{mb:ne()}],ml:[{ml:ne()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],"inline-size":[{inline:["auto",...ye()]}],"min-inline-size":[{"min-inline":["auto",...ye()]}],"max-inline-size":[{"max-inline":["none",...ye()]}],"block-size":[{block:["auto",...me()]}],"min-block-size":[{"min-block":["auto",...me()]}],"max-block-size":[{"max-block":["none",...me()]}],w:[{w:[l,"screen",...W()]}],"min-w":[{"min-w":[l,"screen","none",...W()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",r,_t,lt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,sc,Jl]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Or,F]}],"font-family":[{font:[rc,ec,t]}],"font-features":[{"font-features":[F]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,j,F]}],"line-clamp":[{"line-clamp":[ce,"none",j,io]}],leading:[{leading:[a,...P()]}],"list-image":[{"list-image":["none",j,F]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",j,F]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[ce,"from-font","auto",j,lt]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[ce,"auto",j,F]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",j,F]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",j,F]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:z()}],"bg-repeat":[{bg:B()}],"bg-size":[{bg:se()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Je,j,F],radial:["",j,F],conic:[Je,j,F]},oc,tc]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-bs":[{"border-bs":Z()}],"border-w-be":[{"border-be":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-bs":[{"border-bs":T()}],"border-color-be":[{"border-be":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ce,j,F]}],"outline-w":[{outline:["",ce,_t,lt]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",u,Yt,Zt]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",f,Yt,Zt]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[ce,lt]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",h,Yt,Zt]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[ce,j,F]}],"mix-blend":[{"mix-blend":[...te(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ce]}],"mask-image-linear-from-pos":[{"mask-linear-from":Y()}],"mask-image-linear-to-pos":[{"mask-linear-to":Y()}],"mask-image-linear-from-color":[{"mask-linear-from":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"mask-image-t-from-pos":[{"mask-t-from":Y()}],"mask-image-t-to-pos":[{"mask-t-to":Y()}],"mask-image-t-from-color":[{"mask-t-from":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"mask-image-r-from-pos":[{"mask-r-from":Y()}],"mask-image-r-to-pos":[{"mask-r-to":Y()}],"mask-image-r-from-color":[{"mask-r-from":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"mask-image-b-from-pos":[{"mask-b-from":Y()}],"mask-image-b-to-pos":[{"mask-b-to":Y()}],"mask-image-b-from-color":[{"mask-b-from":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"mask-image-l-from-pos":[{"mask-l-from":Y()}],"mask-image-l-to-pos":[{"mask-l-to":Y()}],"mask-image-l-from-color":[{"mask-l-from":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"mask-image-x-from-pos":[{"mask-x-from":Y()}],"mask-image-x-to-pos":[{"mask-x-to":Y()}],"mask-image-x-from-color":[{"mask-x-from":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"mask-image-y-from-pos":[{"mask-y-from":Y()}],"mask-image-y-to-pos":[{"mask-y-to":Y()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[j,F]}],"mask-image-radial-from-pos":[{"mask-radial-from":Y()}],"mask-image-radial-to-pos":[{"mask-radial-to":Y()}],"mask-image-radial-from-color":[{"mask-radial-from":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[ce]}],"mask-image-conic-from-pos":[{"mask-conic-from":Y()}],"mask-image-conic-to-pos":[{"mask-conic-to":Y()}],"mask-image-conic-from-color":[{"mask-conic-from":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:z()}],"mask-repeat":[{mask:B()}],"mask-size":[{mask:se()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",j,F]}],filter:[{filter:["","none",j,F]}],blur:[{blur:Pe()}],brightness:[{brightness:[ce,j,F]}],contrast:[{contrast:[ce,j,F]}],"drop-shadow":[{"drop-shadow":["","none",g,Yt,Zt]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",ce,j,F]}],"hue-rotate":[{"hue-rotate":[ce,j,F]}],invert:[{invert:["",ce,j,F]}],saturate:[{saturate:[ce,j,F]}],sepia:[{sepia:["",ce,j,F]}],"backdrop-filter":[{"backdrop-filter":["","none",j,F]}],"backdrop-blur":[{"backdrop-blur":Pe()}],"backdrop-brightness":[{"backdrop-brightness":[ce,j,F]}],"backdrop-contrast":[{"backdrop-contrast":[ce,j,F]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ce,j,F]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ce,j,F]}],"backdrop-invert":[{"backdrop-invert":["",ce,j,F]}],"backdrop-opacity":[{"backdrop-opacity":[ce,j,F]}],"backdrop-saturate":[{"backdrop-saturate":[ce,j,F]}],"backdrop-sepia":[{"backdrop-sepia":["",ce,j,F]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",j,F]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ce,"initial",j,F]}],ease:[{ease:["linear","initial",y,j,F]}],delay:[{delay:[ce,j,F]}],animate:[{animate:["none",w,j,F]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,j,F]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:Re()}],"rotate-x":[{"rotate-x":Re()}],"rotate-y":[{"rotate-y":Re()}],"rotate-z":[{"rotate-z":Re()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[j,F,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xe()}],"translate-x":[{"translate-x":xe()}],"translate-y":[{"translate-y":xe()}],"translate-z":[{"translate-z":xe()}],"translate-none":["translate-none"],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",j,F]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mbs":[{"scroll-mbs":P()}],"scroll-mbe":[{"scroll-mbe":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pbs":[{"scroll-pbs":P()}],"scroll-pbe":[{"scroll-pbe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",j,F]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[ce,_t,lt,io]}],stroke:[{stroke:["none",...T()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},lc=Fl(ic);function N(...e){return lc(Ms(e))}var Rg="rounded-lg border border-border bg-surface overflow-hidden",_g="border-b border-border px-3 sm:px-4 py-1.5 sm:py-2",Ig="p-2 sm:p-3 lg:p-4",Tg="space-y-3 sm:space-y-4",Dg="gap-2 sm:gap-3",Lg="px-3 sm:px-4 py-1.5 sm:py-2",Og="grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-4",$g="grid grid-cols-1 lg:grid-cols-2",Bg="flex flex-col-reverse md:flex-row",zg="w-full md:w-44 lg:w-52 md:flex-shrink-0 border-b md:border-b-0 md:border-l border-border",Fg="text-[10px] sm:text-[11px] font-semibold text-foreground uppercase tracking-wider",jg="text-[11px] sm:text-xs text-foreground",Gg="text-[10px] text-foreground-subtle",Qg="text-[11px] sm:text-xs font-medium text-foreground",Hg="text-base sm:text-lg font-semibold leading-tight text-foreground",Ug="inline-flex items-center justify-center gap-1 rounded border border-border bg-surface px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-foreground hover:bg-surface-hover transition-colors disabled:opacity-40",Vg="inline-flex items-center justify-center gap-1 rounded border border-primary/40 bg-primary/15 px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-primary hover:bg-primary/25 transition-colors disabled:opacity-40",qg="inline-flex items-center justify-center gap-1 rounded border border-danger/40 bg-danger/10 px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-danger hover:bg-danger/20 transition-colors disabled:opacity-40",Wg="inline-flex items-center justify-center gap-1 rounded border border-warning/40 bg-warning/10 px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-warning hover:bg-warning/20 transition-colors disabled:opacity-40",Kg="w-full rounded border border-border bg-background px-1.5 py-0.5 sm:px-2 sm:py-1 text-[11px] sm:text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none",Zg="inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium transition-colors",Yg="border-primary/50 bg-primary/15 text-primary",Xg="border-border bg-surface text-foreground-subtle hover:bg-surface-hover";function cc(e,t){for(const r of e.slots)for(const n of r.addons)if(n.id===t)return n;return null}function dc(e,t){return e.models.find(r=>r.id===t)??null}function uc(e,t){return e.models.find(r=>!!r.formats[t])??null}function pc(e,t){const r=new Set((t.configSchema??[]).map(s=>s.key)),n={};for(const[s,a]of Object.entries(e))r.has(s)&&(n[s]=a);return n}function Jg(e){const{source:t,target:r,catalog:n,addonIds:s}=e,a=[];for(const i of s){const l=t.defaults[i];if(!l){a.push({addonId:i,outcome:"skip",modelId:null,reason:"no source entry",patch:null});continue}const c=cc(n,i);if(!c){a.push({addonId:i,outcome:"skip",modelId:null,reason:"addon not in target catalog",patch:null});continue}const d=dc(c,l.modelId),u=d!==null&&!!d.formats[r.engine.format];let f,h;if(u)f=l.modelId,h="exact";else{const b=uc(c,r.engine.format);if(!b){a.push({addonId:i,outcome:"skip",modelId:null,reason:"no compatible model for target format",patch:null});continue}f=b.id,h="mapped"}const g={enabled:l.enabled,modelId:f,settings:pc(l.settings,c)};a.push({addonId:i,outcome:h,modelId:f,patch:g})}return a}var uo={idle:{label:"Idle",textColor:"text-foreground-subtle",badgeClass:"border-border bg-surface-hover text-foreground-subtle",dotClass:"bg-gray-400",icon:"PowerOff"},active:{label:"Active",textColor:"text-success",badgeClass:"border-success/40 bg-success/10 text-success",dotClass:"bg-red-500 animate-pulse",icon:"Activity"},watching:{label:"Watching",textColor:"text-foreground-subtle",badgeClass:"border-border bg-surface-hover text-foreground-subtle",dotClass:"bg-emerald-500",icon:"Eye"},"load-shed":{label:"Load-Shed",textColor:"text-amber-500",badgeClass:"border-amber-500/40 bg-amber-500/10 text-amber-500",dotClass:"bg-amber-500",icon:"AlertTriangle"},paused:{label:"Paused",textColor:"text-gray-400",badgeClass:"border-gray-500/40 bg-gray-500/10 text-gray-400",dotClass:"bg-gray-400",icon:"PauseCircle"}};function js(e){return uo[e]??uo.watching}function ot(e,t){if(typeof globalThis>"u")return Ze(t);const r=globalThis.__camstackSharedContexts,n=r??new Map;r||(globalThis.__camstackSharedContexts=n);const s=n.get(e);if(s)return s;const a=Ze(t);return n.set(e,a),a}var fc="FEDERATION_DEBUG",sn=(function(e){return e[e.UNKNOWN=1]="UNKNOWN",e[e.CALCULATED=2]="CALCULATED",e[e.NO_USE=0]="NO_USE",e})({}),Gs=!0;function mc(){return Gs}function hc(){try{if(mc()&&window.localStorage)return!!localStorage.getItem(fc)}catch{return!1}return!1}function an(){return typeof process<"u"&&Lr&&Lr.FEDERATION_DEBUG?!!Lr.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<"u"&&FEDERATION_DEBUG?!0:hc()}var gc="[ Federation Runtime ]",Qs=function(...e){return e.length?e.reduce((t,r)=>r?t?`${t}:${r}`:r:t,""):""},ln=(e,t)=>{if("getPublicPath"in e){let r;return e.getPublicPath.startsWith("function")?r=new Function("return "+e.getPublicPath)()():r=new Function(e.getPublicPath)(),`${r}${t}`}else return"publicPath"in e?`${e.publicPath}${t}`:(console.warn("Cannot get resource URL. If in debug mode, please ignore.",e,t),"")},Hs=e=>{console.warn(`${gc}: ${e}`)};function Us(e){try{return JSON.stringify(e,null,2)}catch{return""}}var $r=(e,t)=>{if(!e)return t;const n=(s=>{if(s===".")return"";if(s.startsWith("./"))return s.replace("./","");if(s.startsWith("/")){const a=s.slice(1);return a.endsWith("/")?a.slice(0,-1):a}return s})(e);return n?n.endsWith("/")?`${n}${t}`:`${n}/${t}`:t};function bc(e){return e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function vc(e,t={}){const{remotes:r={},overrides:n={},version:s}=t;let a;const i=()=>"publicPath"in e.metaData?(e.metaData.publicPath==="auto"||e.metaData.publicPath==="")&&s?bc(s):e.metaData.publicPath:e.metaData.getPublicPath,l=Object.keys(n);let c={};Object.keys(r).length||(c=e.remotes?.reduce((w,k)=>{let M;const C=k.federationContainerName;return l.includes(C)?M=n[C]:"version"in k?M=k.version:M=k.entry,w[C]={matchedVersion:M},w},{})||{}),Object.keys(r).forEach(w=>c[w]={matchedVersion:l.includes(w)?n[w]:r[w]});const{remoteEntry:{path:d,name:u,type:f},types:h={path:"",name:"",zip:"",api:""},buildInfo:{buildVersion:g},globalName:b,ssrRemoteEntry:v}=e.metaData,{exposes:x}=e;let y={version:s||"",buildVersion:g,globalName:b,remoteEntry:$r(d,u),remoteEntryType:f,remoteTypes:$r(h.path,h.name),remoteTypesZip:h.zip||"",remoteTypesAPI:h.api||"",remotesInfo:c,shared:e?.shared.map(w=>({assets:w.assets,sharedName:w.name,version:w.version,usedExports:w.referenceExports||[]})),modules:x?.map(w=>({moduleName:w.name,modulePath:w.path,assets:w.assets}))};if("publicPath"in e.metaData?(a={...y,publicPath:i()},typeof e.metaData.ssrPublicPath=="string"&&(a.ssrPublicPath=e.metaData.ssrPublicPath)):a={...y,getPublicPath:i()},v){const w=$r(v.path,v.name);a.ssrRemoteEntry=w,a.ssrRemoteEntryType=v.type||"commonjs-module"}return a}function Vs(e){return!!("remoteEntry"in e&&e.remoteEntry.includes(".json"))}var yc="[ Module Federation ]",It=console,xc=["logger.ts","logger.js","captureStackTrace","Logger.emit","Logger.log","Logger.info","Logger.warn","Logger.error","Logger.debug"];function wc(){try{const e=new Error().stack;if(!e)return;const[,...t]=e.split(`
31
- `),r=t.filter(n=>!xc.some(s=>n.includes(s)));return r.length?`Stack trace:
32
- ${r.slice(0,5).join(`
33
- `)}`:void 0}catch{return}}var qs=class{constructor(e,t=It){this.prefix=e,this.delegate=t??It}setPrefix(e){this.prefix=e}setDelegate(e){this.delegate=e??It}emit(e,t){const r=this.delegate,n=an()?wc():void 0,s=n?[...t,n]:t,a=(()=>{switch(e){case"log":return["log","info"];case"info":return["info","log"];case"warn":return["warn","info","log"];case"error":return["error","warn","log"];default:return["debug","log"]}})();for(const i of a){const l=r[i];if(typeof l=="function"){l.call(r,this.prefix,...s);return}}for(const i of a){const l=It[i];if(typeof l=="function"){l.call(It,this.prefix,...s);return}}}log(...e){this.emit("log",e)}warn(...e){this.emit("warn",e)}error(...e){this.emit("error",e)}success(...e){this.emit("info",e)}info(...e){this.emit("info",e)}ready(...e){this.emit("info",e)}debug(...e){an()&&this.emit("debug",e)}};function kc(e){return new qs(e)}function Nc(e){const t=new qs(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}Nc(yc);async function Ws(e,t){try{return await e()}catch(r){Hs(r);return}}function cn(e,t){const r=/^(https?:)?\/\//i;return e.replace(r,"").replace(/\/$/,"")===t.replace(r,"").replace(/\/$/,"")}function Ks(e){let t=null,r=!0,n=2e4,s;const a=document.getElementsByTagName("script");for(let d=0;d<a.length;d++){const u=a[d],f=u.getAttribute("src");if(f&&cn(f,e.url)){t=u,r=!1;break}}if(!t){const d=e.attrs;t=document.createElement("script"),t.type=d?.type==="module"?"module":"text/javascript";let u;e.createScriptHook&&(u=e.createScriptHook(e.url,e.attrs),u instanceof HTMLScriptElement?t=u:typeof u=="object"&&("script"in u&&u.script&&(t=u.script),"timeout"in u&&u.timeout&&(n=u.timeout))),t.src||(t.src=e.url),d&&!u&&Object.keys(d).forEach(f=>{t&&(f==="async"||f==="defer"?t[f]=d[f]:t.getAttribute(f)||t.setAttribute(f,d[f]))})}let i=null;const l=typeof window<"u"?d=>{if(d.filename&&cn(d.filename,e.url)){const u=new Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${d.message} (${d.filename}:${d.lineno}:${d.colno})`);u.name="ScriptExecutionError",i=u}}:null;l&&window.addEventListener("error",l);const c=async(d,u)=>{clearTimeout(s),l&&window.removeEventListener("error",l);const f=()=>{if(u?.type==="error"){const h=new Error(u?.isTimeout?`ScriptNetworkError: Script "${e.url}" timed out.`:`ScriptNetworkError: Failed to load script "${e.url}" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`);h.name="ScriptNetworkError",e?.onErrorCallback&&e?.onErrorCallback(h)}else i?e?.onErrorCallback&&e?.onErrorCallback(i):e?.cb&&e?.cb()};if(t&&(t.onerror=null,t.onload=null,Ws(()=>{const{needDeleteScript:h=!0}=e;h&&t?.parentNode&&t.parentNode.removeChild(t)}),d&&typeof d=="function")){const h=d(u);if(h instanceof Promise){const g=await h;return f(),g}return f(),h}f()};return t.onerror=c.bind(null,t.onerror),t.onload=c.bind(null,t.onload),s=setTimeout(()=>{c(null,{type:"error",isTimeout:!0})},n),{script:t,needAttach:r}}function Br(e){let t=null,r=!0;const n=document.getElementsByTagName("link");for(let a=0;a<n.length;a++){const i=n[a],l=i.getAttribute("href"),c=i.getAttribute("rel");if(l&&cn(l,e.url)&&c===e.attrs.rel){t=i,r=!1;break}}if(!t){t=document.createElement("link"),t.setAttribute("href",e.url);let a;const i=e.attrs;e.createLinkHook&&(a=e.createLinkHook(e.url,i),a instanceof HTMLLinkElement&&(t=a)),i&&!a&&Object.keys(i).forEach(l=>{t&&!t.getAttribute(l)&&t.setAttribute(l,i[l])})}const s=(a,i)=>{const l=()=>{i?.type==="error"?e?.onErrorCallback&&e?.onErrorCallback(i):e?.cb&&e?.cb()};if(t&&(t.onerror=null,t.onload=null,Ws(()=>{const{needDeleteLink:c=!0}=e;c&&t?.parentNode&&t.parentNode.removeChild(t)}),a)){const c=a(i);return l(),c}l()};return t.onerror=s.bind(null,t.onerror),t.onload=s.bind(null,t.onload),{link:t,needAttach:r}}function Sc(e,t){const{attrs:r={},createScriptHook:n}=t;return new Promise((s,a)=>{const{script:i,needAttach:l}=Ks({url:e,cb:s,onErrorCallback:a,attrs:{fetchpriority:"high",...r},createScriptHook:n,needDeleteScript:!0});l&&document.head.appendChild(i)})}var Cc=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`,Zs=(e,t,r,n)=>{const s=[`${[t[e]]} #${e}`];return r&&s.push(`args: ${JSON.stringify(r)}`),s.push(Cc(e)),n&&s.push(`Original Error Message:
34
- ${n}`),s.join(`
35
- `)};function Mc(e,t,r,n,s,a){return n(Zs(e,t,r,s))}var ct="[ Federation Runtime ]",dn=kc(ct);function Le(e,t,r,n,s){e||(r!==void 0?Se(t,r,n,void 0):Se(t))}function Se(e,t,r,n,s){if(t!==void 0)return Mc(e,t,r??{},i=>{throw new Error(`${ct}: ${i}`)},n);const a=e;throw a instanceof Error?(a.message.startsWith(ct)||(a.message=`${ct}: ${a.message}`),a):new Error(`${ct}: ${a}`)}function Tn(e){e instanceof Error&&(e.message.startsWith(ct)||(e.message=`${ct}: ${e.message}`)),dn.warn(e)}function Ec(e,t){return e.findIndex(r=>r===t)===-1&&e.push(t),e}function Bt(e){return"version"in e&&e.version?`${e.name}:${e.version}`:"entry"in e&&e.entry?`${e.name}:${e.entry}`:`${e.name}`}function Dn(e){return typeof e.entry<"u"}function Ys(e){return!e.entry.includes(".json")}function Ln(e){return e&&typeof e=="object"}var Ac=Object.prototype.toString;function Pc(e){return Ac.call(e)==="[object Object]"}function Xs(e){return Array.isArray(e)?e:[e]}function Js(e){const t={url:"",type:"global",globalName:""};return"remoteEntry"in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t}var Rc=(e,t)=>{let r;return e.endsWith("/")?r=e.slice(0,-1):r=e,t.startsWith(".")&&(t=t.slice(1)),r=r+t,r},Me=typeof globalThis=="object"?globalThis:window,je=(()=>{try{return document.defaultView}catch{return Me}})(),zt=je;function lr(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function cr(e,t){return Object.hasOwnProperty.call(e,t)}cr(Me,"__GLOBAL_LOADING_REMOTE_ENTRY__")||lr(Me,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});var yt=Me.__GLOBAL_LOADING_REMOTE_ENTRY__;function ea(e){cr(e,"__VMOK__")&&!cr(e,"__FEDERATION__")&&lr(e,"__FEDERATION__",e.__VMOK__),cr(e,"__FEDERATION__")||(lr(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),lr(e,"__VMOK__",e.__FEDERATION__)),e.__FEDERATION__.__GLOBAL_PLUGIN__??=[],e.__FEDERATION__.__INSTANCES__??=[],e.__FEDERATION__.moduleInfo??={},e.__FEDERATION__.__SHARE__??={},e.__FEDERATION__.__MANIFEST_LOADING__??={},e.__FEDERATION__.__PRELOADED_MAP__??=new Map}ea(Me);ea(je);function _c(e){Me.__FEDERATION__.__INSTANCES__.push(e)}function Ic(){return Me.__FEDERATION__.__DEBUG_CONSTRUCTOR__}function Tc(e,t=an()){t&&(Me.__FEDERATION__.__DEBUG_CONSTRUCTOR__=e,Me.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__="2.4.0")}function Mt(e,t){if(typeof t=="string"){if(e[t])return{value:e[t],key:t};{const r=Object.keys(e);for(const n of r){const[s,a]=n.split(":"),i=`${s}:${t}`,l=e[i];if(l)return{value:l,key:i}}return{value:void 0,key:t}}}else Se(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`)}var po=()=>je.__FEDERATION__.moduleInfo,Dc=(e,t)=>{const r=Mt(t,Bt(e)).value;if(r&&!r.version&&"version"in e&&e.version&&(r.version=e.version),r)return r;if("version"in e&&e.version){const{version:n,...s}=e,a=Bt(s),i=Mt(je.__FEDERATION__.moduleInfo,a).value;if(i?.version===n)return i}},dr=e=>Dc(e,je.__FEDERATION__.moduleInfo),fo=(e,t)=>{const r=Bt(e);return je.__FEDERATION__.moduleInfo[r]=t,je.__FEDERATION__.moduleInfo},Lc=e=>(je.__FEDERATION__.moduleInfo={...je.__FEDERATION__.moduleInfo,...e},()=>{const t=Object.keys(e);for(const r of t)delete je.__FEDERATION__.moduleInfo[r]}),ta=(e,t)=>{const r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:Me[r]}},Oc=()=>je.__FEDERATION__.__GLOBAL_PLUGIN__,$c=e=>Me.__FEDERATION__.__PRELOADED_MAP__.get(e),Bc=e=>Me.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),mo="[0-9A-Za-z-]+",On=`(?:\\+(${mo}(?:\\.${mo})*))`,Dt="0|[1-9]\\d*",ur="[0-9]+",ra="\\d*[a-zA-Z-][a-zA-Z0-9-]*",ho=`(?:${ur}|${ra})`,zc=`(?:-?(${ho}(?:\\.${ho})*))`,go=`(?:${Dt}|${ra})`,na=`(?:-(${go}(?:\\.${go})*))`,zr=`${Dt}|x|X|\\*`,Et=`[v=\\s]*(${zr})(?:\\.(${zr})(?:\\.(${zr})(?:${na})?${On}?)?)?`,Fc=`^\\s*(${Et})\\s+-\\s+(${Et})\\s*$`,jc=`[v=\\s]*${`(${ur})\\.(${ur})\\.(${ur})`}${zc}?${On}?`,$n="((?:<|>)?=?)",Gc=`(\\s*)${$n}\\s*(${jc}|${Et})`,oa="(?:~>?)",Qc=`(\\s*)${oa}\\s+`,sa="(?:\\^)",Hc=`(\\s*)${sa}\\s+`,Uc="(<|>)?=?\\s*\\*",Vc=`^${sa}${Et}$`,qc=`v?${`(${Dt})\\.(${Dt})\\.(${Dt})`}${na}?${On}?`,Wc=`^${oa}${Et}$`,Kc=`^${$n}\\s*${Et}$`,Zc=`^${$n}\\s*(${qc})$|^$`,Yc="^\\s*>=\\s*0.0.0\\s*$";function qe(e){return new RegExp(e)}function _e(e){return!e||e.toLowerCase()==="x"||e==="*"}function aa(...e){return t=>e.reduce((r,n)=>n(r),t)}function bo(e){return e.match(qe(Zc))}function vo(e,t,r,n){const s=`${e}.${t}.${r}`;return n?`${s}-${n}`:s}function Xc(e){return e.replace(qe(Fc),(t,r,n,s,a,i,l,c,d,u,f,h)=>(_e(n)?r="":_e(s)?r=`>=${n}.0.0`:_e(a)?r=`>=${n}.${s}.0`:r=`>=${r}`,_e(d)?c="":_e(u)?c=`<${Number(d)+1}.0.0-0`:_e(f)?c=`<${d}.${Number(u)+1}.0-0`:h?c=`<=${d}.${u}.${f}-${h}`:c=`<=${c}`,`${r} ${c}`.trim()))}function Jc(e){return e.replace(qe(Gc),"$1$2$3")}function ed(e){return e.replace(qe(Qc),"$1~")}function td(e){return e.replace(qe(Hc),"$1^")}function rd(e){return e.trim().split(/\s+/).map(t=>t.replace(qe(Vc),(r,n,s,a,i)=>_e(n)?"":_e(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:_e(a)?n==="0"?`>=${n}.${s}.0 <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.0 <${Number(n)+1}.0.0-0`:i?n==="0"?s==="0"?`>=${n}.${s}.${a}-${i} <${n}.${s}.${Number(a)+1}-0`:`>=${n}.${s}.${a}-${i} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${a}-${i} <${Number(n)+1}.0.0-0`:n==="0"?s==="0"?`>=${n}.${s}.${a} <${n}.${s}.${Number(a)+1}-0`:`>=${n}.${s}.${a} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${a} <${Number(n)+1}.0.0-0`)).join(" ")}function nd(e){return e.trim().split(/\s+/).map(t=>t.replace(qe(Wc),(r,n,s,a,i)=>_e(n)?"":_e(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:_e(a)?`>=${n}.${s}.0 <${n}.${Number(s)+1}.0-0`:i?`>=${n}.${s}.${a}-${i} <${n}.${Number(s)+1}.0-0`:`>=${n}.${s}.${a} <${n}.${Number(s)+1}.0-0`)).join(" ")}function od(e){return e.split(/\s+/).map(t=>t.trim().replace(qe(Kc),(r,n,s,a,i,l)=>{const c=_e(s),d=c||_e(a),u=d||_e(i);return n==="="&&u&&(n=""),l="",c?n===">"||n==="<"?"<0.0.0-0":"*":n&&u?(d&&(a=0),i=0,n===">"?(n=">=",d?(s=Number(s)+1,a=0,i=0):(a=Number(a)+1,i=0)):n==="<="&&(n="<",d?s=Number(s)+1:a=Number(a)+1),n==="<"&&(l="-0"),`${n+s}.${a}.${i}${l}`):d?`>=${s}.0.0${l} <${Number(s)+1}.0.0-0`:u?`>=${s}.${a}.0${l} <${s}.${Number(a)+1}.0-0`:r})).join(" ")}function sd(e){return e.trim().replace(qe(Uc),"")}function ad(e){return e.trim().replace(qe(Yc),"")}function pr(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function id(e,t){const{preRelease:r}=e,{preRelease:n}=t;if(r===void 0&&n)return 1;if(r&&n===void 0)return-1;if(r===void 0&&n===void 0)return 0;for(let s=0,a=r.length;s<=a;s++){const i=r[s],l=n[s];if(i!==l)return i===void 0&&l===void 0?0:i?l?pr(i,l):-1:1}return 0}function Xt(e,t){return pr(e.major,t.major)||pr(e.minor,t.minor)||pr(e.patch,t.patch)||id(e,t)}function Fr(e,t){return e.version===t.version}function ld(e,t){switch(e.operator){case"":case"=":return Fr(e,t);case">":return Xt(e,t)<0;case">=":return Fr(e,t)||Xt(e,t)<0;case"<":return Xt(e,t)>0;case"<=":return Fr(e,t)||Xt(e,t)>0;case void 0:return!0;default:return!1}}function cd(e){return aa(rd,nd,od,sd)(e)}function dd(e){return aa(Xc,Jc,ed,td)(e.trim()).split(/\s+/).join(" ")}function Tt(e,t){if(!e)return!1;const r=bo(e);if(!r)return!1;const[,n,,s,a,i,l]=r,c={operator:n,version:vo(s,a,i,l),major:s,minor:a,patch:i,preRelease:l?.split(".")},d=t.split("||");for(const u of d){const f=u.trim();if(!f||f==="*"||f==="x")return!0;try{const h=dd(f);if(!h.trim())return!0;const g=h.split(" ").map(x=>cd(x)).join(" ");if(!g.trim())return!0;const b=g.split(/\s+/).map(x=>ad(x)).filter(Boolean);if(b.length===0)continue;let v=!0;for(const x of b){const y=bo(x);if(!y){v=!1;break}const[,w,,k,M,C,A]=y;if(!ld({operator:w,version:vo(k,M,C,A),major:k,minor:M,patch:C,preRelease:A?.split(".")},c)){v=!1;break}}if(v)return!0}catch(h){console.error(`[semver] Error processing range part "${f}":`,h);continue}}return!1}var Nr="default",ud="global";function pd(e,t,r,n){let s;return"get"in e?s=e.get:"lib"in e?s=()=>Promise.resolve(e.lib):s=()=>Promise.resolve(()=>{Se(`Cannot get shared "${r}" from "${t}": neither "get" nor "lib" is provided in the share config.`)}),e.shareConfig?.eager&&e.treeShaking?.mode&&Se(`Invalid shared config for "${r}" from "${t}": cannot use both "eager: true" and "treeShaking.mode" simultaneously. Choose one strategy.`),{deps:[],useIn:[],from:t,loading:null,...e,shareConfig:{requiredVersion:`^${e.version}`,singleton:!1,eager:!1,strictVersion:!1,...e.shareConfig},get:s,loaded:e?.loaded||"lib"in e?!0:void 0,version:e.version??"0",scope:Array.isArray(e.scope)?e.scope:[e.scope??"default"],strategy:(e.strategy??n)||"version-first",treeShaking:e.treeShaking?{...e.treeShaking,mode:e.treeShaking.mode??"server-calc",status:e.treeShaking.status??sn.UNKNOWN,useIn:[]}:void 0}}function ia(e,t){const r=t.shared||{},n=t.name,s=Object.keys(r).reduce((i,l)=>{const c=Xs(r[l]);return i[l]=i[l]||[],c.forEach(d=>{i[l].push(pd(d,n,l,t.shareStrategy))}),i},{}),a={...e.shared};return Object.keys(s).forEach(i=>{a[i]?s[i].forEach(l=>{a[i].find(c=>c.version===l.version)||a[i].push(l)}):a[i]=s[i]}),{allShareInfos:a,newShareInfos:s}}function Ft(e,t){if(!e)return!1;const{status:r,mode:n}=e;return r===sn.NO_USE?!1:r===sn.CALCULATED?!0:n==="runtime-infer"?t?md(e,t):!0:!1}function dt(e,t){const r=n=>{if(!Number.isNaN(Number(n))){const s=n.split(".");let a=n;for(let i=0;i<3-s.length;i++)a+=".0";return a}return n};return!!Tt(r(e),`<=${r(t)}`)}var jt=(e,t)=>{const r=t||function(n,s){return dt(n,s)};return Object.keys(e).reduce((n,s)=>!n||r(n,s)||n==="0"?s:n,0)},vr=e=>!!e.loaded||typeof e.lib=="function",fd=e=>!!e.loading,md=(e,t)=>{if(!e||!t)return!1;const{usedExports:r}=e;return r?!!t.every(n=>r.includes(n)):!1};function hd(e,t,r,n){const s=e[t][r];let a="",i=Ft(n);const l=function(c,d){return i?s[c].treeShaking?s[d].treeShaking?!vr(s[c].treeShaking)&&dt(c,d):!1:!0:!vr(s[c])&&dt(c,d)};if(i){if(a=jt(e[t][r],l),a)return{version:a,useTreesShaking:i};i=!1}return{version:jt(e[t][r],l),useTreesShaking:i}}var gt=e=>vr(e)||fd(e);function gd(e,t,r,n){const s=e[t][r];let a="",i=Ft(n);const l=function(c,d){if(i){if(!s[c].treeShaking)return!0;if(!s[d].treeShaking)return!1;if(gt(s[d].treeShaking))return gt(s[c].treeShaking)?!!dt(c,d):!0;if(gt(s[c].treeShaking))return!1}return gt(s[d])?gt(s[c])?!!dt(c,d):!0:gt(s[c])?!1:dt(c,d)};if(i){if(a=jt(e[t][r],l),a)return{version:a,useTreesShaking:i};i=!1}return{version:jt(e[t][r],l),useTreesShaking:i}}function bd(e){return e==="loaded-first"?gd:hd}function fr(e,t,r,n){if(!e)return;const{shareConfig:s,scope:a=Nr,strategy:i,treeShaking:l}=r,c=Array.isArray(a)?a:[a];for(const d of c)if(s&&e[d]&&e[d][t]){const{requiredVersion:u}=s,{version:f,useTreesShaking:h}=bd(i)(e,d,t,l),g=()=>{const v=e[d][t][f];if(s.singleton){if(typeof u=="string"&&!Tt(f,u)){const x=`Version ${f} from ${f&&v.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${u})`;s.strictVersion?Se(x):Tn(x)}return{shared:v,useTreesShaking:h}}else{if(u===!1||u==="*")return{shared:v,useTreesShaking:h};if(Tt(f,u))return{shared:v,useTreesShaking:h};const x=Ft(l);if(x){for(const[y,w]of Object.entries(e[d][t]))if(Ft(w.treeShaking,l?.usedExports)&&Tt(y,u))return{shared:w,useTreesShaking:x}}for(const[y,w]of Object.entries(e[d][t]))if(Tt(y,u))return{shared:w,useTreesShaking:!1}}},b={shareScopeMap:e,scope:d,pkgName:t,version:f,GlobalFederation:zt.__FEDERATION__,shareInfo:r,resolver:g};return(n.emit(b)||b).resolver()}}function la(){return zt.__FEDERATION__.__SHARE__}function yo(e){const{pkgName:t,extraOptions:r,shareInfos:n}=e,s=c=>{if(!c)return;const d={};return c.forEach(f=>{d[f.version]=f}),d[jt(d,function(f,h){return!vr(d[f])&&dt(f,h)})]},a=r?.resolver??s,i=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),l=(...c)=>{const d={};for(const u of c)if(u)for(const[f,h]of Object.entries(u)){const g=d[f];i(g)&&i(h)?d[f]=l(g,h):h!==void 0&&(d[f]=h)}return d};return l(a(n[t]),r?.customShareInfo)}var bt=(e,t)=>{e.useIn||(e.useIn=[]),Ec(e.useIn,t)};function Jt(e,t){return t&&e.treeShaking?e.treeShaking:e}function vd(e,t){for(const r of e){const n=t.startsWith(r.name);let s=t.replace(r.name,"");if(n){if(s.startsWith("/")){const l=r.name;return s=`.${s}`,{pkgNameOrAlias:l,expose:s,remote:r}}else if(s==="")return{pkgNameOrAlias:r.name,expose:".",remote:r}}const a=r.alias&&t.startsWith(r.alias);let i=r.alias&&t.replace(r.alias,"");if(r.alias&&a){if(i&&i.startsWith("/")){const l=r.alias;return i=`.${i}`,{pkgNameOrAlias:l,expose:i,remote:r}}else if(i==="")return{pkgNameOrAlias:r.alias,expose:".",remote:r}}}}function yd(e,t){for(const r of e)if(t===r.name||r.alias&&t===r.alias)return r}var ca="RUNTIME-001",da="RUNTIME-002",ua="RUNTIME-003",pa="RUNTIME-004",fa="RUNTIME-005",un="RUNTIME-006",ma="RUNTIME-007",ha="RUNTIME-008",Bn="RUNTIME-009",ga="RUNTIME-010",ba="RUNTIME-011",xd="RUNTIME-012",Oe={[ca]:"Failed to get remoteEntry exports.",[da]:'The remote entry interface does not contain "init"',[ua]:"Failed to get manifest.",[pa]:"Failed to locate remote.",[fa]:"Invalid loadShareSync function call from bundler runtime",[un]:"Invalid loadShareSync function call from runtime",[ma]:"Failed to get remote snapshot.",[ha]:"Failed to load script resources.",[Bn]:"Please call createInstance first.",[ga]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',[ba]:"The remoteEntry URL is missing from the remote snapshot.",[xd]:'The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.'};({...Oe});var va=".then(callbacks[0]).catch(callbacks[1])";async function wd({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${e}")${va}`)([r,n]):import(e).then(r).catch(n)}catch(s){Se(`Failed to load ESM entry from "${e}". ${s instanceof Error?s.message:String(s)}`)}})}async function kd({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof __system_context__>"u"?System.import(e).then(r).catch(n):new Function("callbacks",`System.import("${e}")${va}`)([r,n])}catch(s){Se(`Failed to load SystemJS entry from "${e}". ${s instanceof Error?s.message:String(s)}`)}})}function Nd(e,t,r){const{remoteEntryKey:n,entryExports:s}=ta(e,t);return s||Se(ca,Oe,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:n}),s}async function Sd({name:e,globalName:t,entry:r,remoteInfo:n,loaderHook:s,getEntryUrl:a}){const{entryExports:i}=ta(e,t);if(i)return i;const l=a?a(r):r;return Sc(l,{attrs:{},createScriptHook:(c,d)=>{const u=s.lifecycle.createScript.emit({url:c,attrs:d,remoteInfo:n});if(u&&(u instanceof HTMLScriptElement||"script"in u||"timeout"in u))return u}}).then(()=>Nd(e,t,r),c=>{const d=c instanceof Error?c.message:String(c);Se(ha,Oe,{remoteName:e,resourceUrl:l},d)})}async function Cd({remoteInfo:e,remoteEntryExports:t,loaderHook:r,getEntryUrl:n}){const{entry:s,entryGlobalName:a,name:i,type:l}=e;switch(l){case"esm":case"module":return wd({entry:s,remoteEntryExports:t});case"system":return kd({entry:s,remoteEntryExports:t});default:return Sd({entry:s,globalName:a,name:i,remoteInfo:e,loaderHook:r,getEntryUrl:n})}}function pn(e){const{entry:t,name:r}=e;return Qs(r,t)}async function yr(e){const{origin:t,remoteEntryExports:r,remoteInfo:n,getEntryUrl:s,_inErrorHandling:a=!1}=e,i=pn(n);if(r)return r;if(!yt[i]){const l=t.remoteHandler.hooks.lifecycle.loadEntry,c=t.loaderHook;yt[i]=l.emit({loaderHook:c,remoteInfo:n,remoteEntryExports:r}).then(d=>d||Cd({remoteInfo:n,remoteEntryExports:r,loaderHook:c,getEntryUrl:s})).catch(async d=>{const u=pn(n),f=d instanceof Error&&d.message.includes("ScriptExecutionError");if(d instanceof Error&&d.message.includes("RUNTIME-008")&&!f&&!a){const h=b=>yr({...b,_inErrorHandling:!0}),g=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:h,origin:t,remoteInfo:n,remoteEntryExports:r,globalLoading:yt,uniqueKey:u});if(g)return g}throw d})}return yt[i]}function xr(e){return{...e,entry:"entry"in e?e.entry:"",type:e.type||"global",entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||"default"}}function Md(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function Ed(e,t){const r=Oc(),n=[t.hooks,t.remoteHandler.hooks,t.sharedHandler.hooks,t.snapshotHandler.hooks,t.loaderHook,t.bridgeHook];return r.length>0&&r.forEach(s=>{e?.find(a=>a.name!==s.name)&&e.push(s)}),e&&e.length>0&&e.forEach(s=>{n.forEach(a=>{a.applyPlugin(s,t)})}),e}function Ad(e){return{name:e.name,alias:e.alias,entry:"entry"in e?e.entry:void 0,version:"version"in e?e.version:void 0,type:e.type,entryGlobalName:e.entryGlobalName,shareScope:e.shareScope}}function At(e){const t={};for(const[r,n]of Object.entries(e.shared)){const s=n[0];s&&(t[r]={version:s.version,singleton:s.shareConfig?.singleton,requiredVersion:s.shareConfig?.requiredVersion===!1?!1:s.shareConfig?.requiredVersion,eager:s.eager,strictVersion:s.shareConfig?.strictVersion})}return{project:{name:e.name,mfRole:e.remotes?.length>0?"host":"unknown"},mfConfig:{name:e.name,remotes:e.remotes?.map(Ad)??[],shared:t}}}function ya(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,...e}}function Pd(e,t){return t.map(r=>{const n=yd(e,r.nameOrAlias);return Le(n,`Unable to preload ${r.nameOrAlias} as it is not included in ${!n&&Us({remoteInfo:n,remotes:e})}`),{remote:n,preloadConfig:ya(r)}})}function Rd(e){return e?e.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function xa(e,t,r,n=!0){const{cssAssets:s,jsAssetsWithoutEntry:a,entryAssets:i}=r;if(t.options.inBrowser){if(i.forEach(l=>{const{moduleInfo:c}=l,d=t.moduleCache.get(e.name);yr(d?{origin:t,remoteInfo:c,remoteEntryExports:d.remoteEntryExports}:{origin:t,remoteInfo:c,remoteEntryExports:void 0})}),n){const l={rel:"preload",as:"style"};s.forEach(c=>{const{link:d,needAttach:u}=Br({url:c,cb:()=>{},attrs:l,createLinkHook:(f,h)=>{const g=t.loaderHook.lifecycle.createLink.emit({url:f,attrs:h,remoteInfo:e});if(g instanceof HTMLLinkElement)return g}});u&&document.head.appendChild(d)})}else{const l={rel:"stylesheet",type:"text/css"};s.forEach(c=>{const{link:d,needAttach:u}=Br({url:c,cb:()=>{},attrs:l,createLinkHook:(f,h)=>{const g=t.loaderHook.lifecycle.createLink.emit({url:f,attrs:h,remoteInfo:e});if(g instanceof HTMLLinkElement)return g},needDeleteLink:!1});u&&document.head.appendChild(d)})}if(n){const l={rel:"preload",as:"script"};a.forEach(c=>{const{link:d,needAttach:u}=Br({url:c,cb:()=>{},attrs:l,createLinkHook:(f,h)=>{const g=t.loaderHook.lifecycle.createLink.emit({url:f,attrs:h,remoteInfo:e});if(g instanceof HTMLLinkElement)return g}});u&&document.head.appendChild(d)})}else{const l={fetchpriority:"high",type:e?.type==="module"?"module":"text/javascript"};a.forEach(c=>{const{script:d,needAttach:u}=Ks({url:c,cb:()=>{},attrs:l,createScriptHook:(f,h)=>{const g=t.loaderHook.lifecycle.createScript.emit({url:f,attrs:h,remoteInfo:e});if(g instanceof HTMLScriptElement)return g},needDeleteScript:!0});u&&document.head.appendChild(d)})}}}function _d(e,t,r){const n=t,s=Array.isArray(e.shareScope)?e.shareScope:[e.shareScope];s.length||s.push("default"),s.forEach(i=>{n[i]||(n[i]={})});const a={version:e.version||"",shareScopeKeys:Array.isArray(e.shareScope)?s:e.shareScope||"default"};return Object.defineProperty(a,"shareScopeMap",{value:n,enumerable:!1}),{remoteEntryInitOptions:a,shareScope:n[s[0]],initScope:r??[]}}var wa=class{constructor({remoteInfo:e,host:t}){this.inited=!1,this.initing=!1,this.lib=void 0,this.remoteInfo=e,this.host=t}async getEntry(){if(this.remoteEntryExports)return this.remoteEntryExports;const e=await yr({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports});return Le(e,`remoteEntryExports is undefined
36
- ${Us(this.remoteInfo)}`),this.remoteEntryExports=e,this.remoteEntryExports}async init(e,t,r){const n=await this.getEntry();if(this.inited)return n;if(this.initPromise)return await this.initPromise,n;this.initing=!0,this.initPromise=(async()=>{const{remoteEntryInitOptions:s,shareScope:a,initScope:i}=_d(this.remoteInfo,this.host.shareScopeMap,r),l=await this.host.hooks.lifecycle.beforeInitContainer.emit({shareScope:a,remoteEntryInitOptions:s,initScope:i,remoteInfo:this.remoteInfo,origin:this.host});typeof n?.init>"u"&&Se(da,Oe,{hostName:this.host.name,remoteName:this.remoteInfo.name,remoteEntryUrl:this.remoteInfo.entry,remoteEntryKey:this.remoteInfo.entryGlobalName},void 0,At(this.host.options)),await n.init(l.shareScope,l.initScope,l.remoteEntryInitOptions),await this.host.hooks.lifecycle.initContainer.emit({...l,id:e,remoteSnapshot:t,remoteEntryExports:n}),this.inited=!0})();try{await this.initPromise}finally{this.initing=!1,this.initPromise=void 0}return n}async get(e,t,r,n){const{loadFactory:s=!0}=r||{loadFactory:!0},a=await this.init(e,n);this.lib=a;let i;i=await this.host.loaderHook.lifecycle.getModuleFactory.emit({remoteEntryExports:a,expose:t,moduleInfo:this.remoteInfo}),i||(i=await a.get(t)),Le(i,`${Bt(this.remoteInfo)} remote don't export ${t}.`);const l=Rc(this.remoteInfo.name,t),c=this.wraperFactory(i,l);return s?await c():c}wraperFactory(e,t){function r(n,s){n&&typeof n=="object"&&Object.isExtensible(n)&&!Object.getOwnPropertyDescriptor(n,Symbol.for("mf_module_id"))&&Object.defineProperty(n,Symbol.for("mf_module_id"),{value:s,enumerable:!1})}return e instanceof Promise?async()=>{const n=await e();return r(n,t),n}:()=>{const n=e();return r(n,t),n}}},$e=class{constructor(e){this.type="",this.listeners=new Set,e&&(this.type=e)}on(e){typeof e=="function"&&this.listeners.add(e)}once(e){const t=this;this.on(function r(...n){return t.remove(r),e.apply(null,n)})}emit(...e){let t;return this.listeners.size>0&&this.listeners.forEach(r=>{t=r(...e)}),t}remove(e){this.listeners.delete(e)}removeAll(){this.listeners.clear()}},ze=class extends $e{emit(...e){let t;const r=Array.from(this.listeners);if(r.length>0){let n=0;const s=a=>a===!1?!1:n<r.length?Promise.resolve(r[n++].apply(null,e)).then(s):a;t=s()}return Promise.resolve(t)}};function ka(e,t){if(!Ln(t))return!1;if(e!==t){for(const r in e)if(!(r in t))return!1}return!0}var wt=class extends $e{constructor(e){super(),this.onerror=Se,this.type=e}emit(e){Ln(e)||Se(`The data for the "${this.type}" hook should be an object.`);for(const t of this.listeners)try{const r=t(e);if(ka(e,r))e=r;else{this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);break}}catch(r){Tn(r),this.onerror(r)}return e}},tt=class extends $e{constructor(e){super(),this.onerror=Se,this.type=e}emit(e){Ln(e)||Se(`The response data for the "${this.type}" hook must be an object.`);const t=Array.from(this.listeners);if(t.length>0){let r=0;const n=a=>(Tn(a),this.onerror(a),e),s=a=>{if(ka(e,a)){if(e=a,r<t.length)try{return Promise.resolve(t[r++](e)).then(s,n)}catch(i){return n(i)}}else this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);return e};return Promise.resolve(s(e))}return Promise.resolve(e)}},kt=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){Le(Pc(e),"Plugin configuration is invalid.");const r=e.name;Le(r,"A name must be provided by the plugin."),this.registerPlugins[r]||(this.registerPlugins[r]=e,e.apply?.(t),Object.keys(this.lifecycle).forEach(n=>{const s=e[n];s&&this.lifecycle[n].on(s)}))}removePlugin(e){Le(e,"A name is required.");const t=this.registerPlugins[e];Le(t,`The plugin "${e}" is not registered.`),Object.keys(t).forEach(r=>{r!=="name"&&this.lifecycle[r].remove(t[r])})}};function Na(e,t){const r=Js(t);r.url||Se(ba,Oe,{remoteName:e.name});let n=ln(t,r.url);e.type=r.type,e.entryGlobalName=r.globalName,e.entry=n,e.version=t.version,e.buildVersion=t.buildVersion}function Id(){return{name:"snapshot-plugin",async afterResolve(e){const{remote:t,pkgNameOrAlias:r,expose:n,origin:s,remoteInfo:a,id:i}=e;if(!Dn(t)||!Ys(t)){const{remoteSnapshot:l,globalSnapshot:c}=await s.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:i});Na(a,l);const d={remote:t,preloadConfig:{nameOrAlias:r,exposes:[n],resourceCategory:"sync",share:!1,depsRemote:!1}},u=await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:s,preloadOptions:d,remoteInfo:a,remote:t,remoteSnapshot:l,globalSnapshot:c});return u&&xa(a,s,u,!1),{...e,remoteSnapshot:l}}return e}}}function Td(e){const t=e.split(":");return t.length===1?{name:t[0],version:void 0}:t.length===2?{name:t[0],version:t[1]}:{name:t[1],version:t[2]}}function Sa(e,t,r,n,s={},a){const{value:i}=Mt(e,Bt(t)),l=a||i;if(l&&!Vs(l)&&(r(l,t,n),l.remotesInfo)){const c=Object.keys(l.remotesInfo);for(const d of c){if(s[d])continue;s[d]=!0;const u=Td(d),f=l.remotesInfo[d];Sa(e,{name:u.name,version:f.matchedVersion},r,!1,s,void 0)}}}var jr=(e,t)=>document.querySelector(`${e}[${e==="link"?"href":"src"}="${t}"]`);function Dd(e,t,r,n,s){const a=[],i=[],l=[],c=new Set,d=new Set,{options:u}=e,{preloadConfig:f}=t,{depsRemote:h}=f;if(Sa(n,r,(b,v,x)=>{let y;if(x)y=f;else if(Array.isArray(h)){const A=h.find(_=>_.nameOrAlias===v.name||_.nameOrAlias===v.alias);if(!A)return;y=ya(A)}else if(h===!0)y=f;else return;const w=ln(b,Js(b).url);w&&l.push({name:v.name,moduleInfo:{name:v.name,entry:w,type:"remoteEntryType"in b?b.remoteEntryType:"global",entryGlobalName:"globalName"in b?b.globalName:v.name,shareScope:"",version:"version"in b?b.version:void 0},url:w});let k="modules"in b?b.modules:[];const M=Rd(y.exposes);M.length&&"modules"in b&&(k=b?.modules?.reduce((A,_)=>(M?.indexOf(_.moduleName)!==-1&&A.push(_),A),[]));function C(A){const _=A.map(P=>ln(b,P));return y.filter?_.filter(y.filter):_}if(k){const A=k.length;for(let _=0;_<A;_++){const P=k[_],Q=`${v.name}/${P.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:P.moduleName==="."?v.name:Q,name:v.name,remoteSnapshot:b,preloadConfig:y,remote:v,origin:e}),!$c(Q)&&(y.resourceCategory==="all"?(a.push(...C(P.assets.css.async)),a.push(...C(P.assets.css.sync)),i.push(...C(P.assets.js.async)),i.push(...C(P.assets.js.sync))):y.resourceCategory==="sync"&&(a.push(...C(P.assets.css.sync)),i.push(...C(P.assets.js.sync))),Bc(Q))}}},!0,{},s),s.shared&&s.shared.length>0){const b=(v,x)=>{const{shared:y}=fr(e.shareScopeMap,x.sharedName,v,e.sharedHandler.hooks.lifecycle.resolveShare)||{};y&&typeof y.lib=="function"&&(x.assets.js.sync.forEach(w=>{c.add(w)}),x.assets.css.sync.forEach(w=>{d.add(w)}))};s.shared.forEach(v=>{const x=u.shared?.[v.sharedName];if(!x)return;const y=v.version?x.find(w=>w.version===v.version):x;y&&Xs(y).forEach(w=>{b(w,v)})})}const g=i.filter(b=>!c.has(b)&&!jr("script",b));return{cssAssets:a.filter(b=>!d.has(b)&&!jr("link",b)),jsAssetsWithoutEntry:g,entryAssets:l.filter(b=>!jr("script",b.url))}}var Ld=function(){return{name:"generate-preload-assets-plugin",async generatePreloadAssets(e){const{origin:t,preloadOptions:r,remoteInfo:n,remote:s,globalSnapshot:a,remoteSnapshot:i}=e;return Dn(s)&&Ys(s)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:s.name,url:s.entry,moduleInfo:{name:n.name,entry:s.entry,type:n.type||"global",entryGlobalName:"",shareScope:""}}]}:(Na(n,i),Dd(t,r,n,a,i))}}};function Ca(e,t){const r=dr({name:t.name,version:t.options.version}),n=r&&"remotesInfo"in r&&r.remotesInfo&&Mt(r.remotesInfo,e.name).value;return n&&n.matchedVersion?{hostGlobalSnapshot:r,globalSnapshot:po(),remoteSnapshot:dr({name:e.name,version:n.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:po(),remoteSnapshot:dr({name:e.name,version:"version"in e?e.version:void 0})}}var Od=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new kt({beforeLoadRemoteSnapshot:new ze("beforeLoadRemoteSnapshot"),loadSnapshot:new tt("loadGlobalSnapshot"),loadRemoteSnapshot:new tt("loadRemoteSnapshot"),afterLoadSnapshot:new tt("afterLoadSnapshot")}),this.manifestLoading=zt.__FEDERATION__.__MANIFEST_LOADING__,this.HostInstance=e,this.loaderHook=e.loaderHook}async loadRemoteSnapshotInfo({moduleInfo:e,id:t,expose:r}){const{options:n}=this.HostInstance;await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({options:n,moduleInfo:e});let s=dr({name:this.HostInstance.options.name,version:this.HostInstance.options.version});s||(s={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},Lc({[this.HostInstance.options.name]:s})),s&&"remotesInfo"in s&&!Mt(s.remotesInfo,e.name).value&&("version"in e||"entry"in e)&&(s.remotesInfo={...s?.remotesInfo,[e.name]:{matchedVersion:"version"in e?e.version:e.entry}});const{hostGlobalSnapshot:a,remoteSnapshot:i,globalSnapshot:l}=this.getGlobalRemoteInfo(e),{remoteSnapshot:c,globalSnapshot:d}=await this.hooks.lifecycle.loadSnapshot.emit({options:n,moduleInfo:e,hostGlobalSnapshot:a,remoteSnapshot:i,globalSnapshot:l});let u,f;if(c)if(Vs(c)){const h=c.remoteEntry,g=await this.getManifestJson(h,e,{}),b=fo({...e,entry:h},g);u=g,f=b}else{const{remoteSnapshot:h}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:c,from:"global"});u=h,f=d}else if(Dn(e)){const h=await this.getManifestJson(e.entry,e,{}),g=fo(e,h),{remoteSnapshot:b}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:h,from:"global"});u=b,f=g}else Se(ma,Oe,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(d)},void 0,At(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:n,moduleInfo:e,remoteSnapshot:u}),{remoteSnapshot:u,globalSnapshot:f}}getGlobalRemoteInfo(e){return Ca(e,this.HostInstance)}async getManifestJson(e,t,r){const n=async()=>{let a=this.manifestCache.get(e);if(a)return a;try{let i=await this.loaderHook.lifecycle.fetch.emit(e,{},xr(t));(!i||!(i instanceof Response))&&(i=await fetch(e,{})),a=await i.json()}catch(i){a=await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:e,error:i,from:"runtime",lifecycle:"afterResolve",origin:this.HostInstance}),a||(delete this.manifestLoading[e],Se(ua,Oe,{manifestUrl:e,moduleName:t.name,hostName:this.HostInstance.options.name},`${i}`,At(this.HostInstance.options)))}return Le(a.metaData&&a.exposes&&a.shared,`"${e}" is not a valid federation manifest for remote "${t.name}". Missing required fields: ${[!a.metaData&&"metaData",!a.exposes&&"exposes",!a.shared&&"shared"].filter(Boolean).join(", ")}.`),this.manifestCache.set(e,a),a},s=async()=>{const a=await n(),i=vc(a,{version:e}),{remoteSnapshot:l}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:t,manifestJson:a,remoteSnapshot:i,manifestUrl:e,from:"manifest"});return l};return this.manifestLoading[e]||(this.manifestLoading[e]=s().then(a=>a)),this.manifestLoading[e]}},$d=class{constructor(e){this.hooks=new kt({beforeRegisterShare:new wt("beforeRegisterShare"),afterResolve:new tt("afterResolve"),beforeLoadShare:new tt("beforeLoadShare"),loadShare:new ze,resolveShare:new wt("resolveShare"),initContainerShareScopeMap:new wt("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}registerShared(e,t){const{newShareInfos:r,allShareInfos:n}=ia(e,t);return Object.keys(r).forEach(s=>{r[s].forEach(a=>{a.scope.forEach(i=>{this.hooks.lifecycle.beforeRegisterShare.emit({origin:this.host,pkgName:s,shared:a}),this.shareScopeMap[i]?.[s]||this.setShared({pkgName:s,lib:a.lib,get:a.get,loaded:a.loaded||!!a.lib,shared:a,from:t.name})})})}),{newShareInfos:r,allShareInfos:n}}async loadShare(e,t){const{host:r}=this,n=yo({pkgName:e,extraOptions:t,shareInfos:r.options.shared});n?.scope&&await Promise.all(n.scope.map(async l=>{await Promise.all(this.initializeSharing(l,{strategy:n.strategy}))}));const{shareInfo:s}=await this.hooks.lifecycle.beforeLoadShare.emit({pkgName:e,shareInfo:n,shared:r.options.shared,origin:r});Le(s,`Cannot find shared "${e}" in host "${r.options.name}". Ensure the shared config for "${e}" is declared in the federation plugin options and the host has been initialized before loading shares.`);const{shared:a,useTreesShaking:i}=fr(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare)||{};if(a){const l=Jt(a,i);if(l.lib)return bt(l,r.options.name),l.lib;if(l.loading&&!l.loaded){const c=await l.loading;return l.loaded=!0,l.lib||(l.lib=c),bt(l,r.options.name),c}else{const d=(async()=>{const u=await l.get();return bt(l,r.options.name),l.loaded=!0,l.lib=u,u})();return this.setShared({pkgName:e,loaded:!1,shared:a,from:r.options.name,lib:null,loading:d,treeShaking:i?l:void 0}),d}}else{if(t?.customShareInfo)return!1;const l=Ft(s.treeShaking),c=Jt(s,l),u=(async()=>{const f=await c.get();c.lib=f,c.loaded=!0,bt(c,r.options.name);const{shared:h,useTreesShaking:g}=fr(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare)||{};if(h){const b=Jt(h,g);b.lib=f,b.loaded=!0,h.from=s.from}return f})();return this.setShared({pkgName:e,loaded:!1,shared:s,from:r.options.name,lib:null,loading:u,treeShaking:l?c:void 0}),u}}initializeSharing(e=Nr,t){const{host:r}=this,n=t?.from,s=t?.strategy;let a=t?.initScope;const i=[];if(n!=="build"){const{initTokens:h}=this;a||(a=[]);let g=h[e];if(g||(g=h[e]={from:this.host.name}),a.indexOf(g)>=0)return i;a.push(g)}const l=this.shareScopeMap,c=r.options.name;l[e]||(l[e]={});const d=l[e],u=(h,g)=>{const{version:b,eager:v}=g;d[h]=d[h]||{};const x=d[h],y=x[b]&&Jt(x[b]),w=!!(y&&("eager"in y&&y.eager||"shareConfig"in y&&y.shareConfig?.eager));(!y||y.strategy!=="loaded-first"&&!y.loaded&&(!v!=!w?v:c>x[b].from))&&(x[b]=g)},f=async h=>{const{module:g}=await r.remoteHandler.getRemoteModuleAndOptions({id:h});let b;try{b=await g.getEntry()}catch(v){if(b=await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({id:h,error:v,from:"runtime",lifecycle:"beforeLoadShare",origin:r}),!b)return}finally{b?.init&&!g.initing&&(g.remoteEntryExports=b,await g.init(void 0,void 0,a))}};return Object.keys(r.options.shared).forEach(h=>{r.options.shared[h].forEach(g=>{g.scope.includes(e)&&u(h,g)})}),(r.options.shareStrategy==="version-first"||s==="version-first")&&r.options.remotes.forEach(h=>{h.shareScope===e&&i.push(f(h.name))}),i}loadShareSync(e,t){const{host:r}=this,n=yo({pkgName:e,extraOptions:t,shareInfos:r.options.shared});n?.scope&&n.scope.forEach(i=>{this.initializeSharing(i,{strategy:n.strategy})});const{shared:s,useTreesShaking:a}=fr(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(s){if(typeof s.lib=="function")return bt(s,r.options.name),s.loaded||(s.loaded=!0,s.from===r.options.name&&(n.loaded=!0)),s.lib;if(typeof s.get=="function"){const i=s.get();if(!(i instanceof Promise))return bt(s,r.options.name),this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:i,shared:s}),i}}if(n.lib)return n.loaded||(n.loaded=!0),n.lib;if(n.get){const i=n.get();return i instanceof Promise&&Se(t?.from==="build"?fa:un,Oe,{hostName:r.options.name,sharedPkgName:e},void 0,At(r.options)),n.lib=i,this.setShared({pkgName:e,loaded:!0,from:r.options.name,lib:n.lib,shared:n}),n.lib}Se(un,Oe,{hostName:r.options.name,sharedPkgName:e},void 0,At(r.options))}initShareScopeMap(e,t,r={}){const{host:n}=this;this.shareScopeMap[e]=t,this.hooks.lifecycle.initContainerShareScopeMap.emit({shareScope:t,options:n.options,origin:n,scopeName:e,hostShareScopeMap:r.hostShareScopeMap})}setShared({pkgName:e,shared:t,from:r,lib:n,loading:s,loaded:a,get:i,treeShaking:l}){const{version:c,scope:d="default",...u}=t,f=Array.isArray(d)?d:[d],h=g=>{const b=(x,y,w)=>{w&&!x[y]&&(x[y]=w)},v=l?g.treeShaking:g;b(v,"loaded",a),b(v,"loading",s),b(v,"get",i)};f.forEach(g=>{this.shareScopeMap[g]||(this.shareScopeMap[g]={}),this.shareScopeMap[g][e]||(this.shareScopeMap[g][e]={}),this.shareScopeMap[g][e][c]||(this.shareScopeMap[g][e][c]={version:c,scope:[g],...u,lib:n});const b=this.shareScopeMap[g][e][c];h(b),r&&b.from!==r&&(b.from=r)})}_setGlobalShareScopeMap(e){const t=la(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},Bd=class{constructor(e){this.hooks=new kt({beforeRegisterRemote:new wt("beforeRegisterRemote"),registerRemote:new wt("registerRemote"),beforeRequest:new tt("beforeRequest"),onLoad:new ze("onLoad"),handlePreloadModule:new $e("handlePreloadModule"),errorLoadRemote:new ze("errorLoadRemote"),beforePreloadRemote:new ze("beforePreloadRemote"),generatePreloadAssets:new ze("generatePreloadAssets"),afterPreloadRemote:new ze,loadEntry:new ze}),this.host=e,this.idToRemoteMap={}}formatAndRegisterRemote(e,t){return(t.remotes||[]).reduce((r,n)=>(this.registerRemote(n,r,{force:!1}),r),e.remotes)}setIdToRemoteMap(e,t){const{remote:r,expose:n}=t,{name:s,alias:a}=r;if(this.idToRemoteMap[e]={name:r.name,expose:n},a&&e.startsWith(s)){const i=e.replace(s,a);this.idToRemoteMap[i]={name:r.name,expose:n};return}if(a&&e.startsWith(a)){const i=e.replace(a,s);this.idToRemoteMap[i]={name:r.name,expose:n}}}async loadRemote(e,t){const{host:r}=this;try{const{loadFactory:n=!0}=t||{loadFactory:!0},{module:s,moduleOptions:a,remoteMatchInfo:i}=await this.getRemoteModuleAndOptions({id:e}),{pkgNameOrAlias:l,remote:c,expose:d,id:u,remoteSnapshot:f}=i,h=await s.get(u,d,t,f),g=await this.hooks.lifecycle.onLoad.emit({id:u,pkgNameOrAlias:l,expose:d,exposeModule:n?h:void 0,exposeModuleFactory:n?void 0:h,remote:c,options:a,moduleInstance:s,origin:r});return this.setIdToRemoteMap(e,i),typeof g=="function"?g:h}catch(n){const{from:s="runtime"}=t||{from:"runtime"},a=await this.hooks.lifecycle.errorLoadRemote.emit({id:e,error:n,from:s,lifecycle:"onLoad",origin:r});if(!a)throw n;return a}}async preloadRemote(e){const{host:t}=this;await this.hooks.lifecycle.beforePreloadRemote.emit({preloadOps:e,options:t.options,origin:t});const r=Pd(t.options.remotes,e);await Promise.all(r.map(async n=>{const{remote:s}=n,a=xr(s),{globalSnapshot:i,remoteSnapshot:l}=await t.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:s}),c=await this.hooks.lifecycle.generatePreloadAssets.emit({origin:t,preloadOptions:n,remote:s,remoteInfo:a,globalSnapshot:i,remoteSnapshot:l});c&&xa(a,t,c)}))}registerRemotes(e,t){const{host:r}=this;e.forEach(n=>{this.registerRemote(n,r.options.remotes,{force:t?.force})})}async getRemoteModuleAndOptions(e){const{host:t}=this,{id:r}=e;let n;try{n=await this.hooks.lifecycle.beforeRequest.emit({id:r,options:t.options,origin:t})}catch(g){if(n=await this.hooks.lifecycle.errorLoadRemote.emit({id:r,options:t.options,origin:t,from:"runtime",error:g,lifecycle:"beforeRequest"}),!n)throw g}const{id:s}=n,a=vd(t.options.remotes,s);a||Se(pa,Oe,{hostName:t.options.name,requestId:s},void 0,At(t.options));const{remote:i}=a,l=xr(i),c=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:s,...a,options:t.options,origin:t,remoteInfo:l}),{remote:d,expose:u}=c;Le(d&&u,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${s}.`);let f=t.moduleCache.get(d.name);const h={host:t,remoteInfo:l};return f||(f=new wa(h),t.moduleCache.set(d.name,f)),{module:f,moduleOptions:h,remoteMatchInfo:c}}registerRemote(e,t,r){const{host:n}=this,s=()=>{if(e.alias){const i=t.find(l=>e.alias&&(l.name.startsWith(e.alias)||l.alias?.startsWith(e.alias)));Le(!i,`The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${i&&i.name} name or alias`)}"entry"in e&&typeof window<"u"&&!e.entry.startsWith("http")&&(e.entry=new URL(e.entry,window.location.origin).href),e.shareScope||(e.shareScope=Nr),e.type||(e.type=ud)};this.hooks.lifecycle.beforeRegisterRemote.emit({remote:e,origin:n});const a=t.find(i=>i.name===e.name);if(!a)s(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:n});else{const i=[`The remote "${e.name}" is already registered.`,"Please note that overriding it may cause unexpected errors."];r?.force&&(this.removeRemote(a),s(),t.push(e),this.hooks.lifecycle.registerRemote.emit({remote:e,origin:n}),Hs(i.join(" ")))}}removeRemote(e){try{const{host:t}=this,{name:r}=e,n=t.options.remotes.findIndex(a=>a.name===r);n!==-1&&t.options.remotes.splice(n,1);const s=t.moduleCache.get(e.name);if(s){const a=s.remoteInfo,i=a.entryGlobalName;Me[i]&&(Object.getOwnPropertyDescriptor(Me,i)?.configurable?delete Me[i]:Me[i]=void 0);const l=pn(s.remoteInfo);yt[l]&&delete yt[l],t.snapshotHandler.manifestCache.delete(a.entry);let c=a.buildVersion?Qs(a.name,a.buildVersion):a.name;const d=Me.__FEDERATION__.__INSTANCES__.findIndex(f=>a.buildVersion?f.options.id===c:f.name===c);if(d!==-1){const f=Me.__FEDERATION__.__INSTANCES__[d];c=f.options.id||c;const h=la();let g=!0;const b=[];Object.keys(h).forEach(v=>{const x=h[v];x&&Object.keys(x).forEach(y=>{const w=x[y];w&&Object.keys(w).forEach(k=>{const M=w[k];M&&Object.keys(M).forEach(C=>{const A=M[C];A&&typeof A=="object"&&A.from===a.name&&(A.loaded||A.loading?(A.useIn=A.useIn.filter(_=>_!==a.name),A.useIn.length?g=!1:b.push([v,y,k,C])):b.push([v,y,k,C]))})})})}),g&&(f.shareScopeMap={},delete h[c]),b.forEach(([v,x,y,w])=>{delete h[v]?.[x]?.[y]?.[w]}),Me.__FEDERATION__.__INSTANCES__.splice(d,1)}const{hostGlobalSnapshot:u}=Ca(e,t);if(u){const f=u&&"remotesInfo"in u&&u.remotesInfo&&Mt(u.remotesInfo,e.name).key;f&&(delete u.remotesInfo[f],zt.__FEDERATION__.__MANIFEST_LOADING__[f]&&delete zt.__FEDERATION__.__MANIFEST_LOADING__[f])}t.moduleCache.delete(e.name)}}catch(t){dn.error(`removeRemote failed: ${t instanceof Error?t.message:String(t)}`)}}},zd=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0,Ma=class{constructor(e){this.hooks=new kt({beforeInit:new wt("beforeInit"),init:new $e,beforeInitContainer:new tt("beforeInitContainer"),initContainer:new tt("initContainer")}),this.version="2.4.0",this.moduleCache=new Map,this.loaderHook=new kt({getModuleInfo:new $e,createScript:new $e,createLink:new $e,fetch:new ze,loadEntryError:new ze,getModuleFactory:new ze}),this.bridgeHook=new kt({beforeBridgeRender:new $e,afterBridgeRender:new $e,beforeBridgeDestroy:new $e,afterBridgeDestroy:new $e});const t=zd?[Id(),Ld()]:[],r={id:Md(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:Gs};this.name=e.name,this.options=r,this.snapshotHandler=new Od(this),this.sharedHandler=new $d(this),this.remoteHandler=new Bd(this),this.shareScopeMap=this.sharedHandler.shareScopeMap,this.registerPlugins([...r.plugins,...e.plugins||[]]),this.options=this.formatOptions(r,e)}initOptions(e){e.name&&e.name!==this.options.name&&Se(Zs(ga,Oe)),this.registerPlugins(e.plugins);const t=this.formatOptions(this.options,e);return this.options=t,t}async loadShare(e,t){return this.sharedHandler.loadShare(e,t)}loadShareSync(e,t){return this.sharedHandler.loadShareSync(e,t)}initializeSharing(e=Nr,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){const n=xr({name:e,entry:t}),s=new wa({host:this,remoteInfo:n});return s.remoteEntryExports=r,this.moduleCache.set(e,s),s}async loadRemote(e,t){return this.remoteHandler.loadRemote(e,t)}async preloadRemote(e){return this.remoteHandler.preloadRemote(e)}initShareScopeMap(e,t,r={}){this.sharedHandler.initShareScopeMap(e,t,r)}formatOptions(e,t){const{allShareInfos:r}=ia(e,t),{userOptions:n,options:s}=this.hooks.lifecycle.beforeInit.emit({origin:this,userOptions:t,options:e,shareInfo:r}),a=this.remoteHandler.formatAndRegisterRemote(s,n),{allShareInfos:i}=this.sharedHandler.registerShared(s,n),l=[...s.plugins];n.plugins&&n.plugins.forEach(d=>{l.includes(d)||l.push(d)});const c={...e,...t,plugins:l,remotes:a,shared:i,id:n.id||e.id};return this.hooks.lifecycle.init.emit({origin:this,options:c}),c}registerPlugins(e){const t=Ed(e,this);this.options.plugins=this.options.plugins.reduce((r,n)=>(n&&r&&!r.find(s=>s.name===n.name)&&r.push(n),r),t||[])}registerRemotes(e,t){return this.remoteHandler.registerRemotes(e,t)}registerShared(e){this.sharedHandler.registerShared(this.options,{...this.options,shared:e})}};function Fd(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function jd(e,t){const r=Fd();return Me.__FEDERATION__.__INSTANCES__.find(n=>!!(r&&n.options.id===r||n.options.name===e&&!n.options.version&&!t||n.options.name===e&&t&&n.options.version===t))}function Gd(e){const t=new(Ic()||Ma)({id:`${e.name}@${e.version||Date.now()}`,...e});return _c(t),t}var Fe=null;function Qd(e){const t=jd(e.name,e.version),r={...e,id:e.id||""};return t?(t.initOptions(r),Fe||(Fe=t),t):(Fe=Gd(r),Fe)}function Hd(...e){return Le(Fe,Bn,Oe),Fe.loadRemote.apply(Fe,e)}function Ud(...e){return Le(Fe,Bn,Oe),Fe.registerRemotes.apply(Fe,e)}function Vd(){return Fe}Tc(Ma);function Nt(e){const t=(typeof globalThis<"u"?globalThis:void 0)?.[e];return t&&typeof t=="object"?t:{}}var qd={singleton:!0,requiredVersion:!1,eager:!0},He=e=>({version:"0.0.0",scope:"default",lib:e,shareConfig:qd}),xo="__mf_module_cache__";function Wd(){const e=globalThis,t=e[xo];if(t&&typeof t=="object"){const n=t;return n.share??={},n.remote??={},n}const r={share:{},remote:{}};return e[xo]=r,r}function Kd(){const e=Wd();e.share.react??=ds,e.share["react-dom"]??=ps,e.share["react-dom/client"]??=fs,e.share["react/jsx-runtime"]??=us,e.share["@tanstack/react-query"]??=hs,e.share["@trpc/client"]??=vs,e.share["@trpc/react-query"]??=ys,e.share["@camstack/ui-library"]??=Nt("__camstackUiLibrary"),e.share["@camstack/sdk"]??=Nt("__camstackSdk"),e.share["@camstack/types"]??=Nt("__camstackTypes")}function Zd(){Kd(),Vd()===null&&Qd({name:"admin_ui_host",remotes:[],shared:{react:He(()=>ds),"react-dom":He(()=>ps),"react-dom/client":He(()=>fs),"react/jsx-runtime":He(()=>us),"@tanstack/react-query":He(()=>hs),"@trpc/client":He(()=>vs),"@trpc/react-query":He(()=>ys),"@camstack/ui-library":He(()=>Nt("__camstackUiLibrary")),"@camstack/sdk":He(()=>Nt("__camstackSdk")),"@camstack/types":He(()=>Nt("__camstackTypes"))}})}/**
37
- * @license lucide-react v0.576.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */var Ea=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/**
42
- * @license lucide-react v0.576.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */var Yd=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
47
- * @license lucide-react v0.576.0 - ISC
48
- *
49
- * This source code is licensed under the ISC license.
50
- * See the LICENSE file in the root directory of this source tree.
51
- */var Xd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase());/**
52
- * @license lucide-react v0.576.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */var wo=e=>{const t=Xd(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
57
- * @license lucide-react v0.576.0 - ISC
58
- *
59
- * This source code is licensed under the ISC license.
60
- * See the LICENSE file in the root directory of this source tree.
61
- */var Jd={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
62
- * @license lucide-react v0.576.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */var eu=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
67
- * @license lucide-react v0.576.0 - ISC
68
- *
69
- * This source code is licensed under the ISC license.
70
- * See the LICENSE file in the root directory of this source tree.
71
- */var tu=Te(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:a,iconNode:i,...l},c)=>$t("svg",{ref:c,...Jd,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Ea("lucide",s),...!a&&!eu(l)&&{"aria-hidden":"true"},...l},[...i.map(([d,u])=>$t(d,u)),...Array.isArray(a)?a:[a]]));/**
72
- * @license lucide-react v0.576.0 - ISC
73
- *
74
- * This source code is licensed under the ISC license.
75
- * See the LICENSE file in the root directory of this source tree.
76
- */var R=(e,t)=>{const r=Te(({className:n,...s},a)=>$t(tu,{ref:a,iconNode:t,className:Ea(`lucide-${Yd(wo(e))}`,`lucide-${e}`,n),...s}));return r.displayName=wo(e),r},et=R("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]),ru=R("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),nu=R("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),ou=R("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),zn=R("arrow-up-to-line",[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]]),su=R("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),au=R("battery-full",[["path",{d:"M10 10v4",key:"1mb2ec"}],["path",{d:"M14 10v4",key:"1nt88p"}],["path",{d:"M22 14v-4",key:"14q9d5"}],["path",{d:"M6 10v4",key:"1n77qd"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]]),iu=R("battery-low",[["path",{d:"M22 14v-4",key:"14q9d5"}],["path",{d:"M6 14v-4",key:"14a6bd"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]]),lu=R("battery-warning",[["path",{d:"M10 17h.01",key:"nbq80n"}],["path",{d:"M10 7v6",key:"nne03l"}],["path",{d:"M14 6h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2",key:"1m83kb"}],["path",{d:"M22 14v-4",key:"14q9d5"}],["path",{d:"M6 18H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"h8lgfh"}]]),Aa=R("battery",[["path",{d:"M 22 14 L 22 10",key:"nqc4tb"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]]),cu=R("bell-ring",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]]),Sr=R("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),du=R("bug",[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]]),Fn=R("camera",[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]),uu=R("cast",[["path",{d:"M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6",key:"3zrzxg"}],["path",{d:"M2 12a9 9 0 0 1 8 8",key:"g6cvee"}],["path",{d:"M2 16a5 5 0 0 1 4 4",key:"1y1dii"}],["line",{x1:"2",x2:"2.01",y1:"20",y2:"20",key:"xu2jvo"}]]),Vt=R("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),pt=R("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),pu=R("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),st=R("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),Cr=R("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),fu=R("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]),mu=R("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),hu=R("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]),gu=R("circle-pause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]),bu=R("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Pa=R("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),vu=R("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),yu=R("copy-plus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),at=R("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),xu=R("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),Ra=R("crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]),wu=R("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),_a=R("door-open",[["path",{d:"M11 20H2",key:"nlcfvz"}],["path",{d:"M11 4.562v16.157a1 1 0 0 0 1.242.97L19 20V5.562a2 2 0 0 0-1.515-1.94l-4-1A2 2 0 0 0 11 4.561z",key:"au4z13"}],["path",{d:"M11 4H8a2 2 0 0 0-2 2v14",key:"74r1mk"}],["path",{d:"M14 12h.01",key:"1jfl7z"}],["path",{d:"M22 20h-3",key:"vhrsz"}]]),fn=R("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),Ia=R("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),Ta=R("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),Da=R("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Mr=R("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),La=R("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]),ku=R("grip-horizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]),Oa=R("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]),Nu=R("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),Su=R("inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]),Cu=R("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),Mu=R("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]),$a=R("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),Ge=R("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Eu=R("locate-fixed",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),ko=R("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),Au=R("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]),Ba=R("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]),No=R("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]),za=R("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),jn=R("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),Pu=R("music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]),mn=R("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),hn=R("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),Er=R("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Ru=R("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]),_u=R("power-off",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Fa=R("radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]),Iu=R("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),Gn=R("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),ja=R("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]),Ga=R("rotate-cw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]),Tu=R("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),Du=R("scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),Lu=R("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),Gt=R("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),Ou=R("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]),$u=R("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),Bu=R("ship",[["path",{d:"M12 10.189V14",key:"1p8cqu"}],["path",{d:"M12 2v3",key:"qbqxhf"}],["path",{d:"M19 13V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6",key:"qpkstq"}],["path",{d:"M19.38 20A11.6 11.6 0 0 0 21 14l-8.188-3.639a2 2 0 0 0-1.624 0L3 14a11.6 11.6 0 0 0 2.81 7.76",key:"7tigtc"}],["path",{d:"M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"1924j5"}]]),zu=R("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]),So=R("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),Fu=R("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]),Qa=R("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),ju=R("table-2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]),Co=R("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),Gu=R("thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]),Qu=R("toggle-left",[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]),Ye=R("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),Hu=R("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]),Uu=R("trending-down",[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]]),qt=R("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Ha=R("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]),Vu=R("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Ua=R("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]),Qn=R("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),Ie=R("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Mo=R("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),qu=R("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),Wu=R("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),eb={frigate:Bu,scrypted:$u,reolink:Iu,homeAssistant:Oa,rtsp:uu},tb={online:mu,offline:vu,degraded:Cr,unknown:Pa},Eo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ao=Ms,ft=(e,t)=>r=>{var n;if(t?.variants==null)return Ao(e,r?.class,r?.className);const{variants:s,defaultVariants:a}=t,i=Object.keys(s).map(c=>{const d=r?.[c],u=a?.[c];if(d===null)return null;const f=Eo(d)||Eo(u);return s[c][f]}),l=r&&Object.entries(r).reduce((c,d)=>{let[u,f]=d;return f===void 0||(c[u]=f),c},{});return Ao(e,i,t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((c,d)=>{let{class:u,className:f,...h}=d;return Object.entries(h).every(g=>{let[b,v]=g;return Array.isArray(v)?v.includes({...a,...l}[b]):{...a,...l}[b]===v})?[...c,u,f]:c},[]),r?.class,r?.className)},Ku=ft("inline-flex items-center justify-center rounded-md font-medium transition-colors cursor-pointer disabled:opacity-50 disabled:pointer-events-none",{variants:{variant:{primary:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-surface text-foreground hover:bg-surface-hover",ghost:"hover:bg-surface-hover text-foreground-muted",danger:"bg-danger text-white hover:bg-danger/90",outline:"border border-border bg-transparent hover:bg-surface-hover"},size:{sm:"h-7 px-2.5 text-xs gap-1.5",md:"h-8 px-3 text-sm gap-2",lg:"h-9 px-4 text-sm gap-2"}},defaultVariants:{variant:"primary",size:"sm"}}),mr=Te(({className:e,variant:t,size:r,...n},s)=>o("button",{ref:s,className:N(Ku({variant:t,size:r}),e),...n}));mr.displayName="Button";var Zu=ft("inline-flex items-center justify-center rounded-md font-medium transition-colors cursor-pointer disabled:opacity-50 disabled:pointer-events-none",{variants:{variant:{primary:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-surface text-foreground hover:bg-surface-hover",ghost:"hover:bg-surface-hover text-foreground-muted",danger:"bg-danger text-white hover:bg-danger/90",outline:"border border-border bg-transparent hover:bg-surface-hover"},size:{sm:"h-7 w-7",md:"h-8 w-8",lg:"h-9 w-9"}},defaultVariants:{variant:"primary",size:"sm"}}),Va=Te(({className:e,variant:t,size:r,icon:n,...s},a)=>o("button",{ref:a,className:N(Zu({variant:t,size:r}),e),...s,children:o(n,{className:"h-4 w-4"})}));Va.displayName="IconButton";var Yu=ft("inline-flex items-center rounded-full text-xs font-medium px-2 py-0.5",{variants:{variant:{default:"bg-surface-hover text-foreground",success:"bg-success/15 text-success",warning:"bg-warning/15 text-warning",danger:"bg-danger/15 text-danger",info:"bg-info/15 text-info"},styleVariant:{solid:"",outline:"border bg-transparent"}},defaultVariants:{variant:"default",styleVariant:"solid"}}),Lt=Te(({className:e,variant:t,style:r,...n},s)=>o("span",{ref:s,className:N(Yu({variant:t,styleVariant:r}),e),...n}));Lt.displayName="Badge";var Xu=ft("rounded-lg p-3",{variants:{variant:{flat:"bg-surface",bordered:"bg-surface border border-border"}},defaultVariants:{variant:"bordered"}}),qa=Te(({className:e,variant:t,...r},n)=>o("div",{ref:n,className:N(Xu({variant:t}),e),...r}));qa.displayName="Card";function Ju({expanded:e,onExpandedChange:t,header:r,children:n,dimmed:s=!1,hideChevron:a=!1,className:i}){return m("div",{className:N("rounded-lg border border-border bg-surface overflow-hidden",s&&"opacity-[0.45]",i),children:[m("div",{role:"button",tabIndex:0,className:"flex items-center gap-2.5 px-3 py-2.5 cursor-pointer select-none",onClick:()=>t(!e),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(!e))},children:[!a&&o("span",{className:"text-foreground-subtle shrink-0",children:e?o(pt,{className:"h-4 w-4"}):o(st,{className:"h-4 w-4"})}),r]}),e&&n&&o("div",{className:"border-t border-border px-3 py-3",children:n})]})}var Wa=Te(({className:e,...t},r)=>o("label",{ref:r,className:N("text-[10px] uppercase tracking-wider text-foreground-muted font-medium",e),...t}));Wa.displayName="Label";var ep=ft("",{variants:{orientation:{horizontal:"h-px w-full bg-border-subtle",vertical:"w-px h-full bg-border-subtle"}},defaultVariants:{orientation:"horizontal"}}),Ka=Te(({className:e,orientation:t,...r},n)=>o("div",{ref:n,role:"separator",className:N(ep({orientation:t}),e),...r}));Ka.displayName="Separator";var tp=Te(({className:e,...t},r)=>o("div",{ref:r,className:N("animate-pulse bg-surface-hover rounded-md h-4 w-full",e),...t}));tp.displayName="Skeleton";var Po=ft("h-7 w-full px-2.5 text-xs bg-surface border rounded-md text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-primary transition-colors",{variants:{state:{default:"border-border",error:"border-danger"}},defaultVariants:{state:"default"}}),gn=Te(({className:e,state:t,leftSlot:r,rightSlot:n,...s},a)=>r||n?m("div",{className:"relative flex items-center w-full",children:[r&&o("div",{className:"absolute left-2.5 flex items-center pointer-events-none",children:r}),o("input",{ref:a,className:N(Po({state:t}),r?"pl-7":"",n?"pr-7":"",e),...s}),n&&o("div",{className:"absolute right-2.5 flex items-center pointer-events-none",children:n})]}):o("input",{ref:a,className:N(Po({state:t}),e),...s}));gn.displayName="Input";var bn=Te(({className:e,options:t,...r},n)=>m("div",{className:"relative w-full",children:[o("select",{ref:n,className:N("h-7 w-full px-2.5 text-xs bg-surface border border-border rounded-md text-foreground appearance-none pr-7 focus:outline-none focus:ring-1 focus:ring-primary",e),...r,children:t.map(s=>o("option",{value:s.value,children:s.label},s.value))}),o("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none text-foreground-muted",children:o(pt,{className:"h-3.5 w-3.5"})})]}));bn.displayName="Select";var rp=Te(({className:e,...t},r)=>o("input",{ref:r,type:"checkbox",className:N("w-3.5 h-3.5 rounded-sm border border-border accent-primary",e),...t}));rp.displayName="Checkbox";var np=Te(({className:e,checked:t,onCheckedChange:r,label:n,...s},a)=>m("button",{ref:a,role:"switch","aria-checked":t,type:"button",onClick:()=>r(!t),className:N("inline-flex items-center gap-2",e),...s,children:[o("span",{className:N("w-8 h-4 rounded-full transition-colors",t?"bg-primary":"bg-surface-hover"),children:o("span",{className:N("block w-3.5 h-3.5 rounded-full bg-white transition-transform",t?"translate-x-4":"translate-x-0.5")})}),n&&o("span",{className:"text-xs text-foreground",children:n})]}));np.displayName="Switch";var Za=Ze(null);function Ya(){const e=Ae(Za);if(!e)throw new Error("Dialog compound components must be used within <Dialog>");return e}function op({children:e,open:t,onOpenChange:r}){const[n,s]=S(!1),a=t??n,i=Ct(),l=I(c=>{r?.(c),t===void 0&&s(c)},[t,r]);return o(Za.Provider,{value:{open:a,setOpen:l,contentId:i},children:e})}function rb({children:e,...t}){const{setOpen:r}=Ya();return o("button",{type:"button",onClick:()=>r(!0),...t,children:e})}var sp=ft("bg-background-elevated border border-border rounded-lg p-4 backdrop:bg-black/50 backdrop:backdrop-blur-sm max-w-[calc(100vw-2rem)] max-h-[calc(100dvh-2rem)] overflow-y-auto",{variants:{width:{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"}},defaultVariants:{width:"md"}}),Xa=Te(({className:e,width:t,children:r,...n},s)=>{const{open:a,setOpen:i,contentId:l}=Ya(),c=q(null),d=s??c;H(()=>{const f=d.current;f&&(a&&!f.open&&f.showModal(),!a&&f.open&&f.close())},[a,d]);const u=f=>{f.target===f.currentTarget&&i(!1)};return o("dialog",{ref:d,id:l,className:N(sp({width:t}),"w-full",e),onClick:u,onClose:()=>i(!1),...n,children:r})});Xa.displayName="DialogContent";function ap({className:e,...t}){return o("div",{className:N("flex flex-col gap-1 mb-3",e),...t})}function ip({className:e,...t}){return o("div",{className:N("flex justify-end gap-2 mt-4",e),...t})}function lp({className:e,...t}){return o("h2",{className:N("text-sm font-semibold text-foreground",e),...t})}function cp({className:e,...t}){return o("p",{className:N("text-xs text-foreground-muted",e),...t})}var Ja=Ze(null);function Hn(){const e=Ae(Ja);if(!e)throw new Error("Dropdown compound components must be used within <Dropdown>");return e}function nb({children:e}){const[t,r]=S(!1),n=Ct(),s=Ct(),a=q(null);return o(Ja.Provider,{value:{open:t,setOpen:r,triggerId:n,contentId:s,triggerRef:a},children:o("div",{className:"relative inline-block",children:e})})}function ob({children:e,...t}){const{open:r,setOpen:n,triggerId:s,contentId:a,triggerRef:i}=Hn();return o("button",{type:"button",ref:i,id:s,"aria-haspopup":"menu","aria-expanded":r,"aria-controls":r?a:void 0,onClick:()=>n(!r),...t,children:e})}function sb({className:e,children:t,align:r="start",offset:n=4,...s}){const{open:a,setOpen:i,contentId:l,triggerId:c,triggerRef:d}=Hn(),u=q(null),[f,h]=S(null);return el(()=>{if(!a){h(null);return}const g=()=>{const b=d.current;if(!b)return;const v=b.getBoundingClientRect(),x=r==="end"?v.right:v.left;h({top:v.bottom+n,left:x,minWidth:v.width})};return g(),window.addEventListener("resize",g),window.addEventListener("scroll",g,!0),()=>{window.removeEventListener("resize",g),window.removeEventListener("scroll",g,!0)}},[a,r,n,d]),H(()=>{if(!a)return;const g=v=>{const x=u.current,y=d.current;x&&!x.contains(v.target)&&!y?.contains(v.target)&&i(!1)},b=v=>{v.key==="Escape"&&i(!1)};return document.addEventListener("mousedown",g),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",b)}},[a,i,d]),!a||!f||typeof document>"u"?null:kr(o("div",{ref:u,id:l,role:"menu","aria-labelledby":c,style:{position:"fixed",top:f.top,...r==="end"?{right:window.innerWidth-f.left}:{left:f.left},minWidth:f.minWidth},className:N("z-50 bg-background-elevated border border-border rounded-md shadow-lg py-1 min-w-[160px]",e),...s,children:t}),document.body)}function ab({className:e,icon:t,variant:r="default",children:n,onClick:s,...a}){const{setOpen:i}=Hn(),l=I(c=>{s?.(c),i(!1)},[s,i]);return m("button",{type:"button",role:"menuitem",className:N("h-7 text-xs px-2 w-full text-left flex items-center gap-2",r==="danger"?"text-danger hover:bg-danger/10":"text-foreground hover:bg-surface-hover",e),onClick:l,...a,children:[t&&o(t,{size:14}),n]})}var ei=Ze(null);function ti(){const e=Ae(ei);if(!e)throw new Error("Tooltip compound components must be used within <Tooltip>");return e}function ib({children:e}){const[t,r]=S(!1),n=q(null),s=Ct(),a=()=>{n.current=setTimeout(()=>r(!0),300)},i=()=>{n.current&&clearTimeout(n.current),r(!1)};return o(ei.Provider,{value:{open:t,show:a,hide:i,tooltipId:s},children:o("div",{className:"relative inline-block",children:e})})}function lb({children:e,...t}){const{show:r,hide:n,tooltipId:s,open:a}=ti();return o("div",{onMouseEnter:r,onMouseLeave:n,onFocus:r,onBlur:n,"aria-describedby":a?s:void 0,...t,children:e})}function cb({className:e,children:t,...r}){const{open:n,tooltipId:s}=ti();return o("div",{id:s,role:"tooltip",className:N("absolute bottom-full left-1/2 -translate-x-1/2 mb-2 bg-foreground text-background text-xs px-2 py-1 rounded-md shadow-md whitespace-nowrap pointer-events-none transition-opacity duration-150",n?"opacity-100":"opacity-0",e),...r,children:t})}var Ro="(max-width: 767px)",_o="(min-width: 768px) and (max-width: 1023px)";function ri(e){return t=>{const r=window.matchMedia(e);return r.addEventListener("change",t),()=>r.removeEventListener("change",t)}}function ni(e){return()=>window.matchMedia(e).matches}function oi(){return!1}function Ar(){return Pn(ri(Ro),ni(Ro),oi)}function db(){return Pn(ri(_o),ni(_o),oi)}function si({open:e,onClose:t,title:r,children:n,className:s}){return H(()=>{if(!e)return;const a=i=>{i.key==="Escape"&&t()};return document.addEventListener("keydown",a),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",a),document.body.style.overflow=""}},[e,t]),m(Ne,{children:[o("div",{className:N("fixed inset-0 z-40 bg-black/50 transition-opacity duration-200",e?"opacity-100":"pointer-events-none opacity-0"),onClick:t,"aria-hidden":"true"}),m("div",{role:"dialog","aria-modal":"true",className:N("fixed inset-x-0 bottom-0 z-50 flex flex-col bg-background-elevated border-t border-border rounded-t-xl shadow-2xl transition-transform duration-200 ease-out","max-h-[80dvh]",e?"translate-y-0":"translate-y-full",s),children:[o("div",{className:"flex justify-center pt-2 pb-1",children:o("div",{className:"h-1 w-8 rounded-full bg-foreground-subtle/30"})}),r&&m("div",{className:"flex items-center justify-between px-4 pb-2",children:[o("span",{className:"text-sm font-medium text-foreground",children:r}),o("button",{onClick:t,className:"p-1 rounded-md hover:bg-surface-hover text-foreground-muted transition-colors",children:o(Ie,{className:"h-4 w-4"})})]}),o("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:n})]})]})}var ai=Ze(null);function ii(){const e=Ae(ai);if(!e)throw new Error("Popover compound components must be used within <Popover>");return e}function dp({children:e,open:t,onOpenChange:r}){const[n,s]=S(!1),a=t??n,i=Ct(),l=Ct(),c=I(d=>{r?.(d),t===void 0&&s(d)},[t,r]);return o(ai.Provider,{value:{open:a,setOpen:c,triggerId:i,contentId:l},children:o("div",{className:"relative inline-block",children:e})})}function up({children:e,...t}){const{open:r,setOpen:n,triggerId:s,contentId:a}=ii();return o("button",{type:"button",id:s,"aria-haspopup":"dialog","aria-expanded":r,"aria-controls":r?a:void 0,onClick:()=>n(!r),...t,children:e})}function pp({className:e,children:t,...r}){const{open:n,setOpen:s,contentId:a,triggerId:i}=ii(),l=Ar(),c=q(null);return H(()=>{if(!n||l)return;const d=f=>{const h=c.current,g=document.getElementById(i);h&&!h.contains(f.target)&&!g?.contains(f.target)&&s(!1)},u=f=>{f.key==="Escape"&&s(!1)};return document.addEventListener("mousedown",d),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",u)}},[n,s,i,l]),n?l?o(si,{open:n,onClose:()=>s(!1),children:t}):o("div",{ref:c,id:a,role:"dialog","aria-labelledby":i,className:N("absolute left-0 top-full z-50 mt-1 bg-background-elevated border border-border rounded-lg shadow-lg p-3",e),...r,children:t}):null}var li=Ze(null);function ci(){const e=Ae(li);if(!e)throw new Error("Tabs compound components must be used within <Tabs>");return e}function ub({value:e,onValueChange:t,defaultValue:r="",className:n,...s}){const[a,i]=S(r),l=e??a,c=I(d=>{t?.(d),e===void 0&&i(d)},[e,t]);return o(li.Provider,{value:{value:l,setValue:c},children:o("div",{className:n,...s})})}function pb({className:e,...t}){return o("div",{role:"tablist",className:N("flex flex-row border-b border-border-subtle",e),...t})}function fb({value:e,className:t,...r}){const{value:n,setValue:s}=ci(),a=e===n;return o("button",{type:"button",role:"tab","aria-selected":a,"aria-controls":`tabpanel-${e}`,tabIndex:a?0:-1,className:N("h-7 text-xs px-3 transition-colors",a?"border-b-2 border-primary text-foreground font-medium":"text-foreground-muted hover:text-foreground",t),onClick:()=>s(e),...r})}function mb({value:e,className:t,...r}){const{value:n}=ci();return e!==n?null:o("div",{role:"tabpanel",id:`tabpanel-${e}`,className:N("pt-3",t),...r})}var di=Te(({className:e,...t},r)=>o("div",{ref:r,className:N("overflow-auto [&::-webkit-scrollbar]:w-1 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-surface-hover [&::-webkit-scrollbar-thumb]:rounded-full",e),...t}));di.displayName="ScrollArea";function hb({title:e,onClose:t,children:r,defaultWidth:n=360,defaultHeight:s=280,minWidth:a=280,minHeight:i=160,offsetIndex:l=0,className:c}){const[d,u]=S({x:80+l*30,y:80+l*30}),[f,h]=S({w:n,h:s}),[g,b]=S(!1),v=q(!1),x=q(!1),y=q({x:0,y:0}),w=Ar(),k=I(C=>{C.preventDefault(),v.current=!0,y.current={x:C.clientX-d.x,y:C.clientY-d.y}},[d]),M=I(C=>{C.preventDefault(),C.stopPropagation(),x.current=!0,y.current={x:C.clientX,y:C.clientY}},[]);return H(()=>{const C=_=>{if(v.current&&u({x:_.clientX-y.current.x,y:_.clientY-y.current.y}),x.current){const P=_.clientX-y.current.x,Q=_.clientY-y.current.y;y.current={x:_.clientX,y:_.clientY},h(oe=>({w:Math.max(a,oe.w+P),h:Math.max(i,oe.h+Q)}))}},A=()=>{v.current=!1,x.current=!1};return window.addEventListener("mousemove",C),window.addEventListener("mouseup",A),()=>{window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",A)}},[a,i]),w?m("div",{className:N("fixed inset-x-0 bottom-0 z-50 rounded-t-xl border-t border-border bg-background-elevated shadow-2xl flex flex-col overflow-hidden",c),style:{maxHeight:"60dvh"},children:[m("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border shrink-0 bg-surface",children:[o("span",{className:"text-[11px] font-medium truncate",children:e}),m("div",{className:"flex items-center gap-1 shrink-0",children:[o("button",{onClick:()=>b(!g),className:"p-0.5 rounded hover:bg-surface-hover text-foreground-muted transition-colors",children:g?o(ko,{size:12}):o(No,{size:12})}),o("button",{onClick:t,className:"p-0.5 rounded hover:bg-danger/20 text-foreground-muted hover:text-danger transition-colors",children:o(Ie,{size:12})})]})]}),!g&&o("div",{className:"flex-1 min-h-0 overflow-y-auto",children:r})]}):m("div",{className:N("fixed z-50 rounded-lg border border-border bg-background-elevated shadow-2xl flex flex-col overflow-hidden",c),style:{left:d.x,top:d.y,width:g?280:f.w,height:g?"auto":f.h},children:[m("div",{onMouseDown:k,className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border cursor-move select-none shrink-0 bg-surface",children:[m("div",{className:"flex items-center gap-2 min-w-0",children:[o(ku,{size:12,className:"text-foreground-subtle shrink-0"}),o("span",{className:"text-[11px] font-medium truncate",children:e})]}),m("div",{className:"flex items-center gap-1 shrink-0",children:[o("button",{onClick:()=>b(!g),className:"p-0.5 rounded hover:bg-surface-hover text-foreground-muted transition-colors",title:g?"Restore":"Minimize",children:g?o(ko,{size:12}):o(No,{size:12})}),o("button",{onClick:t,className:"p-0.5 rounded hover:bg-danger/20 text-foreground-muted hover:text-danger transition-colors",title:"Close",children:o(Ie,{size:12})})]})]}),!g&&m("div",{className:"flex-1 min-h-0 overflow-y-auto relative",children:[r,o("div",{onMouseDown:M,className:"absolute bottom-0 right-0 w-4 h-4 cursor-nwse-resize",style:{background:"linear-gradient(135deg, transparent 50%, var(--color-foreground-subtle) 50%)",opacity:.4}})]})]})}function fp({open:e,onClose:t,children:r,className:n,width:s="w-64"}){const a=q(null);return H(()=>{if(!e)return;const i=l=>{l.key==="Escape"&&t()};return document.addEventListener("keydown",i),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",i),document.body.style.overflow=""}},[e,t]),m(Ne,{children:[o("div",{className:N("fixed inset-0 z-40 bg-black/50 backdrop-blur-sm transition-opacity duration-200",e?"opacity-100":"pointer-events-none opacity-0"),onClick:t,"aria-hidden":"true"}),o("div",{ref:a,role:"dialog","aria-modal":"true",className:N("fixed inset-y-0 left-0 z-50 flex flex-col bg-surface border-r border-border shadow-2xl transition-transform duration-200 ease-out",s,e?"translate-x-0":"-translate-x-full",n),children:r})]})}function gb({items:e,className:t}){return o("nav",{className:`flex items-center gap-1 text-[11px] text-foreground-subtle ${t??""}`,children:e.map((r,n)=>{const s=n===e.length-1,a=!s&&(r.onClick||r.href);return m(Ji.Fragment,{children:[n>0&&o(st,{className:"h-3 w-3 flex-shrink-0"}),a?r.onClick?o("button",{type:"button",onClick:r.onClick,className:"hover:text-foreground transition-colors",children:r.label}):o("a",{href:r.href,className:"hover:text-foreground transition-colors",children:r.label}):o("span",{className:s?"text-foreground font-medium":"",children:r.label})]},n)})})}var Io={left:"text-left",right:"text-right",center:"text-center"};function bb({columns:e,rows:t,rowKey:r,onRowClick:n,minWidthPx:s=480,emptyMessage:a,className:i,bordered:l=!0,rowClassName:c}){return t.length===0&&a?o("div",{className:`rounded-lg ${l?"border border-border":""} bg-surface px-3 py-4 text-xs text-foreground-subtle text-center ${i??""}`,children:a}):t.length===0?null:o("div",{className:`rounded-lg ${l?"border border-border":""} bg-surface overflow-x-auto ${i??""}`,children:m("table",{className:"w-full text-xs",style:{minWidth:`${s}px`},children:[o("thead",{className:"bg-surface",children:o("tr",{children:e.map(d=>{const u=d.align??"left",f=d.nowrap??!0;return o("th",{className:["px-3 py-2 text-foreground-subtle font-medium bg-surface border-b border-border",Io[u],f?"whitespace-nowrap":"",d.width??""].filter(Boolean).join(" "),children:d.headerRender?d.headerRender():d.header},d.key)})})}),o("tbody",{children:t.map((d,u)=>{const f=r?r(d,u):u,h=c?.(d,u)??"",g=n!==void 0;return o("tr",{onClick:g?()=>n(d,u):void 0,className:[g?"cursor-pointer hover:bg-primary/5":"hover:bg-primary/5",h].filter(Boolean).join(" "),children:e.map(b=>{const v=b.align??"left",x=b.nowrap??!1;return o("td",{className:["px-3 py-2 text-foreground border-b border-border",Io[v],x?"whitespace-nowrap":""].filter(Boolean).join(" "),children:b.render(d,u)},b.key)})},f)})})]})})}function vb({open:e,onClose:t,title:r,subtitle:n,footer:s,children:a,widthClass:i="w-[360px]"}){return H(()=>{if(!e)return;const l=c=>{c.key==="Escape"&&t()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[e,t]),e?m("aside",{className:N("absolute top-0 right-0 bottom-0 z-20 flex flex-col","bg-surface border-l border-border shadow-xl",i),role:"dialog","aria-modal":"false",children:[m("header",{className:"flex items-start justify-between gap-2 px-4 py-3 border-b border-border",children:[m("div",{className:"min-w-0",children:[o("div",{className:"text-sm font-semibold text-foreground truncate",children:r}),n!==void 0&&o("div",{className:"text-[11px] text-foreground-subtle mt-0.5 truncate",children:n})]}),o("button",{type:"button",onClick:t,className:"p-1 rounded hover:bg-muted text-foreground-subtle hover:text-foreground","aria-label":"Close panel",children:o(Ie,{className:"w-4 h-4"})})]}),o("div",{className:"flex-1 min-h-0 overflow-y-auto px-4 py-3",children:a}),s!==void 0&&o("footer",{className:"flex items-center gap-2 justify-end px-4 py-3 border-t border-border",children:s})]}):null}var mp={inherit:"bg-muted",on:"bg-emerald-500",off:"bg-orange-500",na:"bg-gray-300 opacity-50"};function ui({node:e,depth:t,selectedAddonId:r,onSelect:n,agentDots:s}){const a=e.addonId===r,i=s?.[e.addonId]??[];return m("div",{children:[m("button",{type:"button",onClick:()=>n(e.addonId),className:N("w-full flex items-center justify-between gap-2 text-left px-3 py-1.5 text-xs","border-l-2",a?"bg-accent border-primary text-foreground font-medium":"border-transparent hover:bg-muted/40 text-foreground"),style:{paddingLeft:`${12+t*14}px`},children:[o("span",{className:"truncate",children:e.addonName}),i.length>0&&o("span",{className:"flex items-center gap-1 shrink-0",children:i.map(l=>o("span",{title:`${l.agentNodeId}: ${l.state}`,className:N("w-2 h-2 rounded-full",mp[l.state])},l.agentNodeId))})]}),e.children.map(l=>o(ui,{node:l,depth:t+1,selectedAddonId:r,onSelect:n,agentDots:s},l.addonId))]})}function yb({tree:e,selectedAddonId:t,onSelect:r,agentDots:n,className:s}){return o("div",{className:N("flex flex-col py-2",s),children:e.map(a=>o(ui,{node:a,depth:0,selectedAddonId:t,onSelect:r,agentDots:n},a.addonId))})}function xb(e){const t=[],r=[],n=new Map;for(const a of e.slots)for(const i of a.addons){const l={addonId:i.id,addonName:i.name,slot:i.slot,inputClasses:i.inputClasses,outputClasses:i.outputClasses,children:[]};i.slot==="audio-classifier"?t.push(l):(r.push(l),n.set(i.id,l))}const s=[];for(const a of r){if(a.inputClasses.length===0){s.push(a);continue}const i=r.find(l=>l.addonId!==a.addonId&&l.outputClasses.some(c=>a.inputClasses.includes(c)));i&&i.children.push(a)}return[...s,...t]}function hp(e){return e?e.models.map(t=>({id:t.id,name:t.name})):[]}function Gr({step:e,schema:t,allSchemas:r,depth:n=0,onChange:s,onDelete:a,readOnly:i=!1,toggleMode:l="simple",overrideState:c=null,onOverrideChange:d,inheritedEnabled:u,hideModelAndSettings:f=!1}){const[h,g]=S(!1),b=hp(t);if(b.length>0&&!b.some(x=>x.id===e.modelId)&&!i){const x=(t?.defaultModelId?b.find(y=>y.id===t.defaultModelId):null)??b[0];x&&x.id!==e.modelId&&queueMicrotask(()=>s({...e,modelId:x.id}))}const v=m(Ne,{children:[m("div",{className:"flex-1 min-w-0",children:[o("span",{className:"text-[10px] uppercase tracking-wider font-medium text-foreground-subtle/60 block leading-none",children:e.slot}),o("span",{className:"text-sm font-semibold text-foreground truncate block leading-tight",children:e.addonName}),m("div",{className:"flex items-center gap-1 mt-0.5 flex-wrap",children:[e.inputClasses.map(x=>o("span",{className:"text-[9px] uppercase font-semibold tracking-wide px-1.5 py-0.5 rounded bg-blue-500/12 text-blue-400",children:x},x)),e.inputClasses.length>0&&e.outputClasses.length>0&&o("span",{className:"text-foreground-subtle/40 text-[10px]",children:"→"}),e.outputClasses.map(x=>o("span",{className:"text-[9px] uppercase font-semibold tracking-wide px-1.5 py-0.5 rounded bg-green-500/12 text-green-400",children:x},x))]})]}),!i&&l==="simple"&&o("button",{onClick:x=>{x.stopPropagation(),s({...e,enabled:!e.enabled})},className:N("relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors",e.enabled?"bg-success":"bg-foreground-subtle/30"),children:o("span",{className:N("inline-block h-4 w-4 rounded-full bg-white shadow transition-transform",e.enabled?"translate-x-6":"translate-x-1")})}),!i&&l==="threeState"&&d&&m("div",{className:"flex items-center gap-0.5 rounded-md border border-border p-0.5",onClick:x=>x.stopPropagation(),children:[o(Qr,{label:"Inherit",active:c===null,variant:"inherit",subtext:u===void 0?void 0:u?"on":"off",onClick:()=>d(null)}),o(Qr,{label:"On",active:c===!0,variant:"on",onClick:()=>d(!0)}),o(Qr,{label:"Off",active:c===!1,variant:"off",onClick:()=>d(!1)})]})]});return o(Ju,{expanded:h,onExpandedChange:g,dimmed:!e.enabled,header:v,children:f?o("p",{className:"text-[11px] text-foreground-subtle",children:"Model and detection settings are managed per agent — open the Pipeline page for this camera's agent to edit them."}):m("div",{className:"space-y-3",children:[o(vn,{label:"Model",value:e.modelId,disabled:i,options:b.map(x=>({value:x.id,label:x.name})),onChange:x=>s({...e,modelId:x})}),e.slot==="audio-classifier"&&e.engine&&o(vn,{label:"Runtime",value:`${e.engine.runtime}/${e.engine.backend}`,disabled:i,options:[{value:"node/cpu",label:"Node.js — ONNX CPU"},{value:"node/coreml",label:"Node.js — Apple SoundAnalysis (macOS)"},{value:"python/cpu",label:"Python — ONNX CPU"}],onChange:x=>{const[y,w]=x.split("/");s({...e,engine:{runtime:y,backend:w,format:w==="coreml"?"coreml":"onnx"}})}}),t?.configSchema?.map(x=>o(Un,{field:x,allFields:t.configSchema??[],step:e,disabled:i,onChange:s},x.key))]})})}function vn({label:e,value:t,options:r,disabled:n,onChange:s}){return m("div",{children:[o("label",{className:"block text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-1.5",children:e}),m("select",{value:t,onChange:a=>s(a.target.value),disabled:n,className:"w-full rounded-lg border border-border bg-surface px-3 py-2 text-xs text-foreground focus:outline-none focus:border-primary/50",children:[r.length===0&&o("option",{value:t,children:t||"default"}),r.map(a=>o("option",{value:a.value,disabled:a.disabled,children:a.label},a.value))]})]})}function gp({label:e,description:t,value:r,options:n,disabled:s,onChange:a}){function i(l){s||a(r.includes(l)?r.filter(c=>c!==l):[...r,l])}return m("div",{children:[o("label",{className:"block text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-1",children:e}),t&&o("p",{className:"text-[10px] text-foreground-subtle/60 mb-1.5",children:t}),o("div",{className:"flex flex-wrap gap-1.5",children:n.map(l=>o("button",{type:"button",disabled:s,onClick:()=>i(l.value),className:N("text-[10px] font-medium px-2 py-1 rounded-md border transition-colors",r.includes(l.value)?"bg-primary/20 text-primary border-primary/40":"bg-surface text-foreground-subtle border-border hover:border-primary/30",s&&"opacity-50 cursor-not-allowed"),children:l.label},l.value))})]})}function bp(e,t,r){const n=t.settings?.[e];if(n!==void 0)return n;const s=r.find(a=>"key"in a&&a.key===e);return s&&"default"in s?s.default:void 0}function Un({field:e,allFields:t,step:r,disabled:n,onChange:s}){const a=e.type!=="separator"&&e.type!=="info"?e.showWhen:void 0;if(a){const{field:l,equals:c,notEquals:d,in:u,notIn:f}=a,h=bp(l,r,t);if(c!==void 0&&h!==c||d!==void 0&&h===d||u!==void 0&&!u.includes(h)||f!==void 0&&f.includes(h))return null}function i(l){s({...r,settings:{...r.settings,[e.key]:l}})}if(e.type==="select"){const l=r.settings?.[e.key],c=typeof l=="string"?l:e.default??"";return o(vn,{label:e.label,value:c,disabled:n||e.disabled,options:e.options,onChange:i})}if(e.type==="multiselect"){const l=r.settings?.[e.key],c=Array.isArray(l)?l:Array.isArray(e.default)?e.default:[];return o(gp,{label:e.label,description:e.description,value:c,options:e.options,disabled:n||e.disabled,onChange:i})}if(e.type==="slider"||e.type==="number"){const l=r.settings?.[e.key],c=typeof e.default=="number"?e.default:e.min??0,d=typeof l=="number"?l:c,u=e.min??0,f=e.max??1,h=e.step??.01,g=e.type==="slider"?e.showValue:!0,b="unit"in e?e.unit:void 0,v=e.type==="slider"?e.displayScale:void 0,x=v?d/v:d;return m("div",{children:[m("div",{className:"flex items-center justify-between mb-1",children:[o("span",{className:"text-[10px] font-medium text-foreground-subtle uppercase tracking-wide",children:e.label}),g&&m("span",{className:"text-xs font-medium text-foreground tabular-nums",children:[typeof x=="number"?x.toFixed(2).replace(/\.?0+$/,""):x,b?` ${b}`:""]})]}),e.description&&o("p",{className:"text-[10px] text-foreground-subtle/60 mb-1.5",children:e.description}),o("input",{type:"range",min:u,max:f,step:h,value:d,disabled:n||e.disabled,onChange:y=>i(Number(y.target.value)),className:"w-full accent-primary h-1.5"})]})}if(e.type==="boolean"){const l=r.settings?.[e.key];return m("label",{className:"flex items-center gap-2",children:[o("input",{type:"checkbox",checked:typeof l=="boolean"?l:e.default===!0,disabled:n||e.disabled,onChange:c=>i(c.target.checked),className:"h-3.5 w-3.5 accent-primary"}),o("span",{className:"text-[10px] font-medium text-foreground-subtle uppercase tracking-wide",children:e.label})]})}if(e.type==="text"||e.type==="password"||e.type==="textarea"){const l=r.settings?.[e.key],c=typeof l=="string"?l:e.default??"",d=e.type==="password"?"password":"text";return m("div",{children:[o("label",{className:"block text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-1.5",children:e.label}),e.type==="textarea"?o("textarea",{value:c,disabled:n||e.disabled,placeholder:e.placeholder,onChange:u=>i(u.target.value),rows:3,className:"w-full rounded-lg border border-border bg-surface px-3 py-2 text-xs text-foreground focus:outline-none focus:border-primary/50 resize-y"}):o("input",{type:d,value:c,disabled:n||e.disabled,placeholder:e.placeholder,onChange:u=>i(u.target.value),className:"w-full rounded-lg border border-border bg-surface px-3 py-2 text-xs text-foreground focus:outline-none focus:border-primary/50"})]})}return e.type==="separator"?o("div",{className:"border-t border-border my-2"}):e.type==="info"?o("div",{className:"rounded-md border border-border bg-surface px-2 py-1.5 text-[10px] text-foreground-subtle",children:e.content}):null}function Qr({label:e,active:t,variant:r,subtext:n,onClick:s}){return m("button",{type:"button",onClick:s,className:N("px-2 py-1 text-[10px] font-medium rounded transition-colors",t?r==="on"?"bg-green-500/20 text-green-400":r==="off"?"bg-red-500/20 text-red-400":"bg-primary/20 text-primary":"text-foreground-subtle hover:bg-surface-hover"),children:[e,n&&t&&m("span",{className:"ml-1 opacity-60",children:["(",n,")"]})]})}function pi(e,t){return{addonId:e.id,addonName:e.name,slot:e.slot,inputClasses:[...e.inputClasses],outputClasses:[...e.outputClasses],enabled:t.enabled,modelId:t.modelId,children:[],settings:{...t.settings}}}function vp(e,t,r){return r?{enabled:r.enabled??t.enabled,modelId:r.modelId??t.modelId,settings:r.settings??t.settings}:t}function yp({addon:e,agentDefault:t,modelsForFormat:r,onChangeAgentConfig:n}){const s=a=>{n?.({...t,...a})};return m("div",{className:"space-y-4 text-xs",children:[m("label",{className:"flex items-center gap-2",children:[o("input",{type:"checkbox",checked:t.enabled,onChange:a=>s({enabled:a.target.checked})}),m("span",{children:["Enabled on this agent (",e.name,")"]})]}),m("div",{children:[o("div",{className:"text-[10px] uppercase tracking-widest text-foreground-subtle mb-1",children:"Model"}),o("select",{className:"w-full bg-surface border border-border rounded px-2 py-1 text-xs",value:t.modelId,onChange:a=>s({modelId:a.target.value}),children:r.map(a=>o("option",{value:a.id,children:a.name},a.id))})]}),(e.configSchema?.length??0)>0&&m("div",{className:"pt-2 border-t border-border/50 space-y-3",children:[o("div",{className:"text-[10px] uppercase tracking-widest text-foreground-subtle",children:"Settings"}),e.configSchema?.map(a=>o(Un,{field:a,allFields:e.configSchema??[],step:pi(e,t),disabled:!1,onChange:i=>s({settings:{...i.settings}})},a.key))]})]})}function xp({addon:e,agentDefault:t,agentNodeId:r,currentPatch:n,modelsForFormat:s,onChangePatch:a}){const i=vp("device",t,n),l=g=>{const b=g.enabled!==void 0||g.modelId!==void 0||g.settings!==void 0;a?.(b?g:null)},c=g=>{const{enabled:b,...v}=n??{};l(g==="inherit"?v:{...v,enabled:g==="on"})},d=g=>{const{modelId:b,...v}=n??{};l(g===void 0?v:{...v,modelId:g})},u=g=>{const{settings:b,...v}=n??{};l(g===void 0?v:{...v,settings:g})},f=n?.enabled===void 0?"inherit":n.enabled?"on":"off",h=n?.modelId!==void 0;return m("div",{className:"space-y-4 text-xs",children:[m("div",{className:"flex items-center gap-1",children:[["inherit","on","off"].map(g=>o("button",{type:"button",onClick:()=>c(g),className:N("px-3 py-1 border border-border rounded text-xs capitalize",f===g?"bg-primary text-primary-foreground border-primary":"bg-surface text-foreground hover:bg-muted"),children:g},g)),m("span",{className:"ml-2 text-[10px] text-foreground-subtle",children:["agent default: ",o("span",{className:"font-semibold",children:t.enabled?"on":"off"})]})]}),m("div",{children:[m("div",{className:"flex items-center justify-between mb-1",children:[o("div",{className:"text-[10px] uppercase tracking-widest text-foreground-subtle",children:"Model"}),h?o("button",{type:"button",className:"text-[10px] text-foreground-subtle hover:text-foreground",onClick:()=>d(void 0),children:"Clear"}):o("button",{type:"button",className:"text-[10px] text-primary hover:underline",onClick:()=>d(t.modelId),children:"Override"})]}),o("select",{disabled:!h,className:"w-full bg-surface border border-border rounded px-2 py-1 text-xs disabled:opacity-50",value:h?n?.modelId??t.modelId:t.modelId,onChange:g=>d(g.target.value),children:s.map(g=>o("option",{value:g.id,children:g.name},g.id))}),!h&&m("div",{className:"text-[10px] text-foreground-subtle mt-1",children:["inherits from ",r]})]}),(e.configSchema?.length??0)>0&&(()=>{const g=n?.settings!==void 0;return m("div",{className:"pt-2 border-t border-border/50 space-y-3",children:[m("div",{className:"flex items-center justify-between",children:[o("div",{className:"text-[10px] uppercase tracking-widest text-foreground-subtle",children:"Settings"}),g?o("button",{type:"button",className:"text-[10px] text-foreground-subtle hover:text-foreground",onClick:()=>u(void 0),children:"Clear"}):o("button",{type:"button",className:"text-[10px] text-primary hover:underline",onClick:()=>u({...t.settings}),children:"Override"})]}),e.configSchema?.map(b=>o(Un,{field:b,allFields:e.configSchema??[],step:pi(e,i),disabled:!g,onChange:v=>u({...v.settings})},b.key)),!g&&m("div",{className:"text-[10px] text-foreground-subtle",children:["inherits from ",r]})]})})(),m("div",{className:"rounded bg-muted/40 px-3 py-2 text-[11px] text-foreground-subtle",children:[o("div",{className:"font-semibold text-foreground mb-0.5",children:"Effective config preview"}),m("div",{className:"font-mono truncate",children:[e.id," · model: ",i.modelId," · ",i.enabled?"on":"off"]})]})]})}function wb(e){const{mode:t,addon:r,agentDefault:n,agentNodeId:s,currentPatch:a,onChangeAgentConfig:i,onChangePatch:l,engineFormat:c}=e,d=re(()=>r.models.filter(u=>!!u.formats[c]),[r.models,c]);return t==="agent"?o(yp,{addon:r,agentDefault:n,modelsForFormat:d,onChangeAgentConfig:i}):o(xp,{addon:r,agentDefault:n,agentNodeId:s,currentPatch:a,modelsForFormat:d,onChangePatch:l})}function wp(e){const t=[],r=(n,s)=>{for(const a of n)t.push({node:a,depth:s}),r(a.children,s+1)};return r(e,0),t}var To={detector:{label:"detector",className:"text-emerald-500"},cropper:{label:"cropper",className:"text-blue-500"},classifier:{label:"classifier",className:"text-violet-500"},refiner:{label:"refiner",className:"text-amber-500"},"audio-classifier":{label:"audio classifier",className:"text-pink-500"}};function kp({slot:e}){const t=To[e]??To.classifier;return o("span",{className:N("text-[9px] font-semibold uppercase tracking-widest leading-none",t.className),children:t.label})}var Do="inline-flex items-center rounded bg-muted px-1.5 py-px text-[9px] font-medium text-foreground-subtle";function Np({inputs:e,outputs:t}){return e.length===0&&t.length===0?null:m("span",{className:"inline-flex items-center gap-1 flex-wrap",children:[e.map(r=>o("span",{className:N(Do,"bg-blue-500/10 text-blue-500"),children:r},`in-${r}`)),e.length>0&&t.length>0&&o("span",{className:"text-foreground-subtle/60 text-[9px]",children:"→"}),t.map(r=>o("span",{className:N(Do,"bg-emerald-500/10 text-emerald-500"),children:r},`out-${r}`))]})}function Sp({enabled:e,onChange:t,disabled:r}){return o("button",{type:"button",role:"switch","aria-checked":e,disabled:r,onClick:n=>{n.stopPropagation(),t(!e)},className:N("relative inline-flex h-3.5 w-7 shrink-0 items-center rounded-full transition-colors",e?"bg-emerald-500":"bg-foreground-subtle/30",r?"opacity-50 cursor-not-allowed":"cursor-pointer"),title:e?"Click to disable":"Click to enable",children:o("span",{className:N("inline-block h-3 w-3 rounded-full bg-white shadow transition-transform",e?"translate-x-3.5":"translate-x-0.5")})})}function Cp(e){return e.kind==="enabled"?m("span",{className:"inline-flex items-center gap-1",children:[o("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 shrink-0"}),o("span",{className:"font-mono text-foreground",children:e.modelId})]}):e.kind==="disabled"?m("span",{className:"inline-flex items-center gap-1 text-foreground-subtle",children:[o("span",{className:"h-1.5 w-1.5 rounded-full border border-foreground-subtle/60 shrink-0"}),"off"]}):m("span",{className:"inline-flex items-center gap-1 text-foreground-subtle/70",children:[o("span",{className:"h-1.5 w-1.5 rounded-full bg-muted shrink-0"}),"n/a"]})}function Mp({node:e,depth:t,agents:r,getCellState:n,onCellClick:s,selectedCell:a,toggleProps:i}){return m(Ne,{children:[m("div",{className:"sticky left-0 z-10 bg-surface px-3 py-2 border-b border-border text-xs flex items-start gap-2",style:{paddingLeft:`${12+t*14}px`},children:[m("div",{className:"flex flex-col gap-1 min-w-0 flex-1",children:[o(kp,{slot:e.slot}),m("div",{className:"flex items-center gap-2 flex-wrap",children:[o("span",{className:"font-semibold truncate",children:e.addonName}),o(Np,{inputs:e.inputClasses,outputs:e.outputClasses})]})]}),i&&o("span",{className:"pl-2 pt-0.5 shrink-0",children:o(Sp,{enabled:i.enabled,onChange:i.onChange,disabled:i.disabled})})]}),r.map(l=>{const c=n(e.addonId,l.agentNodeId),d=a?.addonId===e.addonId&&a.agentNodeId===l.agentNodeId;return o("button",{type:"button",onClick:()=>s(e.addonId,l.agentNodeId),className:N("text-left px-3 py-1.5 border-b border-l border-border text-xs hover:bg-muted/40",c.kind==="enabled"&&"bg-emerald-500/5",c.kind==="na"&&"bg-muted/30",d&&"ring-2 ring-primary ring-inset"),children:Cp(c)},l.agentNodeId)})]})}function kb({tree:e,agents:t,getCellState:r,onCellClick:n,selectedCell:s,onToggleEnabled:a}){const i=re(()=>wp(e),[e]),l=`minmax(320px, 1fr) repeat(${t.length}, minmax(160px, 220px))`,c=a!==void 0&&t.length===1,d=t[0]?.agentNodeId;return o("div",{className:"overflow-auto border border-border rounded",children:m("div",{className:"grid",style:{gridTemplateColumns:l},children:[o("div",{className:"sticky top-0 left-0 z-20 bg-muted/60 px-3 py-2 text-[10px] uppercase tracking-widest text-foreground-subtle border-b border-border",children:"Step"}),t.map(u=>m("div",{className:"sticky top-0 z-10 bg-muted/60 px-3 py-2 border-b border-l border-border",children:[o("div",{className:"text-xs font-semibold text-foreground",children:u.agentNodeId}),o("div",{className:"text-[10px] text-foreground-subtle truncate",children:u.engineLabel})]},u.agentNodeId)),i.map(({node:u,depth:f})=>{const h=c&&d!==void 0?r(u.addonId,d):null;return o(Mp,{node:u,depth:f,agents:t,getCellState:r,onCellClick:n,selectedCell:s,toggleProps:c&&h!==null?{enabled:h.kind==="enabled",onChange:g=>a?.(u.addonId,g),disabled:h.kind==="na"}:void 0},u.addonId)})]})})}var fi=typeof globalThis<"u"?globalThis.__camstackTrpcReact:void 0,p=fi??ll();typeof globalThis<"u"&&!fi&&(globalThis.__camstackTrpcReact=p);var Vn=ot("camstack:system",null);function Ep({system:e,children:t}){return o(Vn.Provider,{value:e,children:t})}function Rt(){const e=Ae(Vn);if(!e)throw new Error("useSystem(): no <SystemProvider> in tree");return e}function Nb(){return Ae(Vn)}function Pr(e,t){const r=Rt(),n=q(t);n.current=t;const[s,a]=S(r.connectionVersion);H(()=>r.subscribeConnectionEvents((i,l)=>{i==="connected"&&a(l)}),[r]),H(()=>r.subscribeEvent(e,i=>{n.current(i)}),[r,e,s])}function yn(e){const t=q(e);return t.current=e,t}function mi(e,t){const[r,n]=S(null),s=yn(t);return Pr(e,a=>{const i=a.data,l=s.current;l&&!l(i)||n(i)}),r}function Sb(e,t,r){const[n,s]=S(()=>new Map),a=yn(t),i=yn(r);return Pr(e,l=>{const c=l.data,d=i.current;if(d&&!d(c))return;const u=a.current(c);s(f=>{const h=new Map(f);return h.set(u,c),h})}),{map:n,values:re(()=>Array.from(n.values()),[n])}}function qn(){const{data:e,isLoading:t}=p.nodes.topology.useQuery(void 0,{staleTime:6e4}),r=mi("cluster.topology-snapshot")?.nodes??e;return{nodes:re(()=>{const n=[];for(const s of r??[])n.push({id:String(s.id??""),name:String(s.name??s.id??""),shortName:s.isHub?"HUB":String(s.name??s.id??""),isHub:!!s.isHub,isOnline:!!s.isOnline,localIps:s.localIps??[],addons:(s.addons??[]).map(a=>({addonId:a.id,capabilities:a.capabilities}))});return n.sort((s,a)=>s.isHub!==a.isHub?s.isHub?-1:1:s.name.localeCompare(a.name)),n},[r]),isLoading:t}}function Cb({selectedNodeId:e,onSelect:t,label:r="Node",hideIcon:n=!1,alwaysShow:s=!1}){const{nodes:a}=qn();return!s&&a.length<=1?null:m("div",{className:"flex items-center gap-1.5",children:[!n&&o(Ou,{className:"h-3.5 w-3.5 text-foreground-subtle"}),r&&o("span",{className:"text-[10px] uppercase tracking-wider text-foreground-subtle",children:r}),o("div",{className:"flex rounded-md border border-border overflow-hidden text-[11px] font-medium",children:a.map((i,l)=>{const c=e===i.id;return o("button",{type:"button",onClick:()=>t(i.id),disabled:!i.isOnline,title:i.isOnline?i.name:`${i.name} (offline)`,className:N("px-2.5 py-1 transition-colors",c?"bg-primary/15 text-primary":"bg-transparent text-foreground-subtle hover:bg-surface-hover hover:text-foreground",l>0&&"border-l border-border",!i.isOnline&&"opacity-50 cursor-not-allowed"),children:i.shortName},i.id)})})]})}var Ap={online:{colorClass:"bg-success",label:"Online"},offline:{colorClass:"bg-danger",label:"Offline"},degraded:{colorClass:"bg-warning",label:"Degraded"},unknown:{colorClass:"bg-foreground-subtle",label:"Unknown"}};function Mb({status:e,showDot:t=!0,showLabel:r=!0,size:n="sm",className:s}){const a=Ap[e];return m("span",{className:N("inline-flex items-center gap-1.5",n==="sm"?"text-xs":"text-sm",s),children:[t&&o("span",{className:N("h-1.5 w-1.5 shrink-0 rounded-full",a.colorClass),"aria-hidden":"true"}),r&&o("span",{className:"text-foreground",children:a.label})]})}var Pp={frigate:{colorClass:"bg-provider-frigate",label:"Frigate"},scrypted:{colorClass:"bg-provider-scrypted",label:"Scrypted"},reolink:{colorClass:"bg-provider-reolink",label:"Reolink"},homeAssistant:{colorClass:"bg-provider-homeAssistant",label:"Home Assistant"},rtsp:{colorClass:"bg-provider-rtsp",label:"RTSP"}};function Eb({provider:e,showLabel:t=!0,className:r}){const n=Pp[e];return m("span",{className:N("inline-flex items-center gap-1.5 text-xs",r),children:[o("span",{className:N("h-1.5 w-1.5 shrink-0 rounded-sm",n.colorClass),"aria-hidden":"true"}),t&&o("span",{className:"text-foreground",children:n.label})]})}var Rp={success:"bg-emerald-400 text-emerald-950",warning:"bg-amber-400 text-amber-950",danger:"bg-red-400 text-red-950",info:"bg-blue-400 text-blue-950",neutral:"bg-foreground-subtle/20 text-foreground"};function _p({children:e,variant:t="neutral",mono:r,className:n}){return o("span",{className:N("inline-flex items-center rounded-md px-2 py-0.5 text-[11px] font-bold leading-tight",r&&"font-mono",Rp[t],n),children:e})}function Ab({version:e,preRelease:t,className:r}){return o(_p,{variant:t??/-(alpha|beta|rc|dev|canary|next)/i.test(e)?"warning":"success",mono:!0,className:r,children:e})}function Pb({label:e,description:t,error:r,required:n,children:s,orientation:a="vertical",className:i}){const l=a==="horizontal";return m("div",{className:N("flex gap-2",l?"flex-row items-center justify-between":"flex-col",i),children:[m("div",{className:N(l?"flex-1":""),children:[m(Wa,{children:[e,n&&o("span",{className:"text-danger ml-0.5",children:"*"})]}),t&&o("p",{className:"text-foreground-subtle text-xs mt-0.5",children:t})]}),o("div",{className:N(l?"shrink-0":""),children:s}),r&&o("p",{className:"text-danger text-xs",children:r})]})}function Rb({title:e,subtitle:t,actions:r,className:n}){return m("div",{className:N("flex flex-col gap-2 mb-3 sm:flex-row sm:items-center sm:justify-between",n),children:[m("div",{children:[o("h1",{className:"text-sm font-semibold text-foreground",children:e}),t&&o("p",{className:"text-foreground-subtle text-xs",children:t})]}),r&&o("div",{className:"flex items-center gap-2 flex-wrap",children:r})]})}function _b({icon:e,title:t,description:r,action:n,className:s}){return m("div",{className:N("flex flex-col items-center justify-center gap-3 py-12",s),children:[e&&o(e,{className:"h-12 w-12 text-foreground-subtle","aria-hidden":"true"}),m("div",{className:"flex flex-col items-center gap-1 text-center",children:[o("p",{className:"text-foreground-muted text-sm font-medium",children:t}),r&&o("p",{className:"text-foreground-subtle text-xs max-w-xs",children:r})]}),n&&o("div",{className:"mt-1",children:n})]})}var hi=ot("camstack:confirm-dialog",null);function Wn(){const e=Ae(hi);if(!e)throw new Error("useConfirm must be used within ConfirmDialogProvider");return e.confirm}function Ib({children:e}){const[t,r]=S(null),n=I(c=>new Promise(d=>{r({...c,resolve:d})}),[]),s=()=>{t?.resolve(!0),r(null)},a=()=>{t?.resolve(!1),r(null)},i={danger:{icon:"text-red-400",button:"bg-red-500 hover:bg-red-600 text-white"},warning:{icon:"text-orange-400",button:"bg-orange-500 hover:bg-orange-600 text-white"},default:{icon:"text-primary",button:"bg-primary hover:bg-primary/90 text-white"}},l=t?i[t.variant??"default"]:i.default;return m(hi.Provider,{value:{confirm:n},children:[e,t&&m("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[o("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:a}),m("div",{className:"relative z-10 w-full max-w-sm mx-4 rounded-xl border border-border bg-surface shadow-2xl overflow-hidden animate-in fade-in zoom-in-95 duration-150",onClick:c=>c.stopPropagation(),children:[m("div",{className:"px-5 pt-5 pb-4",children:[o("h3",{className:"text-sm font-semibold text-foreground",children:t.title}),o("p",{className:"mt-2 text-xs text-foreground-subtle leading-relaxed",children:t.message})]}),m("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border bg-surface-hover/30",children:[o("button",{type:"button",onClick:a,className:"px-3 py-1.5 text-xs font-medium rounded-md border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors",children:t.cancelLabel??"Cancel"}),o("button",{type:"button",onClick:s,className:`px-3 py-1.5 text-xs font-medium rounded-md transition-colors ${l.button}`,children:t.confirmLabel??"Confirm"})]})]})]})]})}function Tb({value:e,label:t,trend:r,className:n}){return m(qa,{className:N("flex flex-col gap-1",n),children:[m("div",{className:"flex items-baseline gap-2",children:[o("span",{className:"text-2xl font-semibold text-foreground",children:e}),r&&m("span",{className:N("inline-flex items-center gap-0.5 text-xs font-medium",r.direction==="up"?"text-success":"text-danger"),children:[r.direction==="up"?o(Hu,{className:"h-3 w-3"}):o(Uu,{className:"h-3 w-3"}),r.value,"%"]})]}),o("span",{className:"text-xs text-foreground-muted",children:t})]})}function Db({items:e,className:t}){return o("dl",{className:N("flex flex-col",t),children:e.map(r=>m("div",{className:"flex items-center h-7",children:[o("dt",{className:"text-foreground-subtle text-xs w-1/3 shrink-0",children:r.key}),o("dd",{className:"text-foreground text-xs",children:r.value})]},r.key))})}function Lb({children:e,maxHeight:t=300,className:r}){const[n,s]=S(!1),a=I(()=>{navigator.clipboard.writeText(e).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)})},[e]);return m("div",{className:N("relative group",r),children:[o(di,{style:{maxHeight:t},children:o("pre",{className:"font-mono text-xs bg-surface p-3 rounded-md border border-border-subtle",children:o("code",{children:e})})}),o("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:o(Va,{icon:n?Vt:at,"aria-label":"Copy code",variant:"ghost",size:"sm",onClick:a})})]})}function Ob({filters:e,values:t,onChange:r,className:n}){const s=Ar(),[a,i]=S(!1),l=(d,u)=>{r({...t,[d]:u})},c=Object.values(t).filter(d=>d!==void 0&&d!=="").length;if(s){const d=e.find(f=>f.type==="search"),u=e.some(f=>f.type!=="search");return m("div",{className:N("flex items-center gap-2",n),children:[d&&o(gn,{placeholder:d.placeholder??"Search...",value:t[d.key]??"",onChange:f=>l(d.key,f.target.value),leftSlot:o(Gt,{className:"h-3 w-3 text-foreground-subtle"}),className:"flex-1"}),u&&m(Ne,{children:[m("button",{onClick:()=>i(!0),className:"flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-xs text-foreground-muted hover:bg-surface-hover transition-colors shrink-0",children:[o(zu,{className:"h-3.5 w-3.5"}),"Filters",c>0&&o(Lt,{variant:"info",className:"ml-1 text-[10px] px-1 py-0",children:c})]}),o(si,{open:a,onClose:()=>i(!1),title:"Filters",children:o("div",{className:"flex flex-col gap-3",children:e.filter(f=>f.type!=="search").map(f=>{switch(f.type){case"select":return m("div",{children:[o("label",{className:"text-xs text-foreground-muted mb-1 block",children:f.label}),o(bn,{options:f.options,value:t[f.key]??"",onChange:h=>l(f.key,h.target.value),className:"w-full"})]},f.key);case"badge-toggle":return o("div",{className:"flex items-center gap-1 flex-wrap",children:f.options.map(h=>{const g=t[f.key]===h.value;return o("button",{type:"button",onClick:()=>l(f.key,g?void 0:h.value),children:o(Lt,{variant:g?"info":"default",className:"cursor-pointer",children:h.label})},h.value)})},f.key);default:return null}})})})]})]})}return o("div",{className:N("flex items-center gap-2 flex-wrap",n),children:e.map(d=>{switch(d.type){case"search":return o(gn,{placeholder:d.placeholder??"Search...",value:t[d.key]??"",onChange:u=>l(d.key,u.target.value),leftSlot:o(Gt,{className:"h-3 w-3 text-foreground-subtle"}),className:"w-48"},d.key);case"select":return o(bn,{options:d.options,value:t[d.key]??"",onChange:u=>l(d.key,u.target.value),className:"w-36"},d.key);case"badge-toggle":return o("div",{className:"flex items-center gap-1",children:d.options.map(u=>{const f=t[d.key]===u.value;return o("button",{type:"button",onClick:()=>l(d.key,f?void 0:u.value),children:o(Lt,{variant:f?"info":"default",className:"cursor-pointer",children:u.label})},u.value)})},d.key);default:return null}})})}function Lo({label:e,icon:t,href:r,badge:n,active:s=!1,className:a}){return m("a",{href:r,className:N("flex items-center gap-2 h-7 px-2 text-[11px] transition-colors",s?"border-l-2 border-primary bg-primary/[0.08] text-foreground rounded-r-md":"text-foreground-subtle hover:bg-surface-hover rounded-md",a),children:[o(t,{className:"h-3.5 w-3.5 shrink-0"}),o("span",{className:"truncate flex-1",children:e}),n!==void 0&&o(Lt,{className:"ml-auto text-[10px] px-1.5 py-0",children:n})]})}function Oo({logo:e,sections:t,footer:r,onNavigate:n,className:s}){return m("nav",{className:N("bg-surface border-r border-border h-full flex flex-col",s),children:[e&&o("div",{className:"px-3 py-2 shrink-0",children:e}),o("div",{className:"flex-1 overflow-auto px-1 py-1",children:t.map((a,i)=>m("div",{className:N(i>0?"mt-3":""),children:[a.label&&o("span",{className:"text-[10px] text-foreground-disabled uppercase tracking-wider px-2 mb-1 block",children:a.label}),o("div",{className:"flex flex-col gap-0.5",onClick:n,children:a.items.map(l=>o(Lo,{...l},l.href))})]},i))}),r&&r.length>0&&m("div",{className:"shrink-0 px-1 pb-1",children:[o(Ka,{className:"mb-1"}),o("div",{className:"flex flex-col gap-0.5",onClick:n,children:r.map(a=>o(Lo,{...a},a.href))})]})]})}function $b({sidebar:e,header:t,mobileLogo:r,mobileActions:n,children:s,className:a}){const i=Ar(),[l,c]=S(!1);return m("div",{className:N("flex h-screen",a),children:[!i&&o(Oo,{...e,className:N("w-44",e.className)}),i&&o(fp,{open:l,onClose:()=>c(!1),width:"w-64",children:o(Oo,{...e,onNavigate:()=>c(!1),className:"w-full border-r-0"})}),m("div",{className:"flex flex-1 flex-col min-w-0",children:[i&&m("header",{className:"flex items-center h-12 border-b border-border px-3 shrink-0 bg-surface/80 backdrop-blur-sm",children:[o("button",{onClick:()=>c(!0),className:"p-1.5 -ml-1.5 rounded-md hover:bg-surface-hover text-foreground-muted transition-colors","aria-label":"Open menu",children:o(Au,{className:"h-5 w-5"})}),r&&o("div",{className:"flex-1 flex justify-center",children:r}),n&&o("div",{className:"shrink-0",children:n})]}),!i&&t&&m("header",{className:"flex items-center h-10 border-b border-border px-4 shrink-0",children:[t.breadcrumbs&&t.breadcrumbs.length>0&&o("nav",{className:"flex items-center gap-1 text-xs flex-1 min-w-0",children:t.breadcrumbs.map((d,u)=>{const f=u===t.breadcrumbs.length-1;return m("span",{className:"flex items-center gap-1",children:[u>0&&o(st,{className:"h-3 w-3 text-foreground-subtle shrink-0"}),d.href&&!f?o("a",{href:d.href,className:"text-foreground-subtle hover:text-foreground transition-colors truncate",children:d.label}):o("span",{className:"text-foreground truncate",children:d.label})]},u)})}),t.actions&&o("div",{className:"flex items-center gap-2 ml-auto shrink-0",children:t.actions})]}),o("main",{className:"flex-1 overflow-auto p-4",children:s})]})]})}var Ip={online:"bg-success",offline:"bg-danger",warning:"bg-warning",unknown:"bg-foreground-subtle"};function Bb({title:e,subtitle:t,status:r,selected:n,onClick:s,badges:a,actions:i,offlineAction:l,className:c}){const d=r==="offline";return m("div",{onClick:s,className:N("w-full rounded-lg border p-3 text-left transition-colors",s&&"cursor-pointer",n?"border-primary bg-primary/10":"border-border bg-surface hover:bg-surface-hover",d&&!n&&"opacity-50",c),children:[m("div",{className:"flex items-center justify-between mb-2",children:[o("span",{className:"text-sm font-medium truncate",children:e}),r&&o("span",{className:N("h-2 w-2 rounded-full shrink-0",Ip[r])})]}),t&&o("div",{className:"text-[11px] text-foreground-muted",children:t}),a&&a.length>0&&o("div",{className:"flex flex-wrap gap-1 mt-2",children:a.map((u,f)=>{const h=N("rounded px-1.5 py-0.5 text-[10px] flex items-center gap-0.5",n?"bg-primary/20":"bg-surface-hover",u.onClick&&"hover:opacity-80 transition-opacity cursor-pointer");return u.onClick?m("button",{onClick:g=>{g.stopPropagation(),u.onClick()},className:h,children:[u.icon,u.label]},f):m("span",{className:h,children:[u.icon,u.label]},f)})}),!d&&i&&i.length>0&&o("div",{className:"flex items-center gap-0.5 mt-2 -mb-1",children:i.map((u,f)=>o("button",{onClick:h=>{h.stopPropagation(),u.onClick()},className:"p-1 rounded hover:bg-surface-hover text-foreground-subtle hover:text-foreground transition-colors",title:u.label,"aria-label":u.label,children:u.icon},f))}),d&&l&&o("div",{className:"mt-2",onClick:u=>u.stopPropagation(),children:l})]})}function zb({children:e,minCardWidth:t=220,gap:r=3,className:n}){return o("div",{className:N("p-4 overflow-y-auto flex-1 content-start",n),style:{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${t}px, 1fr))`,gap:`${r*4}px`},children:e})}var Tp="capability.binding-changed";function Rr(e,t){const[r,n]=S(null);return H(()=>{if(t===null){n(null);return}let s=!1;const a=async()=>{try{const l=await e.deviceManager.getBindings.query({deviceId:t});s||n(l)}catch{s||n(l=>l)}};a();const i=e.live?.onEvent.subscribe({category:Tp},{onData:l=>{const c=l.data?.source;if(!c){a();return}c.type==="device"&&c.id===t&&a()}});return()=>{s=!0,i?.unsubscribe()}},[e,t]),re(()=>r?dl(e,r):null,[e,r])}function gi(e){const t=I(n=>e?e.subscribe(()=>n()):()=>{},[e]),r=I(()=>e?.value,[e]);return Pn(t,r,r)}function Dp(e,t,r){const n=Rr(e,t);return gi(n?r(n.state):void 0)}function Wt(e){const t=Rr(e.trpc,e.deviceId),r=gi(t!==null?e.slice(t):void 0),n=t!==null?e.cap(t):void 0;return{dev:t,cap:n,slice:r,available:(e.requireFeature===void 0||(e.deviceFeatures??[]).includes(e.requireFeature))&&n!==void 0&&r!==void 0}}function Fb(e){return e.parentDeviceId===null?"top-level":e.role?"accessory":"adopted"}var Lp={minimal:{showIntegrationIcon:!1,showParentBadge:!1,showSnapshot:!1,showBattery:!1,showStableId:!1,showId:!1,showSwitchToggle:!0,showChildrenAccordion:!1},compact:{showIntegrationIcon:!0,showParentBadge:!0,showSnapshot:!0,showBattery:!0,showStableId:!1,showId:!1,showSwitchToggle:!0,showChildrenAccordion:!0},expanded:{showIntegrationIcon:!1,showParentBadge:!0,showSnapshot:!0,showBattery:!0,showStableId:!0,showId:!0,showSwitchToggle:!0,showChildrenAccordion:!0}};function Op(e){const t=Lp[e.variant??"compact"];return{showIntegrationIcon:e.showIntegrationIcon??t.showIntegrationIcon,showParentBadge:e.showParentBadge??t.showParentBadge,showSnapshot:e.showSnapshot??t.showSnapshot,showBattery:e.showBattery??t.showBattery,showStableId:e.showStableId??t.showStableId,showId:e.showId??t.showId,showSwitchToggle:e.showSwitchToggle??t.showSwitchToggle,showChildrenAccordion:e.showChildrenAccordion??t.showChildrenAccordion}}var $p={siren:Sr,floodlight:$a,spotlight:Qa,"pir-sensor":Fa,chime:Pu,autotrack:Ra,nightvision:jn,"privacy-mask":Da,doorbell:_a},Bp={camera:Fn,hub:mn,nvr:mn,light:$a,siren:Sr,switch:Qu,sensor:Fa,thermostat:Gu,button:hu,generic:Qn};function bi(e){return e.role?$p[e.role]??Qn:Bp[e.type.toLowerCase()]??Fn}var vi={"native-snapshot":Nu,"two-way-audio":Ba,"pan-tilt-zoom":Ra,"ptz-autotrack":Eu,"doorbell-button":_a,"motion-trigger":et,"battery-operated":Aa,rebootable:Ga},yi={"native-snapshot":"Native snapshot","two-way-audio":"Two-way audio","pan-tilt-zoom":"Pan-Tilt-Zoom","ptz-autotrack":"PTZ autotrack","doorbell-button":"Doorbell button","motion-trigger":"Motion trigger","battery-operated":"Battery operated",rebootable:"Rebootable"},zp={"native-snapshot":"snapshot",rebootable:"reboot","pan-tilt-zoom":"ptz","ptz-autotrack":"ptz-autotrack","two-way-audio":"intercom","motion-trigger":"motion-trigger"},xi=new Set(["camera","hub","nvr"]);function wi(e){return!xi.has(e.type.toLowerCase())}function $o(e){return e.role?!0:!xi.has(e.type.toLowerCase())}function ki(e){return(e.features??[]).includes("motion-trigger")}function Fp(e){if(e.length<=24)return e;const t=e.lastIndexOf(":");if(t>=0&&t<e.length-4)return e.slice(t+1);const r=e.split("-");if(r.length>2){const n=r.slice(-2).join("-");if(n.length>=6)return n}return`…${e.slice(-18)}`}function jp({trpc:e,accessoryChildren:t,adoptedChildren:r,onNavigate:n}){return m("div",{className:"border-t border-border-subtle/50",children:[r.length>0&&o(Bo,{trpc:e,label:"Adopted devices",rows:r,onNavigate:n}),t.length>0&&o(Bo,{trpc:e,label:"Accessories",rows:t,onNavigate:n})]})}function Bo({trpc:e,label:t,rows:r,onNavigate:n}){return m("div",{children:[o("div",{className:"px-3 pt-1.5 pb-1 text-[9px] font-semibold uppercase tracking-wide text-foreground-subtle",children:t}),o("ul",{children:r.map(s=>o(Gp,{trpc:e,child:s,onNavigate:n},s.id))})]})}function Gp({trpc:e,child:t,onNavigate:r}){const n=!t.disabled,s=n&&wi(t),a=n&&ki(t);return o("li",{children:m("div",{onClick:i=>{i.stopPropagation(),r(t.id)},className:"w-full flex items-center gap-2 px-3 py-1.5 text-left hover:bg-surface-hover transition-colors cursor-pointer",children:[o(bi(t),{className:"h-3 w-3 text-foreground-subtle flex-shrink-0"}),o("span",{className:"text-[10.5px] text-foreground flex-1 truncate",children:t.name}),a&&o(Hp,{trpc:e,deviceId:t.id,features:t.features}),s&&o(Qp,{trpc:e,deviceId:t.id}),o("span",{className:N("h-1.5 w-1.5 rounded-full flex-shrink-0",t.online?"bg-success":"bg-foreground-subtle/40"),title:t.online?"Online":"Offline"})]})})}function Qp({trpc:e,deviceId:t}){const{dev:r,cap:n,slice:s,available:a}=Wt({trpc:e,deviceId:t,cap:f=>f.switch,slice:f=>f.state.switch}),[i,l]=S(!1);if(r!==null&&!n)return null;const c=s?.on===!0,d={transform:c?"translateX(14px)":"translateX(2px)"},u=async f=>{if(f.stopPropagation(),!(i||!a||!n)){l(!0);try{await n.setState({on:!c})}finally{l(!1)}}};return o("button",{type:"button",onClick:f=>{u(f)},disabled:i||!a,className:N("relative inline-flex h-4 w-7 items-center rounded-full border transition-colors flex-shrink-0",c?"bg-success/30 border-success/50":"bg-surface-hover border-border",i&&"opacity-60",!a&&"opacity-40 cursor-not-allowed"),title:a?c?"Turn off":"Turn on":"Awaiting state…","aria-pressed":c,children:o("span",{className:N("absolute h-3 w-3 rounded-full transition-all",c?"bg-success":"bg-foreground-subtle"),style:d})})}function Hp({trpc:e,deviceId:t,features:r}){const{dev:n,cap:s,slice:a,available:i}=Wt({trpc:e,deviceId:t,cap:f=>f.motionTrigger,slice:f=>f.state.motionTrigger,requireFeature:"motion-trigger",deviceFeatures:r}),[l,c]=S(!1);if(n!==null&&!s)return null;const d=a?.enabled===!0,u=async f=>{if(f.stopPropagation(),!(l||!i||!s)){c(!0);try{await s.setMotionTrigger({enabled:!d})}finally{c(!1)}}};return o("button",{type:"button",onClick:f=>{u(f)},disabled:l||!i,className:N("inline-flex h-4 w-4 items-center justify-center rounded transition-colors flex-shrink-0",d?"text-primary bg-primary/10":"text-foreground-subtle hover:text-foreground hover:bg-surface-hover",(l||!i)&&"opacity-50"),title:i?d?"Motion-trigger: on (click to disable)":"Motion-trigger: off (click to enable)":"Awaiting state…","aria-pressed":d,children:o(et,{className:"h-2.5 w-2.5"})})}function Ni({trpc:e,device:t,flags:r}){if(t.disabled)return null;const n=t.type.toLowerCase(),s=r.showSwitchToggle&&wi(t),a=ki(t),i=n==="hub"||n==="nvr",l=(t.features??[]).includes("rebootable"),c=i&&l;return m(Ne,{children:[a&&o(Vp,{trpc:e,deviceId:t.id,features:t.features}),s&&o(Up,{trpc:e,deviceId:t.id}),c&&o(Wp,{trpc:e,deviceId:t.id})]})}function Up({trpc:e,deviceId:t}){const{dev:r,cap:n,slice:s,available:a}=Wt({trpc:e,deviceId:t,cap:f=>f.switch,slice:f=>f.state.switch}),[i,l]=S(!1);if(r!==null&&!n)return null;const c=s?.on===!0,d={transform:c?"translateX(14px)":"translateX(2px)"},u=async f=>{if(f.stopPropagation(),!(i||!a||!n)){l(!0);try{await n.setState({on:!c})}finally{l(!1)}}};return o("button",{type:"button",onClick:f=>{u(f)},disabled:i||!a,className:N("relative inline-flex h-4 w-7 items-center rounded-full border transition-colors flex-shrink-0",c?"bg-success/30 border-success/50":"bg-surface-hover border-border",i&&"opacity-60",!a&&"opacity-40 cursor-not-allowed"),title:a?c?"Turn off":"Turn on":"Awaiting state…","aria-pressed":c,children:o("span",{className:N("absolute h-3 w-3 rounded-full transition-all",c?"bg-success":"bg-foreground-subtle"),style:d})})}function Vp({trpc:e,deviceId:t,features:r}){const{dev:n,cap:s,slice:a,available:i}=Wt({trpc:e,deviceId:t,cap:f=>f.motionTrigger,slice:f=>f.state.motionTrigger,requireFeature:"motion-trigger",deviceFeatures:r}),[l,c]=S(!1);if(n!==null&&!s)return null;const d=a?.enabled===!0,u=async f=>{if(f.stopPropagation(),!(l||!i||!s)){c(!0);try{await s.setMotionTrigger({enabled:!d})}finally{c(!1)}}};return o("button",{type:"button",onClick:f=>{u(f)},disabled:l||!i,className:N("inline-flex h-4 w-4 items-center justify-center rounded transition-colors flex-shrink-0",d?"text-primary bg-primary/10":"text-foreground-subtle hover:text-foreground hover:bg-surface-hover",(l||!i)&&"opacity-50"),title:i?d?"Motion-trigger: on (click to disable)":"Motion-trigger: off (click to enable)":"Awaiting state…","aria-pressed":d,children:o(et,{className:"h-2.5 w-2.5"})})}var Hr=168,qp=4;function Wp({trpc:e,deviceId:t}){const{dev:r,cap:n}=Wt({trpc:e,deviceId:t,cap:x=>x.reboot,slice:()=>{}}),s=q(null),a=q(null),[i,l]=S(null),[c,d]=S(!1),u=r!==null&&n!==void 0&&n!==null,f=i!==null,h=()=>l(null),g=()=>{const x=s.current;if(!x)return;const y=x.getBoundingClientRect(),w=y.right-Hr,k=Math.max(8,Math.min(w,window.innerWidth-Hr-8));l({top:y.bottom+qp,left:k})};if(H(()=>{if(!f)return;const x=w=>{const k=s.current,M=a.current,C=w.target;C!==null&&(k&&k.contains(C)||M&&M.contains(C)||h())},y=w=>{w.key==="Escape"&&(w.stopPropagation(),h())};return document.addEventListener("mousedown",x),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",y)}},[f]),r!==null&&!n)return null;const b=x=>{x.stopPropagation(),f?h():g()},v=async()=>{if(!(c||!u||!n)){d(!0),h();try{await n.reboot({})}finally{d(!1)}}};return m(Ne,{children:[o("button",{ref:s,type:"button",onClick:b,disabled:c||!u,className:N("inline-flex h-5 w-5 items-center justify-center rounded text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors flex-shrink-0",(c||!u)&&"opacity-50",f&&"bg-surface-hover text-foreground"),title:"More actions","aria-label":"More actions","aria-haspopup":"menu","aria-expanded":f,children:o(Ia,{className:"h-3 w-3"})}),i&&kr(o("div",{ref:a,role:"menu",style:{position:"fixed",top:i.top,left:i.left,width:Hr},className:"z-[9999] rounded-md border border-border bg-surface shadow-lg shadow-black/30 p-1",onClick:x=>x.stopPropagation(),children:m("button",{type:"button",role:"menuitem",onClick:()=>{v()},disabled:c||!u,className:N("flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-[11px] text-foreground","hover:bg-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed"),children:[o(Ga,{className:"h-3 w-3 shrink-0 text-foreground-subtle"}),o("span",{children:"Reboot device"})]})}),document.body)]})}var Kp=Object.freeze([]);function Zp(e){return e==="native"?"native":"enhanced"}function Yp(e){return e.map(t=>({kind:"marker",feature:t}))}function Xp(e,t){const r=new Map,n=t.entries??[];for(const a of n)r.set(a.capName,a);const s=[];for(const a of e){const i=zp[a];if(i===void 0){s.push({kind:"marker",feature:a});continue}const l=r.get(i);l&&s.push({kind:Zp(l.kind),feature:a,capName:i})}return s}function Jp(e,t,r){const[n,s]=S(null),[a,i]=S(!1),[l,c]=S(!0);return H(()=>{if(t===null){s(null),i(!1),c(!1);return}let d=!1;c(!0),i(!1);const u=async()=>{try{const h=await e.deviceManager.getBindings.query({deviceId:t});if(d)return;s(h),c(!1)}catch{if(d)return;i(!0),c(!1)}};u();const f=e.live?.onEvent.subscribe({category:"capability.binding-changed"},{onData:h=>{const g=h.data?.source;if(!g){u();return}g.type==="device"&&g.id===t&&u()}});return()=>{d=!0,f?.unsubscribe()}},[e,t]),r.length===0?{loading:l,resolved:Kp}:l||a||!n?{loading:l,resolved:Yp(r)}:{loading:!1,resolved:Xp(r,n)}}var ef=[];function Si({trpc:e,device:t,flags:r,accessoryCount:n,adoptedCount:s,showFeatureRow:a=!1}){const i=n+s,l=r.showChildrenAccordion&&i>0,c=t.features??ef,d=a&&c.length>0,{resolved:u}=Jp(e,d?t.id:null,c),f=d&&u.length>0;return!l&&!f?null:m("div",{className:"flex items-center gap-1.5 flex-nowrap whitespace-nowrap min-w-0",children:[l&&o(tf,{accessoryCount:n,adoptedCount:s}),f&&o(rf,{resolved:u})]})}function tf({accessoryCount:e,adoptedCount:t}){const r=e+t;return r===0?null:m("span",{className:"text-[9px] font-medium text-foreground-subtle bg-surface-elevated/60 rounded px-1.5 py-0.5 flex-shrink-0",title:t>0&&e>0?`${String(t)} adopted · ${String(e)} accessor${e===1?"y":"ies"}`:t>0?`${String(t)} adopted`:`${String(e)} accessor${e===1?"y":"ies"}`,children:["+",r]})}var Ci=240,zo=200;function rf({resolved:e}){const t=q(null),[r,n]=S(null);return m("span",{ref:t,className:"relative inline-flex items-center gap-1 cursor-help",onMouseEnter:()=>{const i=t.current;if(!i)return;const l=i.getBoundingClientRect();n({top:window.innerHeight-l.bottom>=zo?l.bottom+4:l.top-zo-4,left:Math.max(8,Math.min(l.left,window.innerWidth-Ci-8))})},onMouseLeave:()=>n(null),children:[e.map(i=>{const l=vi[i.feature];return l?o("span",{className:"inline-flex items-center justify-center h-4 w-4 rounded bg-surface-elevated/60 text-foreground-subtle",title:yi[i.feature]??i.feature,children:o(l,{className:"h-2.5 w-2.5"})},i.feature):null}),r&&kr(o(nf,{resolved:e,position:r}),document.body)]})}function nf({resolved:e,position:t}){return m("div",{style:{position:"fixed",top:t.top,left:t.left,width:Ci,pointerEvents:"none"},className:"z-[9999] rounded-md border border-border bg-surface shadow-lg shadow-black/30 p-2",children:[o("h5",{className:"text-[9px] font-semibold uppercase tracking-wider text-foreground-subtle mb-1.5",children:"Features"}),o("ul",{className:"space-y-0.5",children:e.map(r=>o(of,{entry:r},r.feature))})]})}function of({entry:e}){const t=vi[e.feature],r=yi[e.feature]??e.feature;return m("li",{className:"flex items-center justify-between gap-2 text-[10px]",children:[m("span",{className:"flex items-center gap-1.5 text-foreground",children:[t&&o(t,{className:"h-3 w-3 text-foreground-subtle"}),o("span",{children:r})]}),o(sf,{kind:e.kind})]})}function sf({kind:e}){return e==="marker"?o("span",{className:"text-[8.5px] px-1 rounded text-foreground-subtle",title:"Informational marker (no cap registered)",children:"marker"}):o("span",{className:N("text-[8.5px] px-1 rounded",e==="native"?"bg-success/15 text-success":"bg-primary/15 text-primary"),children:e})}function Mi({device:e,variant:t,flags:r,parent:n,integrationIcon:s,hasChildren:a,expanded:i,onToggleExpand:l,onNavigateToParent:c}){const d=bi(e);return m("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[r.showChildrenAccordion&&a?o("button",{type:"button",onClick:u=>{u.stopPropagation(),l()},className:"flex h-3.5 w-3.5 items-center justify-center text-foreground-subtle hover:text-foreground transition-colors flex-shrink-0","aria-label":i?"Collapse children":"Expand children","aria-expanded":i,children:i?o(pt,{className:"h-3 w-3"}):o(st,{className:"h-3 w-3"})}):r.showChildrenAccordion?o("span",{className:"h-3.5 w-3.5 flex-shrink-0"}):null,o(d,{className:N("text-foreground-subtle flex-shrink-0",t==="minimal"?"h-3 w-3":"h-3.5 w-3.5")}),m("div",{className:"flex-1 min-w-0",children:[m("div",{className:"flex items-center gap-1.5 min-w-0",children:[r.showIntegrationIcon&&s&&o("span",{className:"flex-shrink-0",children:s}),o("span",{className:N("font-semibold text-foreground truncate",t==="minimal"?"text-[10.5px]":"text-[11px]"),title:e.name,children:e.name})]}),(r.showId||r.showStableId)&&m("div",{className:"mt-0.5 flex items-center gap-1 text-[9px] text-foreground-subtle font-mono truncate",title:r.showStableId?`stableId: ${e.stableId}`:void 0,children:[r.showId&&m("span",{className:"flex-shrink-0 tabular-nums",children:["#",String(e.id)]}),r.showId&&r.showStableId&&o("span",{className:"flex-shrink-0 opacity-50",children:"·"}),r.showStableId&&o("span",{className:"truncate",children:Fp(e.stableId)})]}),r.showParentBadge&&n&&m("button",{type:"button",onClick:u=>{u.stopPropagation(),c(n.id)},className:"mt-0.5 inline-flex max-w-full items-center gap-1 text-[9px] text-foreground-subtle hover:text-primary transition-colors",title:`Open parent: ${n.name} (#${String(n.id)})`,children:[o(mn,{className:"h-2.5 w-2.5 shrink-0"}),m("span",{className:"truncate",children:["Under: ",n.name]})]})]})]})}function af(e,t){return Dp(e,t,r=>r.battery)??null}function lf(e,t){const r=Rr(e,t),n=q(!1),{data:s,isLoading:a,isFetching:i,refetch:l}=ms({queryKey:["device",t,"snapshot"],queryFn:()=>{if(!r)throw new Error("useDeviceSnapshotImage: device proxy not ready");const u=n.current;return n.current=!1,r.snapshot?.getSnapshot({force:u})??null},enabled:r!==null&&t!==null,staleTime:1e4,gcTime:1440*60*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1}),c=s?`data:${s.contentType};base64,${s.base64}`:null;function d(){n.current=!0,l()}return{src:c,loading:a||i,refresh:d}}function cf(e){return e<=10?lu:e<=30?iu:e>=95?au:Aa}function df(e,t){return t!=="none"?"text-emerald-400":e<=10?"text-rose-400":e<=30?"text-amber-400":"text-foreground-subtle"}function uf({status:e,variant:t="compact",className:r}){if(!e)return null;const n=cf(e.percentage),s=df(e.percentage,e.charging),a=e.charging==="solar"?Qa:e.charging==="dc"?Ru:null,i=e.sleeping;return m("span",{className:N("inline-flex items-center gap-1 text-[10px] font-medium",s,r),title:`Battery: ${Math.round(e.percentage)}%`+(e.charging!=="none"?` · charging (${e.charging})`:"")+(e.sleeping?" · sleeping":""),children:[o(n,{className:"h-3.5 w-3.5"}),m("span",{children:[Math.round(e.percentage),"%"]}),a&&o(a,{className:"h-3 w-3"}),i&&o(jn,{className:"h-3 w-3 text-blue-300"}),t==="full"&&e.charging!=="none"&&o("span",{className:"text-foreground-subtle",children:e.charging})]})}function Ei({trpc:e,device:t,status:r,enabled:n,showStatusPills:s=!1}){const a=lf(e,n&&t.online?t.id:null),i=(t.features??[]).includes("battery-operated"),l=s&&i&&!t.disabled,c=af(e,l?t.id:null);return!n&&!l?null:m("span",{className:"inline-flex items-center gap-1.5 flex-nowrap whitespace-nowrap",children:[l&&c&&o(uf,{status:c}),n&&o(pf,{deviceName:t.name,snapshotUrl:a.src,status:r})]})}var Ur=288,Fo=196,Vr=8;function pf({deviceName:e,snapshotUrl:t,status:r}){const n=q(null),[s,a]=S(null),i=r==="offline"||r==="disabled",l=()=>{const d=n.current;if(!d)return;const u=d.getBoundingClientRect(),f=u.top,h=window.innerHeight-u.bottom,g=f<Fo+Vr&&h>f,b=g?u.bottom+Vr:u.top-Fo-Vr,v=u.right-Ur;a({top:b,left:Math.max(8,Math.min(v,window.innerWidth-Ur-8)),placeBelow:g})},c=()=>a(null);return m(Ne,{children:[o("button",{ref:n,type:"button",onClick:d=>d.stopPropagation(),onMouseEnter:l,onMouseLeave:c,onFocus:l,onBlur:c,className:"flex h-6 w-6 items-center justify-center rounded text-foreground-subtle hover:bg-surface-hover hover:text-foreground transition-colors flex-shrink-0",title:"Preview","aria-label":"Preview snapshot",children:o(Mr,{className:"h-3.5 w-3.5"})}),s&&kr(m("div",{style:{position:"fixed",top:s.top,left:s.left,width:Ur,pointerEvents:"none"},className:"rounded-lg border border-border bg-surface shadow-lg shadow-black/30 z-[9999] overflow-hidden",children:[o("div",{className:"h-40 bg-background flex items-center justify-center",children:t&&!i?o("img",{src:t,alt:e,className:"h-full w-full object-cover"}):o("span",{className:"text-xs text-foreground-subtle",children:r==="offline"?"Offline — no snapshot":r==="disabled"?"Disabled":"No snapshot yet"})}),o("div",{className:"px-3 py-2",children:o("p",{className:"text-xs font-semibold text-foreground truncate",children:e})})]}),document.body)]})}function Ai({status:e}){const t=e==="disabled"?"bg-warning":e==="online"?"bg-success":"bg-danger",r=e==="disabled"?"Disabled":e==="online"?"Online":"Offline";return o("span",{className:N("h-1.5 w-1.5 rounded-full flex-shrink-0",t),title:r})}function xn(e){const{trpc:t,device:r,parent:n,integrationIcon:s,onNavigate:a,className:i}=e,l=Op(e),c=e.variant??"compact",d=e.view??"card",u=!r.disabled,f=r.isCamera??r.type.toLowerCase()==="camera",h=e.children??[],g=h.filter($o),b=h.filter(_=>!$o(_)),v=h.length>0,[x,y]=S(!1),w=e.expanded??x,k=e.onToggleExpand??(()=>y(_=>!_)),M=_=>{a?.(_)},C=e.indentLevel??(e.isAccessoryRow?2:0),A=u?r.online?"online":"offline":"disabled";return d==="table"?o(mf,{trpc:t,device:r,variant:c,flags:l,parent:n??null,integrationIcon:s??null,accessoryCount:g.length,adoptedCount:b.length,hasChildren:v,expanded:w,onToggleExpand:k,onNavigate:M,displayStatus:A,isCamera:f,showSnapshot:l.showSnapshot&&f,isAccessoryRow:e.isAccessoryRow??!1,indentLevel:C,className:i}):m("div",{className:N("rounded-lg border border-border bg-surface transition-colors",!u&&"opacity-60",i),children:[m("div",{onClick:()=>M(r.id),className:N("flex items-center gap-2 cursor-pointer hover:border-foreground-subtle/30 w-full",c==="minimal"?"px-2.5 py-1.5":"px-3 py-2.5"),children:[o(Mi,{device:r,variant:c,flags:l,parent:n??null,integrationIcon:s??null,hasChildren:v,expanded:w,onToggleExpand:k,onNavigateToParent:M}),o(Si,{trpc:t,device:r,flags:l,accessoryCount:g.length,adoptedCount:b.length,showFeatureRow:!1}),o(Ei,{trpc:t,device:r,status:A,enabled:l.showSnapshot&&f,showStatusPills:!0}),o(Ni,{trpc:t,device:r,flags:l}),o(Ai,{status:A})]}),w&&v&&o(jp,{trpc:t,accessoryChildren:g,adoptedChildren:b,onNavigate:M})]})}var ff={0:"pl-2",1:"pl-6",2:"pl-8"};function mf(e){const{trpc:t,device:r,variant:n,flags:s,parent:a,integrationIcon:i,accessoryCount:l,adoptedCount:c,hasChildren:d,expanded:u,onToggleExpand:f,onNavigate:h,displayStatus:g,isCamera:b,showSnapshot:v,isAccessoryRow:x,indentLevel:y,className:w}=e;return m("tr",{onClick:()=>h(r.id),className:N("cursor-pointer hover:bg-surface-hover transition-colors",!s.showChildrenAccordion&&"border-b border-border-subtle/40",x&&"bg-foreground-subtle/[0.03]",w),children:[o("td",{className:N("py-2 align-middle pr-2",ff[y]),children:o(Mi,{device:r,variant:n,flags:s,parent:a,integrationIcon:i,hasChildren:d,expanded:u,onToggleExpand:f,onNavigateToParent:h})}),o("td",{className:"px-2 py-2 align-middle text-[10px] text-foreground-subtle whitespace-nowrap",children:r.type}),o("td",{className:"px-2 py-2 align-middle",children:o(Si,{trpc:t,device:r,flags:s,accessoryCount:l,adoptedCount:c,showFeatureRow:!0})}),o("td",{className:"px-2 py-2 align-middle",children:o(Ei,{trpc:t,device:r,status:g,enabled:v&&b,showStatusPills:!0})}),o("td",{className:"px-2 py-2 align-middle text-right whitespace-nowrap",children:m("span",{className:"inline-flex items-center gap-1.5",children:[o(Ni,{trpc:t,device:r,flags:s}),o(Ai,{status:g})]})})]})}function hf(e,t){const[r,n]=S(e);return H(()=>{const s=setTimeout(()=>n(e),t);return()=>clearTimeout(s)},[e,t]),r}var gf=new Set(["hub","nvr"]);function bf(e){const t=new Map;for(const s of e)t.set(s.id,s);const r=[],n=new Map;for(const s of e){const a=s.parentDeviceId;if(a==null){r.push(s);continue}const i=t.get(a);if(!i){r.push(s);continue}const l=s.role!==null&&s.role!==void 0;if(gf.has(i.type)&&!l){r.push(s);continue}const c=n.get(a);c?c.push(s):n.set(a,[s])}return{topLevel:r,accessoriesByParent:n}}var jo=2;function vf(e,t){if(t<=1)return[{kind:"page",n:1}];if(t<=7){const a=[];for(let i=1;i<=t;i++)a.push({kind:"page",n:i});return a}const r=[],n=Math.max(2,e-jo),s=Math.min(t-1,e+jo);r.push({kind:"page",n:1}),n>2&&r.push({kind:"ellipsis",side:"left"});for(let a=n;a<=s;a++)r.push({kind:"page",n:a});return s<t-1&&r.push({kind:"ellipsis",side:"right"}),r.push({kind:"page",n:t}),r}function yf({currentPage:e,totalItems:t,pageSize:r,onPageChange:n,itemNoun:s="devices"}){if(t<=r)return null;const a=Math.ceil(t/r),i=(e-1)*r+1,l=Math.min(e*r,t),c=vf(e,a);return m("div",{className:"flex items-center justify-between gap-4 flex-wrap pt-2 text-[11px] text-foreground-subtle",children:[m("span",{children:["Showing ",i,"–",l," of ",t," ",s]}),m("span",{className:"inline-flex items-center gap-1",children:[o("button",{type:"button","aria-label":"Previous page",disabled:e===1,onClick:()=>n(e-1),className:N("inline-flex items-center justify-center h-7 w-7 rounded border border-border bg-surface text-foreground-subtle","hover:text-foreground hover:bg-surface-hover transition-colors","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-surface"),children:o(pu,{className:"h-3 w-3"})}),c.map((d,u)=>d.kind==="ellipsis"?o("span",{className:"px-1 text-foreground-subtle/60 select-none",children:"…"},`e-${u}`):o("button",{type:"button",onClick:()=>n(d.n),className:N("inline-flex items-center justify-center h-7 min-w-7 px-1.5 rounded border text-[10.5px] font-medium transition-colors",d.n===e?"border-primary/40 bg-primary/10 text-primary":"border-border bg-surface text-foreground-subtle hover:text-foreground hover:bg-surface-hover"),children:d.n},`p-${d.n}`)),o("button",{type:"button","aria-label":"Next page",disabled:e===a,onClick:()=>n(e+1),className:N("inline-flex items-center justify-center h-7 w-7 rounded border border-border bg-surface text-foreground-subtle","hover:text-foreground hover:bg-surface-hover transition-colors","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-surface"),children:o(st,{className:"h-3 w-3"})})]})]})}function xf({view:e,onViewChange:t,types:r,currentType:n,onTypeChange:s,addons:a,currentAddon:i,onAddonChange:l,hideAddons:c=!1}){return m("div",{className:"flex items-center gap-2 flex-wrap",children:[m("span",{className:"inline-flex border border-border rounded-md overflow-hidden",children:[o("button",{type:"button",onClick:()=>t("cards"),className:N("inline-flex items-center justify-center h-7 w-8 transition-colors",e==="cards"?"bg-primary/10 text-primary":"bg-surface text-foreground-subtle hover:text-foreground hover:bg-surface-hover"),"aria-label":"Cards view",children:o(Mu,{className:"h-3.5 w-3.5"})}),o("button",{type:"button",onClick:()=>t("table"),className:N("inline-flex items-center justify-center h-7 w-8 border-l border-border transition-colors",e==="table"?"bg-primary/10 text-primary":"bg-surface text-foreground-subtle hover:text-foreground hover:bg-surface-hover"),"aria-label":"Table view",children:o(ju,{className:"h-3.5 w-3.5"})})]}),r&&r.length>0&&m(Ne,{children:[o(Go,{children:"Type"}),o(qr,{active:n===null,onClick:()=>s(null),children:"All"}),r.map(d=>o(qr,{active:n===d,onClick:()=>s(n===d?null:d),children:wf(d)},d))]}),!c&&a&&a.length>0&&m(Ne,{children:[o(Go,{children:"Integration"}),a.map(d=>o(qr,{active:i===d.id,icon:d.icon,onClick:()=>l(i===d.id?null:d.id),showClearIcon:i===d.id,children:d.name},d.id))]})]})}function Go({children:e}){return o("span",{className:"text-[10px] font-medium uppercase tracking-wider text-foreground-subtle ml-1",children:e})}function qr({active:e,icon:t,onClick:r,showClearIcon:n,children:s}){return m("button",{type:"button",onClick:r,className:N("inline-flex items-center gap-1.5 h-7 px-2.5 rounded-full border text-[10.5px] font-medium transition-colors",e?"border-primary/40 bg-primary/15 text-primary":"border-border bg-surface text-foreground-subtle hover:text-foreground hover:bg-surface-hover"),children:[t&&o("span",{className:"inline-flex items-center",children:t}),o("span",{children:s}),e&&n&&o(Ie,{className:"h-2.5 w-2.5 opacity-70"})]})}function wf(e){return e.length===0?e:e[0].toUpperCase()+e.slice(1)}function kf({variant:e,onClearFilters:t}){return m("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[o(Su,{className:"h-8 w-8 text-foreground-subtle/40 mb-3"}),o("p",{className:"text-sm font-medium text-foreground-subtle",children:e==="filtered"?"No devices match the current filters":"No devices yet"}),e==="filtered"&&t&&o("button",{type:"button",onClick:t,className:"mt-2 text-[11px] text-primary hover:underline",children:"Clear filters"})]})}function Ve(e,t){if(e==="root")return t;switch(t){case"view":return"deviceView";case"page":return"devicePage";case"type":return"deviceType";case"q":return"deviceQ";case"addon":return"deviceAddon"}}function Qo(e){try{const t=localStorage.getItem(`camstack:${e}:lastFilters`);if(!t)return{};const r=JSON.parse(t);return typeof r!="object"||r===null?{}:r}catch{return{}}}function Nf(e,t){try{localStorage.setItem(`camstack:${e}:lastFilters`,JSON.stringify(t))}catch{}}function Ho(e,t,r){const n=new URLSearchParams(window.location.search),s=n.get(Ve(e,"view")),a=s==="cards"||s==="table"?s:r.view??t,i=n.get(Ve(e,"page")),l=i?parseInt(i,10):1;return{view:a,page:Number.isFinite(l)&&l>=1?l:1,addon:n.get(Ve(e,"addon"))??r.addon??null,type:n.get(Ve(e,"type"))??r.type??null,q:n.get(Ve(e,"q"))??r.q??""}}function Sf(e,t,r){const n=new URLSearchParams(window.location.search),s=(l,c)=>{c===null||c===""?n.delete(l):n.set(l,c)};s(Ve(e,"view"),t.view===r?null:t.view),s(Ve(e,"page"),t.page===1?null:String(t.page)),s(Ve(e,"addon"),t.addon),s(Ve(e,"type"),t.type),s(Ve(e,"q"),t.q||null);const a=n.toString(),i=a?`${window.location.pathname}?${a}`:window.location.pathname;window.history.replaceState(null,"",i)}function Cf(e){const{scope:t,defaultView:r,lsKey:n}=e,[s,a]=S(()=>Ho(t,r,Qo(n))),i=q(s);i.current=s,H(()=>{const c=()=>{const d=Ho(t,r,Qo(n));i.current=d,a(d)};return window.addEventListener("popstate",c),()=>window.removeEventListener("popstate",c)},[t,r,n]);const l=I(c=>{const d=c(i.current);i.current=d,a(d),Sf(t,d,r),Nf(n,{view:d.view,addon:d.addon,type:d.type,q:d.q})},[t,r,n]);return{state:s,setView:I(c=>l(d=>({...d,view:c})),[l]),setPage:I(c=>l(d=>({...d,page:c})),[l]),setAddon:I(c=>l(d=>({...d,addon:c,page:1})),[l]),setType:I(c=>l(d=>({...d,type:c,page:1})),[l]),setQ:I(c=>l(d=>({...d,q:c,page:1})),[l]),clearFilters:I(()=>l(c=>({...c,addon:null,type:null,q:"",page:1})),[l])}}var Mf={cards:24,table:50};function jb(e){const{devices:t,trpc:r,defaultView:n="table",filters:s,forceAddon:a,resolveIntegrationIcon:i,resolveParent:l,onNavigate:c,pageSize:d=Mf,urlScope:u="root",lsKey:f=u==="root"?"devices":"integrations:nested"}=e,h=Cf({scope:u,defaultView:n,lsKey:f}),g=h.state.view,b=g==="cards"?d.cards:d.table,[v,x]=S(h.state.q),y=hf(v,300);H(()=>{y!==h.state.q&&h.setQ(y)},[y]);const w=a??h.state.addon,k=re(()=>{const de=h.state.q.toLowerCase().trim();return t.filter(pe=>!(w&&pe.addonId!==w||h.state.type&&pe.type!==h.state.type||de&&!pe.name.toLowerCase().includes(de)&&!pe.stableId.toLowerCase().includes(de)))},[t,w,h.state.type,h.state.q]),M=re(()=>bf(k),[k]),C=re(()=>{if(h.state.q.trim()==="")return new Set;const de=h.state.q.toLowerCase().trim(),pe=new Set;for(const[ie,ne]of M.accessoriesByParent.entries())ne.some(W=>W.name.toLowerCase().includes(de)||W.stableId.toLowerCase().includes(de))&&pe.add(ie);return pe},[M.accessoriesByParent,h.state.q]),A=M.topLevel.length,_=Math.max(1,Math.ceil(A/b)),P=Math.min(h.state.page,_),Q=(P-1)*b,oe=M.topLevel.slice(Q,Q+b);H(()=>{P!==h.state.page&&h.setPage(P)},[P]),If();const le=w!=null||h.state.type!==null||h.state.q!=="",ge=A===0;return m("div",{className:"flex flex-col gap-3",children:[m("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[o(xf,{view:g,onViewChange:h.setView,types:s?.types,currentType:h.state.type,onTypeChange:h.setType,addons:s?.addons,currentAddon:h.state.addon,onAddonChange:h.setAddon,hideAddons:a!==void 0}),m("div",{className:"relative",children:[o(Gt,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-foreground-subtle pointer-events-none"}),o("input",{type:"text",value:v,onChange:de=>x(de.target.value),placeholder:"Search by name or stableId","aria-label":"Search devices by name or stableId",className:"h-7 pl-7 pr-2.5 rounded-md border border-border bg-surface text-[11px] text-foreground placeholder:text-foreground-subtle/60 focus:outline-none focus:ring-1 focus:ring-primary/40 w-56"})]})]}),ge?o(kf,{variant:le?"filtered":"nofilter",onClearFilters:le?h.clearFilters:void 0}):g==="cards"?o(Ef,{rows:oe,accessoriesByParent:M.accessoriesByParent,trpc:r,resolveIntegrationIcon:i??null,resolveParent:l??null,onNavigate:c??null}):o(Rf,{rows:oe,accessoriesByParent:M.accessoriesByParent,autoExpandedParents:C,devices:k,trpc:r,resolveIntegrationIcon:i??null,resolveParent:l??null,onNavigate:c??null}),o(yf,{currentPage:P,totalItems:A,pageSize:b,onPageChange:h.setPage}),a===void 0&&le&&A>0&&m("p",{className:"text-[11px] text-foreground-subtle",children:["Showing ",A," of ",t.length," devices",w&&m(Ne,{children:[" ","· filtered by"," ",o("strong",{className:"text-primary",children:s?.addons?.find(de=>de.id===w)?.name??w})]})]})]})}function Ef({rows:e,accessoriesByParent:t,trpc:r,resolveIntegrationIcon:n,resolveParent:s,onNavigate:a}){return o("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:e.map(i=>{const l=t.get(i.id)??[];return o(xn,{trpc:r,device:i,view:"card",integrationIcon:n?.(i.addonId)??null,parent:i.parentDeviceId!==null?s?.(i.parentDeviceId)??null:null,children:l,onNavigate:a??void 0},i.id)})})}var Af=new Set(["hub","nvr"]);function Pf(e,t){return e.parentDeviceId===null||t===null?0:Af.has(t.toLowerCase())?1:0}function Rf({rows:e,accessoriesByParent:t,autoExpandedParents:r,devices:n,trpc:s,resolveIntegrationIcon:a,resolveParent:i,onNavigate:l}){const c=re(()=>{const d=new Map;for(const u of n)d.set(u.id,u.type);return d},[n]);return o("div",{className:"rounded-lg border border-border bg-surface overflow-hidden",children:m("table",{className:"w-full border-collapse",children:[o("thead",{children:m("tr",{className:"border-b border-border",children:[o("th",{className:"text-left px-2 py-2 text-[9.5px] font-medium uppercase tracking-wider text-foreground-subtle",children:"Name"}),o("th",{className:"text-left px-2 py-2 text-[9.5px] font-medium uppercase tracking-wider text-foreground-subtle w-24",children:"Type"}),o("th",{className:"text-left px-2 py-2 text-[9.5px] font-medium uppercase tracking-wider text-foreground-subtle w-32",children:"Features"}),o("th",{className:"text-left px-2 py-2 text-[9.5px] font-medium uppercase tracking-wider text-foreground-subtle w-20",children:"Preview"}),o("th",{className:"text-right px-2 py-2 text-[9.5px] font-medium uppercase tracking-wider text-foreground-subtle w-32",children:"Actions"})]})}),o("tbody",{children:e.map(d=>{const u=t.get(d.id)??[],f=u.length>0,h=r.has(d.id),g=d.parentDeviceId!==null?i?.(d.parentDeviceId)??null:null,b=d.parentDeviceId!==null?c.get(d.parentDeviceId)??null:null;return o(_f,{parent:d,accessories:u,hasAccessories:f,forceExpanded:h,trpc:s,integrationIcon:a?.(d.addonId)??null,parentRowParent:g,indentLevel:Pf(d,b),onNavigate:l??null},d.id)})})]})})}function _f({parent:e,accessories:t,hasAccessories:r,forceExpanded:n,trpc:s,integrationIcon:a,parentRowParent:i,indentLevel:l,onNavigate:c}){const[d,u]=S(n),f=q(n);return H(()=>{f.current!==n&&(u(n),f.current=n)},[n]),m(Ne,{children:[o(xn,{trpc:s,device:e,view:"table",integrationIcon:a,parent:i,children:t,onNavigate:c??void 0,showChildrenAccordion:r,expanded:d,onToggleExpand:()=>u(g=>!g),indentLevel:l}),r&&d&&t.map(g=>o(xn,{trpc:s,device:g,view:"table",integrationIcon:null,parent:null,isAccessoryRow:!0,showChildrenAccordion:!1,onNavigate:c??void 0},g.id))]})}function If(){Rn()}function Gb({options:e,value:t,onChange:r}){return o("div",{className:"flex flex-wrap gap-2",children:e.map(n=>{const s=n.id===t;return m("button",{onClick:()=>n.available&&r(n.id),disabled:!n.available,className:`flex items-center gap-2 rounded-lg border px-3 py-2 text-xs font-medium transition-all ${s?"border-primary/40 bg-primary/10 text-primary":n.available?"border-border bg-surface text-foreground-subtle hover:bg-surface-hover hover:text-foreground":"border-border/40 bg-surface/40 text-foreground-subtle/40 cursor-not-allowed"}`,children:[o(xu,{className:"h-3.5 w-3.5 shrink-0"}),n.label,n.isBest&&m("span",{className:"inline-flex items-center gap-0.5 rounded-full bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-amber-400",children:[o(Fu,{className:"h-2.5 w-2.5"}),"Best"]}),n.platformScore!=null&&m("span",{className:"text-[10px] text-foreground-subtle/60",children:["(",n.platformScore,")"]}),o("span",{className:`h-1.5 w-1.5 rounded-full ${n.available?"bg-success":"bg-danger"}`})]},n.id)})})}function Tf(e,t){const r=new Set(t.slots.flatMap(i=>i.addons.map(l=>l.id))),n=[];function s(i){if(!r.has(i.addonId))return n.push(`Addon "${i.addonId}" is no longer available — step removed`),null;const l=t.slots.flatMap(u=>u.addons).find(u=>u.id===i.addonId);let c=i.modelId;if(l&&!l.models.some(u=>u.id===c)){const u=l.defaultModelId;n.push(`Model "${c}" not available for ${i.addonId} — using "${u}"`),c=u}const d=i.children.map(u=>s(u)).filter(u=>u!==null);return{...i,modelId:c,children:d}}const a=e.map(i=>s(i)).filter(i=>i!==null);return{valid:n.length===0,steps:a,warnings:n}}function Df(e){const t=new Map;for(const r of e.slots)for(const n of r.addons)t.set(n.id,n);return t}function Wr(e){return{addonId:e.id,addonName:e.name,slot:e.slot,inputClasses:[...e.inputClasses],outputClasses:[...e.outputClasses],enabled:!0,modelId:e.defaultModelId,children:[]}}function Kr({addon:e,onClick:t}){return o("button",{type:"button",onClick:t,className:"w-full rounded-lg border border-dashed border-border/60 px-3 py-2.5 text-left transition-all hover:border-primary/30 hover:bg-surface/60 group",children:m("div",{className:"flex items-center gap-3",children:[o(bu,{className:"h-[18px] w-[18px] text-foreground-subtle/30 group-hover:text-primary/60 shrink-0"}),m("div",{className:"flex-1 min-w-0",children:[o("span",{className:"text-[13px] font-medium text-foreground-subtle/50 group-hover:text-foreground-subtle block truncate",children:e.name}),m("div",{className:"flex items-center gap-1 mt-0.5 flex-wrap",children:[e.inputClasses.map(r=>o("span",{className:"text-[9px] uppercase font-semibold tracking-wide px-1.5 py-0.5 rounded bg-blue-500/8 text-blue-400/50",children:r},r)),e.inputClasses.length>0&&e.outputClasses.length>0&&o("span",{className:"text-foreground-subtle/25 text-[10px]",children:"→"}),e.outputClasses.map(r=>o("span",{className:"text-[9px] uppercase font-semibold tracking-wide px-1.5 py-0.5 rounded bg-green-500/8 text-green-400/50",children:r},r))]})]})]})})}function Qb({schema:e,steps:t,onChange:r,templates:n,selectedTemplateId:s,onSelectTemplate:a,onSaveTemplate:i,onUpdateTemplate:l,onDeleteTemplate:c,readOnly:d=!1,excludeAddons:u=[],hideTemplates:f=!1,showOnlyEnabled:h=!1,showSlotLabels:g=!1,toggleMode:b="simple",overrides:v={},onOverrideChange:x,inheritedEnabledByAddon:y={},hideModelAndSettings:w=!1}){const k=z=>({toggleMode:b,hideModelAndSettings:w,...b==="threeState"?{overrideState:v[z]!==void 0?v[z]:null,onOverrideChange:x?B=>x(z,B):void 0,inheritedEnabled:y[z]}:{}}),M=re(()=>new Set(u),[u]),C=re(()=>Df(e),[e]),[A,_]=S([]),P=s?JSON.stringify(t)!==JSON.stringify(n.find(z=>z.id===s)?.steps):!1;function Q(z){const B=z.target.value||null;if(B){const se=n.find(U=>U.id===B);se&&_([...Tf(se.steps,e).warnings])}else _([]);a(B)}function oe(){s&&l(s,t)}function le(){const z=window.prompt("Template name:");z?.trim()&&i(z.trim(),t)}function ge(){if(!s)return;const z=n.find(B=>B.id===s);z&&window.confirm(`Delete template "${z.name}"?`)&&c(s)}function de(z){r(t.map(B=>B.addonId!==z.addonId?B:pe(z)))}function pe(z){const B=z.children.some(se=>se.enabled||se.children.some(U=>U.enabled));return{...z,enabled:z.enabled||B,children:z.children.map(se=>{const U=se.children.some(K=>K.enabled);return{...se,enabled:se.enabled||U}})}}function ie(z,B){const se=Wr(B);r(t.map(U=>U.addonId!==z?U:{...U,children:[...U.children,se]}))}function ne(z){const B=new Set;for(const se of z){B.add(se.addonId);for(const K of se.children)B.add(K.addonId);const U=ne(se.children);for(const K of U)B.add(K)}return B}const W=ne(t);function ye(z){const B=C.get(z.addonId);if(!B)return[];const se=e.slots.find(G=>G.id===B.slot)?.parentSlot==null,U=B.childSlots,K=new Set(z.children.map(G=>G.addonId)),Z=[];for(const G of e.slots)if(U.includes(G.id))for(const te of G.addons){if(K.has(te.id)||M.has(te.id))continue;const Y=te.inputClasses.length===0;Y&&!se||(Y||te.inputClasses.some(Pe=>z.outputClasses.includes(Pe)))&&Z.push(te)}return Z}function me(z){const B=h?{...z,children:z.children.filter(U=>U.enabled).map(U=>({...U,children:U.children.filter(K=>K.enabled)}))}:z,se=h?[]:ye(B);return m("div",{className:"space-y-1.5",children:[o(Gr,{step:B,schema:C.get(B.addonId)??null,allSchemas:C,onChange:de,onDelete:d?void 0:U=>r(t.filter(K=>K.addonId!==U)),readOnly:d,...k(B.addonId)}),(B.children.length>0||se.length>0)&&m("div",{className:"ml-4 pl-3 border-l border-border/60 space-y-1.5",children:[g&&o("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-foreground-subtle/40",children:"Slot: Cropper / Classifier"}),B.children.map(U=>{const K=ye(U);return m("div",{className:"space-y-1.5",children:[o(Gr,{step:U,schema:C.get(U.addonId)??null,allSchemas:C,depth:1,onChange:Z=>{de({...B,children:B.children.map(G=>G.addonId===Z.addonId?Z:G)})},onDelete:d?void 0:Z=>{de({...B,children:B.children.filter(G=>G.addonId!==Z)})},readOnly:d,...k(U.addonId)}),(U.children.length>0||K.length>0)&&m("div",{className:"ml-4 pl-3 border-l border-border/40 space-y-1.5",children:[g&&o("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-foreground-subtle/30",children:"Slot: Recognizer"}),U.children.map(Z=>o(Gr,{step:Z,schema:C.get(Z.addonId)??null,allSchemas:C,depth:2,onChange:G=>{de({...B,children:B.children.map(te=>te.addonId===U.addonId?{...te,children:te.children.map(Y=>Y.addonId===G.addonId?G:Y)}:te)})},onDelete:d?void 0:G=>{de({...B,children:B.children.map(te=>te.addonId===U.addonId?{...te,children:te.children.filter(Y=>Y.addonId!==G)}:te)})},readOnly:d,...k(Z.addonId)},Z.addonId)),!d&&K.map(Z=>o(Kr,{addon:Z,onClick:()=>{const G=Wr(Z);de({...B,children:B.children.map(te=>te.addonId===U.addonId?{...te,children:[...te.children,G]}:te)})}},Z.id))]})]},U.addonId)}),!d&&se.map(U=>o(Kr,{addon:U,onClick:()=>ie(B.addonId,U)},U.id))]})]},B.addonId)}const T=e.slots.filter(z=>z.parentSlot===null).sort((z,B)=>z.priority-B.priority);return m("div",{className:"space-y-4",children:[!f&&o("div",{className:"rounded-lg border border-border bg-surface p-3",children:m("div",{className:"flex items-center gap-2",children:[o("div",{className:"relative flex-1 min-w-0",children:m("select",{value:s??"",onChange:Q,className:"w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground focus:outline-none focus:border-primary/50",children:[o("option",{value:"",children:"No template"}),n.map(z=>o("option",{value:z.id,children:z.name},z.id))]})}),P&&o("span",{className:"h-1.5 w-1.5 rounded-full bg-amber-500 shrink-0"}),o("button",{onClick:oe,disabled:!s||d,title:"Save",className:N("p-2 rounded-lg border border-border transition-colors",s&&!d?"text-foreground-subtle hover:bg-surface-hover":"text-foreground-subtle/30 cursor-not-allowed"),children:o(Tu,{className:"h-4 w-4"})}),o("button",{onClick:le,disabled:d,title:"Save As",className:N("p-2 rounded-lg border border-border transition-colors",d?"text-foreground-subtle/30 cursor-not-allowed":"text-foreground-subtle hover:bg-surface-hover"),children:o(yu,{className:"h-4 w-4"})}),o("button",{onClick:ge,disabled:!s||d,title:"Delete",className:N("p-2 rounded-lg border border-border transition-colors",s&&!d?"text-foreground-subtle hover:text-danger":"text-foreground-subtle/30 cursor-not-allowed"),children:o(Ye,{className:"h-4 w-4"})})]})}),A.length>0&&m("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-3 text-xs text-amber-400 space-y-1",children:[m("div",{className:"flex items-center justify-between",children:[o("span",{className:"font-medium",children:"Template loaded with warnings:"}),o("button",{onClick:()=>_([]),className:"text-amber-400/60 hover:text-amber-400",children:o(Ie,{className:"h-3.5 w-3.5"})})]}),A.map((z,B)=>m("div",{children:["• ",z]},B))]}),T.map(z=>{const B=t.filter(G=>G.slot===z.id&&!M.has(G.addonId)),se=h?B.filter(G=>G.enabled):B,U=h?[]:z.addons.filter(G=>!W.has(G.id)&&!M.has(G.id)),K=new Map,Z=[];for(const G of se)G.group?(K.has(G.group)||K.set(G.group,[]),K.get(G.group).push(G)):Z.push(G);return m("div",{className:"space-y-2",children:[g&&m("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-foreground-subtle/50",children:["Slot: ",z.label]}),Z.map(G=>me(G)),[...K.entries()].map(([G,te])=>m("div",{className:"space-y-2 rounded-lg border border-border/40 p-2",children:[o("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-foreground-subtle/50 px-1",children:G}),te.map(Y=>me(Y))]},G)),!d&&U.map(G=>o(Kr,{addon:G,onClick:()=>{r([...t,Wr(G)])}},G.id))]},z.id)})]})}var er={person:"#3b82f6",vehicle:"#f59e0b",animal:"#22c55e",face:"#a855f7",plate:"#ec4899",bird:"#14b8a6",dog:"#84cc16",cat:"#f97316",car:"#f59e0b",truck:"#d97706",bus:"#b45309",motorcycle:"#eab308",bicycle:"#ca8a04",motion:"#facc15"},Uo=["#ef4444","#8b5cf6","#06b6d4","#f97316","#10b981","#6366f1","#e11d48","#0891b2","#7c3aed","#059669"],Hb="#f59e42";function Be(e,t){if(t?.[e])return t[e];if(t?.[e.toLowerCase()])return t[e.toLowerCase()];if(er[e])return er[e];if(er[e.toLowerCase()])return er[e.toLowerCase()];let r=0;for(let n=0;n<e.length;n++)r=r*31+(e.codePointAt(n)??0)>>>0;return Uo[r%Uo.length]??"#f59e42"}function Ub({src:e,imageWidth:t,imageHeight:r,detections:n=[],classColors:s,aspectRatio:a,className:i,placeholder:l,showConfidence:c=!0,minConfidence:d=0,borderWidth:u=2}){function f(y){return Be(y,s)}const h=a??(t&&r?`${t}/${r}`:"16/9"),g=n.filter(y=>y.score>=d),b=g.filter(y=>y.kind==="first-level"),v=g.filter(y=>y.kind==="detail"),x=$f(v,y=>y.parentId??"");return o("div",{className:N("rounded-lg border border-border bg-surface overflow-hidden relative",i),style:{aspectRatio:h},children:e?m(Ne,{children:[o("img",{src:e,className:"absolute inset-0 w-full h-full object-fill",alt:""}),g.map((y,w)=>y.debug?.mask&&y.debug.maskWidth&&y.debug.maskHeight?o(Lf,{mask:y.debug.mask,maskWidth:y.debug.maskWidth,maskHeight:y.debug.maskHeight,bbox:y.bbox,imageWidth:t,imageHeight:r,color:f(y.macroClass)},`mask-${w}`):null),b.map(y=>{const w=x.get(y.id)??[];return o(Vo,{detection:y,imageWidth:t,imageHeight:r,color:f(y.macroClass),showConfidence:c,borderWidth:y.debug?.mask?1:u,children:w.map(k=>o(Of,{child:k,parentBbox:y.bbox,color:f(k.macroClass),showConfidence:c},`child-${k.id}`))},`det-${y.id}`)}),v.filter(y=>!y.parentId||!b.some(w=>w.id===y.parentId)).map(y=>o(Vo,{detection:y,imageWidth:t,imageHeight:r,color:f(y.macroClass),showConfidence:c,borderWidth:u},`orphan-${y.id}`))]}):o("div",{className:"w-full h-full flex items-center justify-center text-foreground-subtle text-sm",children:l??"No image loaded"})})}function Vo({detection:e,imageWidth:t,imageHeight:r,color:n,showConfidence:s,borderWidth:a,children:i}){const{x:l,y:c,width:d,height:u}=e.bbox,f=m("div",{className:"absolute left-0 flex flex-col items-start gap-px",style:{bottom:"100%",marginBottom:"2px"},children:[m("span",{className:"text-[10px] px-1 rounded-sm whitespace-nowrap text-white",style:{backgroundColor:n},children:[e.macroClass,s&&` ${(e.score*100).toFixed(0)}%`]}),e.labels.map((h,g)=>m("span",{className:"text-[9px] font-semibold px-1 rounded-sm whitespace-nowrap text-white",style:{backgroundColor:Be(h.label)},children:[h.label," ",(h.score*100).toFixed(0),"%"]},`${e.id}-lbl-${g}`))]});return m("div",{className:"absolute rounded-sm",style:{left:`${l/t*100}%`,top:`${c/r*100}%`,width:`${d/t*100}%`,height:`${u/r*100}%`,borderWidth:`${a}px`,borderStyle:"solid",borderColor:n},children:[f,i]})}function Lf({mask:e,maskWidth:t,maskHeight:r,bbox:n,imageWidth:s,imageHeight:a,color:i}){const l=q(null);return H(()=>{const c=l.current;if(!c)return;const d=c.getContext("2d");if(!d)return;const u=atob(e),f=new Uint8Array(u.length);for(let y=0;y<u.length;y++)f[y]=u.charCodeAt(y);const h=parseInt(i.slice(1,3),16),g=parseInt(i.slice(3,5),16),b=parseInt(i.slice(5,7),16);c.width=t,c.height=r;const v=d.createImageData(t,r),x=t*r;for(let y=0;y<x;y++){const w=y<f.length?f[y]:0,k=y*4;w>0&&(v.data[k]=h,v.data[k+1]=g,v.data[k+2]=b,v.data[k+3]=120)}d.putImageData(v,0,0)},[e,t,r,i]),o("canvas",{ref:l,className:"absolute pointer-events-none",style:{left:`${n.x/s*100}%`,top:`${n.y/a*100}%`,width:`${n.width/s*100}%`,height:`${n.height/a*100}%`,imageRendering:"pixelated"}})}function Of({child:e,parentBbox:t,color:r,showConfidence:n}){if(t.width<=0||t.height<=0)return null;const s=(e.bbox.x-t.x)/t.width*100,a=(e.bbox.y-t.y)/t.height*100,i=e.bbox.width/t.width*100,l=e.bbox.height/t.height*100;return o("div",{className:"absolute rounded-sm",style:{left:`${Math.max(0,s)}%`,top:`${Math.max(0,a)}%`,width:`${Math.min(100,i)}%`,height:`${Math.min(100,l)}%`,borderWidth:"1px",borderStyle:"solid",borderColor:r},children:m("div",{className:"absolute left-0 flex flex-col items-start gap-px",style:{bottom:"100%",marginBottom:"1px"},children:[m("span",{className:"text-[9px] px-0.5 rounded-sm whitespace-nowrap text-white",style:{backgroundColor:r},children:[e.macroClass,n&&` ${(e.score*100).toFixed(0)}%`]}),e.labels.map((c,d)=>m("span",{className:"text-[8px] font-semibold px-0.5 rounded-sm whitespace-nowrap text-white",style:{backgroundColor:Be(c.label)},children:[c.label," ",(c.score*100).toFixed(0),"%"]},`${e.id}-lbl-${d}`))]})})}function $f(e,t){const r=new Map;for(const n of e){const s=t(n),a=r.get(s)??[];a.push(n),r.set(s,a)}return r}function Vb({detections:e,classColors:t,className:r,hiddenKeys:n,onToggleVisibility:s}){const a=t;if(e.length===0)return o("div",{className:"text-sm text-foreground-subtle italic text-center py-4",children:"No detections"});const i=e.filter(u=>u.kind==="first-level"),l=e.filter(u=>u.kind==="detail"),c=new Map;for(const u of l){if(!u.parentId)continue;const f=c.get(u.parentId)??[];f.push(u),c.set(u.parentId,f)}const d=l.filter(u=>!u.parentId||!i.some(f=>f.id===u.parentId));return m("div",{className:r,children:[m("div",{className:"text-xs font-medium text-foreground-subtle uppercase tracking-wide mb-2",children:["Detections (",e.length,")"]}),m("div",{className:"space-y-2",children:[i.map(u=>o(qo,{detection:u,children_:c.get(u.id)??[],colors:a,hiddenKeys:n,onToggleVisibility:s},u.id)),d.map(u=>o(qo,{detection:u,children_:[],colors:a,hiddenKeys:n,onToggleVisibility:s},u.id))]})]})}function qo({detection:e,children_:t,colors:r,hiddenKeys:n,onToggleVisibility:s}){const a=Be(e.macroClass,r),i=!n?.has(e.id),l=e.debug?.mask,c=e.debug?.maskWidth,d=e.debug?.maskHeight,u=e.debug?.alternateLabels;return m("div",{className:`rounded-md border border-border bg-surface p-3 space-y-1 ${i?"":"opacity-40"}`,children:[m("div",{className:"flex justify-between items-center",children:[m("div",{className:"flex items-center gap-2",children:[s&&o("input",{type:"checkbox",checked:i,onChange:()=>s(e.id,!i),className:"h-3.5 w-3.5 rounded border-border accent-primary cursor-pointer shrink-0"}),o("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{backgroundColor:a}}),o("span",{className:"text-sm font-medium text-foreground",children:e.macroClass}),e.kind==="detail"&&o("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded bg-primary/10 text-primary",children:"detail"}),l&&c&&d&&m("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded bg-primary/10 text-primary",children:["mask ",c,"x",d]})]}),o(Ff,{confidence:e.score})]}),m("div",{className:"text-[10px] text-foreground-subtle font-mono",children:["bbox: [",Math.round(e.bbox.x),", ",Math.round(e.bbox.y),","," ",Math.round(e.bbox.x+e.bbox.width),","," ",Math.round(e.bbox.y+e.bbox.height),"]"]}),e.labels.length>0&&o("div",{className:"flex flex-wrap gap-1 mt-1",children:e.labels.map((f,h)=>m("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{backgroundColor:Be(f.label,r)+"20",color:Be(f.label,r)},children:[f.label,m("span",{className:"opacity-60",children:[(f.score*100).toFixed(0),"%"]}),f.detectionId&&m("span",{className:"opacity-40 text-[8px]",children:["→ ",f.detectionId]})]},h))}),u&&Object.keys(u).length>0&&o(zf,{alternateLabels:u,colors:r}),t.length>0&&o(Bf,{items:t,colors:r,hiddenKeys:n,onToggleVisibility:s})]})}function Bf({items:e,colors:t,hiddenKeys:r,onToggleVisibility:n}){return o("div",{className:"ml-4 mt-1.5 space-y-1.5 border-l-2 border-border pl-3",children:e.map(s=>{const a=Be(s.macroClass,t),i=!r?.has(s.id),l=s.debug?.mask,c=s.debug?.maskWidth,d=s.debug?.maskHeight;return m("div",{className:`text-xs space-y-0.5 ${i?"":"opacity-40"}`,children:[m("div",{className:"flex items-center gap-1.5",children:[n&&o("input",{type:"checkbox",checked:i,onChange:()=>n(s.id,!i),className:"h-3 w-3 rounded border-border accent-primary cursor-pointer shrink-0"}),o("span",{className:"h-1.5 w-1.5 rounded-full shrink-0",style:{backgroundColor:a}}),o("span",{className:"font-medium",style:{color:a},children:s.macroClass}),m("span",{className:"text-foreground-subtle",children:[(s.score*100).toFixed(0),"%"]}),l&&c&&d&&m("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded bg-primary/10 text-primary",children:["mask ",c,"x",d]})]}),s.labels.length>0&&o("div",{className:"flex flex-wrap gap-1 ml-5 mt-0.5",children:s.labels.map((u,f)=>m("span",{className:"inline-flex items-center gap-0.5 text-[9px] font-medium px-1 py-0.5 rounded-full",style:{backgroundColor:Be(u.label,t)+"20",color:Be(u.label,t)},children:[u.label," ",m("span",{className:"opacity-60",children:[(u.score*100).toFixed(0),"%"]})]},f))})]},s.id)})})}function zf({alternateLabels:e,colors:t}){const[r,n]=S(!1),s=Object.keys(e);return m("div",{className:"mt-1",children:[m("button",{onClick:()=>n(a=>!a),className:"text-[9px] text-foreground-subtle hover:text-foreground transition-colors flex items-center gap-1",children:[o("span",{className:`transition-transform ${r?"rotate-90":""}`,children:"▶"}),"Alternates (",s.length," source",s.length!==1?"s":"",")"]}),r&&o("div",{className:"mt-1 ml-3 space-y-1.5",children:s.map(a=>{const i=e[a];return!i||i.length===0?null:m("div",{children:[o("div",{className:"text-[9px] font-medium text-foreground-subtle mb-0.5",children:a}),o("div",{className:"flex flex-wrap gap-1",children:i.map((l,c)=>m("span",{className:"inline-flex items-center gap-0.5 text-[9px] px-1 py-0.5 rounded-full",style:{backgroundColor:Be(a,t)+"10",color:Be(a,t),opacity:Math.max(.4,l.score)},children:[l.label,m("span",{className:"opacity-60",children:[(l.score*100).toFixed(1),"%"]})]},c))})]},a)})})]})}function Ff({confidence:e}){return m("span",{className:`text-xs font-medium px-2 py-0.5 rounded-full ${e>=.8?"bg-success/10 text-success":e>=.5?"bg-warning/10 text-warning":"bg-danger/10 text-danger"}`,children:[(e*100).toFixed(1),"%"]})}function qb({timings:e,totalMs:t,className:r}){const n=Object.entries(e);return n.length===0&&t===void 0?null:m("div",{className:`rounded-lg border border-border bg-surface p-3 space-y-2 ${r??""}`,children:[o("div",{className:"text-xs font-medium text-foreground-subtle uppercase tracking-wide",children:"Timings"}),m("div",{className:"space-y-1 text-xs",children:[n.map(([s,a])=>m("div",{className:"flex justify-between",children:[o("span",{className:"text-foreground-subtle",children:s}),m("span",{className:"font-mono text-foreground",children:[a.toFixed(1),"ms"]})]},s)),t!==void 0&&m("div",{className:"flex justify-between pt-1 border-t border-border font-medium text-foreground",children:[o("span",{children:"Total"}),m("span",{className:"font-mono",children:[t.toFixed(1),"ms"]})]})]})]})}function Wb({images:e,selectedFilename:t,uploadedName:r,onSelect:n,onUpload:s,className:a,accept:i="image/*",uploadLabel:l="Upload..."}){const c=()=>{const d=document.createElement("input");d.type="file",d.accept=i,d.onchange=()=>{const u=d.files?.[0];if(!u)return;const f=new FileReader;f.onload=()=>{const h=f.result,g=h.split(",")[1];g&&s(g,u.name,h)},f.readAsDataURL(u)},d.click()};return m("div",{className:`flex flex-wrap items-center gap-2 ${a??""}`,children:[e.map(d=>o("button",{onClick:()=>n(d.filename),className:`px-3 py-1.5 text-xs rounded-md border transition-colors ${t===d.filename?"bg-primary text-primary-foreground border-primary":"bg-surface border-border text-foreground hover:border-primary/50"}`,children:d.id??d.filename.replace(/\.[^.]+$/,"")},d.filename)),o("button",{onClick:c,className:"px-3 py-1.5 text-xs rounded-md border border-border bg-surface text-foreground hover:bg-surface-hover transition-colors",children:l}),r&&o("span",{className:"text-xs text-foreground-subtle",children:r})]})}var tr="w-full px-3 py-2 text-sm rounded-md border border-border bg-surface text-foreground focus:outline-none focus:ring-2 focus:ring-primary/50";function Kb({runtime:e,backend:t,modelId:r,agentId:n="hub",runtimes:s,backends:a,models:i,agents:l=[],onRuntimeChange:c,onBackendChange:d,onModelChange:u,onAgentChange:f,layout:h="grid",className:g,showAgent:b=!1}){return m("div",{className:`${h==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4":h==="horizontal"?"flex flex-wrap items-end gap-4":"space-y-3"} ${g??""}`,children:[b&&l.length>0&&m("label",{className:"space-y-1",children:[o("span",{className:"text-xs font-medium text-foreground-subtle",children:"Agent"}),o("select",{value:n,onChange:v=>f?.(v.target.value),className:tr,children:l.map(v=>m("option",{value:v.id,children:[v.name," (",v.status,")"]},v.id))})]}),m("label",{className:"space-y-1",children:[o("span",{className:"text-xs font-medium text-foreground-subtle",children:"Runtime"}),o("select",{value:e,onChange:v=>c(v.target.value),className:tr,children:s.map(v=>m("option",{value:v.value,disabled:!v.available,children:[v.label,v.available?"":" (unavailable)"]},v.value))})]}),m("label",{className:"space-y-1",children:[o("span",{className:"text-xs font-medium text-foreground-subtle",children:"Backend"}),o("select",{value:t,onChange:v=>d(v.target.value),className:tr,children:a.map(v=>m("option",{value:v.id,disabled:!v.available,children:[v.label,v.available?"":" (unavailable)"]},v.id))})]}),m("label",{className:"space-y-1",children:[o("span",{className:"text-xs font-medium text-foreground-subtle",children:"Model"}),o("select",{value:r,onChange:v=>u(v.target.value),className:tr,children:i.length===0?o("option",{value:"",children:"No compatible models"}):i.map(v=>m("option",{value:v.id,children:[v.name,v.downloaded?" ✓":""]},v.id))})]})]})}var jf=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},Pi=class{constructor(e){this.generateIdentifier=e,this.kv=new jf}register(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},Gf=class extends Pi{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t=="object"?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function Qf(e){if("values"in Object)return Object.values(e);const t=[];for(const r in e)e.hasOwnProperty(r)&&t.push(e[r]);return t}function Hf(e,t){const r=Qf(e);if("find"in r)return r.find(t);const n=r;for(let s=0;s<n.length;s++){const a=n[s];if(t(a))return a}}function Pt(e,t){Object.entries(e).forEach(([r,n])=>t(n,r))}function hr(e,t){return e.indexOf(t)!==-1}function Wo(e,t){for(let r=0;r<e.length;r++){const n=e[r];if(t(n))return n}}var Uf=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return Hf(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},Vf=e=>Object.prototype.toString.call(e).slice(8,-1),Ri=e=>typeof e>"u",qf=e=>e===null,Qt=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,wn=e=>Qt(e)&&Object.keys(e).length===0,rt=e=>Array.isArray(e),Wf=e=>typeof e=="string",Kf=e=>typeof e=="number"&&!isNaN(e),Zf=e=>typeof e=="boolean",Yf=e=>e instanceof RegExp,Ht=e=>e instanceof Map,Ut=e=>e instanceof Set,_i=e=>Vf(e)==="Symbol",Xf=e=>e instanceof Date&&!isNaN(e.valueOf()),Ii=e=>e instanceof Error,Ko=e=>typeof e=="number"&&isNaN(e),Jf=e=>Zf(e)||qf(e)||Ri(e)||Kf(e)||Wf(e)||_i(e),em=e=>typeof e=="bigint",tm=e=>e===1/0||e===-1/0,rm=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),nm=e=>e instanceof URL,kn=e=>e.replace(/\\/g,"\\\\").replace(/\./g,"\\."),Zr=e=>e.map(String).map(kn).join("."),Ot=(e,t)=>{const r=[];let n="";for(let a=0;a<e.length;a++){let i=e.charAt(a);if(!t&&i==="\\"){const l=e.charAt(a+1);if(l==="\\"){n+="\\",a++;continue}else if(l!==".")throw Error("invalid path")}if(i==="\\"&&e.charAt(a+1)==="."){n+=".",a++;continue}if(i==="."){r.push(n),n="";continue}n+=i}const s=n;return r.push(s),r};function Ue(e,t,r,n){return{isApplicable:e,annotation:t,transform:r,untransform:n}}var Ti=[Ue(Ri,"undefined",()=>null,()=>{}),Ue(em,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):(console.error("Please add a BigInt polyfill."),e)),Ue(Xf,"Date",e=>e.toISOString(),e=>new Date(e)),Ue(Ii,"Error",(e,t)=>{const r={name:e.name,message:e.message};return"cause"in e&&(r.cause=e.cause),t.allowedErrorProps.forEach(n=>{r[n]=e[n]}),r},(e,t)=>{const r=new Error(e.message,{cause:e.cause});return r.name=e.name,r.stack=e.stack,t.allowedErrorProps.forEach(n=>{r[n]=e[n]}),r}),Ue(Yf,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),r=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,r)}),Ue(Ut,"set",e=>[...e.values()],e=>new Set(e)),Ue(Ht,"map",e=>[...e.entries()],e=>new Map(e)),Ue(e=>Ko(e)||tm(e),"number",e=>Ko(e)?"NaN":e>0?"Infinity":"-Infinity",Number),Ue(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),Ue(nm,"URL",e=>e.toString(),e=>new URL(e))];function _r(e,t,r,n){return{isApplicable:e,annotation:t,transform:r,untransform:n}}var Di=_r((e,t)=>_i(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,r)=>{const n=r.symbolRegistry.getValue(t[1]);if(!n)throw new Error("Trying to deserialize unknown symbol");return n}),om=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),Li=_r(rm,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const r=om[t[1]];if(!r)throw new Error("Trying to deserialize unknown typed array");return new r(e)});function Oi(e,t){return e?.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var $i=_r(Oi,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const r=t.classRegistry.getAllowedProps(e.constructor);if(!r)return{...e};const n={};return r.forEach(s=>{n[s]=e[s]}),n},(e,t,r)=>{const n=r.classRegistry.getValue(t[1]);if(!n)throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(n.prototype),e)}),Bi=_r((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,r)=>{const n=r.customTransformerRegistry.findByName(t[1]);if(!n)throw new Error("Trying to deserialize unknown custom value");return n.deserialize(e)}),sm=[$i,Di,Bi,Li],Zo=(e,t)=>{const r=Wo(sm,s=>s.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation(e,t)};const n=Wo(Ti,s=>s.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation}},zi={};Ti.forEach(e=>{zi[e.annotation]=e});var am=(e,t,r)=>{if(rt(t))switch(t[0]){case"symbol":return Di.untransform(e,t,r);case"class":return $i.untransform(e,t,r);case"custom":return Bi.untransform(e,t,r);case"typed-array":return Li.untransform(e,t,r);default:throw new Error("Unknown transformation: "+t)}else{const n=zi[t];if(!n)throw new Error("Unknown transformation: "+t);return n.untransform(e,r)}},xt=(e,t)=>{if(t>e.size)throw new Error("index out of bounds");const r=e.keys();for(;t>0;)r.next(),t--;return r.next().value};function Fi(e){if(hr(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(hr(e,"prototype"))throw new Error("prototype is not allowed as a property");if(hr(e,"constructor"))throw new Error("constructor is not allowed as a property")}var im=(e,t)=>{Fi(t);for(let r=0;r<t.length;r++){const n=t[r];if(Ut(e))e=xt(e,+n);else if(Ht(e)){const s=+n,a=+t[++r]==0?"key":"value",i=xt(e,s);switch(a){case"key":e=i;break;case"value":e=e.get(i);break}}else e=e[n]}return e},Nn=(e,t,r)=>{if(Fi(t),t.length===0)return r(e);let n=e;for(let a=0;a<t.length-1;a++){const i=t[a];if(rt(n)){const l=+i;n=n[l]}else if(Qt(n))n=n[i];else if(Ut(n)){const l=+i;n=xt(n,l)}else if(Ht(n)){if(a===t.length-2)break;const l=+i,c=+t[++a]==0?"key":"value",d=xt(n,l);switch(c){case"key":n=d;break;case"value":n=n.get(d);break}}}const s=t[t.length-1];if(rt(n)?n[+s]=r(n[+s]):Qt(n)&&(n[s]=r(n[s])),Ut(n)){const a=xt(n,+s),i=r(a);a!==i&&(n.delete(a),n.add(i))}if(Ht(n)){const a=+t[t.length-2],i=xt(n,a);switch(+s==0?"key":"value"){case"key":{const l=r(i);n.set(l,n.get(i)),l!==i&&n.delete(i);break}case"value":n.set(i,r(n.get(i)));break}}return e},ji=e=>e<1;function Sn(e,t,r,n=[]){if(!e)return;const s=ji(r);if(!rt(e)){Pt(e,(l,c)=>Sn(l,t,r,[...n,...Ot(c,s)]));return}const[a,i]=e;i&&Pt(i,(l,c)=>{Sn(l,t,r,[...n,...Ot(c,s)])}),t(a,n)}function lm(e,t,r,n){return Sn(t,(s,a)=>{e=Nn(e,a,i=>am(i,s,n))},r),e}function cm(e,t,r){const n=ji(r);function s(a,i){const l=im(e,Ot(i,n));a.map(c=>Ot(c,n)).forEach(c=>{e=Nn(e,c,()=>l)})}if(rt(t)){const[a,i]=t;a.forEach(l=>{e=Nn(e,Ot(l,n),()=>e)}),i&&Pt(i,s)}else Pt(t,s);return e}var dm=(e,t)=>Qt(e)||rt(e)||Ht(e)||Ut(e)||Ii(e)||Oi(e,t);function um(e,t,r){const n=r.get(e);n?n.push(t):r.set(e,[t])}function pm(e,t){const r={};let n;return e.forEach(s=>{if(s.length<=1)return;t||(s=s.map(l=>l.map(String)).sort((l,c)=>l.length-c.length));const[a,...i]=s;a.length===0?n=i.map(Zr):r[Zr(a)]=i.map(Zr)}),n?wn(r)?[n]:[n,r]:wn(r)?void 0:r}var Gi=(e,t,r,n,s=[],a=[],i=new Map)=>{const l=Jf(e);if(!l){um(e,s,t);const g=i.get(e);if(g)return n?{transformedValue:null}:g}if(!dm(e,r)){const g=Zo(e,r),b=g?{transformedValue:g.value,annotations:[g.type]}:{transformedValue:e};return l||i.set(e,b),b}if(hr(a,e))return{transformedValue:null};const c=Zo(e,r),d=c?.value??e,u=rt(d)?[]:{},f={};Pt(d,(g,b)=>{if(b==="__proto__"||b==="constructor"||b==="prototype")throw new Error(`Detected property ${b}. This is a prototype pollution risk, please remove it from your object.`);const v=Gi(g,t,r,n,[...s,b],[...a,e],i);u[b]=v.transformedValue,rt(v.annotations)?f[kn(b)]=v.annotations:Qt(v.annotations)&&Pt(v.annotations,(x,y)=>{f[kn(b)+"."+y]=x})});const h=wn(f)?{transformedValue:u,annotations:c?[c.type]:void 0}:{transformedValue:u,annotations:c?[c.type,f]:f};return l||i.set(e,h),h};function Qi(e){return Object.prototype.toString.call(e).slice(8,-1)}function Yo(e){return Qi(e)==="Array"}function fm(e){if(Qi(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function mm(e,t,r,n,s){const a={}.propertyIsEnumerable.call(n,t)?"enumerable":"nonenumerable";a==="enumerable"&&(e[t]=r),s&&a==="nonenumerable"&&Object.defineProperty(e,t,{value:r,enumerable:!1,writable:!0,configurable:!0})}function Cn(e,t={}){if(Yo(e))return e.map(s=>Cn(s,t));if(!fm(e))return e;const r=Object.getOwnPropertyNames(e),n=Object.getOwnPropertySymbols(e);return[...r,...n].reduce((s,a)=>{if(a==="__proto__"||Yo(t.props)&&!t.props.includes(a))return s;const i=e[a];return mm(s,a,Cn(i,t),e,t.nonenumerable),s},{})}var ue=class{constructor({dedupe:e=!1}={}){this.classRegistry=new Gf,this.symbolRegistry=new Pi(t=>t.description??""),this.customTransformerRegistry=new Uf,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,r=Gi(e,t,this,this.dedupe),n={json:r.transformedValue};r.annotations&&(n.meta={...n.meta,values:r.annotations});const s=pm(t,this.dedupe);return s&&(n.meta={...n.meta,referentialEqualities:s}),n.meta&&(n.meta.v=1),n}deserialize(e,t){const{json:r,meta:n}=e;let s=t?.inPlace?r:Cn(r);return n?.values&&(s=lm(s,n.values,n.v??0,this)),n?.referentialEqualities&&(s=cm(s,n.referentialEqualities,n.v??0)),s}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e),{inPlace:!0})}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};ue.defaultInstance=new ue;ue.serialize=ue.defaultInstance.serialize.bind(ue.defaultInstance);ue.deserialize=ue.defaultInstance.deserialize.bind(ue.defaultInstance);ue.stringify=ue.defaultInstance.stringify.bind(ue.defaultInstance);ue.parse=ue.defaultInstance.parse.bind(ue.defaultInstance);ue.registerClass=ue.defaultInstance.registerClass.bind(ue.defaultInstance);ue.registerSymbol=ue.defaultInstance.registerSymbol.bind(ue.defaultInstance);ue.registerCustom=ue.defaultInstance.registerCustom.bind(ue.defaultInstance);ue.allowErrorProps=ue.defaultInstance.allowErrorProps.bind(ue.defaultInstance);ue.serialize;ue.deserialize;ue.stringify;ue.parse;ue.registerClass;ue.registerCustom;ue.registerSymbol;ue.allowErrorProps;function hm({className:e}){return m("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[o("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),o("circle",{cx:"12",cy:"12",r:"3"})]})}function gm({className:e}){return m("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[o("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),o("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),o("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),o("path",{d:"m2 2 20 20"})]})}function bm({className:e}){return o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:o("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})})}function vm({onLogin:e,serverUrl:t,logoSrc:r,error:n,className:s}){const[a,i]=S(""),[l,c]=S(""),[d,u]=S(!1),[f,h]=S(!1),[g,b]=S(null),v=n??g,x=async y=>{if(y.preventDefault(),!f){b(null),h(!0);try{await e(a,l)}catch(w){b(w instanceof Error?w.message:"Login failed. Please try again.")}finally{h(!1)}}};return o("div",{className:N("flex min-h-screen items-center justify-center bg-background p-4",s),children:m("div",{className:"w-full max-w-sm",children:[r&&o("div",{className:"flex justify-center mb-8",children:o("img",{src:r,alt:"Logo",className:"h-12"})}),t&&o("p",{className:"mb-4 text-center text-xs text-foreground-subtle truncate",children:t}),m("form",{onSubmit:x,className:"space-y-4 rounded-xl border border-border bg-surface p-6 shadow-xl shadow-black/10",children:[v&&o("div",{className:"rounded-md bg-danger/10 border border-danger/20 px-3 py-2 text-xs text-danger",children:v}),m("div",{className:"space-y-1.5",children:[o("label",{className:"text-xs font-medium text-foreground-subtle",children:"Username"}),o("input",{type:"text",value:a,onChange:y=>i(y.target.value),autoComplete:"username",required:!0,className:"w-full rounded-lg border border-border bg-background px-3 py-2.5 text-sm text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary"})]}),m("div",{className:"space-y-1.5",children:[o("label",{className:"text-xs font-medium text-foreground-subtle",children:"Password"}),m("div",{className:"relative",children:[o("input",{type:d?"text":"password",value:l,onChange:y=>c(y.target.value),autoComplete:"current-password",required:!0,className:"w-full rounded-lg border border-border bg-background px-3 py-2.5 pr-10 text-sm text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary"}),o("button",{type:"button",onClick:()=>u(y=>!y),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground",tabIndex:-1,children:d?o(gm,{className:"h-4 w-4"}):o(hm,{className:"h-4 w-4"})})]})]}),m("button",{type:"submit",disabled:f,className:"w-full rounded-lg bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center justify-center gap-2",children:[f&&o(bm,{className:"h-4 w-4 animate-spin"}),f?"Logging in...":"Log in"]})]})]})})}var Mn="camstack_dev_token",Hi=Ze(null);function Zb(){const e=Ae(Hi);if(!e)throw new Error("useDevShell must be used within a DevShell");return e}function ym(){return typeof window>"u"?null:localStorage.getItem(Mn)}function xm({className:e}){return m("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[o("circle",{cx:"12",cy:"12",r:"4"}),o("path",{d:"M12 2v2"}),o("path",{d:"M12 20v2"}),o("path",{d:"m4.93 4.93 1.41 1.41"}),o("path",{d:"m17.66 17.66 1.41 1.41"}),o("path",{d:"M2 12h2"}),o("path",{d:"M20 12h2"}),o("path",{d:"m6.34 17.66-1.41 1.41"}),o("path",{d:"m19.07 4.93-1.41 1.41"})]})}function wm({className:e}){return o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:o("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function km({children:e,serverUrl:t,title:r,token:n,onLogout:s}){const a=yl(),i=re(()=>[sl({condition:h=>h.type==="subscription",true:al({client:il({url:t.replace(/^http/,"ws")+"/trpc",connectionParams:()=>({token:n})}),transformer:ue}),false:bs({url:`${t}/trpc`,transformer:ue,headers:()=>({authorization:`Bearer ${n}`})})})],[t,n]),l=re(()=>gs({links:i}),[i]),c=re(()=>p.createClient({links:i}),[i]),d=re(()=>ul({serverUrl:t,token:n}),[t,n]);H(()=>(d.init().catch(()=>{}),()=>{d.close()}),[d]);const u=re(()=>new nl,[]),f=re(()=>({trpc:l,token:n,logout:s}),[l,n,s]);return o(Ep,{system:d,children:o(p.Provider,{client:c,queryClient:u,children:o(ol,{client:u,children:o(Hi.Provider,{value:f,children:m("div",{className:"min-h-screen bg-background text-foreground",children:[m("div",{className:"flex items-center justify-between border-b border-border bg-surface px-4 py-2",children:[m("div",{className:"flex items-center gap-2",children:[o("span",{className:"rounded bg-warning/20 px-2 py-0.5 text-xs font-bold text-warning",children:"DEV MODE"}),r&&o("span",{className:"text-sm font-medium text-foreground",children:r}),o("span",{className:"text-xs text-foreground-subtle",children:t})]}),m("div",{className:"flex items-center gap-2",children:[m("button",{type:"button",onClick:a.toggleMode,className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors",title:`Theme: ${a.mode}`,children:[a.resolvedMode==="dark"?o(xm,{className:"h-3.5 w-3.5"}):o(wm,{className:"h-3.5 w-3.5"}),a.mode==="dark"?"Dark":a.mode==="light"?"Light":"System"]}),o("button",{type:"button",onClick:s,className:"rounded-md px-2.5 py-1 text-xs font-medium text-danger hover:bg-danger/10 transition-colors",children:"Logout"})]})]}),o("div",{className:"p-4",children:e({trpc:l,theme:a})})]})})})})})}function Nm({children:e,serverUrl:t="https://localhost:4443",title:r}){const[n,s]=S(ym),a=I(async(l,c)=>{const d=await gs({links:[bs({url:`${t}/trpc`,transformer:ue})]}).auth.login.mutate({username:l,password:c});if(!d.token)throw new Error("No token returned");localStorage.setItem(Mn,d.token),s(d.token)},[t]),i=I(()=>{localStorage.removeItem(Mn),s(null)},[]);return n?o(no,{children:o(km,{serverUrl:t,title:r,token:n,onLogout:i,children:e})}):o(no,{children:o(vm,{onLogin:a,serverUrl:t})})}function Yb(e,t={}){const{serverUrl:r="https://localhost:4443",title:n,rootId:s="root"}=t,a=document.getElementById(s);if(!a){console.error(`[mountAddonPage] Element #${s} not found`);return}tl(a).render($t(Nm,{serverUrl:r,title:n,children:({trpc:i,theme:l})=>$t(e,{trpc:i,theme:{isDark:l.resolvedMode==="dark"},navigate:c=>{console.log("[dev] navigate:",c)}})}))}var Ui=ot("camstack:custom-field-renderers",{});function Xb({renderers:e,children:t}){return o(Ui.Provider,{value:e,children:t})}function Sm(e){return Ae(Ui)[e]??null}var Kn=ot("camstack:device-context",null);function Jb({deviceId:e,device:t,children:r}){const n={deviceId:e,device:t??null};return o(Kn.Provider,{value:n,children:r})}function Cm(){return Ae(Kn)?.deviceId??null}function ev(){return Ae(Kn)?.device??null}var tv=p.accessories.getStatus.useQuery,rv=p.addonPages.listPages.useQuery,nv=p.addons.list.useQuery,ov=p.addons.getLogs.useQuery,sv=p.addons.listPackages.useQuery,av=p.addons.installPackage.useMutation,iv=p.addons.installFromWorkspace.useMutation,lv=p.addons.isWorkspaceAvailable.useQuery,cv=p.addons.listWorkspacePackages.useQuery,dv=p.addons.uninstallPackage.useMutation,uv=p.addons.reloadPackages.useMutation,pv=p.addons.searchAvailable.useQuery,fv=p.addons.listUpdates.useQuery,mv=p.addons.updatePackage.useMutation,hv=p.addons.rollbackPackage.useMutation,gv=p.addons.forceRefresh.useMutation,bv=p.addons.restartServer.useMutation,vv=p.addons.getVersions.useQuery,yv=p.addons.restartAddon.useMutation,xv=p.addons.retryLoad.useMutation,wv=p.addons.getAutoUpdateSettings.useQuery,kv=p.addons.setAutoUpdateSettings.useMutation,Nv=p.addons.getAddonAutoUpdate.useQuery,Sv=p.addons.setAddonAutoUpdate.useMutation,Cv=p.addons.applyAutoUpdateToAll.useMutation,Mv=p.addons.custom.useMutation,Ev=p.addons.onAddonLogs.useSubscription,Av=p.addonSettings.getGlobalSettings.useQuery,Pv=p.addonSettings.updateGlobalSettings.useMutation,Rv=p.addonSettings.getDeviceSettings.useQuery,_v=p.addonSettings.updateDeviceSettings.useMutation,Mm=p.addonWidgets.listWidgets.useQuery,Iv=p.alerts.emit.useMutation,Tv=p.alerts.update.useMutation,Dv=p.alerts.list.useQuery,Lv=p.alerts.getUnreadCount.useQuery,Ov=p.alerts.markRead.useMutation,$v=p.alerts.markAllRead.useMutation,Bv=p.alerts.dismiss.useMutation,zv=p.audioAnalysis.resolveDeviceSettings.useQuery,Fv=p.audioAnalysis.getDeviceSettingsContribution.useQuery,jv=p.audioAnalysis.getDeviceLiveContribution.useQuery,Gv=p.audioAnalysis.applyDeviceSettingsPatch.useMutation,Qv=p.audioAnalyzer.analyseChunk.useMutation,Hv=p.audioAnalyzer.classify.useQuery,Uv=p.audioAnalyzer.isReady.useQuery,Vv=p.audioAnalyzer.dispose.useMutation,qv=p.audioAnalyzer.reprobeAudioEngine.useMutation,Wv=p.audioCodec.listSupportedCodecs.useQuery,Kv=p.audioCodec.canHandle.useQuery,Zv=p.audioCodec.createDecodeSession.useMutation,Yv=p.audioCodec.createEncodeSession.useMutation,Xv=p.audioCodec.closeSession.useMutation,Jv=p.audioCodec.pushEncodedFrame.useMutation,ey=p.audioCodec.pullPcm.useQuery,ty=p.audioCodec.pushPcm.useMutation,ry=p.audioCodec.pullEncoded.useQuery,ny=p.audioCodec.flushEncode.useMutation,oy=p.audioCodec.listActiveSessions.useQuery,sy=p.audioMetrics.getCurrentSnapshot.useQuery,ay=p.audioMetrics.getHistory.useQuery,iy=p.authentication.listProviders.useQuery,ly=p.authentication.setProviderEnabled.useMutation,cy=p.backup.listDestinations.useQuery,dy=p.backup.trigger.useMutation,uy=p.backup.list.useQuery,py=p.backup.listLocations.useQuery,fy=p.backup.getEntries.useQuery,my=p.backup.restore.useMutation,hy=p.backup.delete.useMutation,gy=p.backup.listArchives.useQuery,by=p.backup.upsertDestinationPolicy.useMutation,vy=p.backup.previewSchedule.useQuery,yy=p.battery.getStatus.useQuery,xy=p.brightness.setBrightness.useMutation,wy=p.brightness.getStatus.useQuery,ky=p.cameraStreams.getCameraStreams.useQuery,Ny=p.cameraStreams.getBrokerStreams.useQuery,Sy=p.cameraStreams.getRtspEntries.useQuery,Cy=p.decoder.supportsCodec.useQuery,My=p.decoder.getInfo.useQuery,Ey=p.decoder.createSession.useQuery,Ay=p.decoder.destroySession.useQuery,Py=p.decoder.pushPacket.useQuery,Ry=p.decoder.openStream.useQuery,_y=p.decoder.pullFrames.useQuery,Iy=p.decoder.updateConfig.useQuery,Ty=p.decoder.getStats.useQuery,Dy=p.decoder.listActiveSessions.useQuery,Ly=p.decoder.reprobeHwaccel.useMutation,Oy=p.detectionPipeline.getDeviceSettingsContribution.useQuery,$y=p.detectionPipeline.getDeviceLiveContribution.useQuery,By=p.detectionPipeline.applyDeviceSettingsPatch.useMutation,zy=p.deviceDiscovery.listDiscovered.useQuery,Fy=p.deviceDiscovery.refreshDiscovery.useMutation,jy=p.deviceDiscovery.adoptDevice.useMutation,Gy=p.deviceDiscovery.releaseDevice.useMutation,Qy=p.deviceDiscovery.getStatus.useQuery,Hy=p.deviceManager.allocateDeviceId.useMutation,Uy=p.deviceManager.registerDevice.useMutation,Vy=p.deviceManager.removeDevice.useMutation,qy=p.deviceManager.persistConfig.useMutation,Wy=p.deviceManager.loadConfig.useQuery,Ky=p.deviceManager.loadRuntimeState.useQuery,Zy=p.deviceManager.loadMeta.useQuery,Yy=p.deviceManager.setName.useMutation,Xy=p.deviceManager.setLocation.useMutation,Jy=p.deviceManager.setMetadata.useMutation,ex=p.deviceManager.listLocations.useQuery,tx=p.deviceManager.addLocation.useMutation,rx=p.deviceManager.removeLocation.useMutation,nx=p.deviceManager.setDisabled.useMutation,ox=p.deviceManager.listPersistedByAddon.useQuery,sx=p.deviceManager.listAll.useQuery,ax=p.deviceManager.getDevice.useQuery,ix=p.deviceManager.getChildren.useQuery,lx=p.deviceManager.getStreamSources.useQuery,cx=p.deviceManager.getConfigSchema.useQuery,dx=p.deviceManager.getSettingsSchema.useQuery,ux=p.deviceManager.updateConfig.useMutation,px=p.deviceManager.enable.useMutation,fx=p.deviceManager.disable.useMutation,mx=p.deviceManager.remove.useMutation,hx=p.deviceManager.getStreamProfileMap.useQuery,gx=p.deviceManager.setStreamProfileMap.useMutation,bx=p.deviceManager.probeStreams.useMutation,vx=p.deviceManager.getBindings.useQuery,yx=p.deviceManager.getAllBindings.useQuery,xx=p.deviceManager.setWrapperActive.useMutation,wx=p.deviceManager.listWrappersForCap.useQuery,kx=p.deviceManager.listBindableCapsForDeviceType.useQuery,Nx=p.deviceManager.getDeviceSettingsAggregate.useQuery,Sx=p.deviceManager.getDeviceLiveInfoAggregate.useQuery,Cx=p.deviceManager.getDeviceAggregate.useQuery,Mx=p.deviceManager.updateDeviceField.useMutation,Ex=p.deviceManager.updateDeviceFieldsBatch.useMutation,Ax=p.deviceManager.discoverDevices.useMutation,Px=p.deviceManager.adoptDevice.useMutation,Rx=p.deviceManager.getCreationSchema.useQuery,_x=p.deviceManager.createDevice.useMutation,Ix=p.deviceManager.testCreationField.useMutation,Tx=p.deviceManager.testField.useMutation,Dx=p.deviceManager.getDeviceStatusAggregate.useQuery,Lx=p.deviceOps.getStreamSources.useQuery,Ox=p.deviceOps.getConfigEntries.useQuery,$x=p.deviceOps.setConfig.useMutation,Bx=p.deviceOps.removeDevice.useMutation,zx=p.deviceOps.getSettingsSchema.useQuery,Fx=p.deviceProvider.start.useMutation,jx=p.deviceProvider.stop.useMutation,Gx=p.deviceProvider.getStatus.useQuery,Qx=p.deviceProvider.getDevices.useQuery,Hx=p.deviceProvider.supportsDiscovery.useQuery,Ux=p.deviceProvider.discoverDevices.useMutation,Vx=p.deviceProvider.adoptDiscoveredDevice.useMutation,qx=p.deviceProvider.supportsManualCreation.useQuery,Wx=p.deviceProvider.getChildCreationSchema.useQuery,Kx=p.deviceProvider.createDevice.useMutation,Zx=p.deviceProvider.testCreationField.useMutation,Yx=p.deviceState.getSnapshot.useQuery,Xx=p.deviceState.getCapSlice.useQuery,Jx=p.deviceState.getAllSnapshots.useQuery,e0=p.deviceState.setCapSlice.useMutation,t0=p.doorbell.getStatus.useQuery,r0=p.events.getEvents.useQuery,n0=p.events.getEventThumbnail.useQuery,o0=p.events.getEventClipUrl.useQuery,s0=p.integrations.list.useQuery,a0=p.integrations.get.useQuery,i0=p.integrations.getByAddonId.useQuery,l0=p.integrations.create.useMutation,c0=p.integrations.update.useMutation,d0=p.integrations.delete.useMutation,u0=p.integrations.getSettings.useQuery,p0=p.integrations.setSettings.useMutation,f0=p.integrations.getAvailableTypes.useQuery,m0=p.integrations.testConnection.useMutation,h0=p.intercom.startSession.useMutation,g0=p.intercom.handleAnswer.useMutation,b0=p.intercom.stopSession.useMutation,v0=p.intercom.getStatus.useQuery,y0=p.localNetwork.list.useQuery,x0=p.localNetwork.getPreferred.useQuery,w0=p.localNetwork.getConnectionEndpoints.useQuery,k0=p.localNetwork.getAllowedAddresses.useQuery,N0=p.localNetwork.setAllowedAddresses.useMutation,S0=p.localNetwork.resetAllowlistToBestMatch.useMutation,C0=p.meshOrchestrator.listProviders.useQuery,M0=p.meshOrchestrator.joinProvider.useMutation,E0=p.meshOrchestrator.leaveProvider.useMutation,A0=p.metricsProvider.collectSnapshot.useQuery,P0=p.metricsProvider.getCached.useQuery,R0=p.metricsProvider.getCurrent.useQuery,_0=p.metricsProvider.getDiskSpace.useQuery,I0=p.metricsProvider.getGpuInfo.useQuery,T0=p.metricsProvider.getCpuTemperature.useQuery,D0=p.metricsProvider.getProcessStats.useQuery,L0=p.metricsProvider.listAddonInstances.useQuery,O0=p.metricsProvider.getAddonStats.useQuery,$0=p.metricsProvider.listNodeProcesses.useQuery,B0=p.metricsProvider.killProcess.useMutation,z0=p.motion.isDetected.useQuery,F0=p.motion.getStatus.useQuery,j0=p.motionDetection.analyze.useMutation,G0=p.motionDetection.removeCamera.useMutation,Q0=p.motionDetection.reset.useMutation,H0=p.motionDetection.getDeviceSettingsContribution.useQuery,U0=p.motionDetection.getDeviceLiveContribution.useQuery,V0=p.motionDetection.applyDeviceSettingsPatch.useMutation,q0=p.motionTrigger.setMotionTrigger.useMutation,W0=p.motionTrigger.getStatus.useQuery,K0=p.nativeObjectDetection.getStatus.useQuery,Z0=p.networkQuality.getDeviceStats.useQuery,Y0=p.networkQuality.getAllStats.useQuery,X0=p.networkQuality.reportClientStats.useMutation,J0=p.nodes.topology.useQuery,e1=p.nodes.deployAddon.useMutation,t1=p.nodes.undeployAddon.useMutation,r1=p.nodes.restartAddon.useMutation,n1=p.nodes.restartProcess.useMutation,o1=p.nodes.restartNode.useMutation,s1=p.nodes.shutdownNode.useMutation,a1=p.nodes.renameNode.useMutation,i1=p.nodes.clusterAddonStatus.useQuery,l1=p.nodes.setProcessLogLevel.useMutation,c1=p.nodes.executeQuery.useMutation,d1=p.notificationOutput.send.useMutation,u1=p.notificationOutput.sendTest.useMutation,p1=p.osd.setOverlay.useMutation,f1=p.osd.getStatus.useQuery,m1=p.pipelineAnalytics.getActiveTracks.useQuery,h1=p.pipelineAnalytics.getTrack.useQuery,g1=p.pipelineAnalytics.listTracks.useQuery,b1=p.pipelineAnalytics.clearTracks.useMutation,v1=p.pipelineAnalytics.getMotionEvents.useQuery,y1=p.pipelineAnalytics.getObjectEvents.useQuery,x1=p.pipelineAnalytics.getAudioEvents.useQuery,w1=p.pipelineAnalytics.getEventMedia.useQuery,k1=p.pipelineAnalytics.getTrackMedia.useQuery,N1=p.pipelineAnalytics.getDeviceSettingsContribution.useQuery,S1=p.pipelineAnalytics.getDeviceLiveContribution.useQuery,C1=p.pipelineAnalytics.applyDeviceSettingsPatch.useMutation,M1=p.pipelineExecutor.getAvailableEngines.useQuery,E1=p.pipelineExecutor.getSelectedEngine.useQuery,A1=p.pipelineExecutor.getDefaultSteps.useQuery,P1=p.pipelineExecutor.reprobeEngine.useMutation,R1=p.pipelineExecutor.getVideoPipelineSteps.useQuery,_1=p.pipelineExecutor.setVideoPipelineSteps.useMutation,I1=p.pipelineExecutor.getSchema.useQuery,T1=p.pipelineExecutor.getGlobalSteps.useQuery,D1=p.pipelineExecutor.getGlobalPipelineConfig.useQuery,L1=p.pipelineExecutor.getOrchestratorConfigSchema.useQuery,O1=p.pipelineExecutor.listTemplates.useQuery,$1=p.pipelineExecutor.saveTemplate.useMutation,B1=p.pipelineExecutor.updateTemplate.useMutation,z1=p.pipelineExecutor.deleteTemplate.useMutation,F1=p.pipelineExecutor.getCapabilities.useQuery,j1=p.pipelineExecutor.getAddonModels.useQuery,G1=p.pipelineExecutor.downloadModel.useMutation,Q1=p.pipelineExecutor.deleteModel.useMutation,H1=p.pipelineExecutor.detect.useQuery,U1=p.pipelineExecutor.runPipeline.useMutation,V1=p.pipelineExecutor.runPipelineBatch.useMutation,q1=p.pipelineExecutor.cacheFrameInPool.useMutation,W1=p.pipelineExecutor.inferCached.useMutation,K1=p.pipelineExecutor.uncacheFrame.useMutation,Z1=p.pipelineExecutor.getEffectiveTuning.useQuery,Y1=p.pipelineExecutor.listLoadedEngines.useQuery,X1=p.pipelineExecutor.spinEngine.useMutation,J1=p.pipelineExecutor.killEngine.useMutation,ew=p.pipelineExecutor.listReferenceImages.useQuery,tw=p.pipelineExecutor.getReferenceImage.useQuery,rw=p.pipelineExecutor.getReferenceAudioFiles.useQuery,nw=p.pipelineExecutor.getReferenceAudio.useQuery,ow=p.pipelineExecutor.getAudioCapabilities.useQuery,sw=p.pipelineExecutor.runAudioTest.useMutation,aw=p.pipelineExecutor.getDetectionConfigSchema.useQuery,iw=p.pipelineOrchestrator.assignPipeline.useMutation,lw=p.pipelineOrchestrator.unassignPipeline.useMutation,cw=p.pipelineOrchestrator.rebalance.useMutation,dw=p.pipelineOrchestrator.getPipelineAssignments.useQuery,uw=p.pipelineOrchestrator.getPipelineAssignment.useQuery,pw=p.pipelineOrchestrator.getAgentLoad.useQuery,fw=p.pipelineOrchestrator.getGlobalMetrics.useQuery,mw=p.pipelineOrchestrator.getCameraMetrics.useQuery,hw=p.pipelineOrchestrator.getCapabilityBindings.useQuery,gw=p.pipelineOrchestrator.setCapabilityBinding.useMutation,bw=p.pipelineOrchestrator.assignDecoder.useMutation,vw=p.pipelineOrchestrator.unassignDecoder.useMutation,yw=p.pipelineOrchestrator.getDecoderAssignments.useQuery,xw=p.pipelineOrchestrator.assignAudio.useMutation,ww=p.pipelineOrchestrator.unassignAudio.useMutation,kw=p.pipelineOrchestrator.getAudioAssignment.useQuery,Nw=p.pipelineOrchestrator.getAudioNodeLoad.useQuery,Sw=p.pipelineOrchestrator.getAudioAssignments.useQuery,Cw=p.pipelineOrchestrator.getDecoderAssignment.useQuery,Mw=p.pipelineOrchestrator.getAgentSettings.useQuery,Ew=p.pipelineOrchestrator.listAgentSettings.useQuery,Aw=p.pipelineOrchestrator.setAgentAddonDefaults.useMutation,Pw=p.pipelineOrchestrator.removeAgentSettings.useMutation,Rw=p.pipelineOrchestrator.getCameraSettings.useQuery,_w=p.pipelineOrchestrator.setCameraStepToggle.useMutation,Iw=p.pipelineOrchestrator.getCameraStepOverrides.useQuery,Tw=p.pipelineOrchestrator.setCameraStepOverride.useMutation,Dw=p.pipelineOrchestrator.setCameraPipelineForAgent.useMutation,Lw=p.pipelineOrchestrator.resolvePipeline.useQuery,Ow=p.pipelineOrchestrator.listTemplates.useQuery,$w=p.pipelineOrchestrator.saveTemplate.useMutation,Bw=p.pipelineOrchestrator.updateTemplate.useMutation,zw=p.pipelineOrchestrator.deleteTemplate.useMutation,Fw=p.pipelineOrchestrator.getDeviceSettingsContribution.useQuery,jw=p.pipelineOrchestrator.getDeviceLiveContribution.useQuery,Gw=p.pipelineOrchestrator.applyDeviceSettingsPatch.useMutation,Qw=p.pipelineRunner.attachCamera.useMutation,Hw=p.pipelineRunner.detachCamera.useMutation,Uw=p.pipelineRunner.reportMotion.useMutation,Vw=p.pipelineRunner.getLocalLoad.useQuery,qw=p.pipelineRunner.getLocalMetrics.useQuery,Ww=p.pipelineRunner.getCameraMetrics.useQuery,Kw=p.pipelineRunner.getAllCameraMetrics.useQuery,Zw=p.pipelineRunner.getLocalCameras.useQuery,Yw=p.platformProbe.getCapabilities.useQuery,Xw=p.platformProbe.getHardware.useQuery,Jw=p.platformProbe.resolveInferenceConfig.useQuery,ek=p.platformProbe.resolveHwAccel.useQuery,tk=p.ptz.move.useMutation,rk=p.ptz.continuousMove.useMutation,nk=p.ptz.stop.useMutation,ok=p.ptz.getPresets.useQuery,sk=p.ptz.goToPreset.useMutation,ak=p.ptz.goHome.useMutation,ik=p.ptz.getPosition.useQuery,lk=p.ptz.getStatus.useQuery,ck=p.ptzAutotrack.getStatus.useQuery,dk=p.ptzAutotrack.setEnabled.useMutation,uk=p.ptzAutotrack.getSettings.useQuery,pk=p.ptzAutotrack.setSettings.useMutation,fk=p.reboot.reboot.useMutation,mk=p.recording.getSegments.useQuery,hk=p.recording.getPlaybackUrl.useQuery,gk=p.recording.getThumbnailAt.useQuery,bk=p.recordingEngine.getStatus.useQuery,vk=p.recordingEngine.enable.useMutation,yk=p.recordingEngine.disable.useMutation,xk=p.recordingEngine.getConfig.useQuery,wk=p.recordingEngine.updateConfig.useMutation,kk=p.recordingEngine.getPlaylist.useQuery,Nk=p.recordingEngine.getThumbnail.useQuery,Sk=p.recordingEngine.getSegments.useQuery,Ck=p.recordingEngine.getAvailability.useQuery,Mk=p.recordingEngine.estimateStorage.useQuery,Ek=p.recordingEngine.estimateGlobalStorage.useQuery,Ak=p.recordingEngine.getStorageUsage.useQuery,Pk=p.recordingEngine.setPolicy.useMutation,Rk=p.recordingEngine.getPolicy.useQuery,_k=p.recordingEngine.getPolicyStatus.useQuery,Ik=p.recordingEngine.getRetentionConfig.useQuery,Tk=p.recordingEngine.updateRetentionConfig.useMutation,Dk=p.recordingEngine.getMotionStats.useQuery,Lk=p.remoteAccess.listProviders.useQuery,Ok=p.remoteAccess.startProvider.useMutation,$k=p.remoteAccess.stopProvider.useMutation,Bk=p.settingsStore.get.useQuery,zk=p.settingsStore.set.useMutation,Fk=p.settingsStore.query.useQuery,jk=p.settingsStore.insert.useMutation,Gk=p.settingsStore.update.useMutation,Qk=p.settingsStore.delete.useMutation,Hk=p.settingsStore.count.useQuery,Uk=p.settingsStore.isEmpty.useQuery,Vk=p.settingsStore.declareCollection.useMutation,qk=p.snapshot.getSnapshot.useQuery,Wk=p.snapshot.invalidateCache.useMutation,Kk=p.snapshot.getStatus.useQuery,Zk=p.snapshot.getDeviceSettingsContribution.useQuery,Yk=p.snapshot.getDeviceLiveContribution.useQuery,Xk=p.snapshot.applyDeviceSettingsPatch.useMutation,Jk=p.snapshotProvider.supportsDevice.useQuery,e2=p.snapshotProvider.getSnapshot.useQuery,t2=p.storage.resolve.useQuery,r2=p.storage.write.useMutation,n2=p.storage.read.useQuery,o2=p.storage.exists.useQuery,s2=p.storage.list.useQuery,a2=p.storage.delete.useMutation,i2=p.storage.getAvailableSpace.useQuery,l2=p.storage.beginUpload.useMutation,c2=p.storage.writeChunk.useMutation,d2=p.storage.finalizeUpload.useMutation,u2=p.storage.abortUpload.useMutation,p2=p.storage.beginDownload.useMutation,f2=p.storage.readChunk.useQuery,m2=p.storage.endDownload.useMutation,h2=p.storage.listLocations.useQuery,g2=p.storage.getDefaultLocation.useQuery,b2=p.storage.upsertLocation.useMutation,v2=p.storage.deleteLocation.useMutation,y2=p.storage.testLocation.useQuery,x2=p.storage.listProviders.useQuery,w2=p.storage.testConfig.useQuery,k2=p.streamBroker.publishCameraStream.useMutation,N2=p.streamBroker.retractCameraStream.useMutation,S2=p.streamBroker.assignProfile.useMutation,C2=p.streamBroker.unassignProfile.useMutation,M2=p.streamBroker.listAllCameraStreams.useQuery,E2=p.streamBroker.listAllProfileSlots.useQuery,A2=p.streamBroker.getBrokerStats.useQuery,P2=p.streamBroker.listClients.useQuery,R2=p.streamBroker.killClient.useMutation,_2=p.streamBroker.restartProfile.useMutation,I2=p.streamBroker.getStreamUrl.useQuery,T2=p.streamBroker.getBroker.useQuery,D2=p.streamBroker.setPreBufferDuration.useMutation,L2=p.streamBroker.getPreBufferInfo.useQuery,O2=p.streamBroker.getRtspPort.useQuery,$2=p.streamBroker.getAllRtspEntries.useQuery,B2=p.streamBroker.getRtspEntry.useQuery,z2=p.streamBroker.regenerateRtspToken.useMutation,F2=p.streamBroker.setRtspEnabled.useMutation,j2=p.streamBroker.isRtspEnabled.useQuery,G2=p.streamBroker.getDeviceSettingsContribution.useQuery,Q2=p.streamBroker.getDeviceLiveContribution.useQuery,H2=p.streamBroker.applyDeviceSettingsPatch.useMutation,U2=p.switch.setState.useMutation,V2=p.switch.getStatus.useQuery,q2=p.system.info.useQuery,W2=p.system.health.useQuery,K2=p.system.featureFlags.useQuery,Z2=p.system.networkAddresses.useQuery,Y2=p.system.getRetentionConfig.useQuery,X2=p.system.setRetentionConfig.useMutation,J2=p.system.forceRetentionCleanup.useMutation,eN=p.toast.onToast.useSubscription,tN=p.turnOrchestrator.listProviders.useQuery,rN=p.turnOrchestrator.getAllServers.useQuery,nN=p.turnOrchestrator.setProviderEnabled.useMutation,oN=p.turnProvider.getTurnServers.useQuery,sN=p.userManagement.listUsers.useQuery,aN=p.userManagement.createUser.useMutation,iN=p.userManagement.updateUser.useMutation,lN=p.userManagement.deleteUser.useMutation,cN=p.userManagement.resetPassword.useMutation,dN=p.userManagement.validateCredentials.useMutation,uN=p.userManagement.listApiKeys.useQuery,pN=p.userManagement.createApiKey.useMutation,fN=p.userManagement.revokeApiKey.useMutation,mN=p.userManagement.validateApiKey.useMutation,hN=p.userManagement.createScopedToken.useMutation,gN=p.userManagement.revokeScopedToken.useMutation,bN=p.userManagement.validateScopedToken.useQuery,vN=p.userManagement.listScopedTokens.useQuery,yN=p.webrtcSession.listStreams.useQuery,xN=p.webrtcSession.createSession.useMutation,wN=p.webrtcSession.handleAnswer.useMutation,kN=p.webrtcSession.closeSession.useMutation,NN=p.webrtcSession.hasAdaptiveBitrate.useQuery,SN=p.zoneAnalytics.getCurrentSnapshot.useQuery,CN=p.zoneAnalytics.getZoneHistory.useQuery,MN=p.zoneAnalytics.getCameraHistory.useQuery,EN=p.zoneAnalytics.getUnzonedHistory.useQuery,AN=p.zoneRules.listRules.useQuery,PN=p.zoneRules.setRules.useMutation,RN=p.zones.listZones.useQuery,_N=p.zones.addZone.useMutation,IN=p.zones.removeZone.useMutation,TN=p.zones.updateZone.useMutation,Vi=ot("camstack:widget-registry",null),wr=new Map,rr=new Map,Xo=new Set;function Em(e){if(!e||typeof e!="object")return!1;const t=e.default;return t!==null&&typeof t=="object"}function Am(e){if(!e||typeof e!="object")return typeof e;const t=e,r=Object.getPrototypeOf(t),n=r&&typeof r=="object"?r.constructor?.name:void 0;return{ownKeys:Object.keys(t),allKeys:Object.getOwnPropertyNames(t),proto:typeof n=="string"?n:void 0}}async function Pm(e,t){const r=wr.get(e);if(r)return r;const n=rr.get(e);if(n)return n;Xo.has(e)||(Zd(),Ud([{name:e,entry:t,type:"module"}],{force:!1}),Xo.add(e));const s=Hd(`${e}/widgets`).then(a=>{if(!Em(a)){const l=Am(a);throw new Error(`Widget remote ${e} (${t}) does not expose a default record on './widgets'. Got: ${JSON.stringify(l)}`)}const i=a.default;return wr.set(e,i),rr.delete(e),i}).catch(a=>{throw rr.delete(e),a});return rr.set(e,s),s}var Rm=3e4,_m=2e3;function DN({children:e}){const t=Rn(),r=q(Date.now()),{data:n}=Mm(void 0,{staleTime:0,refetchOnMount:"always",refetchInterval:l=>{const c=l.state.data;return c&&c.length>0||Date.now()-r.current>=Rm?!1:_m}});Pr("addon.widget-ready",()=>{t.invalidateQueries({queryKey:[["addonWidgets","listWidgets"]]})});const[s,a]=S(0);H(()=>{if(!n)return;let l=!1;const c=new Set;for(const d of n){if(c.has(d.remoteName)||(c.add(d.remoteName),wr.has(d.remoteName)))continue;const u=d.bundleUrl;Pm(d.remoteName,u).then(()=>{l||a(f=>f+1)}).catch(f=>{const h=f instanceof Error?f.message:String(f);(typeof globalThis<"u"?globalThis.console:void 0)?.error?.("[WidgetRegistry] Failed to load widget remote",{remoteName:d.remoteName,entryUrl:u,reason:h})})}return()=>{l=!0}},[n]);const i=re(()=>{const l=n??[],c=new Map;for(const u of l)c.set(`${u.addonId}/${u.stableId}`,u);const d=(u,f)=>({widgetId:u,addonId:f.addonId,stableId:f.stableId,label:f.label,description:f.description,icon:f.icon,remoteName:f.remoteName,bundleUrl:f.bundleUrl,hosts:f.hosts,requires:f.requires,defaultSize:f.defaultSize,allowedSizes:f.allowedSizes,defaultColumns:f.defaultColumns,defaultRows:f.defaultRows});return{resolve:u=>{const f=c.get(u);if(!f)return;const h=wr.get(f.remoteName);if(!h)return null;const g=h[f.stableId];if(g)return g},metadata:u=>{const f=c.get(u);if(f)return d(u,f)},listAll:()=>{const u=[];for(const[f,h]of c)u.push(d(f,h));return u}}},[n,s]);return o(Vi.Provider,{value:i,children:e})}function Im(e){return Zn().resolve(e)}function Tm(e){return Zn().metadata(e)}function LN(){return Zn().listAll()}function Zn(){const e=Dm();if(!e)throw new Error("useWidgetRegistry(): no <WidgetRegistryProvider> in tree");return e}function Dm(){return Lm(Vi)}function Lm(e){return Ae(e)}function Om(e){const{widgetId:t,host:r="device-tab",config:n,deviceId:s,integrationId:a,instanceId:i,size:l,columns:c,rows:d}=e,u=Im(t),f=Tm(t),h=re(()=>i??t,[i,t]);if(u===void 0&&f===void 0)return o(nr,{widgetId:t,reason:"unknown"});if(u===void 0)return o(nr,{widgetId:t,reason:"missing-export"});if(u===null)return o($m,{});if(f){if(f.requires.deviceContext&&s===void 0)return o(nr,{widgetId:t,reason:"missing-device-context"});if(f.requires.integrationContext&&a===void 0)return o(nr,{widgetId:t,reason:"missing-integration-context"})}return o(u,{instanceId:h,host:r,config:n,deviceId:s,integrationId:a,size:l,columns:c,rows:d})}function $m(){return m("div",{className:"rounded-lg border border-border bg-surface/40 p-4 animate-pulse",children:[o("div",{className:"h-3 w-24 bg-foreground-subtle/20 rounded mb-2"}),o("div",{className:"h-2 w-full bg-foreground-subtle/10 rounded mb-1"}),o("div",{className:"h-2 w-3/4 bg-foreground-subtle/10 rounded"})]})}function nr({widgetId:e,reason:t}){return o("div",{className:"rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",children:t==="unknown"?`Widget "${e}" not registered`:t==="missing-export"?`Widget "${e}" bundle does not export this stableId`:t==="missing-device-context"?`Widget "${e}" requires a deviceId`:`Widget "${e}" requires an integrationId`})}var mt="w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none disabled:opacity-50 disabled:cursor-not-allowed",Ir="block text-[11px] font-medium text-foreground mb-1",Bm="text-[10px] text-foreground-subtle mt-0.5";function Ce({label:e,description:t,required:r,span:n,children:s,translationFn:a}){const i=n===2?"col-span-2":n===3?"col-span-3":n===4?"col-span-4":"col-span-1",l=Qe(e,a),c=Qe(t,a);return m("div",{className:i,children:[l!==void 0&&l!==""&&m("label",{className:Ir,children:[l,r&&o("span",{className:"text-danger ml-0.5",children:"*"})]}),s,c&&o("p",{className:Bm,children:c})]})}function zm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:o("input",{type:e.inputType??"text",className:mt,value:t==null?"":String(t),placeholder:e.placeholder,maxLength:e.maxLength,pattern:e.pattern,disabled:n||e.disabled,onChange:a=>r(a.target.value)})})}function Fm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const[a,i]=S(t==null?"":String(t)),l=q(!1);H(()=>{l.current||i(t==null?"":String(t))},[t]);const c=d=>{if(i(d),d===""||d==="-"){r(void 0);return}const u=Number(d);Number.isNaN(u)||r(u)};return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("div",{className:"flex items-center gap-1",children:[o("input",{type:"number",className:mt,value:a,placeholder:e.placeholder,min:e.min,max:e.max,step:e.step,disabled:n||e.disabled,onFocus:()=>{l.current=!0},onBlur:()=>{l.current=!1},onChange:d=>c(d.target.value)}),e.unit&&o("span",{className:"text-xs text-foreground-subtle whitespace-nowrap",children:e.unit})]})})}function jm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=!!t,i=n||e.disabled;return e.style==="checkbox"?o(Ce,{label:void 0,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[o("input",{type:"checkbox",className:"h-3.5 w-3.5 rounded border-border accent-primary",checked:a,disabled:i,onChange:l=>r(l.target.checked)}),o("span",{className:"text-xs font-medium text-foreground",children:Qe(e.label,s)}),e.required&&o("span",{className:"text-danger",children:"*"})]})}):o(Ce,{label:void 0,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("div",{className:"flex items-center justify-between",children:[m("span",{className:Ir+" mb-0",children:[Qe(e.label,s),e.required&&o("span",{className:"text-danger ml-0.5",children:"*"})]}),o("button",{type:"button",role:"switch","aria-checked":a,disabled:i,onClick:()=>!i&&r(!a),className:["relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150",a?"bg-primary":"bg-foreground-subtle/30",i?"opacity-50 cursor-not-allowed":"cursor-pointer"].join(" "),children:o("span",{className:["inline-block h-3 w-3 rounded-full bg-white shadow transition-transform duration-150",a?"translate-x-4":"translate-x-0.5"].join(" ")})})]})})}function Gm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=e.options.some(i=>i.value==="");return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("select",{className:mt,value:t==null?"":String(t),disabled:n||e.disabled,onChange:i=>r(i.target.value),children:[!e.required&&!a&&o("option",{value:"",children:"— Select —"}),e.options.map(i=>o("option",{value:i.value,children:i.label},i.value))]})})}function Qm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=Array.isArray(t)?t:[],i=l=>{if(a.includes(l))r(a.filter(c=>c!==l));else{if(e.maxItems!==void 0&&a.length>=e.maxItems)return;r([...a,l])}};return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:o("div",{className:"flex flex-wrap gap-2",children:e.options.map(l=>{const c=a.includes(l.value);return m("label",{className:["flex items-center gap-1.5 rounded-md border px-2 py-1 text-xs cursor-pointer select-none transition-colors",c?"border-primary bg-primary/10 text-primary":"border-border bg-background text-foreground hover:bg-surface",n||e.disabled?"opacity-50 cursor-not-allowed":""].join(" "),children:[o("input",{type:"checkbox",className:"sr-only",checked:c,disabled:n||e.disabled,onChange:()=>i(l.value)}),l.label]},l.value)})})})}function Hm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const[a,i]=S(!1),l=e.showToggle!==!1;return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("div",{className:"relative",children:[o("input",{type:a?"text":"password",className:mt+(l?" pr-9":""),value:t==null?"":String(t),placeholder:e.placeholder,disabled:n||e.disabled,onChange:c=>r(c.target.value)}),l&&o("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground",tabIndex:-1,onClick:()=>i(c=>!c),children:a?o(Da,{className:"h-3.5 w-3.5"}):o(Mr,{className:"h-3.5 w-3.5"})})]})})}function Um({field:e,value:t,onChange:r,disabled:n,translationFn:s}){return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:o("textarea",{className:mt+" resize-y min-h-[60px]",value:t==null?"":String(t),placeholder:e.placeholder,rows:e.rows??3,maxLength:e.maxLength,disabled:n||e.disabled,onChange:a=>r(a.target.value)})})}function Vm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=t==null,i=e.nullable===!0,l=a?e.default??e.min:Number(t),c=e.showValue!==!1,d=e.nullLabel??"Auto",u=n||e.disabled,f=e.displayScale??1,h=e.min/f,g=e.max/f,b=l/f,v=(e.step??1)/f;if(i&&a)return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("button",{className:"w-full rounded-lg border border-dashed border-border px-3 py-2 text-xs text-foreground-subtle hover:border-primary/40 hover:text-primary transition-colors text-left",disabled:u,onClick:()=>r(e.default??e.min),children:[d," — click to set manually"]})});const x=e.showStepper===!0&&c,y=k=>{const M=l+k*(e.step??1),C=Math.min(e.max,Math.max(e.min,M));C!==l&&r(C)},w="flex h-6 w-6 shrink-0 items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:cursor-not-allowed disabled:opacity-40";return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[m("div",{className:"flex min-w-0 flex-1 basis-[160px] items-center gap-2",children:[o("span",{className:"text-[10px] text-foreground-subtle tabular-nums shrink-0",children:h}),o("input",{type:"range",className:"min-w-0 flex-1 h-1 accent-primary cursor-pointer disabled:opacity-50",min:h,max:g,step:v,value:b,disabled:u,onChange:k=>r(Number(k.target.value)*f)}),o("span",{className:"text-[10px] text-foreground-subtle tabular-nums shrink-0",children:g})]}),(c||i||e.unit)&&m("div",{className:"flex shrink-0 items-center gap-2",children:[x&&o("button",{type:"button",className:w,disabled:u||l<=e.min,onClick:()=>y(-1),title:`Decrease by ${e.step??1}`,"aria-label":"Decrement",children:o(za,{className:"h-3 w-3"})}),c&&o("input",{type:"number",className:"w-16 rounded border border-border bg-surface px-1.5 py-0.5 text-xs text-center text-foreground tabular-nums focus:outline-none focus:ring-1 focus:ring-primary",min:h,max:g,step:v,value:b,disabled:u,onChange:k=>{if(k.target.value===""){r(i?null:e.min);return}const M=Number(k.target.value)*f,C=e.step??1,A=M-e.min,_=e.min+Math.round(A/C)*C;r(Math.min(e.max,Math.max(e.min,_)))}}),x&&o("button",{type:"button",className:w,disabled:u||l>=e.max,onClick:()=>y(1),title:`Increase by ${e.step??1}`,"aria-label":"Increment",children:o(Er,{className:"h-3 w-3"})}),e.unit&&o("span",{className:"text-[10px] text-foreground-subtle",children:e.unit}),i&&o("button",{className:"text-[10px] text-foreground-subtle hover:text-primary transition-colors",title:`Reset to ${d}`,disabled:u,onClick:()=>r(null),children:d})]})]})})}function qm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=Array.isArray(t)?t:[],[i,l]=S(""),c=q(null),d=I(g=>{const b=g.trim();!b||a.includes(b)||e.maxTags!==void 0&&a.length>=e.maxTags||(r([...a,b]),l(""))},[a,e.maxTags,r]),u=g=>r(a.filter(b=>b!==g)),f=g=>{g.key==="Enter"||g.key===","?(g.preventDefault(),d(i)):g.key==="Backspace"&&i===""&&a.length>0&&u(a[a.length-1])},h=n||e.disabled;return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("div",{className:["flex flex-wrap gap-1.5 rounded-md border border-border bg-background px-2 py-1.5 min-h-[38px] cursor-text","focus-within:border-primary focus-within:ring-1 focus-within:ring-primary/30",h?"opacity-50 cursor-not-allowed":""].join(" "),onClick:()=>!h&&c.current?.focus(),children:[a.map(g=>m("span",{className:"inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:[g,!h&&o("button",{type:"button",onClick:()=>u(g),className:"hover:text-danger",children:o(Ie,{className:"h-2.5 w-2.5"})})]},g)),o("input",{ref:c,type:"text",className:"flex-1 min-w-[80px] bg-transparent text-sm text-foreground outline-none placeholder:text-foreground-disabled",value:i,placeholder:a.length===0?e.placeholder??"Add tags…":"",disabled:h,list:`tags-suggestions-${e.key}`,onChange:g=>l(g.target.value),onKeyDown:f,onBlur:()=>{i.trim()&&d(i)}}),e.suggestions&&o("datalist",{id:`tags-suggestions-${e.key}`,children:e.suggestions.map(g=>o("option",{value:g},g))})]})})}function Wm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const{nodes:a}=qn(),i=typeof t=="string"?t:"",l=e.showOffline?a:a.filter(c=>c.isOnline);return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:m("select",{className:"w-full px-3 py-2 text-sm bg-background border border-border rounded-lg text-foreground focus:outline-none focus:border-primary/50 disabled:opacity-50",value:i,onChange:c=>r(c.target.value),disabled:n,children:[o("option",{value:"",children:"Select node…"}),l.map(c=>m("option",{value:c.id,disabled:!c.isOnline,children:[c.shortName,c.isOnline?"":" (offline)"]},c.id))]})})}function Km({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const{nodes:a}=qn(),i=new Set(Array.isArray(t)?t.map(String):[]),l=e.showOffline?a:a.filter(d=>d.isOnline),c=d=>{const u=new Set(i);u.has(d)?u.delete(d):u.add(d),r([...u])};return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:o("div",{className:"flex flex-wrap gap-1.5",children:l.map(d=>{const u=i.has(d.id);return o("button",{type:"button",onClick:()=>c(d.id),disabled:n||!d.isOnline,className:`px-2.5 py-1 text-xs font-medium rounded-md border transition-colors ${u?"border-primary bg-primary/10 text-primary":"border-border bg-surface text-foreground-subtle hover:bg-surface-hover"} ${d.isOnline?"":"opacity-50 cursor-not-allowed"}`,children:d.shortName},d.id)})})})}function Zm({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=t==null?"#000000":String(t);return m(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:[m("div",{className:"flex items-center gap-2",children:[o("input",{type:"color",className:"h-9 w-9 rounded-md border border-border bg-background cursor-pointer p-0.5 disabled:opacity-50",value:a,disabled:n||e.disabled,onChange:i=>r(i.target.value)}),o("input",{type:"text",className:mt+" flex-1 font-mono",value:a,placeholder:"#000000",disabled:n||e.disabled,onChange:i=>r(i.target.value)})]}),e.presets&&e.presets.length>0&&o("div",{className:"flex gap-1.5 mt-1.5",children:e.presets.map(i=>o("button",{type:"button",className:"h-5 w-5 rounded-md border border-border hover:scale-110 transition-transform disabled:opacity-50",style:{backgroundColor:i},disabled:n||e.disabled,title:i,onClick:()=>r(i)},i))})]})}function Ym({field:e,value:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i,externalProbe:l}){const[c,d]=S("idle"),[u,f]=S(null),h=l?.status??c,g=l?.result??u,b=!!a||!!i,v=I(async()=>{if(b){d("probing"),f(null);try{const w=a?await a(e.key,t):await i("test-probe",e.key,t),k=w&&typeof w=="object"?w:{status:"error",error:"Probe handler returned no result"};f(k),d(k.status==="ok"?"ok":"error")}catch(w){f({status:"error",error:w instanceof Error?w.message:String(w)}),d("error")}}},[a,i,e.key,t,b]),x=h==="probing"?"border-primary/40 bg-primary/10 text-primary":h==="ok"?"border-success/40 bg-success/10 text-success hover:bg-success/15":h==="error"?"border-danger/40 bg-danger/10 text-danger hover:bg-danger/15":"border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover",y=h==="probing"?o(Ge,{className:"h-3 w-3 animate-spin"}):h==="ok"?o(fu,{className:"h-3 w-3"}):h==="error"?o(Cr,{className:"h-3 w-3"}):o(Ua,{className:"h-3 w-3"});return m(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:[m("div",{className:"@container flex items-center gap-2",style:{containerType:"inline-size"},children:[m("button",{type:"button",onClick:v,title:"Test",disabled:e.disabled||h==="probing"||!b||!t,className:`flex-shrink-0 inline-flex items-center gap-1.5 rounded-md border px-2 py-2 text-xs font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed @[280px]:px-3 ${x}`,children:[y,o("span",{className:"hidden @[280px]:inline",children:"Test"})]}),o("input",{type:e.inputType??"url",className:mt+" flex-1 min-w-0",value:t==null?"":String(t),placeholder:e.placeholder,disabled:n||e.disabled,onChange:w=>{r(w.target.value),c!=="idle"&&(d("idle"),f(null))}})]}),h==="ok"&&g?.labels&&g.labels.length>0&&o("div",{className:"flex flex-wrap gap-1 mt-1.5",children:g.labels.map((w,k)=>o("span",{className:"text-xs bg-success/10 text-success rounded px-2 py-0.5 font-mono",children:w},k))}),h==="error"&&g?.error&&o("p",{className:"text-xs text-danger mt-1 truncate",title:g.error,children:g.error})]})}function Xm({field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a}){const[i,l]=S(e.defaultCollapsed??!1),c=e.style==="accordion";return o("div",{className:e.span===2?"col-span-2":e.span===3?"col-span-3":e.span===4?"col-span-4":"col-span-1",children:m("div",{className:"rounded-lg border border-border bg-surface/50 overflow-hidden",children:[m("div",{className:["px-3 py-2 flex items-center justify-between",c?"cursor-pointer hover:bg-surface":""].join(" "),onClick:c?()=>l(d=>!d):void 0,children:[o("span",{className:"text-xs font-semibold text-foreground",children:Qe(e.label,s)}),c&&o("span",{className:"text-foreground-subtle text-xs",children:i?"▸":"▾"})]}),!i&&o("div",{className:"px-3 pb-3 grid grid-cols-2 gap-x-4 gap-y-3",children:e.fields.map(d=>o(Kt,{field:d,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a},d.key))})]})})}function Jm({field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i}){const[l,c]=S(e.tabs[0]?.id??""),d=e.span===2?"col-span-2":e.span===3?"col-span-3":e.span===4?"col-span-4":"col-span-1";return e.tabs.length===0?null:m("div",{className:d,children:[e.label&&o("div",{className:Ir,children:Qe(e.label,s)}),m("div",{className:"rounded-lg border border-border-subtle bg-surface-hover/40 overflow-hidden",children:[o("div",{className:"flex flex-wrap gap-1 p-1.5 border-b border-border-subtle bg-surface/40",role:"tablist",children:e.tabs.map(u=>{const f=u.id===l;return m("button",{type:"button",role:"tab","aria-selected":f,onClick:()=>c(u.id),className:`inline-flex items-center gap-1.5 whitespace-nowrap rounded-md px-2.5 py-1 text-[11px] transition-colors ${f?"bg-primary text-primary-foreground font-medium shadow-sm":"bg-transparent text-foreground-subtle hover:bg-surface hover:text-foreground"}`,children:[o("span",{children:Qe(u.label,s)}),u.badge&&o("span",{className:`text-[9px] px-1 py-0.5 rounded-full font-medium ${f?"bg-primary-foreground/20 text-primary-foreground":"bg-primary/10 text-primary"}`,children:u.badge})]},u.id)})}),e.tabs.map(u=>u.id!==l?null:o("div",{role:"tabpanel",className:"px-3 pb-3 pt-2 grid grid-cols-2 gap-x-4 gap-y-3",children:u.fields.map((f,h)=>{const g="key"in f&&typeof f.key=="string"?f.key:`__${u.id}__${h}`;return o(Kt,{field:f,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i},g)})},u.id))]})]})}function eh({span:e}){return o("div",{className:e===2?"col-span-2":e===3?"col-span-3":e===4?"col-span-4":"col-span-full",children:o("hr",{className:"border-border"})})}var Jo={info:{border:"border-info",bg:"bg-info/5",text:"text-info"},warning:{border:"border-warning",bg:"bg-warning/5",text:"text-warning"},success:{border:"border-success",bg:"bg-success/5",text:"text-success"},danger:{border:"border-danger",bg:"bg-danger/5",text:"text-danger"}};function th(e){if(typeof window>"u"||typeof DOMParser>"u")return"";const t=new Set(["A","UL","OL","LI","STRONG","EM","CODE","BR","P","SPAN"]),r=new DOMParser().parseFromString(`<div>${e}</div>`,"text/html"),n=r.body.firstElementChild;if(!n)return"";const s=a=>{const i=Array.from(a.children);for(const l of i){if(!t.has(l.tagName)){const d=r.createTextNode(l.textContent??"");l.replaceWith(d);continue}const c=l.tagName==="A"?new Set(["href"]):new Set;for(const d of Array.from(l.attributes))c.has(d.name)||l.removeAttribute(d.name);if(l.tagName==="A"){const d=l.getAttribute("href")??"";!/^https?:\/\//i.test(d)&&!d.startsWith("mailto:")?l.removeAttribute("href"):(l.setAttribute("target","_blank"),l.setAttribute("rel","noopener noreferrer"))}s(l)}};return s(n),n.innerHTML}function rh({field:e}){const t=Jo[e.variant??"info"]??Jo.info,r=e.format==="html";return o("div",{className:"col-span-full",children:m("div",{className:`rounded-md border-l-4 px-3 py-2.5 ${t.border} ${t.bg}`,children:[e.label&&o("p",{className:`text-xs font-semibold mb-0.5 ${t.text}`,children:e.label}),r?o("div",{className:"text-xs text-foreground-subtle leading-relaxed info-html-content",dangerouslySetInnerHTML:{__html:th(e.content)}}):o("p",{className:"text-xs text-foreground-subtle leading-relaxed whitespace-pre-line",children:e.content})]})})}var es={ok:"bg-success",warn:"bg-amber-500",danger:"bg-danger",idle:"bg-foreground-subtle/40",unknown:"bg-foreground-subtle/40"};function nh(e){if(!Number.isFinite(e)||e<0)return"—";if(e<1e3)return`${e}ms`;const t=Math.round(e/1e3);if(t<60)return`${t}s`;const r=Math.floor(t/60),n=t%60;return n===0?`${r}m`:`${r}m ${n}s`}function oh(e){return!Number.isFinite(e)||e<=0?"—":new Date(e).toLocaleTimeString()}function sh({kind:e,value:t}){return t==null||t===""?o("span",{className:"text-foreground-subtle/60",children:"—"}):e==="monospace"?o("span",{className:"font-mono text-[11px]",children:String(t)}):e==="status"?m("span",{className:"inline-flex items-center gap-1.5",children:[o("span",{className:`inline-block h-1.5 w-1.5 rounded-full ${es[String(t).toLowerCase()]??es.unknown}`}),o("span",{children:String(t)})]}):e==="duration"&&typeof t=="number"?o("span",{className:"font-mono text-[11px]",children:nh(t)}):e==="timestamp"&&typeof t=="number"?o("span",{className:"font-mono text-[11px]",children:oh(t)}):o("span",{children:String(t)})}function ah({field:e}){const t=e.value??[],r=e.description;return m("div",{className:"col-span-full",children:[e.label&&o("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-foreground-subtle mb-1",children:e.label}),r&&o("p",{className:"text-xs text-foreground-subtle mb-2",children:r}),t.length===0?o("div",{className:"rounded-md border border-border bg-surface-subtle px-3 py-2 text-xs text-foreground-subtle",children:e.emptyMessage??"No entries"}):o("div",{className:"rounded-md border border-border overflow-hidden",children:m("table",{className:"w-full text-xs",children:[o("thead",{className:"bg-surface-subtle border-b border-border",children:o("tr",{children:e.columns.map(n=>o("th",{className:"px-3 py-1.5 text-left font-medium text-foreground-subtle",style:n.width?{width:n.width}:void 0,children:n.label},n.key))})}),o("tbody",{className:"divide-y divide-border",children:t.map((n,s)=>o("tr",{className:"hover:bg-surface-hover/40",children:e.columns.map(a=>o("td",{className:"px-3 py-1.5 align-top text-foreground",children:o(sh,{kind:a.kind,value:n[a.key]})},a.key))},s))})]})})]})}function ih({field:e,value:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i}){const l=Array.isArray(t)?t:[],c=e.minRows??0,d=e.maxRows??Number.POSITIVE_INFINITY,u=(x,y,w)=>{const k=l.slice();k[x]={...k[x]??{},[y]:w},r(k)},f=x=>{l.length<=c||r(l.filter((y,w)=>w!==x))},h=()=>{if(l.length>=d)return;const x=e.defaultItem??{};r([...l,{...x}])},g=(x,y)=>e.rowTitleTemplate?e.rowTitleTemplate.replace(/\{(\w+)\}/g,(w,k)=>{const M=x[k];return M==null||M===""?"—":String(M)}):`Row ${y+1}`,b=l.length>c,v=l.length<d;return m("div",{className:"col-span-full space-y-2",children:[m("div",{className:"space-y-0.5",children:[e.label&&o("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-foreground-subtle",children:Qe(e.label,s)}),e.description&&o("p",{className:"text-[11px] text-foreground-subtle",children:Qe(e.description,s)})]}),l.length===0?o("div",{className:"rounded-md border border-dashed border-border bg-background px-3 py-3 text-center text-[11px] text-foreground-subtle",children:e.emptyMessage??"No entries"}):o("div",{className:"space-y-2",children:l.map((x,y)=>m("div",{className:"rounded-md border border-border bg-background",children:[m("div",{className:"flex items-center justify-between border-b border-border px-3 py-1.5",children:[o("span",{className:"text-xs font-medium text-foreground",children:g(x,y)}),m("button",{type:"button",onClick:()=>f(y),disabled:n||!b,className:"inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] text-danger hover:bg-danger/10 disabled:opacity-30 disabled:cursor-not-allowed",title:b?"Remove this row":`At least ${c} row(s) required`,children:[o(za,{className:"h-3 w-3"}),"Remove"]})]}),o("div",{className:"grid grid-cols-1 @[420px]:grid-cols-2 gap-x-3 gap-y-2 p-3",children:e.itemFields.map(w=>o(Kt,{field:w,values:x,onChange:(k,M)=>u(y,k,M),disabled:n,translationFn:s,onTestField:a,allFields:e.itemFields,onAction:i},w.key))})]},y))}),m("div",{children:[m("button",{type:"button",onClick:h,disabled:n||!v,className:"inline-flex items-center gap-1 rounded border border-border bg-surface px-3 py-1 text-[11px] font-medium text-foreground hover:border-primary/40 hover:bg-primary/5 disabled:opacity-30 disabled:cursor-not-allowed",children:[o(Er,{className:"h-3 w-3"}),e.addLabel??"Add"]}),!v&&Number.isFinite(d)&&m("span",{className:"ml-2 text-[10px] text-foreground-subtle",children:["(limit: ",d,")"]})]})]})}function lh({field:e,disabled:t,onAction:r}){const[n,s]=S(!1),a=Wn(),i=async()=>{if(!(e.confirmMessage&&!await a({title:e.label,message:e.confirmMessage,confirmLabel:e.buttonLabel,variant:e.variant==="danger"?"danger":"default"}))&&r){s(!0);try{await r(e.action,e.key)}finally{s(!1)}}},l={default:"border border-border text-foreground hover:bg-surface-hover",primary:"bg-primary text-primary-foreground hover:bg-primary/90",danger:"bg-danger text-white hover:bg-danger/90"};return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,children:o("button",{onClick:i,disabled:t||n,className:`inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors disabled:opacity-50 ${l[e.variant??"default"]??l.default}`,children:n?"Processing...":e.buttonLabel})})}function qi(e,t){const r={...e.paramsStatic??{}};if(e.paramsFromForm)for(const[n,s]of Object.entries(e.paramsFromForm)){const a=t[s];a!=null&&a!==""&&(r[n]=a)}return r}function ch({field:e,value:t,values:r,onChange:n,disabled:s,onAction:a}){const[i,l]=S(!1),[c,d]=S(null),[u,f]=S(null),h=qi(e,r),g=Object.keys(e.paramsFromForm??{}).some(y=>h[y]===void 0);H(()=>{if(!a||g){f(null),d(null);return}let y=!1;return l(!0),d(null),a(e.action,e.key,h).then(w=>{if(y)return;const k=w;let M=[];if(Array.isArray(k))M=k;else if(k&&typeof k=="object")for(const C of Object.keys(k)){const A=k[C];if(Array.isArray(A)){M=A;break}}f(M)}).catch(w=>{y||(d(w instanceof Error?w.message:String(w)),f([]))}).finally(()=>{y||l(!1)}),()=>{y=!0}},[(e.refreshOn??Object.values(e.paramsFromForm??{})).map(y=>`${y}=${JSON.stringify(r[y])}`).join("|"),a,e.action,e.key]);const b=e.mapOption.value,v=e.mapOption.label,x=e.mapOption.description;return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,children:g?o("div",{className:"text-[11px] text-foreground-subtle italic",children:e.emptyParamsMessage??"Fill the prerequisite fields above first."}):i?m("div",{className:"flex items-center gap-2 text-[11px] text-foreground-subtle",children:[o(Ge,{className:"h-3 w-3 animate-spin"})," Loading options…"]}):c?o("div",{className:"text-[11px] text-danger",children:c}):u&&u.length===0?o("div",{className:"text-[11px] text-foreground-subtle italic",children:e.emptyResultsMessage??"No options returned."}):(()=>{const y=(u??[]).some(w=>{const k=w[b];return k===""||k===void 0});return m("select",{className:"w-full rounded-md border border-border bg-surface px-2 py-1.5 text-xs text-foreground",value:typeof t=="string"?t:"",disabled:s,onChange:w=>n(w.target.value),children:[!y&&o("option",{value:"",children:"— Select —"}),(u??[]).map((w,k)=>{const M=w[b],C=w[v],A=x?w[x]:void 0,_=typeof M=="string"&&M!==""?M:`row-${k}`;return m("option",{value:typeof M=="string"?M:String(M??""),children:[typeof C=="string"?C:String(C??_),A!==void 0?` (${String(A)})`:""]},_)})]})})()})}function dh({field:e,values:t,disabled:r,onAction:n}){const[s,a]=S(!1),[i,l]=S(null),c=Wn(),d=async()=>{if(e.confirmMessage&&!await c({title:e.label,message:e.confirmMessage,confirmLabel:e.buttonLabel,variant:e.variant==="danger"?"danger":"default"})||!n)return;const f=qi(e,t);a(!0),l(null);try{const h=await n(e.action,e.key,f),g=typeof h=="object"&&h!==null?h:null;l({kind:"ok",text:e.successMessage?e.successMessage.replace(/\{(\w+)\}/g,(b,v)=>{const x=g?.[v];return x===void 0?"":String(x)}):"Done."})}catch(h){l({kind:"error",text:h instanceof Error?h.message:String(h)})}finally{a(!1)}},u={default:"border border-border text-foreground hover:bg-surface-hover",primary:"bg-primary text-primary-foreground hover:bg-primary/90",danger:"bg-danger text-white hover:bg-danger/90"};return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,children:m("div",{className:"flex flex-col gap-1.5",children:[o("button",{onClick:d,disabled:r||s,className:`inline-flex w-fit items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors disabled:opacity-50 ${u[e.variant??"default"]??u.default}`,children:s?"Working…":e.buttonLabel}),i&&o("div",{className:`text-[11px] ${i.kind==="ok"?"text-emerald-700 dark:text-emerald-300":"text-danger"}`,children:i.text})]})})}function uh({field:e}){const t=Cm();return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,children:o(Om,{widgetId:e.widgetId,host:"device-tab",config:e.widgetConfig,deviceId:t??void 0,instanceId:e.key})})}function ph(e,t){if(e==null)return"—";if(typeof e=="boolean")return e?"yes":"no";if(typeof e=="number"){const r=Number.isInteger(e)?String(e):e.toFixed(2);return t?`${r} ${t}`:r}return typeof e=="string"?e:JSON.stringify(e)}function fh({field:e,values:t,onAction:r,translationFn:n}){const s="key"in e?e.key:void 0;if(!s)return null;const a=t[s],i=a!==void 0?a:"default"in e?e.default:void 0,l=ph(i,"unit"in e?e.unit:void 0),c="label"in e?e.label:void 0,d="description"in e?e.description:void 0,u="span"in e?e.span:void 0,f="actions"in e?e.actions??[]:[];return o(Ce,{label:c,description:d,span:u,translationFn:n,children:m("div",{className:"flex items-stretch gap-1",children:[o("div",{className:"flex-1 rounded-md border border-border bg-surface-alt px-2.5 py-1.5 text-xs text-foreground font-mono break-all",children:l}),f.length>0&&o("div",{className:"flex items-center gap-1",children:f.map(h=>o(hh,{action:h,fieldKey:s,value:i,onAction:r},h.action))})]})})}function mh({name:e}){const t="h-3.5 w-3.5";switch(e){case"copy":return o(at,{className:t});case"refresh-cw":return o(Gn,{className:t});case"external-link":return o(Ta,{className:t});case"trash-2":return o(Ye,{className:t});case"download":return o(fn,{className:t});case"upload":return o(Ha,{className:t});default:return o(Qn,{className:t})}}function hh({action:e,fieldKey:t,value:r,onAction:n}){const s=Wn(),[a,i]=S(!1),l=e.variant==="danger"?"text-danger hover:bg-danger/10 border-danger/30":e.variant==="primary"?"text-primary hover:bg-primary/10 border-primary/30":"text-foreground-subtle hover:text-foreground hover:bg-surface-hover border-border";return o("button",{type:"button",onClick:async()=>{if(!(e.confirmMessage&&!await s({title:e.tooltip,message:e.confirmMessage,variant:e.variant==="danger"?"danger":"default"}))){if(e.action==="copy-value"){try{await navigator.clipboard.writeText(typeof r=="string"?r:String(r))}catch{}return}if(n){i(!0);try{await n(e.action,t)}finally{i(!1)}}}},disabled:a,title:e.tooltip,className:`inline-flex items-center justify-center rounded-md border px-2 py-1.5 transition-colors disabled:opacity-50 ${l}`,children:o(mh,{name:e.icon})})}function gh(e){return"multiple"in e&&e.multiple!=null}function bh({field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,externalProbe:i,allFields:l,onAction:c}){const d=e.multiple,u=d.min,f=d.max,h=t[e.key],g=[...Array.isArray(h)?h:h!=null?[h]:[]],b=d.itemDefault!==void 0?d.itemDefault:"default"in e&&e.default!==void 0?e.default:"";for(;g.length<u;)g.push(b);const v=M=>r(e.key,[...M]),x=(M,C)=>{const A=[...g];A[M]=C,v(A)},y=()=>{g.length>=f||v([...g,b])},w=M=>{g.length<=u||v(g.filter((C,A)=>A!==M))},k=()=>{const{multiple:M,...C}=e;return{...C,...{label:void 0,description:void 0,required:!1}}};return o(Ce,{label:e.label,description:e.description,required:u>0?e.required:!1,span:e.span,translationFn:s,children:m("div",{className:"space-y-2",children:[g.map((M,C)=>{const A=d.itemLabel?.replace("${n}",String(C+1));return m("div",{className:"space-y-1",children:[A&&o("div",{className:Ir,children:A}),m("div",{className:"flex items-center gap-2",children:[o("div",{className:"flex-1 min-w-0",children:o(Kt,{field:k(),values:{...t,[e.key]:M},onChange:(_,P)=>x(C,P),disabled:n,translationFn:s,onTestField:a,onAction:c,allFields:l})}),g.length>u&&o("button",{type:"button",onClick:()=>w(C),disabled:n,title:"Remove",className:"flex-shrink-0 inline-flex items-center justify-center rounded-md border border-border p-1.5 text-foreground-subtle hover:text-danger hover:border-danger/50 transition-colors disabled:opacity-40",children:o(Ye,{className:"h-3.5 w-3.5"})})]})]},C)}),m("div",{className:"flex items-center justify-between pt-1",children:[g.length<f?m("button",{type:"button",onClick:y,disabled:n,className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-40",children:[o(Er,{className:"h-3 w-3"}),d.addLabel??"Add"]}):o("span",{}),m("span",{className:"text-[10px] text-foreground-subtle tabular-nums",children:[g.length,"/",f]})]})]})})}function vh(e,t,r){if(!("showWhen"in e)||!e.showWhen)return!0;const n=e.showWhen,s=t[n.field],a=r?.find(c=>"key"in c&&c.key===n.field),i=a&&"default"in a?a.default:void 0,l=s!==void 0?s:i;return n.equals!==void 0?l===n.equals:n.notEquals!==void 0?l!==n.notEquals:n.in!==void 0?n.in.includes(l):n.notIn!==void 0?!n.notIn.includes(l):n.includes!==void 0?Array.isArray(l)&&l.includes(n.includes):n.notIncludes!==void 0?!Array.isArray(l)||!l.includes(n.notIncludes):!0}function Kt({field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,externalProbe:i,allFields:l,onAction:c}){if(gh(e))return o(bh,{field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,externalProbe:i,allFields:l,onAction:c});if("readonlyField"in e&&e.readonlyField===!0)return o(fh,{field:e,values:t,onAction:c,translationFn:s});if(!vh(e,t,l))return null;const d=t[e.key],u=d!==void 0?d:"default"in e?e.default:void 0,f=g=>r(e.key,g),h=Sm(e.type);switch(e.type){case"text":return o(zm,{field:e,value:u,onChange:f,disabled:n,translationFn:s});case"number":return o(Fm,{field:e,value:u,onChange:f,disabled:n,translationFn:s});case"boolean":return o(jm,{field:e,value:u,onChange:f,disabled:n,translationFn:s});case"select":return o(Gm,{field:e,value:u,onChange:f,disabled:n,translationFn:s});case"multiselect":return o(Qm,{field:e,value:u,onChange:f,disabled:n,translationFn:s});case"password":return o(Hm,{field:e,value:u,onChange:f,disabled:n,translationFn:s});case"textarea":return o(Um,{field:e,value:u,onChange:f,disabled:n,translationFn:s});case"slider":return o(Vm,{field:e,value:u,onChange:f,disabled:n,translationFn:s});case"tags":return o(qm,{field:e,value:u,onChange:f,disabled:n,translationFn:s});case"color":return o(Zm,{field:e,value:u,onChange:f,disabled:n,translationFn:s});case"node-select":return o(Wm,{field:e,value:u,onChange:f,disabled:n,translationFn:s});case"node-multiselect":return o(Km,{field:e,value:u,onChange:f,disabled:n,translationFn:s});case"probe":return o(Ym,{field:e,value:u,onChange:f,disabled:n,translationFn:s,onTestField:a,onAction:c,externalProbe:i});case"group":return o(Xm,{field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a});case"sub-tabs":return o(Jm,{field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:c});case"separator":return o(eh,{});case"info":return o(rh,{field:e});case"object-array":return o(ah,{field:e});case"editable-array":return o(ih,{field:e,value:u,onChange:f,disabled:n,translationFn:s,onTestField:a,onAction:c});case"button":return o(lh,{field:e,disabled:n,onAction:c});case"addon-action-select":return o(ch,{field:e,value:u,values:t,onChange:f,disabled:n,onAction:c});case"addon-action-button":return o(dh,{field:e,values:t,disabled:n,onAction:c});case"widget":return o(uh,{field:e});default:return h?o(h,{field:e,value:u,onChange:f,disabled:n}):null}}function yh(e){return/^[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)+$/.test(e)}function Qe(e,t){if(e!==void 0)return t&&yh(e)?t(e):e}function xh({section:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,probeResults:i}){const[l,c]=S(e.defaultCollapsed??!1),d=e.style==="accordion",u=e.columns??2,f=u===1?"grid-cols-1":u===3?"grid-cols-1 @[480px]:grid-cols-2 @[880px]:grid-cols-3":u===4?"grid-cols-1 @[480px]:grid-cols-2 @[1140px]:grid-cols-4":"grid-cols-1 @[640px]:grid-cols-2";return m("div",{className:"@container rounded-lg border border-border bg-surface p-3",style:{containerType:"inline-size"},children:[m("div",{className:["flex items-center justify-between mb-2",d?"cursor-pointer":""].join(" "),onClick:d?()=>c(h=>!h):void 0,children:[m("div",{children:[o("h3",{className:"text-[11px] font-semibold text-foreground-subtle uppercase tracking-wider",children:Qe(e.title,s)}),e.description&&o("p",{className:"text-[10px] text-foreground-subtle mt-0.5",children:Qe(e.description,s)})]}),d&&o("span",{className:"text-foreground-subtle text-xs ml-2",children:l?"▸":"▾"})]}),!l&&o("div",{className:`grid ${f} gap-x-3 gap-y-2.5`,children:e.fields.map(h=>o(Kt,{field:h,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,externalProbe:i?.[h.key]},h.key))})]})}function wh({schema:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,probeResults:i,onClearProbe:l}){const c=(d,u)=>{r({...t,[d]:u}),l?.(d)};return o("div",{className:"space-y-4",children:e.sections.map(d=>o(xh,{section:d,values:t,onChange:c,disabled:n,translationFn:s,onTestField:a,probeResults:i},d.id))})}var kh=({open:e})=>o("svg",{className:`h-3 w-3 transition-transform ${e?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o("polyline",{points:"9 18 15 12 9 6"})});function ts(e){const t={};if(!e)return t;for(const r of e.sections)for(const n of r.fields){if(n.type==="separator"||n.type==="info"||n.type==="button"||n.type==="group")continue;const s=n.key;t[s]=n.value}return t}function Nh(e){return{...e,sections:e.sections.map(t=>({...t,fields:t.fields.map(r=>{if(r.type==="separator"||r.type==="info"||r.type==="button"||r.type==="group")return r;const{value:n,...s}=r;return s})}))}}function ON({trpc:e,addonId:t,nodeId:r,title:n,disabled:s,onAfterChange:a,refreshToken:i,collapsible:l,defaultOpen:c,mode:d,onOverrideChange:u}){const f=d??"persist",[h,g]=S(null),[b,v]=S(!0),[x,y]=S(null),[w,k]=S(!1),[M,C]=S(c??!1),[A,_]=S({}),[P,Q]=S(null);H(()=>{Q(null),_({})},[e,t,r,i,f]),H(()=>{let ie=!1;v(!0),y(null);const ne=f==="override"&&Object.keys(A).length>0?A:void 0;return e.addonSettings.getGlobalSettings.query({addonId:t,nodeId:r,...ne?{overlay:ne}:{}}).then(W=>{ie||(g(W),ne||Q(ts(W)),v(!1))}).catch(W=>{ie||(y(W instanceof Error?W.message:String(W)),v(!1))}),()=>{ie=!0}},[e,t,r,i,f,JSON.stringify(A)]);const oe=re(()=>ts(h),[h]),le=re(()=>h?Nh(h):null,[h]),ge=async ie=>{if(f==="override"){const W=P??oe,ye={};for(const T of Object.keys(ie))ie[T]!==W[T]&&(ye[T]=ie[T]);const me={...W,...ye};_(ye),u?.(ye,me);return}const ne={};for(const W of Object.keys(ie))ie[W]!==oe[W]&&(ne[W]=ie[W]);if(Object.keys(ne).length!==0){k(!0);try{await e.addonSettings.updateGlobalSettings.mutate({addonId:t,nodeId:r,patch:ne}),g(await e.addonSettings.getGlobalSettings.query({addonId:t,nodeId:r})),a?.()}catch(W){y(W instanceof Error?W.message:String(W))}finally{k(!1)}}};if(b)return m("div",{className:"text-xs text-foreground-subtle animate-pulse",children:["Loading ",n??t,"…"]});if(x)return m("div",{className:"text-xs text-red-400",children:[n??t,": ",x]});if(!h||!le)return m("div",{className:"text-xs text-foreground-subtle",children:[n??t," not available on ",r,"."]});const de=f==="override"?{...oe,...A}:oe,pe=m(Ne,{children:[f==="override"?o("div",{className:"mb-2 text-[11px] text-foreground-subtle",children:"Benchmark override — applies to this run only. The addon's saved settings are not changed."}):null,o(wh,{schema:le,values:de,onChange:ge,disabled:s===!0||w})]});return l===!0?m("section",{className:"rounded-lg border border-border bg-surface overflow-hidden",children:[m("button",{type:"button",onClick:()=>C(ie=>!ie),className:"w-full px-4 py-2 flex items-center gap-2 hover:bg-surface-hover text-left","aria-expanded":M,children:[o(kh,{open:M}),o("h3",{className:"text-xs font-semibold text-foreground uppercase tracking-wide flex-1",children:n??t}),o("span",{className:"text-[10px] text-foreground-subtle",children:M?"hide":"edit"})]}),M?o("div",{className:"border-t border-border px-4 py-3",children:pe}):null]}):n?m("section",{className:"rounded-lg border border-border bg-surface overflow-hidden",children:[o("div",{className:"border-b border-border px-4 py-2",children:o("h3",{className:"text-xs font-semibold text-foreground uppercase tracking-wide",children:n})}),o("div",{className:"px-4 py-3",children:pe})]}):o("div",{children:pe})}function Sh({detections:{motion:e,motionRaw:t,detection:r,phase:n},showMotionZones:s=!0,showMotionRaw:a=!0,showDetections:i=!0,showPhaseIndicator:l=!0}){const c=s&&e&&e.zones.length>0,d=a&&t&&t.boxes.length>0,u=i&&r&&r.detections.length>0;return!c&&!d&&!u&&!l?null:m("div",{className:"absolute inset-0 pointer-events-none z-10",children:[l&&o(Ch,{phase:n}),d&&o(Mh,{raw:t}),c&&o(Eh,{motion:e}),u&&o(Ah,{detections:r.detections,frameWidth:r.frameWidth,frameHeight:r.frameHeight})]})}function Ch({phase:e}){const t=js(e);return m("div",{className:"absolute top-2 left-2 flex items-center gap-1.5 px-2 py-1 rounded-md bg-black/60 backdrop-blur-sm",children:[o("span",{className:`w-2 h-2 rounded-full ${t.dotClass}`}),o("span",{className:"text-[10px] font-semibold text-white uppercase tracking-wider",children:t.label})]})}function Mh({raw:e}){return e.frameWidth===0||e.frameHeight===0?null:o(Ne,{children:e.boxes.map((t,r)=>{const[n,s,a,i]=t.bbox,l=n/e.frameWidth*100,c=s/e.frameHeight*100,d=(a-n)/e.frameWidth*100,u=(i-s)/e.frameHeight*100,f=Math.max(.05,Math.min(.25,t.changeScore*.3));return o("div",{className:"absolute rounded-sm",style:{left:`${l}%`,top:`${c}%`,width:`${d}%`,height:`${u}%`,backgroundColor:`rgba(239, 68, 68, ${f})`}},`mr-${r}`)})})}function Eh({motion:e}){return e.frameWidth===0||e.frameHeight===0?null:o(Ne,{children:e.zones.filter(t=>t.w*t.h/(e.frameWidth*e.frameHeight)<.9).map((t,r)=>{const n=Math.max(.15,Math.min(.5,t.intensity/255));return o("div",{className:"absolute rounded-sm",style:{left:`${t.x/e.frameWidth*100}%`,top:`${t.y/e.frameHeight*100}%`,width:`${t.w/e.frameWidth*100}%`,height:`${t.h/e.frameHeight*100}%`,border:`1px solid rgba(250, 204, 21, ${n})`,backgroundColor:`rgba(250, 204, 21, ${n*.15})`}},`mz-${r}`)})})}function Ah({detections:e,frameWidth:t,frameHeight:r}){return t===0||r===0?null:o(Ne,{children:e.map(n=>{const{x:s,y:a,width:i,height:l}=n.bbox,c=s/t*100,d=a/r*100,u=i/t*100,f=l/r*100,h=Be(n.macroClass),g=[`${n.macroClass} ${(n.score*100).toFixed(0)}%`];for(const b of n.labels)g.push(b.label);return o("div",{className:"absolute border-2 rounded-sm",style:{left:`${c}%`,top:`${d}%`,width:`${u}%`,height:`${f}%`,borderColor:h},children:o("div",{className:"absolute -top-4 left-0 px-1 py-0.5 text-[9px] font-bold text-white rounded-sm whitespace-nowrap",style:{backgroundColor:h},children:g.join(" | ")})},`det-${n.id}`)})})}function Ph(e){const t={};if(typeof window<"u"){if(e){const n=e.getBoundingClientRect();n.width>0&&n.height>0&&(t.viewportWidth=Math.round(n.width),t.viewportHeight=Math.round(n.height))}t.viewportWidth===void 0&&(t.viewportWidth=window.innerWidth,t.viewportHeight=window.innerHeight),t.devicePixelRatio=window.devicePixelRatio||1;const r=navigator.connection;r?.downlink&&r.downlink>0&&(t.downlinkMbps=r.downlink)}return t}var Rh=3e3,_h=5;function Ih({serverUrl:e,streamKey:t,label:r,autoPlay:n=!0,muted:s=!0,showControls:a=!0,className:i="",onStateChange:l,onError:c,overlay:d,createSession:u,sendAnswer:f,closeSession:h,hintsOverride:g}){const b=q(null),v=q(null),x=q(null),y=q(new Set),w=q(null),k=q(null),M=q(0),C=q(!0),[A,_]=S("idle"),[P,Q]=S(""),[oe,le]=S(s),[ge,de]=S(!1),[pe,ie]=S(!1),ne=q(null),W=q(!1);(f||u)&&(W.current=!0);const ye=W.current,me=I(X=>{_(X),l?.(X)},[l]),T=I(()=>{if(w.current?.abort(),w.current=null,k.current&&(clearTimeout(k.current),k.current=null),x.current&&(x.current.close(),x.current=null),h&&y.current.size>0){for(const X of y.current)h(X).catch(()=>{});y.current.clear()}b.current&&(b.current.srcObject=null)},[h]),z=I(async()=>{if(!C.current||!u||!f)return;T(),me("connecting");const X=new AbortController;w.current=X;try{const{sessionId:fe,sdpOffer:xe}=await u({...Ph(v.current),...g});if(y.current.add(fe),!C.current||X.signal.aborted){h?.(fe).catch(()=>{}),y.current.delete(fe);return}const we=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]});x.current=we;const O=new MediaStream;we.ontrack=L=>{console.debug("[WebRTC] ontrack",L.track.kind,L.track.readyState),O.addTrack(L.track),b.current&&(b.current.srcObject=O,b.current.play().catch(()=>{}))},we.oniceconnectionstatechange=()=>{if(!C.current)return;const L=we.iceConnectionState;console.debug("[WebRTC] ICE state:",L),L==="connected"||L==="completed"?(M.current=0,me("playing"),b.current?.paused&&(console.debug("[WebRTC] video was paused at ICE connected — calling play()"),b.current.play().catch(()=>{}))):(L==="failed"||L==="disconnected"||L==="closed")&&(me("disconnected"),K())},we.onicecandidateerror=L=>{console.debug("[WebRTC] ICE candidate error:",L)},console.debug("[WebRTC] Setting remote description (server offer)..."),await we.setRemoteDescription({type:"offer",sdp:xe});const E=await we.createAnswer();if(await we.setLocalDescription(E),console.debug("[WebRTC] Local description set, waiting for ICE gathering..."),await rs(we),!C.current)return;const D=(we.localDescription?.sdp??"").split(`
77
- `).filter(L=>L.startsWith("a=candidate:")).length;console.debug("[WebRTC] Sending answer to server",{localCandidates:D,sessionId:fe.slice(0,8)}),await f(fe,we.localDescription?.sdp??""),console.debug("[WebRTC] Answer sent successfully");const J=we,ae=()=>{const L=J.connectionState;if(L==="closed"||L==="failed")return;const ee=b.current;ee&&ee.readyState===0&&console.log(`[WebRTC] no video data yet (ice=${J.iceConnectionState})`)};setTimeout(ae,3e3),setTimeout(ae,8e3)}catch(fe){if(!C.current)return;const xe=fe instanceof Error?fe.message:String(fe);Q(xe),me("error"),c?.(xe),K()}},[e,t,u,f,T,me,c,g]),B=I(async()=>{if(C.current){T(),me("connecting");try{const X=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"}]});x.current=X,X.addTransceiver("video",{direction:"recvonly"}),X.addTransceiver("audio",{direction:"recvonly"});const fe=new MediaStream;X.ontrack=D=>{fe.addTrack(D.track),b.current&&(b.current.srcObject=fe,b.current.play().catch(()=>{}))},X.oniceconnectionstatechange=()=>{if(!C.current)return;const D=X.iceConnectionState;D==="connected"||D==="completed"?(M.current=0,me("playing"),b.current?.paused&&b.current.play().catch(()=>{})):(D==="failed"||D==="disconnected"||D==="closed")&&(me("disconnected"),K())};const xe=await X.createOffer();if(await X.setLocalDescription(xe),await rs(X),!C.current)return;const we=`${e}/api/webrtc?src=${encodeURIComponent(t)}`,O=await fetch(we,{method:"POST",headers:{"Content-Type":"application/sdp"},body:X.localDescription?.sdp??""});if(!O.ok)throw new Error(`WHEP ${O.status}: ${O.statusText}`);const E=await O.text();await X.setRemoteDescription({type:"answer",sdp:E})}catch(X){if(!C.current)return;const fe=X instanceof Error?X.message:String(X);Q(fe),me("error"),c?.(fe),K()}}},[e,t,T,me,c]),se=ye?z:B,U=q(()=>{});U.current=se;const K=I(()=>{C.current&&(M.current>=_h||(M.current+=1,k.current=setTimeout(()=>{C.current&&U.current()},Rh)))},[]);H(()=>(C.current=!0,M.current=0,n&&se(),()=>{C.current=!1,T()}),[e,t]);const Z=q(!1);H(()=>{!n||!ye||!u||!f||Z.current||x.current||(Z.current=!0,se())},[n,ye,u,f,se]);const G=()=>{M.current=0,se()},te=()=>{b.current&&(b.current.muted=!b.current.muted,le(b.current.muted))},Y=async()=>{if(v.current)try{document.fullscreenElement?await document.exitFullscreen():await v.current.requestFullscreen()}catch(X){console.warn(`Fullscreen toggle failed: ${X instanceof Error?X.message:X}`)}},Pe=()=>{if(!b.current)return;const X=document.createElement("canvas");X.width=b.current.videoWidth||1280,X.height=b.current.videoHeight||720;const fe=X.getContext("2d");if(!fe)return;fe.drawImage(b.current,0,0);const xe=document.createElement("a");xe.download=`${t.replace(/[/:]/g,"-")}-${Date.now()}.jpg`,xe.href=X.toDataURL("image/jpeg",.92),xe.click()};H(()=>{const X=()=>de(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",X),()=>document.removeEventListener("fullscreenchange",X)},[]);const Re=()=>{ie(!0),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>ie(!1),3e3)};return m("div",{ref:v,className:`relative bg-black overflow-hidden group ${i}`,onMouseMove:Re,onMouseEnter:Re,children:[o("video",{ref:b,autoPlay:n,muted:oe,playsInline:!0,className:"w-full h-full object-contain"}),r&&A==="playing"&&o("div",{className:"absolute top-2 left-2 px-2 py-0.5 rounded bg-black/60 text-[10px] text-white font-medium",children:r}),d,A==="connecting"&&m("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-black/70 gap-2",children:[o("svg",{className:"h-6 w-6 text-white/60 animate-spin",viewBox:"0 0 24 24",fill:"none",children:o("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"32",className:"animate-[dash_1.5s_ease-in-out_infinite]"})}),o("span",{className:"text-xs text-white/60",children:"Connecting…"})]}),(A==="error"||A==="disconnected")&&m("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-black/70 gap-2",children:[o("svg",{className:"h-6 w-6 text-red-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o("path",{d:"M1 1l5.5 5.5M23 23l-5.5-5.5M8.11 15.89a8 8 0 0110.78-10.78M3.64 3.64A12 12 0 0020.36 20.36",strokeLinecap:"round"})}),o("span",{className:"text-xs text-red-400 text-center px-4",children:A==="error"?P||"Connection failed":"Disconnected"}),o("button",{onClick:G,className:"mt-1 inline-flex items-center gap-1.5 rounded px-3 py-1 text-xs bg-white/10 text-white hover:bg-white/20 transition-colors",children:"Reconnect"})]}),a&&A==="playing"&&m("div",{className:`absolute bottom-0 inset-x-0 flex items-center justify-between px-3 py-1.5 bg-gradient-to-t from-black/80 to-transparent transition-opacity duration-200 ${pe?"opacity-100":"opacity-0"}`,children:[o("div",{className:"flex items-center gap-1",children:o(Yr,{onClick:te,title:oe?"Unmute":"Mute",children:oe?m("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),o("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),o("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]}):m("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),o("path",{d:"M19.07 4.93a10 10 0 010 14.14M15.54 8.46a5 5 0 010 7.07"})]})})}),m("div",{className:"flex items-center gap-1",children:[o(Yr,{onClick:Pe,title:"Take snapshot",children:m("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o("path",{d:"M23 19a2 2 0 01-2 2H3a2 2 0 01-2-2V8a2 2 0 012-2h4l2-3h6l2 3h4a2 2 0 012 2z"}),o("circle",{cx:"12",cy:"13",r:"4"})]})}),o(Yr,{onClick:Y,title:ge?"Exit fullscreen":"Fullscreen",children:ge?o("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:o("path",{d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3"})}):o("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:o("path",{d:"M8 3H5a2 2 0 00-2 2v3m18 0V5a2 2 0 00-2-2h-3m0 18h3a2 2 0 002-2v-3M3 16v3a2 2 0 002 2h3"})})})]})]})]})}function Yr({onClick:e,title:t,children:r}){return o("button",{onClick:e,title:t,className:"rounded-full p-1.5 text-white/80 hover:text-white hover:bg-white/20 transition-colors",children:r})}async function rs(e){if(e.iceGatheringState!=="complete")return new Promise(t=>{const r=()=>{e.iceGatheringState==="complete"&&(e.removeEventListener("icegatheringstatechange",r),t())};e.addEventListener("icegatheringstatechange",r),setTimeout(t,5e3)})}var Yn=ot("camstack:player-overlays-state",null),Xn=ot("camstack:player-overlays-actions",null);function $N({children:e}){const[t,r]=S(()=>new Map),[n,s]=S(()=>new Map),a=I(f=>{r(h=>{const g=new Map(h);return g.set(f.id,f),g})},[]),i=I(f=>{r(h=>{if(!h.has(f))return h;const g=new Map(h);return g.delete(f),g})},[]),l=I(f=>{s(h=>{const g=new Map(h);return g.set(f.id,f),g})},[]),c=I(f=>{s(h=>{if(!h.has(f))return h;const g=new Map(h);return g.delete(f),g})},[]),d=re(()=>({layers:t,buttons:n}),[t,n]),u=re(()=>({setLayer:a,removeLayer:i,setButton:l,removeButton:c}),[a,i,l,c]);return o(Yn.Provider,{value:d,children:o(Xn.Provider,{value:u,children:e})})}function BN(){const e=Ae(Yn);return re(()=>e?[...e.layers.values()].sort((t,r)=>t.order-r.order):[],[e])}function Th(){const e=Ae(Yn);return re(()=>e?[...e.buttons.values()].sort((t,r)=>t.order-r.order):[],[e])}function zN(e){const t=Ae(Xn);H(()=>{if(!(!t||!e))return t.setLayer(e),()=>t.removeLayer(e.id)},[t,e])}function FN(e){const t=Ae(Xn);H(()=>{if(!(!t||!e))return t.setButton(e),()=>t.removeButton(e.id)},[t,e])}function Dh(e){return e==="streaming"?"bg-emerald-500":e==="connecting"?"bg-amber-500":e==="error"?"bg-rose-500":"bg-zinc-500"}function Lh(e){const t=Math.floor(e/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:`${Math.floor(t/3600)}h${Math.floor(t%3600/60)}m`}function En({className:e}){return o("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o("polygon",{points:"5 3 19 12 5 21 5 3"})})}function Oh({className:e}){return o("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function $h({className:e}){return m("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"}),o("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),o("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),o("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]})}function Bh({className:e}){return m("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:[o("circle",{cx:"5",cy:"12",r:"2"}),o("circle",{cx:"12",cy:"12",r:"2"}),o("circle",{cx:"19",cy:"12",r:"2"})]})}function Xr({label:e,active:t,onClick:r}){return m("button",{type:"button",onClick:r,className:"w-full flex items-center justify-between gap-3 px-3 py-1.5 text-[11px] text-foreground hover:bg-surface-hover transition-colors",children:[o("span",{children:e}),o("span",{className:`inline-block h-3 w-5 rounded-full transition-colors ${t?"bg-primary":"bg-foreground-subtle/30"} relative`,children:o("span",{className:`absolute top-0.5 h-2 w-2 rounded-full bg-white transition-all ${t?"left-2.5":"left-0.5"}`})})]})}function Wi({className:e}){return m("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o("polyline",{points:"23 4 23 10 17 10"}),o("polyline",{points:"1 20 1 14 7 14"}),o("path",{d:"M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"})]})}function zh({className:e}){return m("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o("line",{x1:"2",y1:"2",x2:"22",y2:"22"}),o("path",{d:"M10.41 10.41a2 2 0 11-2.83-2.83"}),o("line",{x1:"13.5",y1:"13.5",x2:"6",y2:"21"}),o("path",{d:"M18 12l-1.5-1.5"}),o("path",{d:"M21 15V5a2 2 0 00-2-2H5"}),o("path",{d:"M21 21H5a2 2 0 01-2-2V11"})]})}function jN({serverUrl:e,createSession:t,sendAnswer:r,closeSession:n,streams:s,activeStreamId:a,onStreamChange:i,deviceName:l,phase:c,pipelineMetrics:d,detections:u,defaultShowDetections:f=!0,defaultShowMotion:h=!1,streamStats:g,autoPlay:b=!1,showPlayStop:v=!1,snapshotSrc:x,snapshotLoading:y=!1,onRefreshSnapshot:w,showStreamStats:k=!1,children:M,extraOverlay:C,ptzAvailable:A=!1,ptzShown:_=!1,ptzOverlay:P,onPtzToggle:Q,intercomAvailable:oe=!1,intercomShown:le=!1,onIntercomToggle:ge,chromeless:de=!1,className:pe}){const ie=Th(),[ne,W]=S(b),[ye,me]=S(f),[T,z]=S(h),[B,se]=S(null),[U,K]=S(!1),Z=q(null);H(()=>{if(!U)return;function L(ee){Z.current&&!Z.current.contains(ee.target)&&K(!1)}return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[U]);const G=a??B??s?.[0]?.id??"",te=s?.find(L=>L.id===G)??s?.[0],Y=te?.inputFps!=null?{status:te.status??"unknown",inputFps:te.inputFps,bitrateKbps:te.bitrateKbps??0}:null,Pe=L=>{se(L),i?.(L),ne&&v&&(W(!1),setTimeout(()=>W(!0),50))},Re=re(()=>{const L=te?.target;if(L)return ee=>t(L,ee)},[t,te]),X=s,fe=()=>W(!0),xe=()=>W(!1),we=d?.phase??c,O=we==="active",E=!!u,D=E&&(ye||T),J=A&&_&&!!P,ae=v?ne:!0;return m("div",{className:`overflow-hidden ${de?"":"rounded-xl border border-border bg-surface"} ${pe??""}`,children:[m("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[m("div",{className:"flex items-center gap-2",children:[(g??Y)&&o("span",{className:`w-2 h-2 rounded-full ${Dh((g??Y).status)}`}),l&&o("span",{className:"text-xs font-medium text-foreground",children:l}),X&&X.length>1&&m("div",{className:"relative",children:[o("select",{"data-testid":"stream-profile-select",value:G,onChange:L=>Pe(L.target.value),className:"appearance-none cursor-pointer rounded-md border border-border bg-surface-hover hover:bg-surface text-foreground text-[11px] font-medium pl-2 pr-6 py-1 focus:outline-none focus:ring-1 focus:ring-primary transition-colors",children:X.map(L=>o("option",{value:L.id,children:L.label},L.id))}),o("span",{className:"pointer-events-none absolute right-1.5 top-1/2 -translate-y-1/2 text-foreground-subtle",children:o("svg",{className:"h-2.5 w-2.5",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o("polyline",{points:"3 4.5 6 7.5 9 4.5"})})})]})]}),m("div",{className:"flex items-center gap-1.5",children:[oe&&m("button",{"data-testid":"stream-intercom-toggle","data-intercom-shown":le?"true":"false",onClick:ge,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium transition-colors ${le?"bg-primary/15 text-primary":"text-foreground-subtle hover:text-foreground hover:bg-surface-hover"}`,title:le?"Close intercom":"Open intercom",children:[o($h,{className:"h-3 w-3"}),o("span",{className:"hidden xl:inline",children:"Intercom"})]}),ie.map(L=>{const ee=L.tone==="primary"?"bg-primary text-primary-foreground":"bg-primary/15 text-primary";return m("button",{type:"button","data-toolbar-button-id":L.id,"data-toolbar-button-active":L.active?"true":"false",onClick:L.onClick,disabled:L.disabled,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium transition-colors disabled:opacity-50 ${L.active?ee:"text-foreground-subtle hover:text-foreground hover:bg-surface-hover"}`,title:L.title??L.label,children:[L.icon,o("span",{className:"hidden xl:inline",children:L.label})]},L.id)}),v&&m("button",{"data-testid":"stream-play-toggle","data-stream-playing":ae?"true":"false",onClick:ae?xe:fe,className:`inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium transition-colors ${ae?"bg-danger/10 text-danger hover:bg-danger/20":"bg-primary/10 text-primary hover:bg-primary/20"}`,title:ae?"Stop stream":"Start stream",children:[ae?o(Oh,{className:"h-3 w-3"}):o(En,{className:"h-3 w-3"}),o("span",{className:"hidden xl:inline",children:ae?"Stop":"Play"})]}),w&&m("button",{"data-testid":"stream-snapshot-refresh",onClick:w,disabled:y,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50",title:"Force snapshot refresh",children:[o(Wi,{className:`h-3 w-3 ${y?"animate-spin":""}`}),o("span",{className:"hidden xl:inline",children:"Snapshot"})]}),(E||A||d||we||g||Y&&Y.inputFps>0)&&m("div",{ref:Z,className:"relative",children:[o("button",{onClick:()=>K(L=>!L),title:"More controls",className:"inline-flex items-center justify-center rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors",children:o(Bh,{className:"h-3.5 w-3.5"})}),U&&m("div",{className:"absolute right-0 top-full mt-1 z-30 min-w-[200px] rounded-lg border border-border bg-surface shadow-xl py-1.5",children:[k&&g&&m("div",{className:"px-3 py-1.5 text-[10px] text-foreground-subtle border-b border-border-subtle",children:[m("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Input"}),m("span",{className:"tabular-nums text-foreground",children:[g.inputFps.toFixed(1)," fps"]})]}),m("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Decode"}),m("span",{className:"tabular-nums text-foreground",children:[g.decodeFps.toFixed(1)," fps"]})]}),m("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Uptime"}),o("span",{className:"tabular-nums text-foreground",children:Lh(g.uptimeMs)})]})]}),!k&&Y&&Y.inputFps>0&&m("div",{className:"px-3 py-1.5 text-[10px] text-foreground-subtle border-b border-border-subtle",children:[m("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Input"}),m("span",{className:"tabular-nums text-foreground",children:[Y.inputFps.toFixed(1)," fps"]})]}),Y.bitrateKbps>0&&m("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Bitrate"}),m("span",{className:"tabular-nums text-foreground",children:[Y.bitrateKbps," kbps"]})]})]}),(d||E&&we)&&m("div",{className:"px-3 py-1.5 text-[10px] text-foreground-subtle border-b border-border-subtle",children:[m("div",{className:"flex justify-between gap-3 items-center",children:[o("span",{children:"Phase"}),m("span",{className:`flex items-center gap-1 font-semibold uppercase tracking-wider ${O?"text-red-400":"text-emerald-400"}`,children:[o("span",{className:`w-1.5 h-1.5 rounded-full ${O?"bg-red-500 animate-pulse":"bg-emerald-500"}`}),O?"Active":"Watching"]})]}),d&&d.detectionFps>0&&m("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Detection"}),m("span",{className:"tabular-nums text-foreground",children:[d.detectionFps.toFixed(1)," det/s"]})]}),d&&d.avgInferenceMs>0&&m("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Inference"}),m("span",{className:"tabular-nums text-foreground",children:[d.avgInferenceMs.toFixed(0)," ms"]})]})]}),E&&m(Ne,{children:[o(Xr,{label:"Show detections",active:ye,onClick:()=>me(L=>!L)}),o(Xr,{label:"Show motion",active:T,onClick:()=>z(L=>!L)})]}),A&&o(Xr,{label:"PTZ controls",active:_,onClick:()=>{Q?.(),K(!1)}})]})]})]})]}),ae?o("div",{className:"aspect-video relative",children:o(Ih,{serverUrl:e,streamKey:G,autoPlay:!0,className:"w-full h-full",createSession:Re,sendAnswer:r,closeSession:n,overlay:D||C||J?m(Ne,{children:[D&&o(Sh,{detections:u,showPhaseIndicator:!1,showMotionZones:T,showMotionRaw:T,showDetections:ye}),C,J&&P]}):void 0},G)}):o(Fh,{src:x??null,isLoading:y,onPlay:fe,onRetry:w,extraOverlay:C||J?m(Ne,{children:[C,J&&P]}):null,suppressPlayHover:!!C||J}),M]})}function Fh({src:e,isLoading:t,onPlay:r,onRetry:n,extraOverlay:s,suppressPlayHover:a=!1}){return e?m("div",{className:"relative w-full aspect-video bg-black/90 flex items-center justify-center",children:[o("img",{src:e,alt:"Camera snapshot",className:"w-full h-full object-contain"}),!a&&o("button",{onClick:r,className:"absolute inset-0 flex items-center justify-center bg-black/30 opacity-0 hover:opacity-100 transition-opacity cursor-pointer",children:o("div",{className:"h-14 w-14 rounded-full bg-white/20 backdrop-blur-sm flex items-center justify-center",children:o(En,{className:"h-7 w-7 text-white ml-0.5"})})}),s]}):t?o("div",{className:"relative w-full aspect-video bg-black/90 flex items-center justify-center",children:o("div",{className:"h-8 w-8 border-2 border-white/20 border-t-white/60 rounded-full animate-spin"})}):o("div",{className:"relative w-full aspect-video bg-black/90 flex items-center justify-center",children:m("div",{className:"flex flex-col items-center gap-2 text-white/40",children:[o(zh,{className:"h-8 w-8"}),o("span",{className:"text-xs",children:"No snapshot available"}),m("div",{className:"flex items-center gap-2 mt-1",children:[n&&m("button",{onClick:n,className:"inline-flex items-center gap-1.5 rounded-md border border-white/20 px-3 py-1.5 text-xs font-medium text-white/60 hover:text-white hover:border-white/40 transition-colors",children:[o(Wi,{className:"h-3 w-3"}),"Retry"]}),m("button",{onClick:r,className:"inline-flex items-center gap-1.5 rounded-md bg-primary/80 px-3 py-1.5 text-xs font-medium text-white hover:bg-primary transition-colors",children:[o(En,{className:"h-3 w-3"}),"Play Live"]})]})]})})}function GN({samples:e,sampleRate:t=16e3,height:r=96,className:n="",color:s="#3b82f6",bgColor:a="transparent"}){const i=q(null),l=q(null),c=I(()=>{const u=i.current,f=l.current;if(!u||!f||!e||e.length===0)return;const h=f.clientWidth;if(h===0)return;const g=window.devicePixelRatio||1;u.width=h*g,u.height=r*g,u.style.width=`${h}px`,u.style.height=`${r}px`;const b=u.getContext("2d");if(!b)return;b.scale(g,g),a!=="transparent"?(b.fillStyle=a,b.fillRect(0,0,h,r)):b.clearRect(0,0,h,r);const v=e.length/h,x=r/2;b.fillStyle=s,b.globalAlpha=.7;for(let y=0;y<h;y++){const w=Math.floor(y*v),k=Math.min(Math.floor((y+1)*v),e.length);let M=0,C=0;for(let Q=w;Q<k;Q++){const oe=e[Q];oe<M&&(M=oe),oe>C&&(C=oe)}const A=x-C*x,_=x-M*x,P=Math.max(1,_-A);b.fillRect(y,A,1,P)}b.globalAlpha=1,b.strokeStyle=s,b.globalAlpha=.2,b.lineWidth=1,b.beginPath(),b.moveTo(0,x),b.lineTo(h,x),b.stroke(),b.globalAlpha=1},[e,r,s,a]);H(()=>{c()},[c]),H(()=>{const u=new ResizeObserver(()=>c()),f=l.current;return f&&u.observe(f),()=>u.disconnect()},[c]);const d=((e&&t?Math.round(e.length/t*1e3):0)/1e3).toFixed(1);return m("div",{ref:l,className:`relative ${n}`,children:[o("canvas",{ref:i,className:"w-full rounded-md"}),e&&e.length>0&&m("div",{className:"absolute bottom-1 right-2 text-[10px] text-foreground-subtle/60 font-mono",children:[d,"s · ",t/1e3,"kHz · ",e.length.toLocaleString()," samples"]})]})}function QN({currentDbfs:e,durationSec:t=30,maxSamples:r=120,height:n=64,className:s="",color:a="#10b981",clipColor:i="#ef4444",clipThreshold:l=-6,minDbfs:c=-96}){const d=q(null),u=q(null),[f,h]=S([]);H(()=>{e!==null&&h(v=>{const x=[...v,{dbfs:e,timestamp:Date.now()}];return x.length>r?x.slice(-r):x})},[e,r]);const g=I(()=>{const v=d.current,x=u.current;if(!v||!x)return;const y=x.clientWidth;if(y===0)return;const w=window.devicePixelRatio||1;v.width=y*w,v.height=n*w,v.style.width=`${y}px`,v.style.height=`${n}px`;const k=v.getContext("2d");if(!k||(k.scale(w,w),k.clearRect(0,0,y,n),f.length===0))return;const M=f[f.length-1].timestamp,C=t*1e3,A=M-C,_=f.filter(le=>le.timestamp>=A);if(_.length===0)return;const P=Math.max(1,Math.floor(y/(t*2))),Q=Math.abs(c);for(const le of _){const ge=le.timestamp-A,de=Math.floor(ge/C*y),pe=(Math.max(c,Math.min(0,le.dbfs))-c)/Q,ie=Math.max(1,pe*n);k.fillStyle=le.dbfs>=l?i:a,k.globalAlpha=.8,k.fillRect(de,n-ie,P,ie)}k.globalAlpha=1;const oe=n-(l-c)/Q*n;k.strokeStyle=i,k.globalAlpha=.25,k.lineWidth=1,k.setLineDash([4,4]),k.beginPath(),k.moveTo(0,oe),k.lineTo(y,oe),k.stroke(),k.setLineDash([]),k.globalAlpha=1},[f,t,n,a,i,l,c]);H(()=>{g()},[g]),H(()=>{const v=new ResizeObserver(()=>g()),x=u.current;return x&&v.observe(x),()=>v.disconnect()},[g]);const b=f.length>0?f[f.length-1].dbfs:null;return m("div",{ref:u,className:`relative ${s}`,children:[o("canvas",{ref:d,className:"w-full rounded-md"}),m("div",{className:"absolute top-1 left-2 text-[9px] text-foreground-subtle/50 font-mono",children:[t,"s"]}),b!==null&&m("div",{className:"absolute bottom-1 right-2 text-[9px] text-foreground-subtle/50 font-mono",children:[b.toFixed(1)," dBFS · ",f.length," samples"]})]})}function jh(e){return e>=.8?"bg-emerald-500":e>=.5?"bg-amber-500":e>=.3?"bg-orange-500":"bg-zinc-500"}function Gh(e){return e>=.8?"text-emerald-400":e>=.5?"text-amber-400":e>=.3?"text-orange-400":"text-zinc-400"}function HN({classifications:e,processing:t=!1,inferenceMs:r,maxItems:n=10,className:s=""}){const a=e.slice(0,n),i=a.length>0?a[0].score:1;return t?o("div",{className:`rounded-xl border border-border bg-surface p-4 text-center ${s}`,children:o("div",{className:"text-sm text-foreground-subtle animate-pulse",children:"Classifying audio..."})}):a.length===0?o("div",{className:`rounded-xl border border-border bg-surface p-4 text-center ${s}`,children:o("div",{className:"text-xs text-foreground-subtle",children:"No classifications yet"})}):m("div",{className:`rounded-xl border border-border bg-surface overflow-hidden ${s}`,children:[m("div",{className:"px-3 py-2 border-b border-border flex items-center justify-between",children:[o("h3",{className:"text-xs font-medium text-foreground",children:"Audio Classifications"}),m("div",{className:"flex items-center gap-3 text-[10px] text-foreground-subtle",children:[a.length<e.length&&m("span",{children:["showing ",a.length," of ",e.length]}),r!==void 0&&m("span",{className:"font-mono",children:[r.toFixed(1),"ms"]})]})]}),o("div",{className:"divide-y divide-border/50",children:a.map((l,c)=>{const d=i>0?l.score/i*100:0;return m("div",{className:"px-3 py-1.5 flex items-center gap-3 hover:bg-surface-hover/30",children:[o("span",{className:"text-[10px] text-foreground-subtle w-5 text-right font-mono",children:c+1}),o("span",{className:"text-xs font-medium text-foreground min-w-[120px]",children:l.className}),o("div",{className:"flex-1 h-2 rounded-full bg-zinc-800 overflow-hidden",children:o("div",{className:`h-full rounded-full transition-all duration-300 ${jh(l.score)}`,style:{width:`${d}%`}})}),m("span",{className:`text-xs font-mono font-semibold w-14 text-right ${Gh(l.score)}`,children:[(l.score*100).toFixed(1),"%"]})]},`${l.className}-${c}`)})})]})}function UN({data:e,label:t="Response",className:r=""}){const[n,s]=S(!1);if(!e)return null;const a=JSON.stringify(e,null,2);return m("div",{className:`rounded-xl border border-border bg-surface overflow-hidden ${r}`,children:[m("div",{className:"px-3 py-2 border-b border-border flex items-center justify-between cursor-pointer select-none hover:bg-surface-hover/30",onClick:()=>s(i=>!i),children:[m("div",{className:"flex items-center gap-2",children:[o("span",{className:"text-[10px] text-foreground-subtle",children:n?"▼":"▶"}),o("h3",{className:"text-xs font-medium text-foreground",children:t})]}),o("span",{className:"text-[10px] text-foreground-subtle font-mono",children:a.length>1e3?`${(a.length/1024).toFixed(1)} KB`:`${a.length} bytes`})]}),n&&o("div",{className:"max-h-80 overflow-y-auto overflow-x-auto",children:o("pre",{className:"p-3 text-[10px] leading-4 font-mono text-foreground-subtle whitespace-pre",children:a})})]})}var Qh={Activity:et,Eye:Mr,AlertTriangle:qt,PauseCircle:gu,PowerOff:_u};function VN({phase:e,...t}){const r=Qh[js(e).icon];return o(r,{...t})}function St(e){const[t,r]=S([]),n=I(a=>{r(i=>{const l=[...i,a];return l.length>e?l.slice(-e):l})},[e]),s=I(()=>{r([])},[]);return re(()=>({entries:t,append:n,reset:s}),[t,n,s])}function ns(e){if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}var os={error:{icon:Cr,color:"text-red-400"},warn:{icon:qt,color:"text-amber-400"},info:{icon:Cu,color:"text-blue-400"},debug:{icon:du,color:"text-gray-500"}},ss={debug:0,info:1,warn:2,error:3},Hh=["all","debug","info","warn","error"],Uh=500;function Vh(e,t){return t?(ss[e]??0)>=(ss[t]??0):!0}function Ki({agentId:e,addonId:t,deviceId:r,integrationId:n,requestId:s,level:a,maxHeight:i="max-h-96",showScope:l=!1,showFilters:c=!0,limit:d=100,liveBuffer:u,onClose:f,className:h}){const[g,b]=S(""),[v,x]=S(""),[y,w]=S(a),k=e,M=t??(g||void 0),C=r??(v?Number(v):void 0),A=n,_=s,P=re(()=>{const E={};return k&&(E.agentId=k),M&&(E.addonId=M),C!==void 0&&Number.isFinite(C)&&(E.deviceId=C),A&&(E.integrationId=A),_&&(E.requestId=_),Object.keys(E).length>0?E:void 0},[k,M,C,A,_]),Q=St(Uh),oe=u??Q,le=oe.entries,[ge,de]=S(0),[pe,ie]=S(!1),[ne,W]=S(!1),[ye,me]=S(new Set),[T,z]=S(""),B=q(null),se=`${k??""}:${M??""}:${String(C??"")}:${A??""}:${_??""}`,U=q(se);H(()=>{U.current!==se&&(U.current=se,oe.reset(),de(0),me(new Set))},[se,oe]);const{data:K,isLoading:Z}=p.logs.query.useQuery({...P?{tags:P}:{},limit:d},{staleTime:3e4});p.logs.subscribe.useSubscription({...P?{tags:P}:{}},{onData:E=>{oe.append(E)}});const G=q(le.length);H(()=>{const E=B.current;if(!E){G.current=le.length;return}const D=G.current;if(G.current=le.length,!(le.length<=D)){if(pe&&E.scrollTop<=8)E.scrollTo({top:0});else if(!pe&&E.scrollTop>0){const J=E.querySelector("tbody tr"),ae=J instanceof HTMLElement?J.offsetHeight:24;E.scrollTop+=ae*(le.length-D)}}},[le.length,pe]);const te=re(()=>{const E=(K??[]).map(ee=>({timestamp:ee.timestamp,level:ee.level,message:ee.message,scope:ee.scope,tags:ee.tags,meta:ee.meta})),D=new Set,J=[];for(const ee of[...le].reverse()){const ke=`${ee.timestamp}|${ee.level}|${ee.scope??""}|${ee.message}`;D.has(ke)||(D.add(ke),J.push(ee))}for(const ee of E){const ke=`${ee.timestamp}|${ee.level}|${ee.scope??""}|${ee.message}`;D.has(ke)||(D.add(ke),J.push(ee))}const ae=(ge>0?J.filter(ee=>new Date(ee.timestamp).getTime()>ge):J).filter(ee=>Vh(ee.level,y)),L=T.trim().toLowerCase();return L?ae.filter(ee=>{if(ee.message.toLowerCase().includes(L)||ee.scope&&ee.scope.toLowerCase().includes(L))return!0;if(ee.tags){for(const ke of Object.values(ee.tags))if(ke!==void 0&&String(ke).toLowerCase().includes(L))return!0}if(ee.meta){for(const ke of Object.values(ee.meta))if(ke!=null&&ns(ke).toLowerCase().includes(L))return!0}return!1}):ae},[K,le,y,ge,T]),Y=I(()=>{const E=te.map(D=>{const J=new Date(D.timestamp).toLocaleTimeString(),ae=D.tags?" "+Object.entries(D.tags).filter(([,L])=>L).map(([L,ee])=>`${L}=${ee}`).join(" "):"";return`${J} [${D.level.toUpperCase()}]${D.scope?` [${D.scope}]`:""}${ae} ${D.message}`});navigator.clipboard.writeText(E.join(`
78
- `)).then(()=>{W(!0),setTimeout(()=>W(!1),1500)})},[te]),Pe=p.logs.clear.useMutation(),Re=I(()=>{de(Date.now()),oe.reset(),Pe.mutate({...P?{tags:P}:{}})},[oe,Pe,P]),X=I(E=>{me(D=>{const J=new Set(D);return J.has(E)?J.delete(E):J.add(E),J})},[]),[fe,xe]=S(null),we=I((E,D)=>{const J=new Date(E.timestamp).toISOString(),ae=E.tags?" "+Object.entries(E.tags).filter(([,ke])=>ke).map(([ke,We])=>`${ke}=${We}`).join(" "):"",L=E.meta&&Object.keys(E.meta).length>0?` meta=${JSON.stringify(E.meta)}`:"",ee=`${J} [${E.level.toUpperCase()}]${E.scope?` [${E.scope}]`:""}${ae} ${E.message}${L}`;navigator.clipboard.writeText(ee).then(()=>{xe(D),setTimeout(()=>xe(ke=>ke===D?null:ke),1200)})},[]),O=I(E=>`${E.timestamp}|${E.level}|${E.scope??""}|${E.message}`,[]);return m("div",{className:N("h-full min-h-0 flex flex-col",h),onClick:E=>E.stopPropagation(),children:[m("div",{className:"flex items-center justify-between px-3 py-1.5 bg-surface-hover/30 gap-2 shrink-0",children:[m("div",{className:"flex items-center gap-2 flex-wrap",children:[o("span",{className:"text-[10px] uppercase tracking-wide text-foreground-subtle font-medium",children:"Logs"}),k&&o(Jr,{label:"agent",value:k}),M&&o(Jr,{label:"addon",value:M}),C!==void 0&&o(Jr,{label:"device",value:`#${C}`}),o("div",{className:"flex rounded border border-border overflow-hidden text-[9px]",children:Hh.map(E=>m("button",{type:"button",onClick:()=>w(E==="all"?void 0:E),className:N("px-1.5 py-0.5 capitalize transition-colors",E==="all"&&!y||y===E?"bg-primary/10 text-primary":"text-foreground-subtle hover:bg-surface-hover",E!=="all"&&"border-l border-border"),children:[E,E!=="all"?"+":""]},E))}),o(en,{icon:zn,label:pe?"Auto":"Paused",active:!pe,onClick:()=>{ie(E=>!E),!pe&&B.current&&B.current.scrollTo({top:0,behavior:"smooth"})}}),o(en,{icon:at,label:ne?"Copied!":"Copy",onClick:Y,disabled:te.length===0}),o(en,{icon:Ye,label:"Clear",onClick:Re}),m("div",{className:"relative",children:[o("input",{type:"text",value:T,onChange:E=>z(E.target.value),placeholder:"Search…",className:"w-32 pl-1.5 pr-5 py-0.5 rounded border border-border bg-background text-foreground text-[10px] focus:outline-none focus:border-primary/50"}),T&&o("button",{type:"button",onClick:()=>z(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground",title:"Clear search",children:o(Ie,{className:"h-2.5 w-2.5"})})]}),le.length>0&&m("span",{className:"text-[9px] text-emerald-400 font-medium",children:["+",le.length," live"]})]}),f&&o("button",{type:"button",onClick:f,className:"text-foreground-subtle hover:text-foreground",children:o(Ie,{className:"h-3.5 w-3.5"})})]}),c&&(!t||!r)&&m("div",{className:"flex items-center gap-2 px-3 py-1 border-b border-border/50 bg-surface/50 text-[10px]",children:[!t&&m("label",{className:"flex items-center gap-1",children:[o("span",{className:"text-foreground-subtle",children:"Addon:"}),o("input",{type:"text",value:g,onChange:E=>b(E.target.value),placeholder:"all",className:"w-28 px-1.5 py-0.5 rounded border border-border bg-background text-foreground text-[10px] focus:outline-none focus:border-primary/50"})]}),!r&&m("label",{className:"flex items-center gap-1",children:[o("span",{className:"text-foreground-subtle",children:"Device:"}),o("input",{type:"text",inputMode:"numeric",value:v,onChange:E=>x(E.target.value),placeholder:"all",className:"w-16 px-1.5 py-0.5 rounded border border-border bg-background text-foreground text-[10px] focus:outline-none focus:border-primary/50"})]})]}),m("div",{ref:B,className:N("flex-1 min-h-0 overflow-auto font-mono text-[10px]",i),children:[Z&&m("div",{className:"flex items-center justify-center gap-2 py-6 text-foreground-subtle",children:[o(Ge,{className:"h-3.5 w-3.5 animate-spin"}),"Loading logs..."]}),!Z&&te.length===0&&o("div",{className:"py-4 text-center text-foreground-subtle",children:"No logs found"}),te.length>0&&o("table",{className:"w-full",children:o("tbody",{children:te.map(E=>{const D=os[E.level]??os.info,J=D.icon,ae=O(E),L=ye.has(ae),ee=E.tags&&Object.keys(E.tags).length>0,ke=E.meta&&Object.keys(E.meta).length>0,We=ee||ke;return m("tr",{className:N("hover:bg-surface-hover/30 border-b border-border/30",We&&"cursor-pointer"),onClick:We?()=>X(ae):void 0,children:[o("td",{className:"px-2 py-1 text-foreground-subtle whitespace-nowrap align-top w-[70px]",children:new Date(E.timestamp).toLocaleTimeString()}),o("td",{className:N("px-1 py-1 align-top w-5",D.color),children:o(J,{className:"h-3 w-3"})}),l&&o("td",{className:"px-2 py-1 text-foreground-subtle align-top truncate max-w-[120px]",title:E.scope,children:E.scope?.replace(/^addon:/,"")??""}),o("td",{className:"px-2 py-1 text-foreground break-all",children:m("div",{className:"flex items-start gap-1",children:[We&&(L?o(pt,{className:"h-3 w-3 text-foreground-subtle shrink-0 mt-0.5"}):o(st,{className:"h-3 w-3 text-foreground-subtle shrink-0 mt-0.5"})),m("div",{className:"flex-1 min-w-0",children:[E.message,L&&We&&m("div",{className:"mt-1 text-[9px] text-foreground-subtle bg-surface rounded px-2 py-1 space-y-0.5",children:[ke&&Object.entries(E.meta).filter(([,De])=>De!==void 0&&De!=="").map(([De,ht])=>m("div",{children:[o("span",{className:"text-amber-400/80 font-medium",children:De}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground break-all",children:ns(ht)})]},`m-${De}`)),ee&&Object.entries(E.tags).filter(([,De])=>De!==void 0).map(([De,ht])=>m("div",{children:[o("span",{className:"text-primary/70 font-medium",children:De}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground",children:ht})]},`t-${De}`))]})]})]})}),o("td",{className:"px-1 py-1 align-top w-5",children:o(qh,{copied:fe===ae,onCopy:()=>we(E,ae)})})]},ae)})})})]})]})}function qN({position:e="bottom",className:t,...r}){return o("div",{className:N(e==="bottom"?"absolute bottom-0 left-0 right-0 z-10 border-t border-border bg-surface/95 backdrop-blur-sm":"absolute inset-x-2 bottom-2 z-10 rounded-lg border border-border bg-surface/95 backdrop-blur-sm shadow-xl",t),children:o(Ki,{maxHeight:"max-h-48",...r})})}function Jr({label:e,value:t}){return m("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:[e,": ",t]})}function qh({copied:e,onCopy:t}){return o("button",{type:"button",title:"Copy this row",onClick:r=>{r.stopPropagation(),t()},className:N("rounded p-0.5 transition-colors",e?"text-emerald-400":"text-foreground-subtle/60 hover:text-foreground hover:bg-surface-hover"),children:e?o(Vt,{className:"h-3 w-3"}):o(at,{className:"h-3 w-3"})})}function en({icon:e,label:t,onClick:r,disabled:n,active:s}){return m("button",{type:"button",onClick:r,disabled:n,className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",s?"border-amber-500/30 bg-amber-500/10 text-amber-400":"border-border text-foreground-subtle hover:text-foreground",n&&"opacity-40 cursor-not-allowed"),children:[o(e,{className:"h-2.5 w-2.5"}),t]})}function Wh(e,t,r,n){if(n!==void 0&&(e.source.deviceId??(e.source.type==="device"&&typeof e.source.id=="number"?e.source.id:void 0))!==n||r!==void 0&&(e.source.addonId??(e.source.type==="addon"&&typeof e.source.id=="string"?e.source.id:void 0))!==r)return!1;if(t!==void 0){const s=e.source.nodeId;if(!s||s!==t&&!s.startsWith(`${t}/`))return!1}return!0}var Kh={[V.AddonStarted]:{icon:hn,color:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",label:"Started"},[V.AddonInstalled]:{icon:fn,color:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",label:"Installed"},[V.AddonRestarted]:{icon:Gn,color:"bg-blue-500/15 text-blue-400 border-blue-500/30",label:"Restarted"},[V.AddonUpdated]:{icon:Ha,color:"bg-blue-500/15 text-blue-400 border-blue-500/30",label:"Updated"},[V.AddonStopped]:{icon:So,color:"bg-foreground-subtle/10 text-foreground-subtle border-border",label:"Stopped"},[V.AddonUninstalled]:{icon:Ye,color:"bg-foreground-subtle/10 text-foreground-subtle border-border",label:"Uninstalled"},[V.AddonCrashed]:{icon:Cr,color:"bg-red-500/15 text-red-400 border-red-500/30",label:"Crashed"},[V.AddonError]:{icon:qt,color:"bg-red-500/15 text-red-400 border-red-500/30",label:"Error"},[V.DetectionPhaseTransition]:{icon:et,color:"bg-violet-500/15 text-violet-400 border-violet-500/30",label:"Phase"},[V.DetectionResult]:{icon:Du,color:"bg-purple-500/15 text-purple-400 border-purple-500/30",label:"Detection"},[V.DetectionEvent]:{icon:Mr,color:"bg-blue-500/15 text-blue-400 border-blue-500/30",label:"Event"},[V.DetectionCameraNative]:{icon:Co,color:"bg-cyan-500/15 text-cyan-400 border-cyan-500/30",label:"Camera AI"},[V.ProviderMotion]:{icon:Mo,color:"bg-orange-500/15 text-orange-400 border-orange-500/30",label:"Motion"},[V.MotionOnMotionChanged]:{icon:Mo,color:"bg-orange-500/15 text-orange-400 border-orange-500/30",label:"Motion"},[V.MotionAnalysis]:{icon:et,color:"bg-orange-500/10 text-orange-300 border-orange-500/20",label:"Motion analysis"},[V.MotionZonesRaw]:{icon:et,color:"bg-orange-500/10 text-orange-300 border-orange-500/20",label:"Motion zones"},[V.ProviderDetection]:{icon:Co,color:"bg-cyan-500/15 text-cyan-400 border-cyan-500/30",label:"Provider Det"},[V.PipelineAudioInferenceResult]:{icon:Ba,color:"bg-pink-500/15 text-pink-400 border-pink-500/30",label:"Audio"},[V.AgentOnline]:{icon:hn,color:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",label:"Agent Online"},[V.AgentOffline]:{icon:So,color:"bg-red-500/15 text-red-400 border-red-500/30",label:"Agent Offline"},[V.DeviceRegistered]:{icon:fn,color:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",label:"Registered"},[V.DeviceUnregistered]:{icon:Ye,color:"bg-red-500/15 text-red-400 border-red-500/30",label:"Unregistered"},[V.DeviceStateChanged]:{icon:et,color:"bg-foreground-subtle/10 text-foreground-subtle border-border",label:"State"}};function An(e,t){const r=Kh[e]??{icon:hn,color:"bg-foreground-subtle/10 text-foreground-subtle border-border",label:e.split(".").pop()??e};if(e===V.DeviceStateChanged&&t&&typeof t.capName=="string"){const n=t.capName;return{...r,label:n}}return r}var vt=Object.freeze([...new Set(Object.values(V))].sort()),Zh=Object.freeze([V.PipelineCameraMetricsSnapshot,V.PipelineRunnerLoadSnapshot,V.PipelineEngineMetricsSnapshot,V.PipelineInferenceResult,V.PipelineTrace,V.PipelineProgress,V.StreamBrokerMetricsSnapshot,V.MetricsNodeResourcesSnapshot,V.MetricsNodeProcessesSnapshot,V.ClusterTopologySnapshot,V.MotionAnalysis,V.MotionZonesRaw,V.DetectionResult,V.PipelineAudioInferenceResult,V.PlatformProbePhase,V.BenchmarkProgress,V.ModelDownloadProgress]),Yh=new Set(Zh),Xh=Object.freeze(vt.filter(e=>!Yh.has(e)));function gr(e,t){if(e===V.DetectionPhaseTransition){const s=t.to,a=t.from,i=typeof t.source=="string"?t.source:null,l=typeof t.cooldownMs=="number"?t.cooldownMs:null,c=i?` (${i}${l?`, ${Math.round(l/1e3)}s cooldown`:""})`:"";return s==="active"?`Motion detected — phase active${c}`:s==="watching"?`Cooldown expired — phase watching${c}`:`Phase: ${String(a)} → ${String(s)}${c}`}if(e===V.DetectionResult){const s=t.frame?.detections??[];if(s.length===0)return null;const a=new Map;for(const i of s){const l=i,c=l.class??l.macroClass,d=typeof c=="string"?c:"";d&&a.set(d,(a.get(d)??0)+1)}return[...a.entries()].map(([i,l])=>l>1?`${i} ×${l}`:i).join(", ")}if(e===V.PipelineAudioInferenceResult){const s=t.frame?.detections??[];return s.length===0?null:s.map(a=>{const i=a,l=i.macroClass??i.class??i.label,c=typeof l=="string"?l:"",d=i.score;return d?`${c} (${Math.round(d*100)}%)`:c}).filter(Boolean).join(", ")}if(e===V.DetectionEvent){const s=t.label??t.class,a=t.score??t.confidence,i=[];return typeof s=="string"&&i.push(s),typeof a=="number"&&i.push(`${Math.round(a*100)}%`),i.length>0?i.join(" — "):null}if(e===V.ProviderMotion)return t.active===!0?"motion start":"motion stop";if(e===V.DeviceStateChanged){const s=t.slice;if(s&&typeof s=="object"){const a=Object.keys(s).filter(i=>i!=="lastFetchedAt"&&i!=="ts");if(a.length>0)return a.slice(0,4).join(", ")+(a.length>4?"…":"")}return null}if(e===V.MotionOnMotionChanged){const s=t.detected,a=typeof t.source=="string"?t.source:null,i=s===!0?"motion start":s===!1?"motion stop":"motion";return a?`${i} (${a})`:i}if(e===V.ProviderDetection||e===V.DetectionCameraNative){const s=t.detections??[];if(!Array.isArray(s)||s.length===0)return(typeof t.class=="string"?t.class:null)??null;const a=new Map;for(const i of s){const l=i,c=l.class??l.macroClass,d=typeof c=="string"?c:"";d&&a.set(d,(a.get(d)??0)+1)}return[...a.entries()].map(([i,l])=>l>1?`${i} ×${l}`:i).join(", ")}const r=t.addonId,n=t.error;return n||(r?`addon: ${r}`:null)}function Jh(e){const t=e.category;return t===V.DetectionResult||t===V.PipelineAudioInferenceResult?gr(t,e.data)!==null:!0}var eg=300;function Zi({agentId:e,addonId:t,deviceId:r,defaultCategories:n,categories:s,category:a,maxHeight:i="max-h-96",limit:l=50,showCategoryFilter:c=!0,showFilters:d=!1,liveBuffer:u,onClose:f,className:h}){const g=re(()=>n??s??Xh,[n,s]),b=re(()=>[...g].sort().join(","),[g]),[v,x]=S(()=>new Set(g)),y=q(b);H(()=>{y.current!==b&&(y.current=b,x(new Set(g)))},[b,g]);const w=St(eg),k=u??w,M=k.entries,[C,A]=S(!0),[_,P]=S(new Set),[Q,oe]=S(""),[le,ge]=S(!1),[de,pe]=S(""),[ie,ne]=S(0),W=q(null),ye=q(null),me=`${e??""}:${t??""}:${String(r??"")}:${a??""}`,T=q(me);H(()=>{T.current!==me&&(T.current=me,k.reset(),P(new Set),ne(0))},[me,k]),H(()=>{if(!le)return;const $=he=>{const be=ye.current;be&&he.target instanceof Node&&!be.contains(he.target)&&ge(!1)};return document.addEventListener("mousedown",$),()=>{document.removeEventListener("mousedown",$)}},[le]);const z=re(()=>{const $={};return e&&($.agentId=e),t&&($.addonId=t),r!==void 0&&($.deviceId=r),a&&($.category=a),$},[e,t,r,a]),B=re(()=>[...v].sort(),[v]),se=re(()=>{const $={...z,limit:l};return B.length>0&&B.length<vt.length&&($.category=B),$},[z,l,re(()=>B.join(","),[B]),B]),{data:U,isLoading:K}=p.systemEvents.getRecent.useQuery(se,{staleTime:3e4}),Z=q(v);H(()=>{Z.current=v},[v]);const G=z;p.systemEvents.subscribe.useSubscription(G,{onData:$=>{const he=$;he?.id&&Wh(he,e,t,r)&&Z.current.has(he.category)&&k.append(he)}});const te=q(M.length);H(()=>{const $=W.current;if(!$){te.current=M.length;return}const he=te.current;if(te.current=M.length,!(M.length<=he)){if(C&&$.scrollTop<=8)$.scrollTo({top:0});else if(!C&&$.scrollTop>0){const be=$.firstElementChild?.firstElementChild,ve=be instanceof HTMLElement?be.offsetHeight:28;$.scrollTop+=ve*(M.length-he)}}},[M.length,C]);const Y=re(()=>{const $=new Map;for(const ve of U??[])$.set(ve.id,ve);for(const ve of M)$.set(ve.id,ve);let he=[...$.values()].filter(ve=>v.has(ve.category)).filter(Jh);ie>0&&(he=he.filter(ve=>new Date(ve.timestamp).getTime()>ie));const be=Q.trim().toLowerCase();return be&&(he=he.filter(ve=>{if(ve.category.toLowerCase().includes(be)||An(ve.category,ve.data).label.toLowerCase().includes(be))return!0;const it=gr(ve.category,ve.data);if(it&&it.toLowerCase().includes(be))return!0;try{if(new Date(ve.timestamp).toLocaleTimeString().toLowerCase().includes(be))return!0}catch{}try{if(JSON.stringify(ve.data).toLowerCase().includes(be)||JSON.stringify(ve.source).toLowerCase().includes(be))return!0}catch{}return!1})),he.sort((ve,it)=>new Date(it.timestamp).getTime()-new Date(ve.timestamp).getTime())},[U,M,v,Q,ie]),Pe=I($=>{P(he=>{const be=new Set(he);return be.has($)?be.delete($):be.add($),be})},[]),Re=I($=>{x(he=>{const be=new Set(he);return be.has($)?be.delete($):be.add($),be})},[]),X=I(()=>{x(new Set(g)),oe(""),ne(0)},[g]),fe=I(()=>{ne(Date.now()),k.reset()},[k]),[xe,we]=S(!1),[O,E]=S(null),D=I($=>{const he=new Date($.timestamp).toISOString(),be=gr($.category,$.data)??"",ve=be?` ${be}`:"";return`${he} [${$.category}]${ve} data=${JSON.stringify($.data)}`},[]),J=I(()=>{const $=Y.map(D);navigator.clipboard.writeText($.join(`
79
- `)).then(()=>{we(!0),setTimeout(()=>we(!1),1500)})},[Y,D]),ae=I($=>{navigator.clipboard.writeText(D($)).then(()=>{E($.id),setTimeout(()=>E(he=>he===$.id?null:he),1200)})},[D]),L=I(()=>{x(new Set(vt))},[]),ee=I(()=>{x(new Set)},[]),ke=re(()=>{const $=de.trim().toLowerCase();return $?vt.filter(he=>he.toLowerCase().includes($)):vt},[de]),We=vt.length,De=v.size,ht=De===We,Xi=ht?"All":`${De}/${We}`;return m("div",{className:N("h-full min-h-0 flex flex-col",h),onClick:$=>$.stopPropagation(),children:[m("div",{className:"flex items-center justify-between px-3 py-1.5 bg-surface-hover/30 gap-2 shrink-0",children:[m("div",{className:"flex items-center gap-2 flex-wrap",children:[o("span",{className:"text-[10px] uppercase tracking-wide text-foreground-subtle font-medium",children:"Events"}),e&&o(or,{label:"agent",value:e}),t&&o(or,{label:"addon",value:t}),r!==void 0&&o(or,{label:"device",value:`#${r}`}),a&&o(or,{label:"category",value:a}),m("button",{type:"button",onClick:()=>{A($=>!$),!C&&W.current&&W.current.scrollTo({top:0,behavior:"smooth"})},className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",C?"border-border text-foreground-subtle hover:text-foreground":"border-amber-500/30 bg-amber-500/10 text-amber-400"),children:[o(zn,{className:"h-2.5 w-2.5"}),C?"Auto":"Paused"]}),c&&m("div",{className:"relative",ref:ye,children:[m("button",{type:"button",onClick:()=>ge($=>!$),className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",ht?"border-border text-foreground-subtle hover:text-foreground":"border-violet-500/30 bg-violet-500/10 text-violet-400"),title:"Pick events to track",children:[o(La,{className:"h-2.5 w-2.5"}),"Filter (",Xi,")"]}),le&&o(tg,{search:de,onSearchChange:pe,categories:ke,active:v,onToggle:Re,onSelectAll:L,onSelectNone:ee,onResetDefaults:X})]}),m("button",{type:"button",onClick:X,className:"inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground transition-colors",title:"Reset filters to defaults",children:[o(ja,{className:"h-2.5 w-2.5"}),"Reset"]}),m("button",{type:"button",onClick:fe,className:"inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground transition-colors",title:"Clear visible entries",children:[o(Ye,{className:"h-2.5 w-2.5"}),"Clear"]}),m("button",{type:"button",onClick:J,disabled:Y.length===0,className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",xe?"border-emerald-500/30 bg-emerald-500/10 text-emerald-400":"border-border text-foreground-subtle hover:text-foreground",Y.length===0&&"opacity-40 cursor-not-allowed"),title:"Copy all visible events",children:[o(at,{className:"h-2.5 w-2.5"}),xe?"Copied!":"Copy"]}),m("div",{className:"relative",children:[o("input",{type:"text",value:Q,onChange:$=>oe($.target.value),placeholder:"Search…",className:"w-32 pl-1.5 pr-5 py-0.5 rounded border border-border bg-background text-foreground text-[10px] focus:outline-none focus:border-primary/50"}),Q&&o("button",{type:"button",onClick:()=>oe(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground",title:"Clear search",children:o(Ie,{className:"h-2.5 w-2.5"})})]}),M.length>0&&m("span",{className:"text-[9px] text-emerald-400 font-medium",children:["+",M.length," live"]})]}),f&&o("button",{type:"button",onClick:f,className:"text-foreground-subtle hover:text-foreground",children:o(Ie,{className:"h-3.5 w-3.5"})})]}),m("div",{ref:W,className:N("flex-1 min-h-0 overflow-auto text-[10px]",i),children:[K&&m("div",{className:"flex items-center justify-center gap-2 py-6 text-foreground-subtle",children:[o(Ge,{className:"h-3.5 w-3.5 animate-spin"}),"Loading events..."]}),!K&&Y.length===0&&o("div",{className:"py-4 text-center text-foreground-subtle",children:"No events found"}),Y.length>0&&o("div",{className:"divide-y divide-border/30",children:Y.map($=>{const he=An($.category,$.data),be=he.icon,ve=gr($.category,$.data),it=_.has($.id);return m("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-surface-hover/30 cursor-pointer",onClick:()=>Pe($.id),children:[o("span",{className:"text-foreground-subtle whitespace-nowrap w-[70px] shrink-0 pt-0.5",children:new Date($.timestamp).toLocaleTimeString()}),o(rg,{copied:O===$.id,onCopy:()=>ae($)}),m("div",{className:"flex-1 min-w-0",children:[m("div",{className:"flex items-center gap-1.5",children:[it?o(pt,{className:"h-3 w-3 text-foreground-subtle shrink-0"}):o(st,{className:"h-3 w-3 text-foreground-subtle shrink-0"}),m("span",{className:N("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[9px] font-medium",he.color),children:[o(be,{className:"h-2.5 w-2.5"}),he.label]}),$.source.nodeId&&$.source.nodeId!=="hub"&&o("span",{className:"text-[9px] px-1 py-0.5 rounded bg-foreground-subtle/10 text-foreground-subtle font-mono",children:$.source.nodeId})]}),ve&&o("p",{className:"text-foreground-subtle text-[10px] mt-0.5 ml-5",children:ve}),it&&m("div",{className:"mt-1 ml-5 text-[9px] bg-surface rounded px-2 py-1.5 space-y-0.5 font-mono overflow-x-auto",children:[m("div",{children:[o("span",{className:"text-primary/70",children:"source"}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground",children:JSON.stringify($.source)})]}),m("div",{children:[o("span",{className:"text-primary/70",children:"category"}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground",children:$.category})]}),Object.entries($.data).map(([Jn,Tr])=>m("div",{children:[o("span",{className:"text-primary/70",children:Jn}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground break-all",children:typeof Tr=="object"?JSON.stringify(Tr):String(Tr)})]},Jn))]})]})]},$.id)})})]})]})}function tg({search:e,onSearchChange:t,categories:r,active:n,onToggle:s,onSelectAll:a,onSelectNone:i,onResetDefaults:l}){return m("div",{className:"absolute z-20 top-full mt-1 left-0 w-72 max-h-80 rounded-md border border-border bg-surface shadow-lg flex flex-col",onClick:c=>c.stopPropagation(),children:[m("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border/50",children:[o(Gt,{className:"h-3 w-3 text-foreground-subtle"}),o("input",{type:"text",value:e,onChange:c=>t(c.target.value),placeholder:"Filter categories…",className:"flex-1 bg-transparent text-[10px] focus:outline-none text-foreground placeholder:text-foreground-subtle",autoFocus:!0}),e&&o("button",{type:"button",onClick:()=>t(""),className:"text-foreground-subtle hover:text-foreground",children:o(Ie,{className:"h-2.5 w-2.5"})})]}),m("div",{className:"flex items-center gap-1 px-2 py-1 border-b border-border/50 text-[9px]",children:[o("button",{type:"button",onClick:a,className:"px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground",children:"All"}),o("button",{type:"button",onClick:i,className:"px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground",children:"None"}),o("button",{type:"button",onClick:l,className:"px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground",children:"Defaults"})]}),m("div",{className:"overflow-y-auto flex-1",children:[r.length===0&&o("div",{className:"text-[10px] text-foreground-subtle italic px-2 py-3 text-center",children:"No matches"}),r.map(c=>{const d=n.has(c),u=An(c),f=u.icon;return m("button",{type:"button",onClick:()=>s(c),className:"w-full flex items-center gap-2 px-2 py-1 text-left hover:bg-surface-hover/40 text-[10px]",children:[o("input",{type:"checkbox",readOnly:!0,checked:d,className:"accent-violet-500"}),m("span",{className:N("inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[9px] font-medium shrink-0",u.color),children:[o(f,{className:"h-2.5 w-2.5"}),u.label]}),o("span",{className:"text-foreground-subtle font-mono truncate",children:c})]},c)})]})]})}function WN({position:e="bottom",className:t,...r}){return o("div",{className:N(e==="bottom"?"absolute bottom-0 left-0 right-0 z-10 border-t border-border bg-surface/95 backdrop-blur-sm":"absolute inset-x-2 bottom-2 z-10 rounded-lg border border-border bg-surface/95 backdrop-blur-sm shadow-xl",t),children:o(Zi,{maxHeight:"max-h-48",...r})})}function or({label:e,value:t}){return m("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:[e,": ",t]})}function rg({copied:e,onCopy:t}){return o("button",{type:"button",title:"Copy this event",onClick:r=>{r.stopPropagation(),t()},className:N("rounded p-0.5 transition-colors mt-0.5",e?"text-emerald-400":"text-foreground-subtle/60 hover:text-foreground hover:bg-surface-hover"),children:e?o(Vt,{className:"h-3 w-3"}):o(at,{className:"h-3 w-3"})})}function KN({deviceId:e,className:t="",onOpenChild:r}){const n=p.useUtils(),s=p.deviceDiscovery.listDiscovered.useQuery({deviceId:e},{refetchInterval:1e4,retry:!1}),a=p.deviceDiscovery.getStatus.useQuery({deviceId:e},{refetchInterval:1e4,retry:!1}),i=p.deviceDiscovery.refreshDiscovery.useMutation({onSuccess:()=>{n.deviceDiscovery.listDiscovered.invalidate({deviceId:e}),n.deviceDiscovery.getStatus.invalidate({deviceId:e})}}),l=p.deviceDiscovery.adoptDevice.useMutation({onSuccess:()=>{n.deviceDiscovery.listDiscovered.invalidate({deviceId:e})}}),c=p.deviceDiscovery.releaseDevice.useMutation({onSuccess:()=>{n.deviceDiscovery.listDiscovered.invalidate({deviceId:e})}}),[d,u]=S(null),{available:f,adopted:h}=re(()=>{const k=s.data??[],M=A=>typeof A.metadata.rtspChannel=="number"?A.metadata.rtspChannel:Number.POSITIVE_INFINITY,C=(A,_)=>{const P=M(A),Q=M(_);return P!==Q?P-Q:A.name.localeCompare(_.name)};return{available:k.filter(A=>!A.alreadyAdopted).sort(C),adopted:k.filter(A=>A.alreadyAdopted).sort(C)}},[s.data]),g=a.data,b=g?.lastError??null,v=g?.lastDiscoveryAt??null;async function x(){await i.mutateAsync({deviceId:e}).catch(()=>{})}async function y(k){u(k.childNativeId);try{await l.mutateAsync({deviceId:e,childNativeId:k.childNativeId})}finally{u(null)}}async function w(k){if(k.adoptedDeviceId!=null){u(k.childNativeId);try{await c.mutateAsync({deviceId:e,childDeviceId:k.adoptedDeviceId})}finally{u(null)}}}return m("div",{className:`rounded-xl border border-border bg-surface ${t}`,children:[m("div",{className:"flex items-start justify-between gap-2 border-b border-border px-3 py-2 sm:px-5 sm:py-3",children:[m("div",{className:"min-w-0",children:[o("h3",{className:"text-sm font-semibold text-foreground",children:"Discovered devices"}),m("p",{className:"text-[11px] text-foreground-subtle",children:["Channels behind this hub. Click ",o("span",{className:"font-medium",children:"Add"})," to promote a channel to a managed device, or ",o("span",{className:"font-medium",children:"Remove"})," to detach."]})]}),m("button",{type:"button",onClick:x,disabled:i.isPending,className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-2 py-1.5 sm:px-3 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50 shrink-0",children:[i.isPending?o(Ge,{className:"h-3.5 w-3.5 animate-spin"}):o(Gn,{className:"h-3.5 w-3.5"}),o("span",{className:"hidden sm:inline",children:"Refresh"})]})]}),b?m("div",{className:"flex items-start gap-2 border-b border-border bg-destructive/10 px-5 py-2 text-[11px] text-destructive",children:[o(qt,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),m("span",{children:["Last refresh failed: ",b]})]}):null,s.isLoading?o("div",{className:"flex items-center justify-center py-8 text-foreground-subtle",children:o(Ge,{className:"h-5 w-5 animate-spin"})}):f.length===0&&h.length===0?o("div",{className:"px-5 py-8 text-center text-xs text-foreground-subtle",children:"No channels reported by the hub yet. Click Refresh to enumerate."}):m(Ne,{children:[f.length>0?o(as,{title:"Available to add",count:f.length,tone:"primary",children:f.map(k=>o(is,{child:k,busy:d===k.childNativeId,onAdopt:y,onRelease:w,onOpenChild:r},k.childNativeId))}):null,h.length>0?o(as,{title:"Already adopted",count:h.length,tone:"muted",children:h.map(k=>o(is,{child:k,busy:d===k.childNativeId,onAdopt:y,onRelease:w,onOpenChild:r},k.childNativeId))}):null]}),v!=null?m("div",{className:"border-t border-border px-5 py-2 text-[10px] text-foreground-subtle",children:["Last refreshed ",new Date(v).toLocaleString()]}):null]})}function as({title:e,count:t,tone:r,children:n}){return m("div",{className:"border-t border-border",children:[m("div",{className:`flex items-center justify-between border-b px-3 sm:px-5 py-1.5 text-[10px] uppercase tracking-wider ${r==="primary"?"bg-primary/5 text-primary border-primary/30":"bg-surface text-foreground-subtle border-border"}`,children:[o("span",{className:"font-semibold",children:e}),o("span",{className:"font-mono",children:t})]}),o("div",{className:"divide-y divide-border",children:n})]})}function is({child:e,busy:t,onAdopt:r,onRelease:n,onOpenChild:s}){return m("div",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2 sm:px-5 sm:py-3 sm:flex-nowrap sm:gap-3",children:[m("div",{className:"min-w-0 flex-1",children:[m("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[o(ng,{status:e.status}),o("span",{className:"truncate text-sm font-medium text-foreground",children:e.name}),e.metadata.isDoorbell?o("span",{className:"rounded bg-surface-hover px-1.5 py-0.5 text-[9px] uppercase tracking-wide text-foreground-subtle",children:"Doorbell"}):null,e.metadata.isBattery?o("span",{className:"rounded bg-surface-hover px-1.5 py-0.5 text-[9px] uppercase tracking-wide text-foreground-subtle",children:"Battery"}):null,e.metadata.isMultifocal?o("span",{className:"rounded bg-surface-hover px-1.5 py-0.5 text-[9px] uppercase tracking-wide text-foreground-subtle",children:"Multifocal"}):null]}),m("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-foreground-subtle",children:[typeof e.metadata.rtspChannel=="number"?m("span",{children:["ch ",o("span",{className:"font-mono",children:e.metadata.rtspChannel})]}):null,e.metadata.model?o("span",{className:"truncate max-w-[160px]",children:e.metadata.model}):null,e.metadata.uid?m("span",{className:"font-mono truncate max-w-[140px]",children:[e.metadata.uid.slice(0,12),"…"]}):null]})]}),e.alreadyAdopted?m("div",{className:"flex items-center gap-2",children:[s&&e.adoptedDeviceId!==null?m("button",{type:"button",onClick:()=>s(e.adoptedDeviceId),className:"inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors",title:"Open device detail",children:[o(Ta,{className:"h-3.5 w-3.5"}),"Open"]}):null,m("button",{type:"button",onClick:()=>{n(e)},disabled:t,className:"inline-flex items-center gap-1.5 rounded-lg border border-destructive/30 px-3 py-1.5 text-xs text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-50",children:[t?o(Ge,{className:"h-3.5 w-3.5 animate-spin"}):o(Ye,{className:"h-3.5 w-3.5"}),"Remove"]})]}):m("button",{type:"button",onClick:()=>{r(e)},disabled:t,className:"inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50",children:[t?o(Ge,{className:"h-3.5 w-3.5 animate-spin"}):o(Er,{className:"h-3.5 w-3.5"}),"Add"]})]})}function ng({status:e}){switch(e){case"online":return m("span",{className:"inline-flex items-center gap-1 rounded-full border border-emerald-500/40 bg-emerald-500/10 px-2 py-0.5 text-[10px] font-medium text-emerald-500",children:[o(Ua,{className:"h-2.5 w-2.5"})," online"]});case"sleeping":return m("span",{className:"inline-flex items-center gap-1 rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-[10px] font-medium text-amber-500",children:[o(jn,{className:"h-2.5 w-2.5"})," sleeping"]});case"offline":return m("span",{className:"inline-flex items-center gap-1 rounded-full border border-destructive/40 bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive",children:[o(Vu,{className:"h-2.5 w-2.5"})," offline"]});default:return m("span",{className:"inline-flex items-center gap-1 rounded-full border border-border bg-surface px-2 py-0.5 text-[10px] font-medium text-foreground-subtle",children:[o(Pa,{className:"h-2.5 w-2.5"})," unknown"]})}}function og(e,t){if(!e||typeof e!="object")return!1;const r=e;if(r.category!==V.DeviceStateChanged)return!1;const n=r.data;return!(!n||typeof n!="object"||n.deviceId!==t||typeof n.capName!="string"||!n.slice||typeof n.slice!="object")}function tn(e){if(!e||typeof e!="object")return null;const t=e,r=typeof t.id=="string"?t.id:null,n=typeof t.timestamp=="string"?t.timestamp:null,s=t.data;return!r||!n||!s||typeof s!="object"||typeof s.capName!="string"||!s.slice||typeof s.slice!="object"?null:{id:r,timestamp:n,capName:s.capName,slice:s.slice}}var sg=300,ag=Object.freeze([...new Set(cl.filter(e=>e.scope==="device").map(e=>e.name))].sort());function ig({deviceId:e,defaultCaps:t,maxHeight:r="max-h-96",limit:n=50,liveBuffer:s,onClose:a,className:i}){const[l,c]=S(re(()=>new Set(t??[]),[t])),[d,u]=S(""),[f,h]=S(!0),[g,b]=S(new Set),[v,x]=S(0),[y,w]=S(!1),[k,M]=S(""),C=q(null),A=St(sg),_=s??A,P=_.entries,Q=q(null),oe=q(e);H(()=>{oe.current!==e&&(oe.current=e,_.reset(),b(new Set),x(0))},[e,_]);const le=re(()=>({deviceId:e,category:V.DeviceStateChanged,limit:n}),[e,n]),{data:ge,isLoading:de}=p.systemEvents.getRecent.useQuery(le,{staleTime:3e4}),pe=q(l);H(()=>{pe.current=l},[l]),p.systemEvents.subscribe.useSubscription({deviceId:e,category:V.DeviceStateChanged},{onData:O=>{if(!og(O,e))return;const E=tn(O);if(!E)return;const D=pe.current;D.size>0&&!D.has(E.capName)||_.append(E)}});const ie=q(P.length);H(()=>{const O=Q.current;if(!O){ie.current=P.length;return}const E=ie.current;if(ie.current=P.length,!(P.length<=E)){if(f&&O.scrollTop<=8)O.scrollTo({top:0});else if(!f&&O.scrollTop>0){const D=O.firstElementChild?.firstElementChild,J=D instanceof HTMLElement?D.offsetHeight:28,ae=P.length-E;O.scrollTop+=J*ae}}},[P.length,f]);const ne=re(()=>{const O=new Map;for(const J of ge??[]){const ae=tn(J);ae&&O.set(ae.id,ae)}for(const J of P)O.set(J.id,J);let E=[...O.values()];v>0&&(E=E.filter(J=>new Date(J.timestamp).getTime()>v)),l.size>0&&(E=E.filter(J=>l.has(J.capName)));const D=d.trim().toLowerCase();return D&&(E=E.filter(J=>{if(J.capName.toLowerCase().includes(D))return!0;try{if(new Date(J.timestamp).toLocaleTimeString().toLowerCase().includes(D))return!0}catch{}try{if(Object.entries(J.slice).map(([ae,L])=>`${ae}=${rn(L)}`).join(" · ").toLowerCase().includes(D))return!0}catch{}try{if(JSON.stringify(J.slice).toLowerCase().includes(D))return!0}catch{}return!1})),E.sort((J,ae)=>new Date(ae.timestamp).getTime()-new Date(J.timestamp).getTime())},[ge,P,l,d,v]),W=re(()=>{const O=new Set(ag);for(const E of ge??[]){const D=tn(E);D&&O.add(D.capName)}for(const E of P)O.add(E.capName);return[...O].sort()},[ge,P]),ye=I(O=>{b(E=>{const D=new Set(E);return D.has(O)?D.delete(O):D.add(O),D})},[]),me=I(O=>{c(E=>{const D=new Set(E);return D.has(O)?D.delete(O):D.add(O),D})},[]),T=I(()=>{c(new Set(t??[])),u("")},[t]),z=I(()=>{x(Date.now()),_.reset()},[_]),[B,se]=S(!1),[U,K]=S(null),Z=I(O=>`${new Date(O.timestamp).toISOString()} [${O.capName}] slice=${JSON.stringify(O.slice)}`,[]),G=I(()=>{const O=ne.map(Z);navigator.clipboard.writeText(O.join(`
80
- `)).then(()=>{se(!0),setTimeout(()=>se(!1),1500)})},[ne,Z]),te=I(O=>{navigator.clipboard.writeText(Z(O)).then(()=>{K(O.id),setTimeout(()=>K(E=>E===O.id?null:E),1200)})},[Z]),Y=I(()=>{c(new Set(W))},[W]),Pe=I(()=>{c(new Set)},[]),Re=re(()=>{const O=k.trim().toLowerCase();return O?W.filter(E=>E.toLowerCase().includes(O)):W},[k,W]),X=W.length,fe=l.size,xe=fe===0||fe===X,we=xe?"All":`${fe}/${X}`;return H(()=>{if(!y)return;const O=E=>{const D=C.current;D&&!D.contains(E.target)&&w(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[y]),m("div",{className:N("h-full min-h-0 flex flex-col",i),onClick:O=>O.stopPropagation(),children:[m("div",{className:"flex items-center justify-between px-3 py-1.5 bg-surface-hover/30 gap-2 shrink-0",children:[m("div",{className:"flex items-center gap-2 flex-wrap",children:[o("span",{className:"text-[10px] uppercase tracking-wide text-foreground-subtle font-medium",children:"State"}),o(lg,{label:"device",value:`#${e}`}),m("button",{type:"button",onClick:()=>{h(O=>!O),!f&&Q.current&&Q.current.scrollTo({top:0,behavior:"smooth"})},className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",f?"border-border text-foreground-subtle hover:text-foreground":"border-amber-500/30 bg-amber-500/10 text-amber-400"),children:[o(zn,{className:"h-2.5 w-2.5"}),f?"Auto":"Paused"]}),m("div",{className:"relative",ref:C,children:[m("button",{type:"button",onClick:()=>w(O=>!O),className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",xe?"border-border text-foreground-subtle hover:text-foreground":"border-violet-500/30 bg-violet-500/10 text-violet-400"),title:"Pick caps to track",children:[o(La,{className:"h-2.5 w-2.5"}),"Filter (",we,")"]}),y&&o(cg,{search:k,onSearchChange:M,caps:Re,active:l,onToggle:me,onSelectAll:Y,onSelectNone:Pe,onResetDefaults:T})]}),m("button",{type:"button",onClick:T,className:"inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground transition-colors",title:"Reset filters",children:[o(ja,{className:"h-2.5 w-2.5"}),"Reset"]}),m("button",{type:"button",onClick:z,className:"inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground transition-colors",title:"Clear visible entries",children:[o(Ye,{className:"h-2.5 w-2.5"}),"Clear"]}),m("button",{type:"button",onClick:G,disabled:ne.length===0,className:N("inline-flex items-center gap-1 text-[9px] px-1.5 py-0.5 rounded border transition-colors",B?"border-emerald-500/30 bg-emerald-500/10 text-emerald-400":"border-border text-foreground-subtle hover:text-foreground",ne.length===0&&"opacity-40 cursor-not-allowed"),title:"Copy all visible state changes",children:[o(at,{className:"h-2.5 w-2.5"}),B?"Copied!":"Copy"]}),m("div",{className:"relative",children:[o("input",{type:"text",value:d,onChange:O=>u(O.target.value),placeholder:"Search…",className:"w-32 pl-1.5 pr-5 py-0.5 rounded border border-border bg-background text-foreground text-[10px] focus:outline-none focus:border-primary/50"}),d&&o("button",{type:"button",onClick:()=>u(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground",title:"Clear search",children:o(Ie,{className:"h-2.5 w-2.5"})})]}),P.length>0&&m("span",{className:"text-[9px] text-emerald-400 font-medium",children:["+",P.length," live"]})]}),a&&o("button",{type:"button",onClick:a,className:"text-foreground-subtle hover:text-foreground",children:o(Ie,{className:"h-3.5 w-3.5"})})]}),m("div",{ref:Q,className:N("flex-1 min-h-0 overflow-auto text-[10px]",r),children:[de&&m("div",{className:"flex items-center justify-center gap-2 py-6 text-foreground-subtle",children:[o(Ge,{className:"h-3.5 w-3.5 animate-spin"}),"Loading state changes..."]}),!de&&ne.length===0&&o("div",{className:"py-4 text-center text-foreground-subtle",children:"No state changes"}),ne.length>0&&o("div",{className:"divide-y divide-border/30",children:ne.map(O=>{const E=g.has(O.id),D=Object.entries(O.slice),J=D.slice(0,3).map(([ae,L])=>`${ae}=${rn(L)}`).join(" · ");return m("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-surface-hover/30 cursor-pointer",onClick:()=>ye(O.id),children:[o("span",{className:"text-foreground-subtle whitespace-nowrap w-[70px] shrink-0 pt-0.5",children:new Date(O.timestamp).toLocaleTimeString()}),o(dg,{copied:U===O.id,onCopy:()=>te(O)}),m("div",{className:"flex-1 min-w-0",children:[m("div",{className:"flex items-center gap-1.5",children:[E?o(pt,{className:"h-3 w-3 text-foreground-subtle shrink-0"}):o(st,{className:"h-3 w-3 text-foreground-subtle shrink-0"}),o("span",{className:"inline-flex items-center gap-1 rounded-full border border-violet-500/30 bg-violet-500/15 text-violet-400 px-2 py-0.5 text-[9px] font-medium",children:O.capName}),D.length>3&&m("span",{className:"text-[9px] text-foreground-subtle",children:["+",D.length-3," more"]})]}),J&&o("p",{className:"text-foreground-subtle text-[10px] mt-0.5 ml-5 truncate",children:J}),E&&o("div",{className:"mt-1 ml-5 text-[9px] bg-surface rounded px-2 py-1.5 space-y-0.5 font-mono overflow-x-auto",children:D.length===0?o("div",{className:"text-foreground-subtle italic",children:"empty slice"}):D.map(([ae,L])=>m("div",{children:[o("span",{className:"text-primary/70",children:ae}),o("span",{className:"text-foreground-subtle",children:": "}),o("span",{className:"text-foreground break-all",children:rn(L)})]},ae))})]})]},O.id)})})]})]})}function rn(e){if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function lg({label:e,value:t}){return m("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:[e,": ",t]})}function cg({search:e,onSearchChange:t,caps:r,active:n,onToggle:s,onSelectAll:a,onSelectNone:i,onResetDefaults:l}){return m("div",{className:"absolute z-20 top-full mt-1 left-0 w-72 max-h-80 rounded-md border border-border bg-surface shadow-lg flex flex-col",onClick:c=>c.stopPropagation(),children:[m("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border/50",children:[o(Gt,{className:"h-3 w-3 text-foreground-subtle"}),o("input",{type:"text",value:e,onChange:c=>t(c.target.value),placeholder:"Filter caps…",className:"flex-1 bg-transparent text-[10px] focus:outline-none text-foreground placeholder:text-foreground-subtle",autoFocus:!0}),e&&o("button",{type:"button",onClick:()=>t(""),className:"text-foreground-subtle hover:text-foreground",children:o(Ie,{className:"h-2.5 w-2.5"})})]}),m("div",{className:"flex items-center gap-1 px-2 py-1 border-b border-border/50 text-[9px]",children:[o("button",{type:"button",onClick:a,className:"px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground",children:"All"}),o("button",{type:"button",onClick:i,className:"px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground",children:"None"}),o("button",{type:"button",onClick:l,className:"px-1.5 py-0.5 rounded border border-border text-foreground-subtle hover:text-foreground",children:"Defaults"})]}),m("div",{className:"overflow-y-auto flex-1",children:[r.length===0&&o("div",{className:"text-[10px] text-foreground-subtle italic px-2 py-3 text-center",children:"No matches"}),r.map(c=>m("button",{type:"button",onClick:()=>s(c),className:"w-full flex items-center gap-2 px-2 py-1 text-left hover:bg-surface-hover/40 text-[10px]",children:[o("input",{type:"checkbox",readOnly:!0,checked:n.has(c),className:"accent-violet-500"}),o("span",{className:"inline-flex items-center gap-1 rounded-full border border-violet-500/30 bg-violet-500/15 text-violet-400 px-1.5 py-0.5 text-[9px] font-medium shrink-0",children:c})]},c))]})]})}function dg({copied:e,onCopy:t}){return o("button",{type:"button",title:"Copy this state change",onClick:r=>{r.stopPropagation(),t()},className:N("rounded p-0.5 transition-colors mt-0.5",e?"text-emerald-400":"text-foreground-subtle/60 hover:text-foreground hover:bg-surface-hover"),children:e?o(Vt,{className:"h-3 w-3"}):o(at,{className:"h-3 w-3"})})}var nn=500,ug=[{id:"logs",label:"Logs",icon:Lu},{id:"events",label:"Events",icon:Sr},{id:"state",label:"State",icon:wu}];function ZN({deviceId:e,defaultEventCategories:t,defaultStateCaps:r,initialTab:n="events",className:s,maxHeight:a="max-h-96"}){const[i,l]=S(n),c=St(nn),d=St(nn),u=St(nn),f=c.reset,h=d.reset,g=u.reset;return H(()=>{f(),h(),g()},[e,f,h,g]),m("div",{className:N("flex flex-col h-full min-h-0",s),children:[o("div",{className:"flex items-center gap-1 mb-2 shrink-0",children:ug.map(({id:b,label:v,icon:x})=>m("button",{type:"button",onClick:()=>l(b),className:N("inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[11px] font-medium transition-colors",i===b?"bg-primary/15 text-primary border border-primary/30":"text-foreground-subtle hover:text-foreground hover:bg-surface-hover border border-transparent"),children:[o(x,{className:"h-3.5 w-3.5"}),v]},b))}),m("div",{className:"flex-1 min-h-0 overflow-hidden",children:[i==="logs"&&o(Ki,{deviceId:e,maxHeight:a,showFilters:!1,liveBuffer:c}),i==="events"&&o(Zi,{deviceId:e,defaultCategories:t,maxHeight:a,showCategoryFilter:!0,liveBuffer:d}),i==="state"&&o(ig,{deviceId:e,defaultCaps:r,maxHeight:a,liveBuffer:u})]})]})}function YN({label:e,icon:t,title:r="Confirm action",description:n,confirmLabel:s,triggerVariant:a="outline",confirmVariant:i="danger",size:l="sm",disabled:c,className:d,action:u,onSuccess:f}){const[h,g]=S(!1),[b,v]=S(!1),[x,y]=S(null),w=async()=>{y(null),v(!0);try{const k=await u();f?.(k),g(!1)}catch(k){y(k instanceof Error?k.message:String(k))}finally{v(!1)}};return m(Ne,{children:[m(mr,{type:"button",variant:a,size:l,disabled:c,onClick:()=>{y(null),g(!0)},className:d,children:[t&&o(t,{className:"h-3.5 w-3.5"}),e]}),o(op,{open:h,onOpenChange:k=>!b&&g(k),children:m(Xa,{children:[m(ap,{children:[m(lp,{className:"flex items-center gap-2",children:[o(qt,{className:"h-4 w-4 text-amber-400"}),r]}),typeof n=="string"?o(cp,{children:n}):n]}),x&&o("div",{className:N("mt-2 px-3 py-2 rounded border border-danger/40 bg-danger/10","text-xs text-danger"),children:x}),m(ip,{children:[o(mr,{type:"button",variant:"ghost",size:l,disabled:b,onClick:()=>g(!1),children:"Cancel"}),m(mr,{type:"button",variant:i,size:l,disabled:b,onClick:()=>{w()},children:[b&&o(Ge,{className:"h-3.5 w-3.5 animate-spin"}),s??e]})]})]})})]})}function sr({direction:e,icon:t,disabled:r,className:n,variant:s,onMove:a,onStart:i,onStop:l}){const[c,d]=S(null),[u,f]=S(!1),h=I(y=>{if(r)return;y.currentTarget.setPointerCapture(y.pointerId),d(Date.now()),f(!1);const w=setTimeout(()=>{f(!0),i(e)},250);y.currentTarget.dataset.timer=String(w)},[e,r,i]),g=I(y=>{const w=Number(y.currentTarget.dataset.timer);w&&clearTimeout(w),y.currentTarget.dataset.timer="",u?l():c!==null&&a(e),d(null),f(!1)},[u,e,a,l,c]),b=I(y=>{const w=Number(y.currentTarget.dataset.timer);w&&clearTimeout(w),y.currentTarget.dataset.timer="",u&&l(),d(null),f(!1)},[u,l]),v=s==="panel"?"h-9 w-9":"h-7 w-7",x=s==="panel"?"h-4 w-4":"h-3.5 w-3.5";return o("button",{type:"button",disabled:r,onPointerDown:h,onPointerUp:g,onPointerCancel:b,className:N("flex items-center justify-center rounded transition-colors disabled:opacity-40",s==="panel"?"text-foreground hover:bg-surface-hover active:bg-surface-hover/80":"text-white hover:bg-white/15 active:bg-white/25",v,n),title:e,children:o(t,{className:x})})}function XN({controls:e,mode:t="overlay",showPresets:r,showZoom:n=!0,showHome:s=!0,className:a}){const{move:i,startContinuous:l,stopContinuous:c,zoom:d,goHome:u,goToPreset:f,presets:h,busy:g,error:b}=e,[v,x]=S(!1),y=(r??h.length>0)&&h.length>0,w=t==="panel",k=w?"flex flex-col items-stretch gap-2 w-full h-full p-3":"pointer-events-auto absolute top-3 right-3 z-10 flex flex-col items-end gap-2",M=N(w?"flex items-center gap-3 rounded-lg p-2":"flex items-center gap-2 rounded-lg border border-white/30 bg-zinc-900/90 backdrop-blur-md p-2 shadow-lg shadow-black/40",g&&"ring-1 ring-primary/40"),C=w?"h-9 w-9":"h-7 w-7",A=w?"h-4 w-4":"h-3.5 w-3.5",_=w?"text-foreground hover:bg-surface-hover":"text-white hover:bg-white/15",P=w?"h-12 w-px bg-border mx-1":"h-12 w-px bg-white/15 mx-1";return m("div",{className:N(k,a),children:[b&&m("div",{className:"rounded bg-danger/90 px-2 py-1 text-[10px] font-medium text-white shadow-lg max-w-[200px] self-center",children:["PTZ: ",b]}),m("div",{className:N(M,w&&"justify-center"),children:[m("div",{className:"grid grid-cols-3 gap-0.5",children:[o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"}),o(sr,{direction:"up",icon:su,variant:t,onMove:i,onStart:l,onStop:c}),o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"}),o(sr,{direction:"left",icon:nu,variant:t,onMove:i,onStart:l,onStop:c}),o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"}),o(sr,{direction:"right",icon:ou,variant:t,onMove:i,onStart:l,onStop:c}),o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"}),o(sr,{direction:"down",icon:ru,variant:t,onMove:i,onStart:l,onStop:c}),o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"})]}),(n||s)&&o("div",{className:P}),m("div",{className:"flex flex-col gap-0.5",children:[n&&m(Ne,{children:[o("button",{type:"button",onClick:()=>d("in"),disabled:g,title:"Zoom in",className:N("flex items-center justify-center rounded disabled:opacity-40",C,_),children:o(qu,{className:A})}),o("button",{type:"button",onClick:()=>d("out"),disabled:g,title:"Zoom out",className:N("flex items-center justify-center rounded disabled:opacity-40",C,_),children:o(Wu,{className:A})})]}),s&&o("button",{type:"button",onClick:()=>u(),disabled:g,title:"Go home",className:N("flex items-center justify-center rounded disabled:opacity-40",C,_),children:o(Oa,{className:A})})]}),y&&m("div",{className:"relative",children:[m("button",{type:"button",onClick:()=>x(Q=>!Q),disabled:g,className:N("flex items-center gap-1 rounded px-2 text-[10px] disabled:opacity-40",w?"h-9 text-foreground hover:bg-surface-hover":"h-7 text-white hover:bg-white/15"),title:"Presets",children:["Presets",o(pt,{className:N("h-3 w-3 transition-transform",v&&"rotate-180")})]}),v&&o("div",{className:N("absolute right-0 min-w-[140px] rounded-lg shadow-xl py-1 z-20",w?"bottom-full mb-1 bg-surface border border-border":"top-full mt-1 border border-white/30 bg-zinc-900/95 backdrop-blur-md"),children:h.map(Q=>o("button",{type:"button",onClick:()=>{f(Q.id),x(!1)},disabled:g,className:N("block w-full px-3 py-1.5 text-left text-[10px] disabled:opacity-40",w?"text-foreground hover:bg-surface-hover":"text-white hover:bg-white/15"),children:Q.name||Q.id},Q.id))})]})]})]})}function pg(e,t){const r=document.createElement("a");r.href=t,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)}function JN({trpc:e,deviceId:t,deviceName:r,size:n="sm",className:s}){const[a,i]=S(!1),[l,c]=S(!1),[d,u]=S(null),f=r.replace(/[^a-zA-Z0-9_.-]+/g,"_"),h=I(async C=>{i(!0),u(null),c(!1);try{const A=await e.snapshot.getSnapshot.query({deviceId:t,force:!0});if(!A)throw new Error("No snapshot available");const _=`data:${A.contentType};base64,${A.base64}`;if(C==="copy")try{await navigator.clipboard.writeText(_)}catch{throw new Error("Clipboard unavailable")}else{const P=A.contentType.includes("png")?"png":"jpg";pg(`${f}-${new Date().toISOString().replace(/[:.]/g,"-")}.${P}`,_)}c(!0),setTimeout(()=>c(!1),1500)}catch(A){u(A instanceof Error?A.message:String(A))}finally{i(!1)}},[e,t,f]),g=n==="md"?"h-9 px-3 text-sm gap-2":"h-7 px-2.5 text-[11px] gap-1.5",[b,v]=S(null),[x,y]=S(!1),w=()=>{y(!1),v(setTimeout(()=>{y(!0),h("copy")},600))},k=()=>{b&&(clearTimeout(b),v(null)),x||h("download")},M=()=>{b&&(clearTimeout(b),v(null))};return m("button",{type:"button",title:"Click to download · long-press to copy",disabled:a,onPointerDown:w,onPointerUp:k,onPointerLeave:M,onPointerCancel:M,className:N("inline-flex items-center justify-center rounded-lg font-medium border border-border","text-foreground-subtle hover:text-foreground hover:bg-surface-hover","disabled:opacity-50 transition-colors",g,d&&"border-danger/40 text-danger",s),children:[a?o(Ge,{className:"h-3.5 w-3.5 animate-spin"}):l?o(Vt,{className:"h-3.5 w-3.5 text-success"}):o(Fn,{className:"h-3.5 w-3.5"}),"Snapshot"]})}function fg(e){const t=Date.now()-e;return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m ago`:t<864e5?`${Math.floor(t/36e5)}h ago`:`${Math.floor(t/864e5)}d ago`}function eS({history:e,limit:t=5,latestIsFresh:r,className:n}){if(e.length===0)return null;const s=r?cu:Sr,a=e.slice(0,t);return m("div",{className:N("rounded-lg border border-border bg-surface px-3 py-2",n),children:[m("div",{className:"flex items-center gap-2 mb-2",children:[o(s,{className:N("h-4 w-4 text-amber-400",r&&"animate-pulse")}),o("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-foreground-subtle",children:"Recent presses"}),o("span",{className:"ml-auto rounded-full bg-foreground-subtle/10 px-1.5 py-0.5 text-[10px] font-medium text-foreground-subtle border border-border",children:e.length})]}),o("ul",{className:"space-y-1",children:a.map(i=>m("li",{className:"flex items-center justify-between text-[11px]",title:new Date(i.timestamp).toLocaleString(),children:[o("span",{className:"text-foreground",children:fg(i.timestamp)}),o("span",{className:"text-foreground-subtle font-mono text-[10px]",children:new Date(i.timestamp).toLocaleTimeString()})]},`${i.deviceId}-${i.timestamp}`))})]})}function tS({items:e,header:t,triggerClassName:r,title:n="More actions"}){const[s,a]=S(!1),i=e.filter(l=>!l.hidden);return i.length===0?null:m(dp,{open:s,onOpenChange:a,children:[o(up,{title:n,className:N("inline-flex items-center justify-center rounded-lg p-2","text-foreground-subtle hover:text-foreground hover:bg-surface-hover","border border-transparent transition-colors",r),children:o(Ia,{className:"h-4 w-4"})}),m(pp,{className:"left-auto right-0 mt-1 min-w-[200px] p-1",children:[t&&o("div",{className:"px-2 py-1 text-[10px] uppercase tracking-wider text-foreground-subtle",children:t}),o("ul",{className:"space-y-0.5",children:i.map((l,c)=>m("li",{children:[l.separatorBefore&&c>0&&o("div",{className:"my-1 h-px bg-border"}),m("button",{type:"button",disabled:l.disabled,onClick:()=>{l.disabled||(l.onClick(),a(!1))},className:N("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-[12px]","transition-colors disabled:opacity-40 disabled:cursor-not-allowed",l.danger?"text-foreground hover:bg-danger/10 hover:text-danger":"text-foreground hover:bg-surface-hover"),children:[l.icon&&o(l.icon,{className:N("h-3.5 w-3.5 shrink-0 mt-0.5",l.danger&&"text-danger/80")}),m("span",{className:"flex-1 min-w-0",children:[o("span",{className:"block leading-tight",children:l.label}),l.description&&o("span",{className:"block mt-0.5 text-[10px] text-foreground-subtle leading-tight",children:l.description})]})]})]},l.id))})]})]})}var Yi=ot("camstack:zone-editing",null);function rS({children:e}){const[t,r]=S(!1),[n,s]=S(null),[a,i]=S(null),[l,c]=S(null),d=I(w=>{r(w),w||(s(null),i(null),c(null))},[]),u=I(w=>{s(w)},[]),f=I(w=>{i(w)},[]),h=I(w=>{r(!0),i(null),s(w),c(null)},[]),g=I(()=>{r(!1),s(null),i(null),c(null)},[]),b=I(w=>{i(w.id),c(w)},[]),v=I(w=>{c(k=>k===null?k:{...k,...w})},[]),x=I(()=>{c(null)},[]),y=re(()=>({editing:t,drawingKind:n,selectedZoneId:a,editingDraft:l,setEditing:d,setDrawingKind:u,setSelectedZoneId:f,startDrawing:h,exitEditing:g,enterDraft:b,updateDraft:v,discardDraft:x}),[t,n,a,l,d,u,f,h,g,b,v,x]);return o(Yi.Provider,{value:y,children:e})}function nS(){return Ae(Yi)}var ls=500,mg=800;function ar(e,t,r){try{const n=e.live;if(!n)return null;const s=n.onEvent;return!s||typeof s.subscribe!="function"?null:s.subscribe({category:t},{onData:r})}catch{return null}}function ir(e,t){return e?.id===t}function oS(e,t){const[r,n]=S(null),[s,a]=S(null),[i,l]=S(null),[c,d]=S("watching"),u=q(void 0),f=q(void 0),h=q(void 0);return H(()=>{if(t===null)return;const g=ar(e,"detection.motion-analysis",b=>{const v=b;if(!ir(v?.source,t))return;const x=v.data;!x?.regions||x.regions.length===0||(n({zones:x.regions.map(y=>({...y.bbox,intensity:y.intensity})),frameWidth:x.frameWidth,frameHeight:x.frameHeight}),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>n(null),ls))});return()=>{g?.unsubscribe(),u.current&&clearTimeout(u.current)}},[e,t]),H(()=>{if(t===null)return;const g=ar(e,"detection.motion-zones-raw",b=>{const v=b;if(!ir(v?.source,t))return;const x=v.data;x?.zones&&(a({boxes:x.zones.map(y=>({bbox:y.bbox,changeScore:y.changeScore})),frameWidth:x.frameSize?.width??0,frameHeight:x.frameSize?.height??0,motionScore:x.zones.length>0?x.zones.reduce((y,w)=>y+w.changeScore,0)/x.zones.length:0}),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>a(null),ls))});return()=>{g?.unsubscribe(),f.current&&clearTimeout(f.current)}},[e,t]),H(()=>{if(t===null)return;const g=ar(e,"detection.result",b=>{const v=b;if(!ir(v?.source,t))return;const x=v.data?.frame;x?.detections?.length&&(l({detections:x.detections,frameWidth:x.width,frameHeight:x.height}),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>l(null),mg))});return()=>{g?.unsubscribe(),h.current&&clearTimeout(h.current)}},[e,t]),H(()=>{if(t===null)return;const g=ar(e,"detection.phase-transition",b=>{const v=b;ir(v?.source,t)&&v.data?.to&&d(v.data.to)});return()=>{g?.unsubscribe()}},[e,t]),{motion:r,motionRaw:s,detection:i,phase:c}}function sS(e,t,r=5e3){const[n,s]=S([]);H(()=>{if(t===null)return;let d=!1;const u=()=>{e.webrtcSession.listStreams.query({deviceId:t}).then(h=>{d||s(h)}).catch(()=>{})};u();const f=setInterval(u,r);return()=>{d=!0,clearInterval(f)}},[e,t,r]);const[a,i]=S(null);H(()=>{if(t===null)return;let d=!1;return e.pipelineOrchestrator&&e.pipelineOrchestrator.getCameraMetrics.query({deviceId:t}).then(u=>{d||!u||i({phase:u.phase,detectionFps:u.actualFps,avgInferenceMs:u.avgInferenceTimeMs,droppedFrames:u.droppedFrames})}).catch(()=>{}),()=>{d=!0}},[e,t]),Pr("pipeline.camera-metrics-snapshot",d=>{if(t===null)return;const u=d.data;u.deviceId!==t||!u.metrics||i({phase:u.metrics.phase,detectionFps:u.metrics.actualFps,avgInferenceMs:u.metrics.avgInferenceTimeMs,droppedFrames:u.metrics.droppedFrames})});const{streams:l,hasWebrtc:c}=re(()=>t===null||n.length===0?{streams:[],hasWebrtc:!1}:{streams:n.map(d=>({id:d.id,label:d.label,target:d.target,status:d.status,inputFps:d.inputFps,decodeFps:d.decodeFps,bitrateKbps:d.bitrateKbps})),hasWebrtc:!0},[t,n]);return{streams:l,hasWebrtc:c,pipelineMetrics:a,createSession:I(async(d,u)=>{if(t===null)throw new Error("No device selected");const f=await e.webrtcSession.createSession.mutate({deviceId:t,target:d,hints:u});return{sessionId:f.sessionId,sdpOffer:f.sdpOffer}},[e,t]),sendAnswer:I(async(d,u)=>{if(t===null)throw new Error("No device selected");await e.webrtcSession.handleAnswer.mutate({deviceId:t,sessionId:d,sdpAnswer:u})},[e,t]),closeSession:I(async d=>{t!==null&&await e.webrtcSession.closeSession.mutate({deviceId:t,sessionId:d}).catch(()=>{})},[e,t])}}var cs={up:{pan:0,tilt:1},down:{pan:0,tilt:-1},left:{pan:-1,tilt:0},right:{pan:1,tilt:0},"up-left":{pan:-1,tilt:1},"up-right":{pan:1,tilt:1},"down-left":{pan:-1,tilt:-1},"down-right":{pan:1,tilt:-1}};function aS(e,t,r){const n=r?.defaultSpeed??.5,s=r?.pulseMs??250,a=r?.enabled??!0,i=Rr(e,a?t:null)?.ptz,[l,c]=S([]),[d,u]=S(!1),[f,h]=S(null),g=I(async()=>{if(!(!a||!i))try{c(await i.getPresets({}))}catch(v){const x=v instanceof Error?v.message:String(v);if(x.includes("provider not available")||x.includes("no 'ptz' binding"))return;h(x)}},[i,a]);H(()=>{g()},[g]);const b=I(async v=>{if(!(!a||!i)){h(null),u(!0);try{return await v()}catch(x){h(x instanceof Error?x.message:String(x));return}finally{u(!1)}}},[a,i]);return{move:I(async(v,x)=>{if(!i)return;const y=cs[v],w=x??n;await b(async()=>{await i.move({pan:y.pan,tilt:y.tilt,speed:w}),await new Promise(k=>setTimeout(k,s)),await i.stop({})})},[i,n,s,b]),startContinuous:I(async(v,x)=>{if(!i)return;const y=cs[v],w=x??n;await b(()=>i.continuousMove({pan:y.pan,tilt:y.tilt,speed:w}))},[i,n,b]),stopContinuous:I(async()=>{i&&await b(()=>i.stop({}))},[i,b]),zoom:I(async(v,x)=>{if(!i)return;const y=v==="in"?1:-1,w=x??n;await b(async()=>{await i.move({zoom:y,speed:w}),await new Promise(k=>setTimeout(k,s)),await i.stop({})})},[i,n,s,b]),goHome:I(async()=>{i&&await b(()=>i.goHome({}))},[i,b]),goToPreset:I(async v=>{i&&await b(()=>i.goToPreset({presetId:v}))},[i,b]),presets:l,refreshPresets:g,busy:d,error:f}}function iS(e){const t=e?.deviceId??null,r=e?.historyLimit??20,n=mi("doorbell.onPressed",t!==null?i=>i.deviceId===t:void 0),[s,a]=S([]);return H(()=>{n&&a(i=>{if(i.length>0&&i[0].deviceId===n.deviceId&&i[0].timestamp===n.timestamp)return i;const l=[n,...i];return l.length>r?l.slice(0,r):l})},[n,r]),{latest:n??null,history:s}}function lS(e){const t=Rt(),r=re(()=>e?JSON.stringify(e):"",[e]),[n,s]=S(()=>t.listDevices(e));return H(()=>{const a=()=>{s(t.listDevices(e))};a();let i=null,l=null;try{i=t.onDeviceAdded(a),l=t.onDeviceRemoved(a)}catch{}const c=t.subscribeConnectionEvents(d=>{d==="connected"&&a()});return()=>{i?.(),l?.(),c()}},[t,e,r]),n}function cS(e){const t=Rt(),[r,n]=S(()=>e===null?null:t.getDevice(e));return H(()=>{if(e===null){n(null);return}const s=()=>{n(t.getDevice(e))};s();let a=null,i=null;try{a=t.onDeviceAdded(s),i=t.onDeviceRemoved(s)}catch{}const l=t.subscribeConnectionEvents(c=>{c==="connected"&&s()});return()=>{a?.(),i?.(),l()}},[t,e]),r}function dS(e,t,r){const n=Rt();return ms({queryKey:e,queryFn:()=>t(n)(),...r})}function uS(e,t){const r=Rt();return rl({mutationFn:n=>e(r)(n),...t})}function pS(e,t){const r=Rt(),n=Rn(),[s,a]=S(r.connectionVersion);H(()=>r.subscribeConnectionEvents((c,d)=>{c==="connected"&&a(d)}),[r]);const i=t.join("|"),l=JSON.stringify(e);H(()=>{const c=[],d=()=>{const u=JSON.parse(l),f=u.length===1&&Array.isArray(u[0])?u:[u];n.invalidateQueries({queryKey:f})};d();for(const u of i.split("|"))if(u)try{c.push(r.subscribeEvent(u,d))}catch{}return()=>{for(const u of c)u()}},[r,n,i,l,s])}export{ON as AddonGlobalSettingsForm,wb as AgentStepEditor,$b as AppShell,HN as AudioClassificationList,QN as AudioLevelWaveform,GN as AudioWaveform,Ug as BTN_COMPACT,qg as BTN_COMPACT_DANGER,Vg as BTN_COMPACT_PRIMARY,Wg as BTN_COMPACT_WARNING,Lt as Badge,uf as BatteryBadge,si as BottomSheet,gb as Breadcrumb,mr as Button,Yg as CHIP_ACTIVE,Zg as CHIP_BASE,Xg as CHIP_INACTIVE,er as CLASS_COLORS,Ih as CameraStreamPlayer,qa as Card,rp as Checkbox,Lb as CodeBlock,Ju as CollapsibleCard,wh as ConfigFormBuilder,Kt as ConfigFormField,Un as ConfigSchemaField,YN as ConfirmActionButton,Ib as ConfirmDialogProvider,Xb as CustomFieldRenderersProvider,Hb as DEFAULT_COLOR,bb as DataTable,Ub as DetectionCanvas,Sh as DetectionOverlay,Vb as DetectionResultTree,Nm as DevShell,ZN as DeviceActivityPanel,Bb as DeviceCard,Jb as DeviceContextProvider,zb as DeviceGrid,xn as DeviceItem,jb as DeviceList,op as Dialog,Xa as DialogContent,cp as DialogDescription,ip as DialogFooter,ap as DialogHeader,lp as DialogTitle,rb as DialogTrigger,KN as DiscoveryPanel,eS as DoorbellRecentPanel,nb as Dropdown,sb as DropdownContent,ab as DropdownItem,ob as DropdownTrigger,_b as EmptyState,Zi as EventStream,Ob as FilterBar,WN as FloatingEventStream,qN as FloatingLogStream,hb as FloatingPanel,Pb as FormField,Dg as GRID_GAP,$g as GRID_PAIRED,Og as GRID_QUICK_STATS,Kg as INPUT_COMPACT,Va as IconButton,Wb as ImageSelector,Kb as InferenceConfigSelector,gn as Input,tS as KebabMenu,Db as KeyValueList,Lg as LIST_ROW,Wa as Label,Ki as LogStream,vm as LoginForm,fp as MobileDrawer,Km as NodeMultiSelectField,Cb as NodePicker,Wm as NodeSelectField,uo as PHASE_CONFIG,XN as PTZOverlay,Rb as PageHeader,VN as PhaseIcon,Qb as PipelineBuilder,Gb as PipelineRuntimeSelector,Gr as PipelineStep,kb as PipelineTreeMatrix,$N as PlayerOverlaysProvider,dp as Popover,pp as PopoverContent,up as PopoverTrigger,Eb as ProviderBadge,UN as ResponseLog,Ig as SECTION_BODY,Rg as SECTION_CARD,_g as SECTION_HEADER,Bg as SPLIT_PANEL_OUTER,zg as SPLIT_PANEL_SIDE,Tg as STACK_GAP,di as ScrollArea,bn as Select,_p as SemanticBadge,Ka as Separator,Oo as Sidebar,Lo as SidebarItem,tp as Skeleton,vb as SlideOverPanel,JN as SnapshotButton,Tb as StatCard,ig as StateValuesStream,Mb as StatusBadge,qb as StepTimings,yb as StepTreeMaster,jN as StreamPanel,np as Switch,Ep as SystemProvider,jg as TEXT_FIELD_LABEL,Gg as TEXT_HINT,Hg as TEXT_METRIC,Fg as TEXT_SECTION_LABEL,Qg as TEXT_VALUE,ub as Tabs,mb as TabsContent,pb as TabsList,fb as TabsTrigger,no as ThemeProvider,ib as Tooltip,cb as TooltipContent,lb as TooltipTrigger,Ab as VersionBadge,DN as WidgetRegistryProvider,Om as WidgetSlot,rS as ZoneEditingProvider,xb as buildStepTreeFromSchema,N as cn,ot as createSharedContext,Ag as createTheme,pl as darkColors,eo as defaultTheme,Fb as deriveDeviceKind,Zd as ensureMfHostInit,Be as getClassColor,js as getPhaseVisual,vh as isFieldVisible,fl as lightColors,Jg as mirror,Yb as mountAddonPage,eb as providerIcons,tb as statusIcons,Pg as themeToCss,p as trpc,tv as useAccessoriesGetStatus,rv as useAddonPagesListPages,Rv as useAddonSettingsGetDeviceSettings,Av as useAddonSettingsGetGlobalSettings,_v as useAddonSettingsUpdateDeviceSettings,Pv as useAddonSettingsUpdateGlobalSettings,Mm as useAddonWidgetsListWidgets,Cv as useAddonsApplyAutoUpdateToAll,Mv as useAddonsCustom,gv as useAddonsForceRefresh,Nv as useAddonsGetAddonAutoUpdate,wv as useAddonsGetAutoUpdateSettings,ov as useAddonsGetLogs,vv as useAddonsGetVersions,iv as useAddonsInstallFromWorkspace,av as useAddonsInstallPackage,lv as useAddonsIsWorkspaceAvailable,nv as useAddonsList,sv as useAddonsListPackages,fv as useAddonsListUpdates,cv as useAddonsListWorkspacePackages,Ev as useAddonsOnAddonLogs,uv as useAddonsReloadPackages,yv as useAddonsRestartAddon,bv as useAddonsRestartServer,xv as useAddonsRetryLoad,hv as useAddonsRollbackPackage,pv as useAddonsSearchAvailable,Sv as useAddonsSetAddonAutoUpdate,kv as useAddonsSetAutoUpdateSettings,dv as useAddonsUninstallPackage,mv as useAddonsUpdatePackage,Bv as useAlertsDismiss,Iv as useAlertsEmit,Lv as useAlertsGetUnreadCount,Dv as useAlertsList,$v as useAlertsMarkAllRead,Ov as useAlertsMarkRead,Tv as useAlertsUpdate,LN as useAllWidgets,Gv as useAudioAnalysisApplyDeviceSettingsPatch,jv as useAudioAnalysisGetDeviceLiveContribution,Fv as useAudioAnalysisGetDeviceSettingsContribution,zv as useAudioAnalysisResolveDeviceSettings,Qv as useAudioAnalyzerAnalyseChunk,Hv as useAudioAnalyzerClassify,Vv as useAudioAnalyzerDispose,Uv as useAudioAnalyzerIsReady,qv as useAudioAnalyzerReprobeAudioEngine,Kv as useAudioCodecCanHandle,Xv as useAudioCodecCloseSession,Zv as useAudioCodecCreateDecodeSession,Yv as useAudioCodecCreateEncodeSession,ny as useAudioCodecFlushEncode,oy as useAudioCodecListActiveSessions,Wv as useAudioCodecListSupportedCodecs,ry as useAudioCodecPullEncoded,ey as useAudioCodecPullPcm,Jv as useAudioCodecPushEncodedFrame,ty as useAudioCodecPushPcm,sy as useAudioMetricsGetCurrentSnapshot,ay as useAudioMetricsGetHistory,iy as useAuthenticationListProviders,ly as useAuthenticationSetProviderEnabled,hy as useBackupDelete,fy as useBackupGetEntries,uy as useBackupList,gy as useBackupListArchives,cy as useBackupListDestinations,py as useBackupListLocations,vy as useBackupPreviewSchedule,my as useBackupRestore,dy as useBackupTrigger,by as useBackupUpsertDestinationPolicy,yy as useBatteryGetStatus,wy as useBrightnessGetStatus,xy as useBrightnessSetBrightness,Ny as useCameraStreamsGetBrokerStreams,ky as useCameraStreamsGetCameraStreams,Sy as useCameraStreamsGetRtspEntries,qn as useClusterNodes,Wn as useConfirm,Sm as useCustomFieldRenderer,hf as useDebouncedString,Ey as useDecoderCreateSession,Ay as useDecoderDestroySession,My as useDecoderGetInfo,Ty as useDecoderGetStats,Dy as useDecoderListActiveSessions,Ry as useDecoderOpenStream,_y as useDecoderPullFrames,Py as useDecoderPushPacket,Ly as useDecoderReprobeHwaccel,Cy as useDecoderSupportsCodec,Iy as useDecoderUpdateConfig,By as useDetectionPipelineApplyDeviceSettingsPatch,$y as useDetectionPipelineGetDeviceLiveContribution,Oy as useDetectionPipelineGetDeviceSettingsContribution,Zb as useDevShell,cS as useDevice,af as useDeviceBattery,Wt as useDeviceCapability,oS as useDeviceDetections,jy as useDeviceDiscoveryAdoptDevice,Qy as useDeviceDiscoveryGetStatus,zy as useDeviceDiscoveryListDiscovered,Fy as useDeviceDiscoveryRefreshDiscovery,Gy as useDeviceDiscoveryReleaseDevice,Cm as useDeviceId,tx as useDeviceManagerAddLocation,Px as useDeviceManagerAdoptDevice,Hy as useDeviceManagerAllocateDeviceId,_x as useDeviceManagerCreateDevice,fx as useDeviceManagerDisable,Ax as useDeviceManagerDiscoverDevices,px as useDeviceManagerEnable,yx as useDeviceManagerGetAllBindings,vx as useDeviceManagerGetBindings,ix as useDeviceManagerGetChildren,cx as useDeviceManagerGetConfigSchema,Rx as useDeviceManagerGetCreationSchema,ax as useDeviceManagerGetDevice,Cx as useDeviceManagerGetDeviceAggregate,Sx as useDeviceManagerGetDeviceLiveInfoAggregate,Nx as useDeviceManagerGetDeviceSettingsAggregate,Dx as useDeviceManagerGetDeviceStatusAggregate,dx as useDeviceManagerGetSettingsSchema,hx as useDeviceManagerGetStreamProfileMap,lx as useDeviceManagerGetStreamSources,sx as useDeviceManagerListAll,kx as useDeviceManagerListBindableCapsForDeviceType,ex as useDeviceManagerListLocations,ox as useDeviceManagerListPersistedByAddon,wx as useDeviceManagerListWrappersForCap,Wy as useDeviceManagerLoadConfig,Zy as useDeviceManagerLoadMeta,Ky as useDeviceManagerLoadRuntimeState,qy as useDeviceManagerPersistConfig,bx as useDeviceManagerProbeStreams,Uy as useDeviceManagerRegisterDevice,mx as useDeviceManagerRemove,Vy as useDeviceManagerRemoveDevice,rx as useDeviceManagerRemoveLocation,nx as useDeviceManagerSetDisabled,Xy as useDeviceManagerSetLocation,Jy as useDeviceManagerSetMetadata,Yy as useDeviceManagerSetName,gx as useDeviceManagerSetStreamProfileMap,xx as useDeviceManagerSetWrapperActive,Ix as useDeviceManagerTestCreationField,Tx as useDeviceManagerTestField,ux as useDeviceManagerUpdateConfig,Mx as useDeviceManagerUpdateDeviceField,Ex as useDeviceManagerUpdateDeviceFieldsBatch,Ox as useDeviceOpsGetConfigEntries,zx as useDeviceOpsGetSettingsSchema,Lx as useDeviceOpsGetStreamSources,Bx as useDeviceOpsRemoveDevice,$x as useDeviceOpsSetConfig,Vx as useDeviceProviderAdoptDiscoveredDevice,Kx as useDeviceProviderCreateDevice,Ux as useDeviceProviderDiscoverDevices,Wx as useDeviceProviderGetChildCreationSchema,Qx as useDeviceProviderGetDevices,Gx as useDeviceProviderGetStatus,Fx as useDeviceProviderStart,jx as useDeviceProviderStop,Hx as useDeviceProviderSupportsDiscovery,qx as useDeviceProviderSupportsManualCreation,Zx as useDeviceProviderTestCreationField,Rr as useDeviceProxy,ev as useDeviceSnapshot,lf as useDeviceSnapshotImage,Dp as useDeviceState,Jx as useDeviceStateGetAllSnapshots,Xx as useDeviceStateGetCapSlice,Yx as useDeviceStateGetSnapshot,e0 as useDeviceStateSetCapSlice,gi as useDeviceStateSlice,sS as useDeviceWebrtc,lS as useDevices,iS as useDoorbellEvents,t0 as useDoorbellGetStatus,pS as useEventInvalidation,mi as useEventStreamLatest,Sb as useEventStreamMap,o0 as useEventsGetEventClipUrl,n0 as useEventsGetEventThumbnail,r0 as useEventsGetEvents,l0 as useIntegrationsCreate,d0 as useIntegrationsDelete,a0 as useIntegrationsGet,f0 as useIntegrationsGetAvailableTypes,i0 as useIntegrationsGetByAddonId,u0 as useIntegrationsGetSettings,s0 as useIntegrationsList,p0 as useIntegrationsSetSettings,m0 as useIntegrationsTestConnection,c0 as useIntegrationsUpdate,v0 as useIntercomGetStatus,g0 as useIntercomHandleAnswer,h0 as useIntercomStartSession,b0 as useIntercomStopSession,db as useIsMidWidth,Ar as useIsMobile,St as useLiveBuffer,Pr as useLiveEvent,k0 as useLocalNetworkGetAllowedAddresses,w0 as useLocalNetworkGetConnectionEndpoints,x0 as useLocalNetworkGetPreferred,y0 as useLocalNetworkList,S0 as useLocalNetworkResetAllowlistToBestMatch,N0 as useLocalNetworkSetAllowedAddresses,M0 as useMeshOrchestratorJoinProvider,E0 as useMeshOrchestratorLeaveProvider,C0 as useMeshOrchestratorListProviders,A0 as useMetricsProviderCollectSnapshot,O0 as useMetricsProviderGetAddonStats,P0 as useMetricsProviderGetCached,T0 as useMetricsProviderGetCpuTemperature,R0 as useMetricsProviderGetCurrent,_0 as useMetricsProviderGetDiskSpace,I0 as useMetricsProviderGetGpuInfo,D0 as useMetricsProviderGetProcessStats,B0 as useMetricsProviderKillProcess,L0 as useMetricsProviderListAddonInstances,$0 as useMetricsProviderListNodeProcesses,j0 as useMotionDetectionAnalyze,V0 as useMotionDetectionApplyDeviceSettingsPatch,U0 as useMotionDetectionGetDeviceLiveContribution,H0 as useMotionDetectionGetDeviceSettingsContribution,G0 as useMotionDetectionRemoveCamera,Q0 as useMotionDetectionReset,F0 as useMotionGetStatus,z0 as useMotionIsDetected,W0 as useMotionTriggerGetStatus,q0 as useMotionTriggerSetMotionTrigger,K0 as useNativeObjectDetectionGetStatus,Y0 as useNetworkQualityGetAllStats,Z0 as useNetworkQualityGetDeviceStats,X0 as useNetworkQualityReportClientStats,i1 as useNodesClusterAddonStatus,e1 as useNodesDeployAddon,c1 as useNodesExecuteQuery,a1 as useNodesRenameNode,r1 as useNodesRestartAddon,o1 as useNodesRestartNode,n1 as useNodesRestartProcess,l1 as useNodesSetProcessLogLevel,s1 as useNodesShutdownNode,J0 as useNodesTopology,t1 as useNodesUndeployAddon,d1 as useNotificationOutputSend,u1 as useNotificationOutputSendTest,Nb as useOptionalSystem,Dm as useOptionalWidgetRegistry,f1 as useOsdGetStatus,p1 as useOsdSetOverlay,aS as usePTZ,C1 as usePipelineAnalyticsApplyDeviceSettingsPatch,b1 as usePipelineAnalyticsClearTracks,m1 as usePipelineAnalyticsGetActiveTracks,x1 as usePipelineAnalyticsGetAudioEvents,S1 as usePipelineAnalyticsGetDeviceLiveContribution,N1 as usePipelineAnalyticsGetDeviceSettingsContribution,w1 as usePipelineAnalyticsGetEventMedia,v1 as usePipelineAnalyticsGetMotionEvents,y1 as usePipelineAnalyticsGetObjectEvents,h1 as usePipelineAnalyticsGetTrack,k1 as usePipelineAnalyticsGetTrackMedia,g1 as usePipelineAnalyticsListTracks,q1 as usePipelineExecutorCacheFrameInPool,Q1 as usePipelineExecutorDeleteModel,z1 as usePipelineExecutorDeleteTemplate,H1 as usePipelineExecutorDetect,G1 as usePipelineExecutorDownloadModel,j1 as usePipelineExecutorGetAddonModels,ow as usePipelineExecutorGetAudioCapabilities,M1 as usePipelineExecutorGetAvailableEngines,F1 as usePipelineExecutorGetCapabilities,A1 as usePipelineExecutorGetDefaultSteps,aw as usePipelineExecutorGetDetectionConfigSchema,Z1 as usePipelineExecutorGetEffectiveTuning,D1 as usePipelineExecutorGetGlobalPipelineConfig,T1 as usePipelineExecutorGetGlobalSteps,L1 as usePipelineExecutorGetOrchestratorConfigSchema,nw as usePipelineExecutorGetReferenceAudio,rw as usePipelineExecutorGetReferenceAudioFiles,tw as usePipelineExecutorGetReferenceImage,I1 as usePipelineExecutorGetSchema,E1 as usePipelineExecutorGetSelectedEngine,R1 as usePipelineExecutorGetVideoPipelineSteps,W1 as usePipelineExecutorInferCached,J1 as usePipelineExecutorKillEngine,Y1 as usePipelineExecutorListLoadedEngines,ew as usePipelineExecutorListReferenceImages,O1 as usePipelineExecutorListTemplates,P1 as usePipelineExecutorReprobeEngine,sw as usePipelineExecutorRunAudioTest,U1 as usePipelineExecutorRunPipeline,V1 as usePipelineExecutorRunPipelineBatch,$1 as usePipelineExecutorSaveTemplate,_1 as usePipelineExecutorSetVideoPipelineSteps,X1 as usePipelineExecutorSpinEngine,K1 as usePipelineExecutorUncacheFrame,B1 as usePipelineExecutorUpdateTemplate,Gw as usePipelineOrchestratorApplyDeviceSettingsPatch,xw as usePipelineOrchestratorAssignAudio,bw as usePipelineOrchestratorAssignDecoder,iw as usePipelineOrchestratorAssignPipeline,zw as usePipelineOrchestratorDeleteTemplate,pw as usePipelineOrchestratorGetAgentLoad,Mw as usePipelineOrchestratorGetAgentSettings,kw as usePipelineOrchestratorGetAudioAssignment,Sw as usePipelineOrchestratorGetAudioAssignments,Nw as usePipelineOrchestratorGetAudioNodeLoad,mw as usePipelineOrchestratorGetCameraMetrics,Rw as usePipelineOrchestratorGetCameraSettings,Iw as usePipelineOrchestratorGetCameraStepOverrides,hw as usePipelineOrchestratorGetCapabilityBindings,Cw as usePipelineOrchestratorGetDecoderAssignment,yw as usePipelineOrchestratorGetDecoderAssignments,jw as usePipelineOrchestratorGetDeviceLiveContribution,Fw as usePipelineOrchestratorGetDeviceSettingsContribution,fw as usePipelineOrchestratorGetGlobalMetrics,uw as usePipelineOrchestratorGetPipelineAssignment,dw as usePipelineOrchestratorGetPipelineAssignments,Ew as usePipelineOrchestratorListAgentSettings,Ow as usePipelineOrchestratorListTemplates,cw as usePipelineOrchestratorRebalance,Pw as usePipelineOrchestratorRemoveAgentSettings,Lw as usePipelineOrchestratorResolvePipeline,$w as usePipelineOrchestratorSaveTemplate,Aw as usePipelineOrchestratorSetAgentAddonDefaults,Dw as usePipelineOrchestratorSetCameraPipelineForAgent,Tw as usePipelineOrchestratorSetCameraStepOverride,_w as usePipelineOrchestratorSetCameraStepToggle,gw as usePipelineOrchestratorSetCapabilityBinding,ww as usePipelineOrchestratorUnassignAudio,vw as usePipelineOrchestratorUnassignDecoder,lw as usePipelineOrchestratorUnassignPipeline,Bw as usePipelineOrchestratorUpdateTemplate,Qw as usePipelineRunnerAttachCamera,Hw as usePipelineRunnerDetachCamera,Kw as usePipelineRunnerGetAllCameraMetrics,Ww as usePipelineRunnerGetCameraMetrics,Zw as usePipelineRunnerGetLocalCameras,Vw as usePipelineRunnerGetLocalLoad,qw as usePipelineRunnerGetLocalMetrics,Uw as usePipelineRunnerReportMotion,Yw as usePlatformProbeGetCapabilities,Xw as usePlatformProbeGetHardware,ek as usePlatformProbeResolveHwAccel,Jw as usePlatformProbeResolveInferenceConfig,zN as usePlayerOverlayLayer,BN as usePlayerOverlayLayers,FN as usePlayerToolbarButton,Th as usePlayerToolbarButtons,uk as usePtzAutotrackGetSettings,ck as usePtzAutotrackGetStatus,dk as usePtzAutotrackSetEnabled,pk as usePtzAutotrackSetSettings,rk as usePtzContinuousMove,ik as usePtzGetPosition,ok as usePtzGetPresets,lk as usePtzGetStatus,ak as usePtzGoHome,sk as usePtzGoToPreset,tk as usePtzMove,nk as usePtzStop,fk as useRebootReboot,yk as useRecordingEngineDisable,vk as useRecordingEngineEnable,Ek as useRecordingEngineEstimateGlobalStorage,Mk as useRecordingEngineEstimateStorage,Ck as useRecordingEngineGetAvailability,xk as useRecordingEngineGetConfig,Dk as useRecordingEngineGetMotionStats,kk as useRecordingEngineGetPlaylist,Rk as useRecordingEngineGetPolicy,_k as useRecordingEngineGetPolicyStatus,Ik as useRecordingEngineGetRetentionConfig,Sk as useRecordingEngineGetSegments,bk as useRecordingEngineGetStatus,Ak as useRecordingEngineGetStorageUsage,Nk as useRecordingEngineGetThumbnail,Pk as useRecordingEngineSetPolicy,wk as useRecordingEngineUpdateConfig,Tk as useRecordingEngineUpdateRetentionConfig,hk as useRecordingGetPlaybackUrl,mk as useRecordingGetSegments,gk as useRecordingGetThumbnailAt,Lk as useRemoteAccessListProviders,Ok as useRemoteAccessStartProvider,$k as useRemoteAccessStopProvider,Hk as useSettingsStoreCount,Vk as useSettingsStoreDeclareCollection,Qk as useSettingsStoreDelete,Bk as useSettingsStoreGet,jk as useSettingsStoreInsert,Uk as useSettingsStoreIsEmpty,Fk as useSettingsStoreQuery,zk as useSettingsStoreSet,Gk as useSettingsStoreUpdate,Xk as useSnapshotApplyDeviceSettingsPatch,Yk as useSnapshotGetDeviceLiveContribution,Zk as useSnapshotGetDeviceSettingsContribution,qk as useSnapshotGetSnapshot,Kk as useSnapshotGetStatus,Wk as useSnapshotInvalidateCache,e2 as useSnapshotProviderGetSnapshot,Jk as useSnapshotProviderSupportsDevice,u2 as useStorageAbortUpload,p2 as useStorageBeginDownload,l2 as useStorageBeginUpload,a2 as useStorageDelete,v2 as useStorageDeleteLocation,m2 as useStorageEndDownload,o2 as useStorageExists,d2 as useStorageFinalizeUpload,i2 as useStorageGetAvailableSpace,g2 as useStorageGetDefaultLocation,s2 as useStorageList,h2 as useStorageListLocations,x2 as useStorageListProviders,n2 as useStorageRead,f2 as useStorageReadChunk,t2 as useStorageResolve,w2 as useStorageTestConfig,y2 as useStorageTestLocation,b2 as useStorageUpsertLocation,r2 as useStorageWrite,c2 as useStorageWriteChunk,H2 as useStreamBrokerApplyDeviceSettingsPatch,S2 as useStreamBrokerAssignProfile,$2 as useStreamBrokerGetAllRtspEntries,T2 as useStreamBrokerGetBroker,A2 as useStreamBrokerGetBrokerStats,Q2 as useStreamBrokerGetDeviceLiveContribution,G2 as useStreamBrokerGetDeviceSettingsContribution,L2 as useStreamBrokerGetPreBufferInfo,B2 as useStreamBrokerGetRtspEntry,O2 as useStreamBrokerGetRtspPort,I2 as useStreamBrokerGetStreamUrl,j2 as useStreamBrokerIsRtspEnabled,R2 as useStreamBrokerKillClient,M2 as useStreamBrokerListAllCameraStreams,E2 as useStreamBrokerListAllProfileSlots,P2 as useStreamBrokerListClients,k2 as useStreamBrokerPublishCameraStream,z2 as useStreamBrokerRegenerateRtspToken,_2 as useStreamBrokerRestartProfile,N2 as useStreamBrokerRetractCameraStream,D2 as useStreamBrokerSetPreBufferDuration,F2 as useStreamBrokerSetRtspEnabled,C2 as useStreamBrokerUnassignProfile,V2 as useSwitchGetStatus,U2 as useSwitchSetState,Rt as useSystem,K2 as useSystemFeatureFlags,J2 as useSystemForceRetentionCleanup,Y2 as useSystemGetRetentionConfig,W2 as useSystemHealth,q2 as useSystemInfo,uS as useSystemMutation,Z2 as useSystemNetworkAddresses,dS as useSystemQuery,X2 as useSystemSetRetentionConfig,yl as useThemeMode,eN as useToastOnToast,rN as useTurnOrchestratorGetAllServers,tN as useTurnOrchestratorListProviders,nN as useTurnOrchestratorSetProviderEnabled,oN as useTurnProviderGetTurnServers,pN as useUserManagementCreateApiKey,hN as useUserManagementCreateScopedToken,aN as useUserManagementCreateUser,lN as useUserManagementDeleteUser,uN as useUserManagementListApiKeys,vN as useUserManagementListScopedTokens,sN as useUserManagementListUsers,cN as useUserManagementResetPassword,fN as useUserManagementRevokeApiKey,gN as useUserManagementRevokeScopedToken,iN as useUserManagementUpdateUser,mN as useUserManagementValidateApiKey,dN as useUserManagementValidateCredentials,bN as useUserManagementValidateScopedToken,kN as useWebrtcSessionCloseSession,xN as useWebrtcSessionCreateSession,wN as useWebrtcSessionHandleAnswer,NN as useWebrtcSessionHasAdaptiveBitrate,yN as useWebrtcSessionListStreams,Im as useWidget,Tm as useWidgetMetadata,Zn as useWidgetRegistry,MN as useZoneAnalyticsGetCameraHistory,SN as useZoneAnalyticsGetCurrentSnapshot,EN as useZoneAnalyticsGetUnzonedHistory,CN as useZoneAnalyticsGetZoneHistory,nS as useZoneEditing,AN as useZoneRulesListRules,PN as useZoneRulesSetRules,_N as useZonesAddZone,RN as useZonesListZones,IN as useZonesRemoveZone,TN as useZonesUpdateZone};