@camstack/addon-admin-ui 0.1.33 → 0.1.35

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 (34) hide show
  1. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DJQnlBBe.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DYU-qDnu.js} +1 -1
  2. package/dist/assets/{devices-BnLu5dxg.js → devices-D4k34mru.js} +1 -1
  3. package/dist/assets/{hostInit-DQ5UjxJa.js → hostInit-CBKchP1G.js} +1 -1
  4. package/dist/assets/index-BEewR-UX.js +1 -0
  5. package/dist/assets/{index-BmzE49kT.js → index-BGZqVJZt.js} +1 -1
  6. package/dist/assets/{index-DIIqKU3D.js → index-BI3Z7SSi.js} +1 -1
  7. package/dist/assets/index-BhNfKRLZ.js +1156 -0
  8. package/dist/assets/index-BqMPfvQx.js +1 -0
  9. package/dist/assets/{index-dePEzy7t.js → index-Bwcmc2hW.js} +1 -1
  10. package/dist/assets/index-CP1R6E2R.js +88 -0
  11. package/dist/assets/index-CwjnPcOV.js +152 -0
  12. package/dist/assets/{index-CMxz0koW.js → index-D92THlot.js} +1 -1
  13. package/dist/assets/index-Dmon2mdO.js +1 -0
  14. package/dist/assets/index-KlKJOjpC.js +1 -0
  15. package/dist/assets/index-bBEaoekV.css +1 -0
  16. package/dist/assets/method-access-map-BFPyQ2-G.js +1 -0
  17. package/dist/assets/{remoteEntry-D28y34bi.js → remoteEntry-BRybuw2S.js} +1 -1
  18. package/dist/assets/{schemas-DZqswtjx.js → schemas-BEt-CulV.js} +1 -1
  19. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BXwMMqlX.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DUkp33c_.js} +2 -2
  20. package/dist/index.html +7 -7
  21. package/dist/mf-entry-bootstrap-0.js +2 -2
  22. package/dist/server/addon.js +196 -235
  23. package/dist/server/addon.js.map +1 -1
  24. package/dist/sw.js +1 -1
  25. package/package.json +1 -1
  26. package/dist/assets/index-DFRMwfPq.js +0 -1
  27. package/dist/assets/index-DRW7rVhn.js +0 -1133
  28. package/dist/assets/index-DYSrVZ4G.js +0 -1
  29. package/dist/assets/index-DeVjiPqm.js +0 -1
  30. package/dist/assets/index-DuHBxCOe.js +0 -1
  31. package/dist/assets/index-Dv0-1gwL.js +0 -80
  32. package/dist/assets/index-NNW--T4H.js +0 -80
  33. package/dist/assets/index-n9RexO7D.css +0 -1
  34. package/dist/assets/method-access-map-OoQznstl.js +0 -1
@@ -1,80 +0,0 @@
1
- import{e as S,h as I,c as Q,f as J,d as Ae,b as Ye,i as q,j as Te,R as el,l as dt,m as tl,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 f,e as Ne,a as ps}from"./__mfe_internal__admin_ui_host__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-C_6K4VBY.js";import{b as Cr,a as ms}from"./__mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.mjs-CzO_Esxm.js";import{b as rl,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 hs,h as nl,o as ol,p as sl,_ as gs}from"./__mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-CeLhKMin.js";import{c as bs,s as vs,B as al,F as il,n as ll,_ as ys}from"./__mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.mjs-DIkg6-MH.js";import{a as cl,_ as xs}from"./__mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-OcRSBqRe.js";import{K as ul,E as V,A as dl}from"./method-access-map-OoQznstl.js";import{c as pl}from"./index-DeVjiPqm.js";import{c as ml}from"./devices-BnLu5dxg.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-DZqswtjx.js";var ws={frigate:"#3b82f6",scrypted:"#a855f7",reolink:"#06b6d4",homeAssistant:"#22d3ee",rtsp:"#78716c"},fl={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:ws},hl={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:ws},eo={colors:{dark:fl,light:hl},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 ks(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]=ks(a,s):s!==void 0&&(r[n]=s)}return r}function jg(e){return e?ks(structuredClone(eo),e):structuredClone(eo)}function Ns(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function gl(e){return`--color-${Ns(e)}`}function to(e){const t=[];for(const[r,n]of Object.entries(e))r!=="provider"&&t.push(` ${gl(r)}: ${n};`);return t.join(`
2
- `)}function bl(e){const t=[];for(const[r,n]of Object.entries(e))t.push(` --color-provider-${Ns(r)}: ${n};`);return t.join(`
3
- `)}function vl(e){const t=[];for(const[r,n]of Object.entries(e))t.push(` --spacing-${r}: ${n}px;`);return t.join(`
4
- `)}function yl(e){const t=[];for(const[r,n]of Object.entries(e))t.push(` --radius-${r}: ${n}px;`);return t.join(`
5
- `)}function Qg(e){const t=to(e.colors.dark),r=to(e.colors.light);return`@theme {
6
- ${bl(e.colors.dark.provider)}
7
- ${vl(e.spacing)}
8
- ${yl(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 Ss=Ye(null),Lr=["dark","light","system"];function Cs(){return typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function xl(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"?Cs():e}function no({children:e,defaultMode:t="system",storageKey:r="camstack-theme-mode"}){const[n,s]=S(()=>xl(r,t)),[a,i]=S(()=>ro(n)),l=I(d=>{s(d),i(ro(d)),typeof window<"u"&&localStorage.setItem(r,d)},[r]),c=I(()=>{l(Lr[(Lr.indexOf(n)+1)%Lr.length]??"dark")},[n,l]);Q(()=>{if(typeof document>"u")return;const d=document.documentElement;d.classList.remove("dark","light"),d.classList.add(a)},[n,a]),Q(()=>{if(typeof window>"u"||n!=="system")return;const d=window.matchMedia("(prefers-color-scheme: dark)"),m=()=>{i(Cs())};return d.addEventListener("change",m),()=>d.removeEventListener("change",m)},[n]);const u=J(()=>({mode:n,resolvedMode:a,setMode:l,toggleMode:c}),[n,a,l,c]);return o(Ss.Provider,{value:u,children:e})}function wl(){const e=Ae(Ss);if(!e)throw new Error("useThemeMode must be used within a ThemeProvider");return e}var Or={};function Ms(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=Ms(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Es(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=Ms(e))&&(n&&(n+=" "),n+=t);return n}var kl=(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},Nl=(e,t)=>({classGroupId:e,validator:t}),As=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),yr="-",oo=[],Sl="arbitrary..",Cl=e=>{const t=El(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Ml(i);const l=i.split(yr);return Ps(l,l[0]===""&&l.length>1?1:0,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=n[i],u=r[i];return c?u?kl(u,c):c:u||oo}return r[i]||oo}}},Ps=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],s=r.nextPart.get(n);if(s){const c=Ps(e,t+1,s);if(c)return c}const a=r.validators;if(a===null)return;const i=t===0?e.join(yr):e.slice(t).join(yr),l=a.length;for(let c=0;c<l;c++){const u=a[c];if(u.validator(i))return u.classGroupId}},Ml=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?Sl+n:void 0})(),El=e=>{const{theme:t,classGroups:r}=e;return Al(r,t)},Al=(e,t)=>{const r=As();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];Pl(i,t,r,n)}},Pl=(e,t,r,n)=>{if(typeof e=="string"){Rl(e,t,r);return}if(typeof e=="function"){_l(e,t,r,n);return}Il(e,t,r,n)},Rl=(e,t,r)=>{const n=e===""?t:Rs(t,e);n.classGroupId=r},_l=(e,t,r,n)=>{if(Tl(e)){_n(e(n),t,r,n);return}t.validators===null&&(t.validators=[]),t.validators.push(Nl(r,e))},Il=(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,Rs(t,l),r,n)}},Rs=(e,t)=>{let r=e;const n=t.split(yr),s=n.length;for(let a=0;a<s;a++){const i=n[a];let l=r.nextPart.get(i);l||(l=As(),r.nextPart.set(i,l)),r=l}return r},Tl=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Dl=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)}}},sn="!",so=":",Ll=[],ao=(e,t,r,n,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:s}),Ol=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=s=>{const a=[];let i=0,l=0,c=0,u;const d=s.length;for(let v=0;v<d;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==="/"){u=v;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const m=a.length===0?s:s.slice(c);let h=m,g=!1;m.endsWith(sn)?(h=m.slice(0,-1),g=!0):m.startsWith(sn)&&(h=m.slice(1),g=!0);const b=u&&u>c?u-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(Ll,!1,i,void 0,!0)}if(r){const s=n;n=a=>r({className:a,parseClassName:s})}return n},$l=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}},Bl=e=>({cache:Dl(e.cacheSize),parseClassName:Ol(e),sortModifiers:$l(e),...Cl(e)}),zl=/\s+/,Fl=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],l=e.trim().split(zl);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:m,modifiers:h,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:v}=r(d);if(m){c=d+(c.length>0?" "+c:c);continue}let x=!!v,y=n(x?b.substring(0,v):b);if(!y){if(!x){c=d+(c.length>0?" "+c:c);continue}if(y=n(b),!y){c=d+(c.length>0?" "+c:c);continue}x=!1}const w=h.length===0?"":h.length===1?h[0]:a(h).join(":"),k=g?w+sn:w,M=k+y;if(i.indexOf(M)>-1)continue;i.push(M);const C=s(y,x);for(let E=0;E<C.length;++E){const _=C[E];i.push(k+_)}c=d+(c.length>0?" "+c:c)}return c},Gl=(...e)=>{let t=0,r,n,s="";for(;t<e.length;)(r=e[t++])&&(n=_s(r))&&(s&&(s+=" "),s+=n);return s},_s=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=_s(e[n]))&&(r&&(r+=" "),r+=t);return r},jl=(e,...t)=>{let r,n,s,a;const i=c=>(r=Bl(t.reduce((u,d)=>d(u),e())),n=r.cache.get,s=r.cache.set,a=l,l(c)),l=c=>{const u=n(c);if(u)return u;const d=Fl(c,r);return s(c,d),d};return a=i,(...c)=>a(Gl(...c))},Ql=[],Ee=e=>{const t=r=>r[e]||Ql;return t.isThemeGetter=!0,t},Is=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ts=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Hl=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ul=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Vl=/\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$/,ql=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Wl=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Kl=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xe=e=>Hl.test(e),ce=e=>!!e&&!Number.isNaN(Number(e)),Je=e=>!!e&&Number.isInteger(Number(e)),$r=e=>e.endsWith("%")&&ce(e.slice(0,-1)),Ze=e=>Ul.test(e),Ds=()=>!0,Zl=e=>Vl.test(e)&&!ql.test(e),In=()=>!1,Yl=e=>Wl.test(e),Xl=e=>Kl.test(e),Jl=e=>!F(e)&&!G(e),ec=e=>nt(e,$s,In),F=e=>Is.test(e),lt=e=>nt(e,Bs,Zl),io=e=>nt(e,lc,ce),tc=e=>nt(e,Fs,Ds),rc=e=>nt(e,zs,In),lo=e=>nt(e,Ls,In),nc=e=>nt(e,Os,Xl),Xt=e=>nt(e,Gs,Yl),G=e=>Ts.test(e),_t=e=>pt(e,Bs),oc=e=>pt(e,zs),co=e=>pt(e,Ls),sc=e=>pt(e,$s),ac=e=>pt(e,Os),Jt=e=>pt(e,Gs,!0),ic=e=>pt(e,Fs,!0),nt=(e,t,r)=>{const n=Is.exec(e);return n?n[1]?t(n[1]):r(n[2]):!1},pt=(e,t,r=!1)=>{const n=Ts.exec(e);return n?n[1]?t(n[1]):r:!1},Ls=e=>e==="position"||e==="percentage",Os=e=>e==="image"||e==="url",$s=e=>e==="length"||e==="size"||e==="bg-size",Bs=e=>e==="length",lc=e=>e==="number",zs=e=>e==="family-name",Fs=e=>e==="number"||e==="weight",Gs=e=>e==="shadow",cc=()=>{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"),u=Ee("radius"),d=Ee("shadow"),m=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(),G,F],E=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],A=()=>[G,F,c],H=()=>[Xe,"full","auto",...A()],oe=()=>[Je,"none","subgrid",G,F],le=()=>["auto",{span:["full",Je,G,F]},Je,G,F],ge=()=>[Je,"auto",G,F],ue=()=>["auto","min","max","fr",G,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",...A()],W=()=>[Xe,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],ye=()=>[Xe,"screen","full","dvw","lvw","svw","min","max","fit",...A()],fe=()=>[Xe,"screen","full","lh","dvh","lvh","svh","min","max","fit",...A()],T=()=>[e,G,F],z=()=>[...M(),co,lo,{position:[G,F]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],se=()=>["auto","cover","contain",sc,ec,{size:[G,F]}],U=()=>[$r,_t,lt],K=()=>["","none","full",u,G,F],Z=()=>["",ce,_t,lt],j=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>[ce,$r,co,lo],Re=()=>["","none",b,G,F],_e=()=>["none",ce,G,F],X=()=>["none",ce,G,F],me=()=>[ce,G,F],xe=()=>[Xe,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ze],breakpoint:[Ze],color:[Ds],container:[Ze],"drop-shadow":[Ze],ease:["in","out","in-out"],font:[Jl],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ze],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ze],shadow:[Ze],spacing:["px",ce],text:[Ze],"text-shadow":[Ze],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Xe,F,G,x]}],container:["container"],columns:[{columns:[ce,F,G,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:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:H()}],"inset-x":[{"inset-x":H()}],"inset-y":[{"inset-y":H()}],start:[{"inset-s":H(),start:H()}],end:[{"inset-e":H(),end:H()}],"inset-bs":[{"inset-bs":H()}],"inset-be":[{"inset-be":H()}],top:[{top:H()}],right:[{right:H()}],bottom:[{bottom:H()}],left:[{left:H()}],visibility:["visible","invisible","collapse"],z:[{z:[Je,"auto",G,F]}],basis:[{basis:[Xe,"full","auto",l,...A()]}],"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,G,F]}],shrink:[{shrink:["",ce,G,F]}],order:[{order:[Je,"first","last","none",G,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":ue()}],"auto-rows":[{"auto-rows":ue()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"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:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pbs:[{pbs:A()}],pbe:[{pbe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],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":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"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",...fe()]}],"min-block-size":[{"min-block":["auto",...fe()]}],"max-block-size":[{"max-block":["none",...fe()]}],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,ic,tc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",$r,F]}],"font-family":[{font:[oc,rc,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,G,F]}],"line-clamp":[{"line-clamp":[ce,"none",G,io]}],leading:[{leading:[a,...A()]}],"list-image":[{"list-image":["none",G,F]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",G,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:[...j(),"wavy"]}],"text-decoration-thickness":[{decoration:[ce,"from-font","auto",G,lt]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[ce,"auto",G,F]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",G,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",G,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,G,F],radial:["",G,F],conic:[Je,G,F]},ac,nc]}],"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:[...j(),"hidden","none"]}],"divide-style":[{divide:[...j(),"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:[...j(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ce,G,F]}],"outline-w":[{outline:["",ce,_t,lt]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",d,Jt,Xt]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",m,Jt,Xt]}],"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,Jt,Xt]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[ce,G,F]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"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":[G,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",G,F]}],filter:[{filter:["","none",G,F]}],blur:[{blur:Re()}],brightness:[{brightness:[ce,G,F]}],contrast:[{contrast:[ce,G,F]}],"drop-shadow":[{"drop-shadow":["","none",g,Jt,Xt]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",ce,G,F]}],"hue-rotate":[{"hue-rotate":[ce,G,F]}],invert:[{invert:["",ce,G,F]}],saturate:[{saturate:[ce,G,F]}],sepia:[{sepia:["",ce,G,F]}],"backdrop-filter":[{"backdrop-filter":["","none",G,F]}],"backdrop-blur":[{"backdrop-blur":Re()}],"backdrop-brightness":[{"backdrop-brightness":[ce,G,F]}],"backdrop-contrast":[{"backdrop-contrast":[ce,G,F]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ce,G,F]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ce,G,F]}],"backdrop-invert":[{"backdrop-invert":["",ce,G,F]}],"backdrop-opacity":[{"backdrop-opacity":[ce,G,F]}],"backdrop-saturate":[{"backdrop-saturate":[ce,G,F]}],"backdrop-sepia":[{"backdrop-sepia":["",ce,G,F]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",G,F]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ce,"initial",G,F]}],ease:[{ease:["linear","initial",y,G,F]}],delay:[{delay:[ce,G,F]}],animate:[{animate:["none",w,G,F]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,G,F]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:_e()}],"rotate-x":[{"rotate-x":_e()}],"rotate-y":[{"rotate-y":_e()}],"rotate-z":[{"rotate-z":_e()}],scale:[{scale:X()}],"scale-x":[{"scale-x":X()}],"scale-y":[{"scale-y":X()}],"scale-z":[{"scale-z":X()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[G,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",G,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":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mbs":[{"scroll-mbs":A()}],"scroll-mbe":[{"scroll-mbe":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pbs":[{"scroll-pbs":A()}],"scroll-pbe":[{"scroll-pbe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",G,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"]}},uc=jl(cc);function N(...e){return uc(Es(e))}var Hg="rounded-lg border border-border bg-surface overflow-hidden",Ug="border-b border-border px-3 sm:px-4 py-1.5 sm:py-2",Vg="p-2 sm:p-3 lg:p-4",qg="space-y-3 sm:space-y-4",Wg="gap-2 sm:gap-3",Kg="px-3 sm:px-4 py-1.5 sm:py-2",Zg="grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-4",Yg="grid grid-cols-1 lg:grid-cols-2",Xg="flex flex-col-reverse md:flex-row",Jg="w-full md:w-44 lg:w-52 md:flex-shrink-0 border-b md:border-b-0 md:border-l border-border",eb="text-[10px] sm:text-[11px] font-semibold text-foreground uppercase tracking-wider",tb="text-[11px] sm:text-xs text-foreground",rb="text-[10px] text-foreground-subtle",nb="text-[11px] sm:text-xs font-medium text-foreground",ob="text-base sm:text-lg font-semibold leading-tight text-foreground",sb="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",ab="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",ib="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",lb="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",cb="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",ub="inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium transition-colors",db="border-primary/50 bg-primary/15 text-primary",pb="border-border bg-surface text-foreground-subtle hover:bg-surface-hover";function dc(e,t){for(const r of e.slots)for(const n of r.addons)if(n.id===t)return n;return null}function pc(e,t){return e.models.find(r=>r.id===t)??null}function mc(e,t){return e.models.find(r=>!!r.formats[t])??null}function fc(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 mb(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=dc(n,i);if(!c){a.push({addonId:i,outcome:"skip",modelId:null,reason:"addon not in target catalog",patch:null});continue}const u=pc(c,l.modelId),d=u!==null&&!!u.formats[r.engine.format];let m,h;if(d)m=l.modelId,h="exact";else{const b=mc(c,r.engine.format);if(!b){a.push({addonId:i,outcome:"skip",modelId:null,reason:"no compatible model for target format",patch:null});continue}m=b.id,h="mapped"}const g={enabled:l.enabled,modelId:m,settings:fc(l.settings,c)};a.push({addonId:i,outcome:h,modelId:m,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 Ye(t);const r=globalThis.__camstackSharedContexts,n=r??new Map;r||(globalThis.__camstackSharedContexts=n);const s=n.get(e);if(s)return s;const a=Ye(t);return n.set(e,a),a}var hc="FEDERATION_DEBUG",an=(function(e){return e[e.UNKNOWN=1]="UNKNOWN",e[e.CALCULATED=2]="CALCULATED",e[e.NO_USE=0]="NO_USE",e})({}),Qs=!0;function gc(){return Qs}function bc(){try{if(gc()&&window.localStorage)return!!localStorage.getItem(hc)}catch{return!1}return!1}function ln(){return typeof process<"u"&&Or&&Or.FEDERATION_DEBUG?!!Or.FEDERATION_DEBUG:typeof FEDERATION_DEBUG<"u"&&FEDERATION_DEBUG?!0:bc()}var vc="[ Federation Runtime ]",Hs=function(...e){return e.length?e.reduce((t,r)=>r?t?`${t}:${r}`:r:t,""):""},cn=(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),"")},Us=e=>{console.warn(`${vc}: ${e}`)};function Vs(e){try{return JSON.stringify(e,null,2)}catch{return""}}var Br=(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 yc(e){return e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")}function xc(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?yc(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:u,name:d,type:m},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:Br(u,d),remoteEntryType:m,remoteTypes:Br(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=Br(v.path,v.name);a.ssrRemoteEntry=w,a.ssrRemoteEntryType=v.type||"commonjs-module"}return a}function qs(e){return!!("remoteEntry"in e&&e.remoteEntry.includes(".json"))}var wc="[ Module Federation ]",It=console,kc=["logger.ts","logger.js","captureStackTrace","Logger.emit","Logger.log","Logger.info","Logger.warn","Logger.error","Logger.debug"];function Nc(){try{const e=new Error().stack;if(!e)return;const[,...t]=e.split(`
31
- `),r=t.filter(n=>!kc.some(s=>n.includes(s)));return r.length?`Stack trace:
32
- ${r.slice(0,5).join(`
33
- `)}`:void 0}catch{return}}var Ws=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=ln()?Nc():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){ln()&&this.emit("debug",e)}};function Sc(e){return new Ws(e)}function Cc(e){const t=new Ws(e);return Object.defineProperty(t,"__mf_infrastructure_logger__",{value:!0,enumerable:!1,configurable:!1}),t}Cc(wc);async function Ks(e,t){try{return await e()}catch(r){Us(r);return}}function un(e,t){const r=/^(https?:)?\/\//i;return e.replace(r,"").replace(/\/$/,"")===t.replace(r,"").replace(/\/$/,"")}function Zs(e){let t=null,r=!0,n=2e4,s;const a=document.getElementsByTagName("script");for(let u=0;u<a.length;u++){const d=a[u],m=d.getAttribute("src");if(m&&un(m,e.url)){t=d,r=!1;break}}if(!t){const u=e.attrs;t=document.createElement("script"),t.type=u?.type==="module"?"module":"text/javascript";let d;e.createScriptHook&&(d=e.createScriptHook(e.url,e.attrs),d instanceof HTMLScriptElement?t=d:typeof d=="object"&&("script"in d&&d.script&&(t=d.script),"timeout"in d&&d.timeout&&(n=d.timeout))),t.src||(t.src=e.url),u&&!d&&Object.keys(u).forEach(m=>{t&&(m==="async"||m==="defer"?t[m]=u[m]:t.getAttribute(m)||t.setAttribute(m,u[m]))})}let i=null;const l=typeof window<"u"?u=>{if(u.filename&&un(u.filename,e.url)){const d=new Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${u.message} (${u.filename}:${u.lineno}:${u.colno})`);d.name="ScriptExecutionError",i=d}}:null;l&&window.addEventListener("error",l);const c=async(u,d)=>{clearTimeout(s),l&&window.removeEventListener("error",l);const m=()=>{if(d?.type==="error"){const h=new Error(d?.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,Ks(()=>{const{needDeleteScript:h=!0}=e;h&&t?.parentNode&&t.parentNode.removeChild(t)}),u&&typeof u=="function")){const h=u(d);if(h instanceof Promise){const g=await h;return m(),g}return m(),h}m()};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 zr(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&&un(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,Ks(()=>{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 Mc(e,t){const{attrs:r={},createScriptHook:n}=t;return new Promise((s,a)=>{const{script:i,needAttach:l}=Zs({url:e,cb:s,onErrorCallback:a,attrs:{fetchpriority:"high",...r},createScriptHook:n,needDeleteScript:!0});l&&document.head.appendChild(i)})}var Ec=e=>`View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`,Ys=(e,t,r,n)=>{const s=[`${[t[e]]} #${e}`];return r&&s.push(`args: ${JSON.stringify(r)}`),s.push(Ec(e)),n&&s.push(`Original Error Message:
34
- ${n}`),s.join(`
35
- `)};function Ac(e,t,r,n,s,a){return n(Ys(e,t,r,s))}var ct="[ Federation Runtime ]",dn=Sc(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 Ac(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 Pc(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 Xs(e){return!e.entry.includes(".json")}function Ln(e){return e&&typeof e=="object"}var Rc=Object.prototype.toString;function _c(e){return Rc.call(e)==="[object Object]"}function Js(e){return Array.isArray(e)?e:[e]}function ea(e){const t={url:"",type:"global",globalName:""};return"remoteEntry"in e?{url:e.remoteEntry,type:e.remoteEntryType,globalName:e.globalName}:t}var Ic=(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,Ge=(()=>{try{return document.defaultView}catch{return Me}})(),zt=Ge;function ur(e,t,r){Object.defineProperty(e,t,{value:r,configurable:!1,writable:!0})}function dr(e,t){return Object.hasOwnProperty.call(e,t)}dr(Me,"__GLOBAL_LOADING_REMOTE_ENTRY__")||ur(Me,"__GLOBAL_LOADING_REMOTE_ENTRY__",{});var xt=Me.__GLOBAL_LOADING_REMOTE_ENTRY__;function ta(e){dr(e,"__VMOK__")&&!dr(e,"__FEDERATION__")&&ur(e,"__FEDERATION__",e.__VMOK__),dr(e,"__FEDERATION__")||(ur(e,"__FEDERATION__",{__GLOBAL_PLUGIN__:[],__INSTANCES__:[],moduleInfo:{},__SHARE__:{},__MANIFEST_LOADING__:{},__PRELOADED_MAP__:new Map}),ur(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}ta(Me);ta(Ge);function Tc(e){Me.__FEDERATION__.__INSTANCES__.push(e)}function Dc(){return Me.__FEDERATION__.__DEBUG_CONSTRUCTOR__}function Lc(e,t=ln()){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=()=>Ge.__FEDERATION__.moduleInfo,Oc=(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(Ge.__FEDERATION__.moduleInfo,a).value;if(i?.version===n)return i}},pr=e=>Oc(e,Ge.__FEDERATION__.moduleInfo),mo=(e,t)=>{const r=Bt(e);return Ge.__FEDERATION__.moduleInfo[r]=t,Ge.__FEDERATION__.moduleInfo},$c=e=>(Ge.__FEDERATION__.moduleInfo={...Ge.__FEDERATION__.moduleInfo,...e},()=>{const t=Object.keys(e);for(const r of t)delete Ge.__FEDERATION__.moduleInfo[r]}),ra=(e,t)=>{const r=t||`__FEDERATION_${e}:custom__`;return{remoteEntryKey:r,entryExports:Me[r]}},Bc=()=>Ge.__FEDERATION__.__GLOBAL_PLUGIN__,zc=e=>Me.__FEDERATION__.__PRELOADED_MAP__.get(e),Fc=e=>Me.__FEDERATION__.__PRELOADED_MAP__.set(e,!0),fo="[0-9A-Za-z-]+",On=`(?:\\+(${fo}(?:\\.${fo})*))`,Dt="0|[1-9]\\d*",mr="[0-9]+",na="\\d*[a-zA-Z-][a-zA-Z0-9-]*",ho=`(?:${mr}|${na})`,Gc=`(?:-?(${ho}(?:\\.${ho})*))`,go=`(?:${Dt}|${na})`,oa=`(?:-(${go}(?:\\.${go})*))`,Fr=`${Dt}|x|X|\\*`,Et=`[v=\\s]*(${Fr})(?:\\.(${Fr})(?:\\.(${Fr})(?:${oa})?${On}?)?)?`,jc=`^\\s*(${Et})\\s+-\\s+(${Et})\\s*$`,Qc=`[v=\\s]*${`(${mr})\\.(${mr})\\.(${mr})`}${Gc}?${On}?`,$n="((?:<|>)?=?)",Hc=`(\\s*)${$n}\\s*(${Qc}|${Et})`,sa="(?:~>?)",Uc=`(\\s*)${sa}\\s+`,aa="(?:\\^)",Vc=`(\\s*)${aa}\\s+`,qc="(<|>)?=?\\s*\\*",Wc=`^${aa}${Et}$`,Kc=`v?${`(${Dt})\\.(${Dt})\\.(${Dt})`}${oa}?${On}?`,Zc=`^${sa}${Et}$`,Yc=`^${$n}\\s*${Et}$`,Xc=`^${$n}\\s*(${Kc})$|^$`,Jc="^\\s*>=\\s*0.0.0\\s*$";function We(e){return new RegExp(e)}function Ie(e){return!e||e.toLowerCase()==="x"||e==="*"}function ia(...e){return t=>e.reduce((r,n)=>n(r),t)}function bo(e){return e.match(We(Xc))}function vo(e,t,r,n){const s=`${e}.${t}.${r}`;return n?`${s}-${n}`:s}function eu(e){return e.replace(We(jc),(t,r,n,s,a,i,l,c,u,d,m,h)=>(Ie(n)?r="":Ie(s)?r=`>=${n}.0.0`:Ie(a)?r=`>=${n}.${s}.0`:r=`>=${r}`,Ie(u)?c="":Ie(d)?c=`<${Number(u)+1}.0.0-0`:Ie(m)?c=`<${u}.${Number(d)+1}.0-0`:h?c=`<=${u}.${d}.${m}-${h}`:c=`<=${c}`,`${r} ${c}`.trim()))}function tu(e){return e.replace(We(Hc),"$1$2$3")}function ru(e){return e.replace(We(Uc),"$1~")}function nu(e){return e.replace(We(Vc),"$1^")}function ou(e){return e.trim().split(/\s+/).map(t=>t.replace(We(Wc),(r,n,s,a,i)=>Ie(n)?"":Ie(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:Ie(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 su(e){return e.trim().split(/\s+/).map(t=>t.replace(We(Zc),(r,n,s,a,i)=>Ie(n)?"":Ie(s)?`>=${n}.0.0 <${Number(n)+1}.0.0-0`:Ie(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 au(e){return e.split(/\s+/).map(t=>t.trim().replace(We(Yc),(r,n,s,a,i,l)=>{const c=Ie(s),u=c||Ie(a),d=u||Ie(i);return n==="="&&d&&(n=""),l="",c?n===">"||n==="<"?"<0.0.0-0":"*":n&&d?(u&&(a=0),i=0,n===">"?(n=">=",u?(s=Number(s)+1,a=0,i=0):(a=Number(a)+1,i=0)):n==="<="&&(n="<",u?s=Number(s)+1:a=Number(a)+1),n==="<"&&(l="-0"),`${n+s}.${a}.${i}${l}`):u?`>=${s}.0.0${l} <${Number(s)+1}.0.0-0`:d?`>=${s}.${a}.0${l} <${s}.${Number(a)+1}.0-0`:r})).join(" ")}function iu(e){return e.trim().replace(We(qc),"")}function lu(e){return e.trim().replace(We(Jc),"")}function fr(e,t){return e=Number(e)||e,t=Number(t)||t,e>t?1:e===t?0:-1}function cu(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?fr(i,l):-1:1}return 0}function er(e,t){return fr(e.major,t.major)||fr(e.minor,t.minor)||fr(e.patch,t.patch)||cu(e,t)}function Gr(e,t){return e.version===t.version}function uu(e,t){switch(e.operator){case"":case"=":return Gr(e,t);case">":return er(e,t)<0;case">=":return Gr(e,t)||er(e,t)<0;case"<":return er(e,t)>0;case"<=":return Gr(e,t)||er(e,t)>0;case void 0:return!0;default:return!1}}function du(e){return ia(ou,su,au,iu)(e)}function pu(e){return ia(eu,tu,ru,nu)(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(".")},u=t.split("||");for(const d of u){const m=d.trim();if(!m||m==="*"||m==="x")return!0;try{const h=pu(m);if(!h.trim())return!0;const g=h.split(" ").map(x=>du(x)).join(" ");if(!g.trim())return!0;const b=g.split(/\s+/).map(x=>lu(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,E]=y;if(!uu({operator:w,version:vo(k,M,C,E),major:k,minor:M,patch:C,preRelease:E?.split(".")},c)){v=!1;break}}if(v)return!0}catch(h){console.error(`[semver] Error processing range part "${m}":`,h);continue}}return!1}var Mr="default",mu="global";function fu(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??an.UNKNOWN,useIn:[]}:void 0}}function la(e,t){const r=t.shared||{},n=t.name,s=Object.keys(r).reduce((i,l)=>{const c=Js(r[l]);return i[l]=i[l]||[],c.forEach(u=>{i[l].push(fu(u,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===an.NO_USE?!1:r===an.CALCULATED?!0:n==="runtime-infer"?t?gu(e,t):!0:!1}function ut(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 Gt=(e,t)=>{const r=t||function(n,s){return ut(n,s)};return Object.keys(e).reduce((n,s)=>!n||r(n,s)||n==="0"?s:n,0)},xr=e=>!!e.loaded||typeof e.lib=="function",hu=e=>!!e.loading,gu=(e,t)=>{if(!e||!t)return!1;const{usedExports:r}=e;return r?!!t.every(n=>r.includes(n)):!1};function bu(e,t,r,n){const s=e[t][r];let a="",i=Ft(n);const l=function(c,u){return i?s[c].treeShaking?s[u].treeShaking?!xr(s[c].treeShaking)&&ut(c,u):!1:!0:!xr(s[c])&&ut(c,u)};if(i){if(a=Gt(e[t][r],l),a)return{version:a,useTreesShaking:i};i=!1}return{version:Gt(e[t][r],l),useTreesShaking:i}}var bt=e=>xr(e)||hu(e);function vu(e,t,r,n){const s=e[t][r];let a="",i=Ft(n);const l=function(c,u){if(i){if(!s[c].treeShaking)return!0;if(!s[u].treeShaking)return!1;if(bt(s[u].treeShaking))return bt(s[c].treeShaking)?!!ut(c,u):!0;if(bt(s[c].treeShaking))return!1}return bt(s[u])?bt(s[c])?!!ut(c,u):!0:bt(s[c])?!1:ut(c,u)};if(i){if(a=Gt(e[t][r],l),a)return{version:a,useTreesShaking:i};i=!1}return{version:Gt(e[t][r],l),useTreesShaking:i}}function yu(e){return e==="loaded-first"?vu:bu}function hr(e,t,r,n){if(!e)return;const{shareConfig:s,scope:a=Mr,strategy:i,treeShaking:l}=r,c=Array.isArray(a)?a:[a];for(const u of c)if(s&&e[u]&&e[u][t]){const{requiredVersion:d}=s,{version:m,useTreesShaking:h}=yu(i)(e,u,t,l),g=()=>{const v=e[u][t][m];if(s.singleton){if(typeof d=="string"&&!Tt(m,d)){const x=`Version ${m} from ${m&&v.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${d})`;s.strictVersion?Se(x):Tn(x)}return{shared:v,useTreesShaking:h}}else{if(d===!1||d==="*")return{shared:v,useTreesShaking:h};if(Tt(m,d))return{shared:v,useTreesShaking:h};const x=Ft(l);if(x){for(const[y,w]of Object.entries(e[u][t]))if(Ft(w.treeShaking,l?.usedExports)&&Tt(y,d))return{shared:w,useTreesShaking:x}}for(const[y,w]of Object.entries(e[u][t]))if(Tt(y,d))return{shared:w,useTreesShaking:!1}}},b={shareScopeMap:e,scope:u,pkgName:t,version:m,GlobalFederation:zt.__FEDERATION__,shareInfo:r,resolver:g};return(n.emit(b)||b).resolver()}}function ca(){return zt.__FEDERATION__.__SHARE__}function yo(e){const{pkgName:t,extraOptions:r,shareInfos:n}=e,s=c=>{if(!c)return;const u={};return c.forEach(m=>{u[m.version]=m}),u[Gt(u,function(m,h){return!xr(u[m])&&ut(m,h)})]},a=r?.resolver??s,i=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),l=(...c)=>{const u={};for(const d of c)if(d)for(const[m,h]of Object.entries(d)){const g=u[m];i(g)&&i(h)?u[m]=l(g,h):h!==void 0&&(u[m]=h)}return u};return l(a(n[t]),r?.customShareInfo)}var vt=(e,t)=>{e.useIn||(e.useIn=[]),Pc(e.useIn,t)};function tr(e,t){return t&&e.treeShaking?e.treeShaking:e}function xu(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 wu(e,t){for(const r of e)if(t===r.name||r.alias&&t===r.alias)return r}var ua="RUNTIME-001",da="RUNTIME-002",pa="RUNTIME-003",ma="RUNTIME-004",fa="RUNTIME-005",pn="RUNTIME-006",ha="RUNTIME-007",ga="RUNTIME-008",Bn="RUNTIME-009",ba="RUNTIME-010",va="RUNTIME-011",ku="RUNTIME-012",Oe={[ua]:"Failed to get remoteEntry exports.",[da]:'The remote entry interface does not contain "init"',[pa]:"Failed to get manifest.",[ma]:"Failed to locate remote.",[fa]:"Invalid loadShareSync function call from bundler runtime",[pn]:"Invalid loadShareSync function call from runtime",[ha]:"Failed to get remote snapshot.",[ga]:"Failed to load script resources.",[Bn]:"Please call createInstance first.",[ba]:'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',[va]:"The remoteEntry URL is missing from the remote snapshot.",[ku]:'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 ya=".then(callbacks[0]).catch(callbacks[1])";async function Nu({entry:e,remoteEntryExports:t}){return new Promise((r,n)=>{try{t?r(t):typeof FEDERATION_ALLOW_NEW_FUNCTION<"u"?new Function("callbacks",`import("${e}")${ya}`)([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 Su({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}")${ya}`)([r,n])}catch(s){Se(`Failed to load SystemJS entry from "${e}". ${s instanceof Error?s.message:String(s)}`)}})}function Cu(e,t,r){const{remoteEntryKey:n,entryExports:s}=ra(e,t);return s||Se(ua,Oe,{remoteName:e,remoteEntryUrl:r,remoteEntryKey:n}),s}async function Mu({name:e,globalName:t,entry:r,remoteInfo:n,loaderHook:s,getEntryUrl:a}){const{entryExports:i}=ra(e,t);if(i)return i;const l=a?a(r):r;return Mc(l,{attrs:{},createScriptHook:(c,u)=>{const d=s.lifecycle.createScript.emit({url:c,attrs:u,remoteInfo:n});if(d&&(d instanceof HTMLScriptElement||"script"in d||"timeout"in d))return d}}).then(()=>Cu(e,t,r),c=>{const u=c instanceof Error?c.message:String(c);Se(ga,Oe,{remoteName:e,resourceUrl:l},u)})}async function Eu({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 Nu({entry:s,remoteEntryExports:t});case"system":return Su({entry:s,remoteEntryExports:t});default:return Mu({entry:s,globalName:a,name:i,remoteInfo:e,loaderHook:r,getEntryUrl:n})}}function mn(e){const{entry:t,name:r}=e;return Hs(r,t)}async function wr(e){const{origin:t,remoteEntryExports:r,remoteInfo:n,getEntryUrl:s,_inErrorHandling:a=!1}=e,i=mn(n);if(r)return r;if(!xt[i]){const l=t.remoteHandler.hooks.lifecycle.loadEntry,c=t.loaderHook;xt[i]=l.emit({loaderHook:c,remoteInfo:n,remoteEntryExports:r}).then(u=>u||Eu({remoteInfo:n,remoteEntryExports:r,loaderHook:c,getEntryUrl:s})).catch(async u=>{const d=mn(n),m=u instanceof Error&&u.message.includes("ScriptExecutionError");if(u instanceof Error&&u.message.includes("RUNTIME-008")&&!m&&!a){const h=b=>wr({...b,_inErrorHandling:!0}),g=await t.loaderHook.lifecycle.loadEntryError.emit({getRemoteEntry:h,origin:t,remoteInfo:n,remoteEntryExports:r,globalLoading:xt,uniqueKey:d});if(g)return g}throw u})}return xt[i]}function kr(e){return{...e,entry:"entry"in e?e.entry:"",type:e.type||"global",entryGlobalName:e.entryGlobalName||e.name,shareScope:e.shareScope||"default"}}function Au(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function Pu(e,t){const r=Bc(),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 Ru(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(Ru)??[],shared:t}}}function xa(e){return{resourceCategory:"sync",share:!0,depsRemote:!0,...e}}function _u(e,t){return t.map(r=>{const n=wu(e,r.nameOrAlias);return Le(n,`Unable to preload ${r.nameOrAlias} as it is not included in ${!n&&Vs({remoteInfo:n,remotes:e})}`),{remote:n,preloadConfig:xa(r)}})}function Iu(e){return e?e.map(t=>t==="."?t:t.startsWith("./")?t.replace("./",""):t):[]}function wa(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,u=t.moduleCache.get(e.name);wr(u?{origin:t,remoteInfo:c,remoteEntryExports:u.remoteEntryExports}:{origin:t,remoteInfo:c,remoteEntryExports:void 0})}),n){const l={rel:"preload",as:"style"};s.forEach(c=>{const{link:u,needAttach:d}=zr({url:c,cb:()=>{},attrs:l,createLinkHook:(m,h)=>{const g=t.loaderHook.lifecycle.createLink.emit({url:m,attrs:h,remoteInfo:e});if(g instanceof HTMLLinkElement)return g}});d&&document.head.appendChild(u)})}else{const l={rel:"stylesheet",type:"text/css"};s.forEach(c=>{const{link:u,needAttach:d}=zr({url:c,cb:()=>{},attrs:l,createLinkHook:(m,h)=>{const g=t.loaderHook.lifecycle.createLink.emit({url:m,attrs:h,remoteInfo:e});if(g instanceof HTMLLinkElement)return g},needDeleteLink:!1});d&&document.head.appendChild(u)})}if(n){const l={rel:"preload",as:"script"};a.forEach(c=>{const{link:u,needAttach:d}=zr({url:c,cb:()=>{},attrs:l,createLinkHook:(m,h)=>{const g=t.loaderHook.lifecycle.createLink.emit({url:m,attrs:h,remoteInfo:e});if(g instanceof HTMLLinkElement)return g}});d&&document.head.appendChild(u)})}else{const l={fetchpriority:"high",type:e?.type==="module"?"module":"text/javascript"};a.forEach(c=>{const{script:u,needAttach:d}=Zs({url:c,cb:()=>{},attrs:l,createScriptHook:(m,h)=>{const g=t.loaderHook.lifecycle.createScript.emit({url:m,attrs:h,remoteInfo:e});if(g instanceof HTMLScriptElement)return g},needDeleteScript:!0});d&&document.head.appendChild(u)})}}}function Tu(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 ka=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 wr({origin:this.host,remoteInfo:this.remoteInfo,remoteEntryExports:this.remoteEntryExports});return Le(e,`remoteEntryExports is undefined
36
- ${Vs(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}=Tu(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=Ic(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 Na(e,t){if(!Ln(t))return!1;if(e!==t){for(const r in e)if(!(r in t))return!1}return!0}var kt=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(Na(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(Na(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)}},Nt=class{constructor(e){this.registerPlugins={},this.lifecycle=e,this.lifecycleKeys=Object.keys(e)}applyPlugin(e,t){Le(_c(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 Sa(e,t){const r=ea(t);r.url||Se(va,Oe,{remoteName:e.name});let n=cn(t,r.url);e.type=r.type,e.entryGlobalName=r.globalName,e.entry=n,e.version=t.version,e.buildVersion=t.buildVersion}function Du(){return{name:"snapshot-plugin",async afterResolve(e){const{remote:t,pkgNameOrAlias:r,expose:n,origin:s,remoteInfo:a,id:i}=e;if(!Dn(t)||!Xs(t)){const{remoteSnapshot:l,globalSnapshot:c}=await s.snapshotHandler.loadRemoteSnapshotInfo({moduleInfo:t,id:i});Sa(a,l);const u={remote:t,preloadConfig:{nameOrAlias:r,exposes:[n],resourceCategory:"sync",share:!1,depsRemote:!1}},d=await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({origin:s,preloadOptions:u,remoteInfo:a,remote:t,remoteSnapshot:l,globalSnapshot:c});return d&&wa(a,s,d,!1),{...e,remoteSnapshot:l}}return e}}}function Lu(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 Ca(e,t,r,n,s={},a){const{value:i}=Mt(e,Bt(t)),l=a||i;if(l&&!qs(l)&&(r(l,t,n),l.remotesInfo)){const c=Object.keys(l.remotesInfo);for(const u of c){if(s[u])continue;s[u]=!0;const d=Lu(u),m=l.remotesInfo[u];Ca(e,{name:d.name,version:m.matchedVersion},r,!1,s,void 0)}}}var jr=(e,t)=>document.querySelector(`${e}[${e==="link"?"href":"src"}="${t}"]`);function Ou(e,t,r,n,s){const a=[],i=[],l=[],c=new Set,u=new Set,{options:d}=e,{preloadConfig:m}=t,{depsRemote:h}=m;if(Ca(n,r,(b,v,x)=>{let y;if(x)y=m;else if(Array.isArray(h)){const E=h.find(_=>_.nameOrAlias===v.name||_.nameOrAlias===v.alias);if(!E)return;y=xa(E)}else if(h===!0)y=m;else return;const w=cn(b,ea(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=Iu(y.exposes);M.length&&"modules"in b&&(k=b?.modules?.reduce((E,_)=>(M?.indexOf(_.moduleName)!==-1&&E.push(_),E),[]));function C(E){const _=E.map(A=>cn(b,A));return y.filter?_.filter(y.filter):_}if(k){const E=k.length;for(let _=0;_<E;_++){const A=k[_],H=`${v.name}/${A.moduleName}`;e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({id:A.moduleName==="."?v.name:H,name:v.name,remoteSnapshot:b,preloadConfig:y,remote:v,origin:e}),!zc(H)&&(y.resourceCategory==="all"?(a.push(...C(A.assets.css.async)),a.push(...C(A.assets.css.sync)),i.push(...C(A.assets.js.async)),i.push(...C(A.assets.js.sync))):y.resourceCategory==="sync"&&(a.push(...C(A.assets.css.sync)),i.push(...C(A.assets.js.sync))),Fc(H))}}},!0,{},s),s.shared&&s.shared.length>0){const b=(v,x)=>{const{shared:y}=hr(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=>{u.add(w)}))};s.shared.forEach(v=>{const x=d.shared?.[v.sharedName];if(!x)return;const y=v.version?x.find(w=>w.version===v.version):x;y&&Js(y).forEach(w=>{b(w,v)})})}const g=i.filter(b=>!c.has(b)&&!jr("script",b));return{cssAssets:a.filter(b=>!u.has(b)&&!jr("link",b)),jsAssetsWithoutEntry:g,entryAssets:l.filter(b=>!jr("script",b.url))}}var $u=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)&&Xs(s)?{cssAssets:[],jsAssetsWithoutEntry:[],entryAssets:[{name:s.name,url:s.entry,moduleInfo:{name:n.name,entry:s.entry,type:n.type||"global",entryGlobalName:"",shareScope:""}}]}:(Sa(n,i),Ou(t,r,n,a,i))}}};function Ma(e,t){const r=pr({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:pr({name:e.name,version:n.matchedVersion})}:{hostGlobalSnapshot:void 0,globalSnapshot:po(),remoteSnapshot:pr({name:e.name,version:"version"in e?e.version:void 0})}}var Bu=class{constructor(e){this.loadingHostSnapshot=null,this.manifestCache=new Map,this.hooks=new Nt({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=pr({name:this.HostInstance.options.name,version:this.HostInstance.options.version});s||(s={version:this.HostInstance.options.version||"",remoteEntry:"",remotesInfo:{}},$c({[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:u}=await this.hooks.lifecycle.loadSnapshot.emit({options:n,moduleInfo:e,hostGlobalSnapshot:a,remoteSnapshot:i,globalSnapshot:l});let d,m;if(c)if(qs(c)){const h=c.remoteEntry,g=await this.getManifestJson(h,e,{}),b=mo({...e,entry:h},g);d=g,m=b}else{const{remoteSnapshot:h}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:c,from:"global"});d=h,m=u}else if(Dn(e)){const h=await this.getManifestJson(e.entry,e,{}),g=mo(e,h),{remoteSnapshot:b}=await this.hooks.lifecycle.loadRemoteSnapshot.emit({options:this.HostInstance.options,moduleInfo:e,remoteSnapshot:h,from:"global"});d=b,m=g}else Se(ha,Oe,{remoteName:e.name,remoteVersion:e.version,hostName:this.HostInstance.options.name,globalSnapshot:JSON.stringify(u)},void 0,At(this.HostInstance.options));return await this.hooks.lifecycle.afterLoadSnapshot.emit({id:t,host:this.HostInstance,options:n,moduleInfo:e,remoteSnapshot:d}),{remoteSnapshot:d,globalSnapshot:m}}getGlobalRemoteInfo(e){return Ma(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,{},kr(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(pa,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=xc(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]}},zu=class{constructor(e){this.hooks=new Nt({beforeRegisterShare:new kt("beforeRegisterShare"),afterResolve:new tt("afterResolve"),beforeLoadShare:new tt("beforeLoadShare"),loadShare:new ze,resolveShare:new kt("resolveShare"),initContainerShareScopeMap:new kt("initContainerShareScopeMap")}),this.host=e,this.shareScopeMap={},this.initTokens={},this._setGlobalShareScopeMap(e.options)}registerShared(e,t){const{newShareInfos:r,allShareInfos:n}=la(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}=hr(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare)||{};if(a){const l=tr(a,i);if(l.lib)return vt(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),vt(l,r.options.name),c}else{const u=(async()=>{const d=await l.get();return vt(l,r.options.name),l.loaded=!0,l.lib=d,d})();return this.setShared({pkgName:e,loaded:!1,shared:a,from:r.options.name,lib:null,loading:u,treeShaking:i?l:void 0}),u}}else{if(t?.customShareInfo)return!1;const l=Ft(s.treeShaking),c=tr(s,l),d=(async()=>{const m=await c.get();c.lib=m,c.loaded=!0,vt(c,r.options.name);const{shared:h,useTreesShaking:g}=hr(this.shareScopeMap,e,s,this.hooks.lifecycle.resolveShare)||{};if(h){const b=tr(h,g);b.lib=m,b.loaded=!0,h.from=s.from}return m})();return this.setShared({pkgName:e,loaded:!1,shared:s,from:r.options.name,lib:null,loading:d,treeShaking:l?c:void 0}),d}}initializeSharing(e=Mr,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 u=l[e],d=(h,g)=>{const{version:b,eager:v}=g;u[h]=u[h]||{};const x=u[h],y=x[b]&&tr(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)},m=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)&&d(h,g)})}),(r.options.shareStrategy==="version-first"||s==="version-first")&&r.options.remotes.forEach(h=>{h.shareScope===e&&i.push(m(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}=hr(this.shareScopeMap,e,n,this.hooks.lifecycle.resolveShare)||{};if(s){if(typeof s.lib=="function")return vt(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 vt(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:pn,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(pn,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:u="default",...d}=t,m=Array.isArray(u)?u:[u],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)};m.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],...d,lib:n});const b=this.shareScopeMap[g][e][c];h(b),r&&b.from!==r&&(b.from=r)})}_setGlobalShareScopeMap(e){const t=ca(),r=e.id||e.name;r&&!t[r]&&(t[r]=this.shareScopeMap)}},Fu=class{constructor(e){this.hooks=new Nt({beforeRegisterRemote:new kt("beforeRegisterRemote"),registerRemote:new kt("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:u,id:d,remoteSnapshot:m}=i,h=await s.get(d,u,t,m),g=await this.hooks.lifecycle.onLoad.emit({id:d,pkgNameOrAlias:l,expose:u,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=_u(t.options.remotes,e);await Promise.all(r.map(async n=>{const{remote:s}=n,a=kr(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&&wa(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=xu(t.options.remotes,s);a||Se(ma,Oe,{hostName:t.options.name,requestId:s},void 0,At(t.options));const{remote:i}=a,l=kr(i),c=await t.sharedHandler.hooks.lifecycle.afterResolve.emit({id:s,...a,options:t.options,origin:t,remoteInfo:l}),{remote:u,expose:d}=c;Le(u&&d,`The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${s}.`);let m=t.moduleCache.get(u.name);const h={host:t,remoteInfo:l};return m||(m=new ka(h),t.moduleCache.set(u.name,m)),{module:m,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=Mr),e.type||(e.type=mu)};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}),Us(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=mn(s.remoteInfo);xt[l]&&delete xt[l],t.snapshotHandler.manifestCache.delete(a.entry);let c=a.buildVersion?Hs(a.name,a.buildVersion):a.name;const u=Me.__FEDERATION__.__INSTANCES__.findIndex(m=>a.buildVersion?m.options.id===c:m.name===c);if(u!==-1){const m=Me.__FEDERATION__.__INSTANCES__[u];c=m.options.id||c;const h=ca();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 E=M[C];E&&typeof E=="object"&&E.from===a.name&&(E.loaded||E.loading?(E.useIn=E.useIn.filter(_=>_!==a.name),E.useIn.length?g=!1:b.push([v,y,k,C])):b.push([v,y,k,C]))})})})}),g&&(m.shareScopeMap={},delete h[c]),b.forEach(([v,x,y,w])=>{delete h[v]?.[x]?.[y]?.[w]}),Me.__FEDERATION__.__INSTANCES__.splice(u,1)}const{hostGlobalSnapshot:d}=Ma(e,t);if(d){const m=d&&"remotesInfo"in d&&d.remotesInfo&&Mt(d.remotesInfo,e.name).key;m&&(delete d.remotesInfo[m],zt.__FEDERATION__.__MANIFEST_LOADING__[m]&&delete zt.__FEDERATION__.__MANIFEST_LOADING__[m])}t.moduleCache.delete(e.name)}}catch(t){dn.error(`removeRemote failed: ${t instanceof Error?t.message:String(t)}`)}}},Gu=typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN=="boolean"?!FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN:!0,Ea=class{constructor(e){this.hooks=new Nt({beforeInit:new kt("beforeInit"),init:new $e,beforeInitContainer:new tt("beforeInitContainer"),initContainer:new tt("initContainer")}),this.version="2.4.0",this.moduleCache=new Map,this.loaderHook=new Nt({getModuleInfo:new $e,createScript:new $e,createLink:new $e,fetch:new ze,loadEntryError:new ze,getModuleFactory:new ze}),this.bridgeHook=new Nt({beforeBridgeRender:new $e,afterBridgeRender:new $e,beforeBridgeDestroy:new $e,afterBridgeDestroy:new $e});const t=Gu?[Du(),$u()]:[],r={id:Au(),name:e.name,plugins:t,remotes:[],shared:{},inBrowser:Qs};this.name=e.name,this.options=r,this.snapshotHandler=new Bu(this),this.sharedHandler=new zu(this),this.remoteHandler=new Fu(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(Ys(ba,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=Mr,t){return this.sharedHandler.initializeSharing(e,t)}initRawContainer(e,t,r){const n=kr({name:e,entry:t}),s=new ka({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}=la(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(u=>{l.includes(u)||l.push(u)});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=Pu(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 ju(){return typeof FEDERATION_BUILD_IDENTIFIER<"u"?FEDERATION_BUILD_IDENTIFIER:""}function Qu(e,t){const r=ju();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 Hu(e){const t=new(Dc()||Ea)({id:`${e.name}@${e.version||Date.now()}`,...e});return Tc(t),t}var Fe=null;function Uu(e){const t=Qu(e.name,e.version),r={...e,id:e.id||""};return t?(t.initOptions(r),Fe||(Fe=t),t):(Fe=Hu(r),Fe)}function Vu(...e){return Le(Fe,Bn,Oe),Fe.loadRemote.apply(Fe,e)}function qu(...e){return Le(Fe,Bn,Oe),Fe.registerRemotes.apply(Fe,e)}function Wu(){return Fe}Lc(Ea);function St(e){const t=(typeof globalThis<"u"?globalThis:void 0)?.[e];return t&&typeof t=="object"?t:{}}var Ku={singleton:!0,requiredVersion:!1,eager:!0},He=e=>({version:"0.0.0",scope:"default",lib:e,shareConfig:Ku}),xo="__mf_module_cache__";function Zu(){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 Yu(){const e=Zu();e.share.react??=ds,e.share["react-dom"]??=ms,e.share["react-dom/client"]??=fs,e.share["react/jsx-runtime"]??=ps,e.share["@tanstack/react-query"]??=gs,e.share["@trpc/client"]??=ys,e.share["@trpc/react-query"]??=xs,e.share["@camstack/ui-library"]??=St("__camstackUiLibrary"),e.share["@camstack/sdk"]??=St("__camstackSdk"),e.share["@camstack/types"]??=St("__camstackTypes")}function Xu(){Yu(),Wu()===null&&Uu({name:"admin_ui_host",remotes:[],shared:{react:He(()=>ds),"react-dom":He(()=>ms),"react-dom/client":He(()=>fs),"react/jsx-runtime":He(()=>ps),"@tanstack/react-query":He(()=>gs),"@trpc/client":He(()=>ys),"@trpc/react-query":He(()=>xs),"@camstack/ui-library":He(()=>St("__camstackUiLibrary")),"@camstack/sdk":He(()=>St("__camstackSdk")),"@camstack/types":He(()=>St("__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 Aa=(...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 Ju=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 ed=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=ed(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 td={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 rd=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 nd=Te(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:a,iconNode:i,...l},c)=>$t("svg",{ref:c,...td,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Aa("lucide",s),...!a&&!rd(l)&&{"aria-hidden":"true"},...l},[...i.map(([u,d])=>$t(u,d)),...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(nd,{ref:a,iconNode:t,className:Aa(`lucide-${Ju(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"}]]),od=R("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),sd=R("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),ad=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"}]]),id=R("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),ld=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"}]]),cd=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"}]]),ud=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"}]]),Pa=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"}]]),dd=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"}]]),Er=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"}]]),pd=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"}]]),md=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"}]]),mt=R("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),fd=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"}]]),Ar=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"}]]),hd=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"}]]),gd=R("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),bd=R("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]),vd=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"}]]),yd=R("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),Ra=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"}]]),xd=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"}]]),wd=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"}]]),kd=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"}]]),_a=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"}]]),Nd=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"}]]),Ia=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"}]]),Ta=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"}]]),Da=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"}]]),La=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"}]]),qt=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"}]]),Oa=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"}]]),Sd=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"}]]),$a=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"}]]),Cd=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"}]]),Md=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"}]]),Ed=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"}]]),Ad=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"}]]),Ba=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"}]]),je=R("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Pd=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"}]]),Rd=R("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]),za=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"}]]),Fa=R("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),Gn=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"}]]),_d=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"}]]),hn=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"}]]),Id=R("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),gn=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"}]]),Wt=R("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),Td=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"}]]),Dd=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"}]]),Ga=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"}]]),Ld=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"}]]),jn=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"}]]),Qa=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"}]]),Od=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"}]]),$d=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"}]]),Bd=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"}]]),jt=R("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),zd=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"}]]),Fd=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"}]]),Gd=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"}]]),jd=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"}]]),Qd=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"}]]),Ha=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"}]]),Hd=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"}]]),Ud=R("thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]),Vd=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"}]]),qe=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"}]]),qd=R("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]),Wd=R("trending-down",[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]]),Kt=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"}]]),Ua=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"}]]),Kd=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"}]]),Va=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"}]]),Pe=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"}]]),Zd=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"}]]),Yd=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"}]]),fb={frigate:Gd,scrypted:Fd,reolink:Ld,homeAssistant:$a,rtsp:md},hb={online:gd,offline:xd,degraded:Ar,unknown:Ra},Eo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ao=Es,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 u=r?.[c],d=a?.[c];if(u===null)return null;const m=Eo(u)||Eo(d);return s[c][m]}),l=r&&Object.entries(r).reduce((c,u)=>{let[d,m]=u;return m===void 0||(c[d]=m),c},{});return Ao(e,i,t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((c,u)=>{let{class:d,className:m,...h}=u;return Object.entries(h).every(g=>{let[b,v]=g;return Array.isArray(v)?v.includes({...a,...l}[b]):{...a,...l}[b]===v})?[...c,d,m]:c},[]),r?.class,r?.className)},Xd=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"}}),gr=Te(({className:e,variant:t,size:r,...n},s)=>o("button",{ref:s,className:N(Xd({variant:t,size:r}),e),...n}));gr.displayName="Button";var Jd=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"}}),qa=Te(({className:e,variant:t,size:r,icon:n,...s},a)=>o("button",{ref:a,className:N(Jd({variant:t,size:r}),e),...s,children:o(n,{className:"h-4 w-4"})}));qa.displayName="IconButton";var ep=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(ep({variant:t,styleVariant:r}),e),...n}));Lt.displayName="Badge";var tp=ft("rounded-lg p-3",{variants:{variant:{flat:"bg-surface",bordered:"bg-surface border border-border"}},defaultVariants:{variant:"bordered"}}),Wa=Te(({className:e,variant:t,...r},n)=>o("div",{ref:n,className:N(tp({variant:t}),e),...r}));Wa.displayName="Card";function rp({expanded:e,onExpandedChange:t,header:r,children:n,dimmed:s=!1,hideChevron:a=!1,className:i}){return f("div",{className:N("rounded-lg border border-border bg-surface overflow-hidden",s&&"opacity-[0.45]",i),children:[f("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(mt,{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 Ka=Te(({className:e,...t},r)=>o("label",{ref:r,className:N("text-[10px] uppercase tracking-wider text-foreground-muted font-medium",e),...t}));Ka.displayName="Label";var np=ft("",{variants:{orientation:{horizontal:"h-px w-full bg-border-subtle",vertical:"w-px h-full bg-border-subtle"}},defaultVariants:{orientation:"horizontal"}}),Za=Te(({className:e,orientation:t,...r},n)=>o("div",{ref:n,role:"separator",className:N(np({orientation:t}),e),...r}));Za.displayName="Separator";var op=Te(({className:e,...t},r)=>o("div",{ref:r,className:N("animate-pulse bg-surface-hover rounded-md h-4 w-full",e),...t}));op.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"}}),bn=Te(({className:e,state:t,leftSlot:r,rightSlot:n,...s},a)=>r||n?f("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}));bn.displayName="Input";var Nr=Te(({className:e,options:t,...r},n)=>f("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(mt,{className:"h-3.5 w-3.5"})})]}));Nr.displayName="Select";var sp=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}));sp.displayName="Checkbox";var ap=Te(({className:e,checked:t,onCheckedChange:r,label:n,...s},a)=>f("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})]}));ap.displayName="Switch";var Ya=Ye(null);function Xa(){const e=Ae(Ya);if(!e)throw new Error("Dialog compound components must be used within <Dialog>");return e}function ip({children:e,open:t,onOpenChange:r}){const[n,s]=S(!1),a=t??n,i=dt(),l=I(c=>{r?.(c),t===void 0&&s(c)},[t,r]);return o(Ya.Provider,{value:{open:a,setOpen:l,contentId:i},children:e})}function gb({children:e,...t}){const{setOpen:r}=Xa();return o("button",{type:"button",onClick:()=>r(!0),...t,children:e})}var lp=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"}}),Ja=Te(({className:e,width:t,children:r,...n},s)=>{const{open:a,setOpen:i,contentId:l}=Xa(),c=q(null),u=s??c;Q(()=>{const m=u.current;m&&(a&&!m.open&&m.showModal(),!a&&m.open&&m.close())},[a,u]);const d=m=>{m.target===m.currentTarget&&i(!1)};return o("dialog",{ref:u,id:l,className:N(lp({width:t}),"w-full",e),onClick:d,onClose:()=>i(!1),...n,children:r})});Ja.displayName="DialogContent";function cp({className:e,...t}){return o("div",{className:N("flex flex-col gap-1 mb-3",e),...t})}function up({className:e,...t}){return o("div",{className:N("flex justify-end gap-2 mt-4",e),...t})}function dp({className:e,...t}){return o("h2",{className:N("text-sm font-semibold text-foreground",e),...t})}function pp({className:e,...t}){return o("p",{className:N("text-xs text-foreground-muted",e),...t})}var ei=Ye(null);function Hn(){const e=Ae(ei);if(!e)throw new Error("Dropdown compound components must be used within <Dropdown>");return e}function bb({children:e}){const[t,r]=S(!1),n=dt(),s=dt(),a=q(null);return o(ei.Provider,{value:{open:t,setOpen:r,triggerId:n,contentId:s,triggerRef:a},children:o("div",{className:"relative inline-block",children:e})})}function vb({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 yb({className:e,children:t,align:r="start",offset:n=4,...s}){const{open:a,setOpen:i,contentId:l,triggerId:c,triggerRef:u}=Hn(),d=q(null),[m,h]=S(null);return tl(()=>{if(!a){h(null);return}const g=()=>{const b=u.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,u]),Q(()=>{if(!a)return;const g=v=>{const x=d.current,y=u.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,u]),!a||!m||typeof document>"u"?null:Cr(o("div",{ref:d,id:l,role:"menu","aria-labelledby":c,style:{position:"fixed",top:m.top,...r==="end"?{right:window.innerWidth-m.left}:{left:m.left},minWidth:m.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 xb({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 f("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 ti=Ye(null);function ri(){const e=Ae(ti);if(!e)throw new Error("Tooltip compound components must be used within <Tooltip>");return e}function wb({children:e}){const[t,r]=S(!1),n=q(null),s=dt(),a=()=>{n.current=setTimeout(()=>r(!0),300)},i=()=>{n.current&&clearTimeout(n.current),r(!1)};return o(ti.Provider,{value:{open:t,show:a,hide:i,tooltipId:s},children:o("div",{className:"relative inline-block",children:e})})}function kb({children:e,...t}){const{show:r,hide:n,tooltipId:s,open:a}=ri();return o("div",{onMouseEnter:r,onMouseLeave:n,onFocus:r,onBlur:n,"aria-describedby":a?s:void 0,...t,children:e})}function Nb({className:e,children:t,...r}){const{open:n,tooltipId:s}=ri();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 ni(e){return t=>{const r=window.matchMedia(e);return r.addEventListener("change",t),()=>r.removeEventListener("change",t)}}function oi(e){return()=>window.matchMedia(e).matches}function si(){return!1}function Pr(){return Pn(ni(Ro),oi(Ro),si)}function Sb(){return Pn(ni(_o),oi(_o),si)}function ai({open:e,onClose:t,title:r,children:n,className:s}){return Q(()=>{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]),f(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"}),f("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&&f("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(Pe,{className:"h-4 w-4"})})]}),o("div",{className:"flex-1 overflow-y-auto px-4 pb-4",children:n})]})]})}var ii=Ye(null);function li(){const e=Ae(ii);if(!e)throw new Error("Popover compound components must be used within <Popover>");return e}function mp({children:e,open:t,onOpenChange:r}){const[n,s]=S(!1),a=t??n,i=dt(),l=dt(),c=I(u=>{r?.(u),t===void 0&&s(u)},[t,r]);return o(ii.Provider,{value:{open:a,setOpen:c,triggerId:i,contentId:l},children:o("div",{className:"relative inline-block",children:e})})}function fp({children:e,...t}){const{open:r,setOpen:n,triggerId:s,contentId:a}=li();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 hp({className:e,children:t,...r}){const{open:n,setOpen:s,contentId:a,triggerId:i}=li(),l=Pr(),c=q(null);return Q(()=>{if(!n||l)return;const u=m=>{const h=c.current,g=document.getElementById(i);h&&!h.contains(m.target)&&!g?.contains(m.target)&&s(!1)},d=m=>{m.key==="Escape"&&s(!1)};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d)}},[n,s,i,l]),n?l?o(ai,{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 ci=Ye(null);function ui(){const e=Ae(ci);if(!e)throw new Error("Tabs compound components must be used within <Tabs>");return e}function Cb({value:e,onValueChange:t,defaultValue:r="",className:n,...s}){const[a,i]=S(r),l=e??a,c=I(u=>{t?.(u),e===void 0&&i(u)},[e,t]);return o(ci.Provider,{value:{value:l,setValue:c},children:o("div",{className:n,...s})})}function Mb({className:e,...t}){return o("div",{role:"tablist",className:N("flex flex-row border-b border-border-subtle",e),...t})}function Eb({value:e,className:t,...r}){const{value:n,setValue:s}=ui(),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 Ab({value:e,className:t,...r}){const{value:n}=ui();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 Pb({title:e,onClose:t,children:r,defaultWidth:n=360,defaultHeight:s=280,minWidth:a=280,minHeight:i=160,offsetIndex:l=0,className:c}){const[u,d]=S({x:80+l*30,y:80+l*30}),[m,h]=S({w:n,h:s}),[g,b]=S(!1),v=q(!1),x=q(!1),y=q({x:0,y:0}),w=Pr(),k=I(C=>{C.preventDefault(),v.current=!0,y.current={x:C.clientX-u.x,y:C.clientY-u.y}},[u]),M=I(C=>{C.preventDefault(),C.stopPropagation(),x.current=!0,y.current={x:C.clientX,y:C.clientY}},[]);return Q(()=>{const C=_=>{if(v.current&&d({x:_.clientX-y.current.x,y:_.clientY-y.current.y}),x.current){const A=_.clientX-y.current.x,H=_.clientY-y.current.y;y.current={x:_.clientX,y:_.clientY},h(oe=>({w:Math.max(a,oe.w+A),h:Math.max(i,oe.h+H)}))}},E=()=>{v.current=!1,x.current=!1};return window.addEventListener("mousemove",C),window.addEventListener("mouseup",E),()=>{window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",E)}},[a,i]),w?f("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:[f("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}),f("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(Pe,{size:12})})]})]}),!g&&o("div",{className:"flex-1 min-h-0 overflow-y-auto",children:r})]}):f("div",{className:N("fixed z-50 rounded-lg border border-border bg-background-elevated shadow-2xl flex flex-col overflow-hidden",c),style:{left:u.x,top:u.y,width:g?280:m.w,height:g?"auto":m.h},children:[f("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:[f("div",{className:"flex items-center gap-2 min-w-0",children:[o(Sd,{size:12,className:"text-foreground-subtle shrink-0"}),o("span",{className:"text-[11px] font-medium truncate",children:e})]}),f("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(Pe,{size:12})})]})]}),!g&&f("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 gp({open:e,onClose:t,children:r,className:n,width:s="w-64"}){const a=q(null);return Q(()=>{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]),f(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 Rb({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 f(el.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 _b({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:f("table",{className:"w-full text-xs",style:{minWidth:`${s}px`},children:[o("thead",{className:"bg-surface",children:o("tr",{children:e.map(u=>{const d=u.align??"left",m=u.nowrap??!0;return o("th",{className:["px-3 py-2 text-foreground-subtle font-medium bg-surface border-b border-border",Io[d],m?"whitespace-nowrap":"",u.width??""].filter(Boolean).join(" "),children:u.headerRender?u.headerRender():u.header},u.key)})})}),o("tbody",{children:t.map((u,d)=>{const m=r?r(u,d):d,h=c?.(u,d)??"",g=n!==void 0;return o("tr",{onClick:g?()=>n(u,d):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(u,d)},b.key)})},m)})})]})})}function Ib({open:e,onClose:t,title:r,subtitle:n,footer:s,children:a,widthClass:i="w-[360px]"}){return Q(()=>{if(!e)return;const l=c=>{c.key==="Escape"&&t()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[e,t]),e?f("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:[f("header",{className:"flex items-start justify-between gap-2 px-4 py-3 border-b border-border",children:[f("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(Pe,{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 bp={inherit:"bg-muted",on:"bg-emerald-500",off:"bg-orange-500",na:"bg-gray-300 opacity-50"};function pi({node:e,depth:t,selectedAddonId:r,onSelect:n,agentDots:s}){const a=e.addonId===r,i=s?.[e.addonId]??[];return f("div",{children:[f("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",bp[l.state])},l.agentNodeId))})]}),e.children.map(l=>o(pi,{node:l,depth:t+1,selectedAddonId:r,onSelect:n,agentDots:s},l.addonId))]})}function Tb({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(pi,{node:a,depth:0,selectedAddonId:t,onSelect:r,agentDots:n},a.addonId))})}function Db(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 vp(e){return e?e.models.map(t=>({id:t.id,name:t.name})):[]}function Qr({step:e,schema:t,allSchemas:r,depth:n=0,onChange:s,onDelete:a,readOnly:i=!1,toggleMode:l="simple",overrideState:c=null,onOverrideChange:u,inheritedEnabled:d,hideModelAndSettings:m=!1}){const[h,g]=S(!1),b=vp(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=f(Ne,{children:[f("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}),f("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"&&u&&f("div",{className:"flex items-center gap-0.5 rounded-md border border-border p-0.5",onClick:x=>x.stopPropagation(),children:[o(Hr,{label:"Inherit",active:c===null,variant:"inherit",subtext:d===void 0?void 0:d?"on":"off",onClick:()=>u(null)}),o(Hr,{label:"On",active:c===!0,variant:"on",onClick:()=>u(!0)}),o(Hr,{label:"Off",active:c===!1,variant:"off",onClick:()=>u(!1)})]})]});return o(rp,{expanded:h,onExpandedChange:g,dimmed:!e.enabled,header:v,children:m?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."}):f("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 f("div",{children:[o("label",{className:"block text-[10px] font-medium text-foreground-subtle uppercase tracking-wide mb-1.5",children:e}),f("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 yp({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 f("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 xp(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:u,in:d,notIn:m}=a,h=xp(l,r,t);if(c!==void 0&&h!==c||u!==void 0&&h===u||d!==void 0&&!d.includes(h)||m!==void 0&&m.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(yp,{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,u=typeof l=="number"?l:c,d=e.min??0,m=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?u/v:u;return f("div",{children:[f("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&&f("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:d,max:m,step:h,value:u,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 f("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??"",u=e.type==="password"?"password":"text";return f("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:d=>i(d.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:u,value:c,disabled:n||e.disabled,placeholder:e.placeholder,onChange:d=>i(d.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 Hr({label:e,active:t,variant:r,subtext:n,onClick:s}){return f("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&&f("span",{className:"ml-1 opacity-60",children:["(",n,")"]})]})}function mi(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 wp(e,t,r){return r?{enabled:r.enabled??t.enabled,modelId:r.modelId??t.modelId,settings:r.settings??t.settings}:t}function kp({addon:e,agentDefault:t,modelsForFormat:r,onChangeAgentConfig:n}){const s=a=>{n?.({...t,...a})};return f("div",{className:"space-y-4 text-xs",children:[f("label",{className:"flex items-center gap-2",children:[o("input",{type:"checkbox",checked:t.enabled,onChange:a=>s({enabled:a.target.checked})}),f("span",{children:["Enabled on this agent (",e.name,")"]})]}),f("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&&f("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:mi(e,t),disabled:!1,onChange:i=>s({settings:{...i.settings}})},a.key))]})]})}function Np({addon:e,agentDefault:t,agentNodeId:r,currentPatch:n,modelsForFormat:s,onChangePatch:a}){const i=wp("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"})},u=g=>{const{modelId:b,...v}=n??{};l(g===void 0?v:{...v,modelId:g})},d=g=>{const{settings:b,...v}=n??{};l(g===void 0?v:{...v,settings:g})},m=n?.enabled===void 0?"inherit":n.enabled?"on":"off",h=n?.modelId!==void 0;return f("div",{className:"space-y-4 text-xs",children:[f("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",m===g?"bg-primary text-primary-foreground border-primary":"bg-surface text-foreground hover:bg-muted"),children:g},g)),f("span",{className:"ml-2 text-[10px] text-foreground-subtle",children:["agent default: ",o("span",{className:"font-semibold",children:t.enabled?"on":"off"})]})]}),f("div",{children:[f("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:()=>u(void 0),children:"Clear"}):o("button",{type:"button",className:"text-[10px] text-primary hover:underline",onClick:()=>u(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=>u(g.target.value),children:s.map(g=>o("option",{value:g.id,children:g.name},g.id))}),!h&&f("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 f("div",{className:"pt-2 border-t border-border/50 space-y-3",children:[f("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:()=>d(void 0),children:"Clear"}):o("button",{type:"button",className:"text-[10px] text-primary hover:underline",onClick:()=>d({...t.settings}),children:"Override"})]}),e.configSchema?.map(b=>o(Un,{field:b,allFields:e.configSchema??[],step:mi(e,i),disabled:!g,onChange:v=>d({...v.settings})},b.key)),!g&&f("div",{className:"text-[10px] text-foreground-subtle",children:["inherits from ",r]})]})})(),f("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"}),f("div",{className:"font-mono truncate",children:[e.id," · model: ",i.modelId," · ",i.enabled?"on":"off"]})]})]})}function Lb(e){const{mode:t,addon:r,agentDefault:n,agentNodeId:s,currentPatch:a,onChangeAgentConfig:i,onChangePatch:l,engineFormat:c}=e,u=J(()=>r.models.filter(d=>!!d.formats[c]),[r.models,c]);return t==="agent"?o(kp,{addon:r,agentDefault:n,modelsForFormat:u,onChangeAgentConfig:i}):o(Np,{addon:r,agentDefault:n,agentNodeId:s,currentPatch:a,modelsForFormat:u,onChangePatch:l})}function Sp(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 Cp({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 Mp({inputs:e,outputs:t}){return e.length===0&&t.length===0?null:f("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 Ep({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 Ap(e){return e.kind==="enabled"?f("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"?f("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"]}):f("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 Pp({node:e,depth:t,agents:r,getCellState:n,onCellClick:s,selectedCell:a,toggleProps:i}){return f(Ne,{children:[f("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:[f("div",{className:"flex flex-col gap-1 min-w-0 flex-1",children:[o(Cp,{slot:e.slot}),f("div",{className:"flex items-center gap-2 flex-wrap",children:[o("span",{className:"font-semibold truncate",children:e.addonName}),o(Mp,{inputs:e.inputClasses,outputs:e.outputClasses})]})]}),i&&o("span",{className:"pl-2 pt-0.5 shrink-0",children:o(Ep,{enabled:i.enabled,onChange:i.onChange,disabled:i.disabled})})]}),r.map(l=>{const c=n(e.addonId,l.agentNodeId),u=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",u&&"ring-2 ring-primary ring-inset"),children:Ap(c)},l.agentNodeId)})]})}function Ob({tree:e,agents:t,getCellState:r,onCellClick:n,selectedCell:s,onToggleEnabled:a}){const i=J(()=>Sp(e),[e]),l=`minmax(320px, 1fr) repeat(${t.length}, minmax(160px, 220px))`,c=a!==void 0&&t.length===1,u=t[0]?.agentNodeId;return o("div",{className:"overflow-auto border border-border rounded",children:f("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(d=>f("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:d.agentNodeId}),o("div",{className:"text-[10px] text-foreground-subtle truncate",children:d.engineLabel})]},d.agentNodeId)),i.map(({node:d,depth:m})=>{const h=c&&u!==void 0?r(d.addonId,u):null;return o(Pp,{node:d,depth:m,agents:t,getCellState:r,onCellClick:n,selectedCell:s,toggleProps:c&&h!==null?{enabled:h.kind==="enabled",onChange:g=>a?.(d.addonId,g),disabled:h.kind==="na"}:void 0},d.addonId)})]})})}var fi=typeof globalThis<"u"?globalThis.__camstackTrpcReact:void 0,p=fi??cl();typeof globalThis<"u"&&!fi&&(globalThis.__camstackTrpcReact=p);var Vn=ot("camstack:system",null);function Rp({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 $b(){return Ae(Vn)}function Rr(e,t){const r=Rt(),n=q(t);n.current=t;const[s,a]=S(r.connectionVersion);Q(()=>r.subscribeConnectionEvents((i,l)=>{i==="connected"&&a(l)}),[r]),Q(()=>r.subscribeEvent(e,i=>{n.current(i)}),[r,e,s])}function yn(e){const t=q(e);return t.current=e,t}function hi(e,t){const[r,n]=S(null),s=yn(t);return Rr(e,a=>{const i=a.data,l=s.current;l&&!l(i)||n(i)}),r}function Bb(e,t,r){const[n,s]=S(()=>new Map),a=yn(t),i=yn(r);return Rr(e,l=>{const c=l.data,u=i.current;if(u&&!u(c))return;const d=a.current(c);s(m=>{const h=new Map(m);return h.set(d,c),h})}),{map:n,values:J(()=>Array.from(n.values()),[n])}}function qn(){const{data:e,isLoading:t}=p.nodes.topology.useQuery(void 0,{staleTime:6e4}),r=hi("cluster.topology-snapshot")?.nodes??e;return{nodes:J(()=>{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 zb({selectedNodeId:e,onSelect:t,label:r="Node",hideIcon:n=!1,alwaysShow:s=!1}){const{nodes:a}=qn();return!s&&a.length<=1?null:f("div",{className:"flex items-center gap-1.5",children:[!n&&o(zd,{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 _p={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 Fb({status:e,showDot:t=!0,showLabel:r=!0,size:n="sm",className:s}){const a=_p[e];return f("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 Ip={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 Gb({provider:e,showLabel:t=!0,className:r}){const n=Ip[e];return f("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 Tp={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 Dp({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",Tp[t],n),children:e})}function jb({version:e,preRelease:t,className:r}){return o(Dp,{variant:t??/-(alpha|beta|rc|dev|canary|next)/i.test(e)?"warning":"success",mono:!0,className:r,children:e})}function Qb({label:e,description:t,error:r,required:n,children:s,orientation:a="vertical",className:i}){const l=a==="horizontal";return f("div",{className:N("flex gap-2",l?"flex-row items-center justify-between":"flex-col",i),children:[f("div",{className:N(l?"flex-1":""),children:[f(Ka,{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 Hb({title:e,subtitle:t,actions:r,className:n}){return f("div",{className:N("flex flex-col gap-2 mb-3 sm:flex-row sm:items-center sm:justify-between",n),children:[f("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 Ub({icon:e,title:t,description:r,action:n,className:s}){return f("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"}),f("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 gi=ot("camstack:confirm-dialog",null);function Wn(){const e=Ae(gi);if(!e)throw new Error("useConfirm must be used within ConfirmDialogProvider");return e.confirm}function Vb({children:e}){const[t,r]=S(null),n=I(c=>new Promise(u=>{r({...c,resolve:u})}),[]),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 f(gi.Provider,{value:{confirm:n},children:[e,t&&f("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}),f("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:[f("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})]}),f("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 qb({value:e,label:t,trend:r,className:n}){return f(Wa,{className:N("flex flex-col gap-1",n),children:[f("div",{className:"flex items-baseline gap-2",children:[o("span",{className:"text-2xl font-semibold text-foreground",children:e}),r&&f("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(qd,{className:"h-3 w-3"}):o(Wd,{className:"h-3 w-3"}),r.value,"%"]})]}),o("span",{className:"text-xs text-foreground-muted",children:t})]})}function Wb({items:e,className:t}){return o("dl",{className:N("flex flex-col",t),children:e.map(r=>f("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 Kb({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 f("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(qa,{icon:n?Vt:at,"aria-label":"Copy code",variant:"ghost",size:"sm",onClick:a})})]})}function Zb({filters:e,values:t,onChange:r,className:n}){const s=Pr(),[a,i]=S(!1),l=(u,d)=>{r({...t,[u]:d})},c=Object.values(t).filter(u=>u!==void 0&&u!=="").length;if(s){const u=e.find(m=>m.type==="search"),d=e.some(m=>m.type!=="search");return f("div",{className:N("flex items-center gap-2",n),children:[u&&o(bn,{placeholder:u.placeholder??"Search...",value:t[u.key]??"",onChange:m=>l(u.key,m.target.value),leftSlot:o(jt,{className:"h-3 w-3 text-foreground-subtle"}),className:"flex-1"}),d&&f(Ne,{children:[f("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(jd,{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(ai,{open:a,onClose:()=>i(!1),title:"Filters",children:o("div",{className:"flex flex-col gap-3",children:e.filter(m=>m.type!=="search").map(m=>{switch(m.type){case"select":return f("div",{children:[o("label",{className:"text-xs text-foreground-muted mb-1 block",children:m.label}),o(Nr,{options:m.options,value:t[m.key]??"",onChange:h=>l(m.key,h.target.value),className:"w-full"})]},m.key);case"badge-toggle":return o("div",{className:"flex items-center gap-1 flex-wrap",children:m.options.map(h=>{const g=t[m.key]===h.value;return o("button",{type:"button",onClick:()=>l(m.key,g?void 0:h.value),children:o(Lt,{variant:g?"info":"default",className:"cursor-pointer",children:h.label})},h.value)})},m.key);default:return null}})})})]})]})}return o("div",{className:N("flex items-center gap-2 flex-wrap",n),children:e.map(u=>{switch(u.type){case"search":return o(bn,{placeholder:u.placeholder??"Search...",value:t[u.key]??"",onChange:d=>l(u.key,d.target.value),leftSlot:o(jt,{className:"h-3 w-3 text-foreground-subtle"}),className:"w-48"},u.key);case"select":return o(Nr,{options:u.options,value:t[u.key]??"",onChange:d=>l(u.key,d.target.value),className:"w-36"},u.key);case"badge-toggle":return o("div",{className:"flex items-center gap-1",children:u.options.map(d=>{const m=t[u.key]===d.value;return o("button",{type:"button",onClick:()=>l(u.key,m?void 0:d.value),children:o(Lt,{variant:m?"info":"default",className:"cursor-pointer",children:d.label})},d.value)})},u.key);default:return null}})})}function Lo({label:e,icon:t,href:r,badge:n,active:s=!1,className:a}){return f("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 f("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)=>f("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&&f("div",{className:"shrink-0 px-1 pb-1",children:[o(Za,{className:"mb-1"}),o("div",{className:"flex flex-col gap-0.5",onClick:n,children:r.map(a=>o(Lo,{...a},a.href))})]})]})}function Yb({sidebar:e,header:t,mobileLogo:r,mobileActions:n,children:s,className:a}){const i=Pr(),[l,c]=S(!1);return f("div",{className:N("flex h-screen",a),children:[!i&&o(Oo,{...e,className:N("w-44",e.className)}),i&&o(gp,{open:l,onClose:()=>c(!1),width:"w-64",children:o(Oo,{...e,onNavigate:()=>c(!1),className:"w-full border-r-0"})}),f("div",{className:"flex flex-1 flex-col min-w-0",children:[i&&f("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(Rd,{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&&f("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((u,d)=>{const m=d===t.breadcrumbs.length-1;return f("span",{className:"flex items-center gap-1",children:[d>0&&o(st,{className:"h-3 w-3 text-foreground-subtle shrink-0"}),u.href&&!m?o("a",{href:u.href,className:"text-foreground-subtle hover:text-foreground transition-colors truncate",children:u.label}):o("span",{className:"text-foreground truncate",children:u.label})]},d)})}),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 Lp={online:"bg-success",offline:"bg-danger",warning:"bg-warning",unknown:"bg-foreground-subtle"};function Xb({title:e,subtitle:t,status:r,selected:n,onClick:s,badges:a,actions:i,offlineAction:l,className:c}){const u=r==="offline";return f("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",u&&!n&&"opacity-50",c),children:[f("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",Lp[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((d,m)=>{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",d.onClick&&"hover:opacity-80 transition-opacity cursor-pointer");return d.onClick?f("button",{onClick:g=>{g.stopPropagation(),d.onClick()},className:h,children:[d.icon,d.label]},m):f("span",{className:h,children:[d.icon,d.label]},m)})}),!u&&i&&i.length>0&&o("div",{className:"flex items-center gap-0.5 mt-2 -mb-1",children:i.map((d,m)=>o("button",{onClick:h=>{h.stopPropagation(),d.onClick()},className:"p-1 rounded hover:bg-surface-hover text-foreground-subtle hover:text-foreground transition-colors",title:d.label,"aria-label":d.label,children:d.icon},m))}),u&&l&&o("div",{className:"mt-2",onClick:d=>d.stopPropagation(),children:l})]})}function Jb({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 Op="capability.binding-changed";function _r(e,t){const[r,n]=S(null);return Q(()=>{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:Op},{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]),J(()=>r?pl(e,r):null,[e,r])}function bi(e){const t=I(n=>e?e.subscribe(()=>n()):()=>{},[e]),r=I(()=>e?.value,[e]);return Pn(t,r,r)}function $p(e,t,r){const n=_r(e,t);return bi(n?r(n.state):void 0)}function Zt(e){const t=_r(e.trpc,e.deviceId),r=bi(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 ev(e){return e.parentDeviceId===null?"top-level":e.role?"accessory":"adopted"}var Bp={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 zp(e){const t=Bp[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 Fp={siren:Er,floodlight:Ba,spotlight:Ha,"pir-sensor":Ga,chime:_d,autotrack:_a,nightvision:Gn,"privacy-mask":La,doorbell:Ia},Gp={camera:Fn,hub:hn,nvr:hn,light:Ba,siren:Er,switch:Vd,sensor:Ga,thermostat:Ud,button:bd,generic:Qn};function vi(e){return e.role?Fp[e.role]??Qn:Gp[e.type.toLowerCase()]??Fn}var yi={"native-snapshot":Cd,"two-way-audio":za,"pan-tilt-zoom":_a,"ptz-autotrack":Pd,"doorbell-button":Ia,"motion-trigger":et,"battery-operated":Pa,rebootable:Qa},xi={"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"},jp={"native-snapshot":"snapshot",rebootable:"reboot","pan-tilt-zoom":"ptz","ptz-autotrack":"ptz-autotrack","two-way-audio":"intercom","motion-trigger":"motion-trigger"},wi=new Set(["camera","hub","nvr"]);function ki(e){return!wi.has(e.type.toLowerCase())}function $o(e){return e.role?!0:!wi.has(e.type.toLowerCase())}function Ni(e){return(e.features??[]).includes("motion-trigger")}function Qp(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 Hp({trpc:e,accessoryChildren:t,adoptedChildren:r,onNavigate:n}){return f("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 f("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(Up,{trpc:e,child:s,onNavigate:n},s.id))})]})}function Up({trpc:e,child:t,onNavigate:r}){const n=!t.disabled,s=n&&ki(t),a=n&&Ni(t);return o("li",{children:f("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(vi(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(qp,{trpc:e,deviceId:t.id,features:t.features}),s&&o(Vp,{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 Vp({trpc:e,deviceId:t}){const{dev:r,cap:n,slice:s,available:a}=Zt({trpc:e,deviceId:t,cap:m=>m.switch,slice:m=>m.state.switch}),[i,l]=S(!1);if(r!==null&&!n)return null;const c=s?.on===!0,u={transform:c?"translateX(14px)":"translateX(2px)"},d=async m=>{if(m.stopPropagation(),!(i||!a||!n)){l(!0);try{await n.setState({on:!c})}finally{l(!1)}}};return o("button",{type:"button",onClick:m=>{d(m)},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:u})})}function qp({trpc:e,deviceId:t,features:r}){const{dev:n,cap:s,slice:a,available:i}=Zt({trpc:e,deviceId:t,cap:m=>m.motionTrigger,slice:m=>m.state.motionTrigger,requireFeature:"motion-trigger",deviceFeatures:r}),[l,c]=S(!1);if(n!==null&&!s)return null;const u=a?.enabled===!0,d=async m=>{if(m.stopPropagation(),!(l||!i||!s)){c(!0);try{await s.setMotionTrigger({enabled:!u})}finally{c(!1)}}};return o("button",{type:"button",onClick:m=>{d(m)},disabled:l||!i,className:N("inline-flex h-4 w-4 items-center justify-center rounded transition-colors flex-shrink-0",u?"text-primary bg-primary/10":"text-foreground-subtle hover:text-foreground hover:bg-surface-hover",(l||!i)&&"opacity-50"),title:i?u?"Motion-trigger: on (click to disable)":"Motion-trigger: off (click to enable)":"Awaiting state…","aria-pressed":u,children:o(et,{className:"h-2.5 w-2.5"})})}function Si({trpc:e,device:t,flags:r}){if(t.disabled)return null;const n=t.type.toLowerCase(),s=r.showSwitchToggle&&ki(t),a=Ni(t),i=n==="hub"||n==="nvr",l=(t.features??[]).includes("rebootable"),c=i&&l;return f(Ne,{children:[a&&o(Kp,{trpc:e,deviceId:t.id,features:t.features}),s&&o(Wp,{trpc:e,deviceId:t.id}),c&&o(Yp,{trpc:e,deviceId:t.id})]})}function Wp({trpc:e,deviceId:t}){const{dev:r,cap:n,slice:s,available:a}=Zt({trpc:e,deviceId:t,cap:m=>m.switch,slice:m=>m.state.switch}),[i,l]=S(!1);if(r!==null&&!n)return null;const c=s?.on===!0,u={transform:c?"translateX(14px)":"translateX(2px)"},d=async m=>{if(m.stopPropagation(),!(i||!a||!n)){l(!0);try{await n.setState({on:!c})}finally{l(!1)}}};return o("button",{type:"button",onClick:m=>{d(m)},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:u})})}function Kp({trpc:e,deviceId:t,features:r}){const{dev:n,cap:s,slice:a,available:i}=Zt({trpc:e,deviceId:t,cap:m=>m.motionTrigger,slice:m=>m.state.motionTrigger,requireFeature:"motion-trigger",deviceFeatures:r}),[l,c]=S(!1);if(n!==null&&!s)return null;const u=a?.enabled===!0,d=async m=>{if(m.stopPropagation(),!(l||!i||!s)){c(!0);try{await s.setMotionTrigger({enabled:!u})}finally{c(!1)}}};return o("button",{type:"button",onClick:m=>{d(m)},disabled:l||!i,className:N("inline-flex h-4 w-4 items-center justify-center rounded transition-colors flex-shrink-0",u?"text-primary bg-primary/10":"text-foreground-subtle hover:text-foreground hover:bg-surface-hover",(l||!i)&&"opacity-50"),title:i?u?"Motion-trigger: on (click to disable)":"Motion-trigger: off (click to enable)":"Awaiting state…","aria-pressed":u,children:o(et,{className:"h-2.5 w-2.5"})})}var Ur=168,Zp=4;function Yp({trpc:e,deviceId:t}){const{dev:r,cap:n}=Zt({trpc:e,deviceId:t,cap:x=>x.reboot,slice:()=>{}}),s=q(null),a=q(null),[i,l]=S(null),[c,u]=S(!1),d=r!==null&&n!==void 0&&n!==null,m=i!==null,h=()=>l(null),g=()=>{const x=s.current;if(!x)return;const y=x.getBoundingClientRect(),w=y.right-Ur,k=Math.max(8,Math.min(w,window.innerWidth-Ur-8));l({top:y.bottom+Zp,left:k})};if(Q(()=>{if(!m)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)}},[m]),r!==null&&!n)return null;const b=x=>{x.stopPropagation(),m?h():g()},v=async()=>{if(!(c||!d||!n)){u(!0),h();try{await n.reboot({})}finally{u(!1)}}};return f(Ne,{children:[o("button",{ref:s,type:"button",onClick:b,disabled:c||!d,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||!d)&&"opacity-50",m&&"bg-surface-hover text-foreground"),title:"More actions","aria-label":"More actions","aria-haspopup":"menu","aria-expanded":m,children:o(Ta,{className:"h-3 w-3"})}),i&&Cr(o("div",{ref:a,role:"menu",style:{position:"fixed",top:i.top,left:i.left,width:Ur},className:"z-[9999] rounded-md border border-border bg-surface shadow-lg shadow-black/30 p-1",onClick:x=>x.stopPropagation(),children:f("button",{type:"button",role:"menuitem",onClick:()=>{v()},disabled:c||!d,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(Qa,{className:"h-3 w-3 shrink-0 text-foreground-subtle"}),o("span",{children:"Reboot device"})]})}),document.body)]})}var Xp=Object.freeze([]);function Jp(e){return e==="native"?"native":"enhanced"}function em(e){return e.map(t=>({kind:"marker",feature:t}))}function tm(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=jp[a];if(i===void 0){s.push({kind:"marker",feature:a});continue}const l=r.get(i);l&&s.push({kind:Jp(l.kind),feature:a,capName:i})}return s}function rm(e,t,r){const[n,s]=S(null),[a,i]=S(!1),[l,c]=S(!0);return Q(()=>{if(t===null){s(null),i(!1),c(!1);return}let u=!1;c(!0),i(!1);const d=async()=>{try{const h=await e.deviceManager.getBindings.query({deviceId:t});if(u)return;s(h),c(!1)}catch{if(u)return;i(!0),c(!1)}};d();const m=e.live?.onEvent.subscribe({category:"capability.binding-changed"},{onData:h=>{const g=h.data?.source;if(!g){d();return}g.type==="device"&&g.id===t&&d()}});return()=>{u=!0,m?.unsubscribe()}},[e,t]),r.length===0?{loading:l,resolved:Xp}:l||a||!n?{loading:l,resolved:em(r)}:{loading:!1,resolved:tm(r,n)}}var nm=[];function Ci({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??nm,u=a&&c.length>0,{resolved:d}=rm(e,u?t.id:null,c),m=u&&d.length>0;return!l&&!m?null:f("div",{className:"flex items-center gap-1.5 flex-nowrap whitespace-nowrap min-w-0",children:[l&&o(om,{accessoryCount:n,adoptedCount:s}),m&&o(sm,{resolved:d})]})}function om({accessoryCount:e,adoptedCount:t}){const r=e+t;return r===0?null:f("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 Mi=240,zo=200;function sm({resolved:e}){const t=q(null),[r,n]=S(null);return f("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-Mi-8))})},onMouseLeave:()=>n(null),children:[e.map(i=>{const l=yi[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:xi[i.feature]??i.feature,children:o(l,{className:"h-2.5 w-2.5"})},i.feature):null}),r&&Cr(o(am,{resolved:e,position:r}),document.body)]})}function am({resolved:e,position:t}){return f("div",{style:{position:"fixed",top:t.top,left:t.left,width:Mi,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(im,{entry:r},r.feature))})]})}function im({entry:e}){const t=yi[e.feature],r=xi[e.feature]??e.feature;return f("li",{className:"flex items-center justify-between gap-2 text-[10px]",children:[f("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(lm,{kind:e.kind})]})}function lm({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 Ei({device:e,variant:t,flags:r,parent:n,integrationIcon:s,hasChildren:a,expanded:i,onToggleExpand:l,onNavigateToParent:c}){const u=vi(e);return f("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[r.showChildrenAccordion&&a?o("button",{type:"button",onClick:d=>{d.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(mt,{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(u,{className:N("text-foreground-subtle flex-shrink-0",t==="minimal"?"h-3 w-3":"h-3.5 w-3.5")}),f("div",{className:"flex-1 min-w-0",children:[f("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)&&f("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&&f("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:Qp(e.stableId)})]}),r.showParentBadge&&n&&f("button",{type:"button",onClick:d=>{d.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(hn,{className:"h-2.5 w-2.5 shrink-0"}),f("span",{className:"truncate",children:["Under: ",n.name]})]})]})]})}function cm(e,t){return $p(e,t,r=>r.battery)??null}function um(e,t){const r=_r(e,t),n=q(!1),{data:s,isLoading:a,isFetching:i,refetch:l}=hs({queryKey:["device",t,"snapshot"],queryFn:()=>{if(!r)throw new Error("useDeviceSnapshotImage: device proxy not ready");const d=n.current;return n.current=!1,r.snapshot?.getSnapshot({force:d})??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 u(){n.current=!0,l()}return{src:c,loading:a||i,refresh:u}}function dm(e){return e<=10?ud:e<=30?cd:e>=95?ld:Pa}function pm(e,t){return t!=="none"?"text-emerald-400":e<=10?"text-rose-400":e<=30?"text-amber-400":"text-foreground-subtle"}function mm({status:e,variant:t="compact",className:r}){if(!e)return null;const n=dm(e.percentage),s=pm(e.percentage,e.charging),a=e.charging==="solar"?Ha:e.charging==="dc"?Td:null,i=e.sleeping;return f("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"}),f("span",{children:[Math.round(e.percentage),"%"]}),a&&o(a,{className:"h-3 w-3"}),i&&o(Gn,{className:"h-3 w-3 text-blue-300"}),t==="full"&&e.charging!=="none"&&o("span",{className:"text-foreground-subtle",children:e.charging})]})}function Ai({trpc:e,device:t,status:r,enabled:n,showStatusPills:s=!1}){const a=um(e,n&&t.online?t.id:null),i=(t.features??[]).includes("battery-operated"),l=s&&i&&!t.disabled,c=cm(e,l?t.id:null);return!n&&!l?null:f("span",{className:"inline-flex items-center gap-1.5 flex-nowrap whitespace-nowrap",children:[l&&c&&o(mm,{status:c}),n&&o(fm,{deviceName:t.name,snapshotUrl:a.src,status:r})]})}var Vr=288,Fo=196,qr=8;function fm({deviceName:e,snapshotUrl:t,status:r}){const n=q(null),[s,a]=S(null),i=r==="offline"||r==="disabled",l=()=>{const u=n.current;if(!u)return;const d=u.getBoundingClientRect(),m=d.top,h=window.innerHeight-d.bottom,g=m<Fo+qr&&h>m,b=g?d.bottom+qr:d.top-Fo-qr,v=d.right-Vr;a({top:b,left:Math.max(8,Math.min(v,window.innerWidth-Vr-8)),placeBelow:g})},c=()=>a(null);return f(Ne,{children:[o("button",{ref:n,type:"button",onClick:u=>u.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(qt,{className:"h-3.5 w-3.5"})}),s&&Cr(f("div",{style:{position:"fixed",top:s.top,left:s.left,width:Vr,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 Pi({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=zp(e),c=e.variant??"compact",u=e.view??"card",d=!r.disabled,m=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),E=d?r.online?"online":"offline":"disabled";return u==="table"?o(gm,{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:E,isCamera:m,showSnapshot:l.showSnapshot&&m,isAccessoryRow:e.isAccessoryRow??!1,indentLevel:C,className:i}):f("div",{className:N("rounded-lg border border-border bg-surface transition-colors",!d&&"opacity-60",i),children:[f("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(Ei,{device:r,variant:c,flags:l,parent:n??null,integrationIcon:s??null,hasChildren:v,expanded:w,onToggleExpand:k,onNavigateToParent:M}),o(Ci,{trpc:t,device:r,flags:l,accessoryCount:g.length,adoptedCount:b.length,showFeatureRow:!1}),o(Ai,{trpc:t,device:r,status:E,enabled:l.showSnapshot&&m,showStatusPills:!0}),o(Si,{trpc:t,device:r,flags:l}),o(Pi,{status:E})]}),w&&v&&o(Hp,{trpc:t,accessoryChildren:g,adoptedChildren:b,onNavigate:M})]})}var hm={0:"pl-2",1:"pl-6",2:"pl-8"};function gm(e){const{trpc:t,device:r,variant:n,flags:s,parent:a,integrationIcon:i,accessoryCount:l,adoptedCount:c,hasChildren:u,expanded:d,onToggleExpand:m,onNavigate:h,displayStatus:g,isCamera:b,showSnapshot:v,isAccessoryRow:x,indentLevel:y,className:w}=e;return f("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",hm[y]),children:o(Ei,{device:r,variant:n,flags:s,parent:a,integrationIcon:i,hasChildren:u,expanded:d,onToggleExpand:m,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(Ci,{trpc:t,device:r,flags:s,accessoryCount:l,adoptedCount:c,showFeatureRow:!0})}),o("td",{className:"px-2 py-2 align-middle",children:o(Ai,{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:f("span",{className:"inline-flex items-center gap-1.5",children:[o(Si,{trpc:t,device:r,flags:s}),o(Pi,{status:g})]})})]})}function bm(e,t){const[r,n]=S(e);return Q(()=>{const s=setTimeout(()=>n(e),t);return()=>clearTimeout(s)},[e,t]),r}var vm=new Set(["hub","nvr"]);function ym(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(vm.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 Go=2;function xm(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-Go),s=Math.min(t-1,e+Go);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 wm({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=xm(e,a);return f("div",{className:"flex items-center justify-between gap-4 flex-wrap pt-2 text-[11px] text-foreground-subtle",children:[f("span",{children:["Showing ",i,"–",l," of ",t," ",s]}),f("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(fd,{className:"h-3 w-3"})}),c.map((u,d)=>u.kind==="ellipsis"?o("span",{className:"px-1 text-foreground-subtle/60 select-none",children:"…"},`e-${d}`):o("button",{type:"button",onClick:()=>n(u.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",u.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:u.n},`p-${u.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 km({view:e,onViewChange:t,types:r,currentType:n,onTypeChange:s,addons:a,currentAddon:i,onAddonChange:l,hideAddons:c=!1}){return f("div",{className:"flex items-center gap-2 flex-wrap",children:[f("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(Ad,{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(Hd,{className:"h-3.5 w-3.5"})})]}),r&&r.length>0&&f(Ne,{children:[o(jo,{children:"Type"}),o(Wr,{active:n===null,onClick:()=>s(null),children:"All"}),r.map(u=>o(Wr,{active:n===u,onClick:()=>s(n===u?null:u),children:Nm(u)},u))]}),!c&&a&&a.length>0&&f(Ne,{children:[o(jo,{children:"Integration"}),a.map(u=>o(Wr,{active:i===u.id,icon:u.icon,onClick:()=>l(i===u.id?null:u.id),showClearIcon:i===u.id,children:u.name},u.id))]})]})}function jo({children:e}){return o("span",{className:"text-[10px] font-medium uppercase tracking-wider text-foreground-subtle ml-1",children:e})}function Wr({active:e,icon:t,onClick:r,showClearIcon:n,children:s}){return f("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(Pe,{className:"h-2.5 w-2.5 opacity-70"})]})}function Nm(e){return e.length===0?e:e[0].toUpperCase()+e.slice(1)}function Sm({variant:e,onClearFilters:t}){return f("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[o(Md,{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 Cm(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 Mm(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 Em(e){const{scope:t,defaultView:r,lsKey:n}=e,[s,a]=S(()=>Ho(t,r,Qo(n))),i=q(s);i.current=s,Q(()=>{const c=()=>{const u=Ho(t,r,Qo(n));i.current=u,a(u)};return window.addEventListener("popstate",c),()=>window.removeEventListener("popstate",c)},[t,r,n]);const l=I(c=>{const u=c(i.current);i.current=u,a(u),Mm(t,u,r),Cm(n,{view:u.view,addon:u.addon,type:u.type,q:u.q})},[t,r,n]);return{state:s,setView:I(c=>l(u=>({...u,view:c})),[l]),setPage:I(c=>l(u=>({...u,page:c})),[l]),setAddon:I(c=>l(u=>({...u,addon:c,page:1})),[l]),setType:I(c=>l(u=>({...u,type:c,page:1})),[l]),setQ:I(c=>l(u=>({...u,q:c,page:1})),[l]),clearFilters:I(()=>l(c=>({...c,addon:null,type:null,q:"",page:1})),[l])}}var Am={cards:24,table:50};function tv(e){const{devices:t,trpc:r,defaultView:n="table",filters:s,forceAddon:a,resolveIntegrationIcon:i,resolveParent:l,onNavigate:c,pageSize:u=Am,urlScope:d="root",lsKey:m=d==="root"?"devices":"integrations:nested"}=e,h=Em({scope:d,defaultView:n,lsKey:m}),g=h.state.view,b=g==="cards"?u.cards:u.table,[v,x]=S(h.state.q),y=bm(v,300);Q(()=>{y!==h.state.q&&h.setQ(y)},[y]);const w=a??h.state.addon,k=J(()=>{const ue=h.state.q.toLowerCase().trim();return t.filter(pe=>!(w&&pe.addonId!==w||h.state.type&&pe.type!==h.state.type||ue&&!pe.name.toLowerCase().includes(ue)&&!pe.stableId.toLowerCase().includes(ue)))},[t,w,h.state.type,h.state.q]),M=J(()=>ym(k),[k]),C=J(()=>{if(h.state.q.trim()==="")return new Set;const ue=h.state.q.toLowerCase().trim(),pe=new Set;for(const[ie,ne]of M.accessoriesByParent.entries())ne.some(W=>W.name.toLowerCase().includes(ue)||W.stableId.toLowerCase().includes(ue))&&pe.add(ie);return pe},[M.accessoriesByParent,h.state.q]),E=M.topLevel.length,_=Math.max(1,Math.ceil(E/b)),A=Math.min(h.state.page,_),H=(A-1)*b,oe=M.topLevel.slice(H,H+b);Q(()=>{A!==h.state.page&&h.setPage(A)},[A]),Dm();const le=w!=null||h.state.type!==null||h.state.q!=="",ge=E===0;return f("div",{className:"flex flex-col gap-3",children:[f("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[o(km,{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}),f("div",{className:"relative",children:[o(jt,{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:ue=>x(ue.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(Sm,{variant:le?"filtered":"nofilter",onClearFilters:le?h.clearFilters:void 0}):g==="cards"?o(Pm,{rows:oe,accessoriesByParent:M.accessoriesByParent,trpc:r,resolveIntegrationIcon:i??null,resolveParent:l??null,onNavigate:c??null}):o(Im,{rows:oe,accessoriesByParent:M.accessoriesByParent,autoExpandedParents:C,devices:k,trpc:r,resolveIntegrationIcon:i??null,resolveParent:l??null,onNavigate:c??null}),o(wm,{currentPage:A,totalItems:E,pageSize:b,onPageChange:h.setPage}),a===void 0&&le&&E>0&&f("p",{className:"text-[11px] text-foreground-subtle",children:["Showing ",E," of ",t.length," devices",w&&f(Ne,{children:[" ","· filtered by"," ",o("strong",{className:"text-primary",children:s?.addons?.find(ue=>ue.id===w)?.name??w})]})]})]})}function Pm({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 Rm=new Set(["hub","nvr"]);function _m(e,t){return e.parentDeviceId===null||t===null?0:Rm.has(t.toLowerCase())?1:0}function Im({rows:e,accessoriesByParent:t,autoExpandedParents:r,devices:n,trpc:s,resolveIntegrationIcon:a,resolveParent:i,onNavigate:l}){const c=J(()=>{const u=new Map;for(const d of n)u.set(d.id,d.type);return u},[n]);return o("div",{className:"rounded-lg border border-border bg-surface overflow-hidden",children:f("table",{className:"w-full border-collapse",children:[o("thead",{children:f("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(u=>{const d=t.get(u.id)??[],m=d.length>0,h=r.has(u.id),g=u.parentDeviceId!==null?i?.(u.parentDeviceId)??null:null,b=u.parentDeviceId!==null?c.get(u.parentDeviceId)??null:null;return o(Tm,{parent:u,accessories:d,hasAccessories:m,forceExpanded:h,trpc:s,integrationIcon:a?.(u.addonId)??null,parentRowParent:g,indentLevel:_m(u,b),onNavigate:l??null},u.id)})})]})})}function Tm({parent:e,accessories:t,hasAccessories:r,forceExpanded:n,trpc:s,integrationIcon:a,parentRowParent:i,indentLevel:l,onNavigate:c}){const[u,d]=S(n),m=q(n);return Q(()=>{m.current!==n&&(d(n),m.current=n)},[n]),f(Ne,{children:[o(xn,{trpc:s,device:e,view:"table",integrationIcon:a,parent:i,children:t,onNavigate:c??void 0,showChildrenAccordion:r,expanded:u,onToggleExpand:()=>d(g=>!g),indentLevel:l}),r&&u&&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 Dm(){Rn()}function rv({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 f("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(kd,{className:"h-3.5 w-3.5 shrink-0"}),n.label,n.isBest&&f("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(Qd,{className:"h-2.5 w-2.5"}),"Best"]}),n.platformScore!=null&&f("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 Lm(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(d=>d.addons).find(d=>d.id===i.addonId);let c=i.modelId;if(l&&!l.models.some(d=>d.id===c)){const d=l.defaultModelId;n.push(`Model "${c}" not available for ${i.addonId} — using "${d}"`),c=d}const u=i.children.map(d=>s(d)).filter(d=>d!==null);return{...i,modelId:c,children:u}}const a=e.map(i=>s(i)).filter(i=>i!==null);return{valid:n.length===0,steps:a,warnings:n}}function Om(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 Kr(e){return{addonId:e.id,addonName:e.name,slot:e.slot,inputClasses:[...e.inputClasses],outputClasses:[...e.outputClasses],enabled:!0,modelId:e.defaultModelId,children:[]}}function Zr({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:f("div",{className:"flex items-center gap-3",children:[o(yd,{className:"h-[18px] w-[18px] text-foreground-subtle/30 group-hover:text-primary/60 shrink-0"}),f("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}),f("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 nv({schema:e,steps:t,onChange:r,templates:n,selectedTemplateId:s,onSelectTemplate:a,onSaveTemplate:i,onUpdateTemplate:l,onDeleteTemplate:c,readOnly:u=!1,excludeAddons:d=[],hideTemplates:m=!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=J(()=>new Set(d),[d]),C=J(()=>Om(e),[e]),[E,_]=S([]),A=s?JSON.stringify(t)!==JSON.stringify(n.find(z=>z.id===s)?.steps):!1;function H(z){const B=z.target.value||null;if(B){const se=n.find(U=>U.id===B);se&&_([...Lm(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 ue(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=Kr(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(j=>j.id===B.slot)?.parentSlot==null,U=B.childSlots,K=new Set(z.children.map(j=>j.addonId)),Z=[];for(const j of e.slots)if(U.includes(j.id))for(const re of j.addons){if(K.has(re.id)||M.has(re.id))continue;const Y=re.inputClasses.length===0;Y&&!se||(Y||re.inputClasses.some(Re=>z.outputClasses.includes(Re)))&&Z.push(re)}return Z}function fe(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 f("div",{className:"space-y-1.5",children:[o(Qr,{step:B,schema:C.get(B.addonId)??null,allSchemas:C,onChange:ue,onDelete:u?void 0:U=>r(t.filter(K=>K.addonId!==U)),readOnly:u,...k(B.addonId)}),(B.children.length>0||se.length>0)&&f("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 f("div",{className:"space-y-1.5",children:[o(Qr,{step:U,schema:C.get(U.addonId)??null,allSchemas:C,depth:1,onChange:Z=>{ue({...B,children:B.children.map(j=>j.addonId===Z.addonId?Z:j)})},onDelete:u?void 0:Z=>{ue({...B,children:B.children.filter(j=>j.addonId!==Z)})},readOnly:u,...k(U.addonId)}),(U.children.length>0||K.length>0)&&f("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(Qr,{step:Z,schema:C.get(Z.addonId)??null,allSchemas:C,depth:2,onChange:j=>{ue({...B,children:B.children.map(re=>re.addonId===U.addonId?{...re,children:re.children.map(Y=>Y.addonId===j.addonId?j:Y)}:re)})},onDelete:u?void 0:j=>{ue({...B,children:B.children.map(re=>re.addonId===U.addonId?{...re,children:re.children.filter(Y=>Y.addonId!==j)}:re)})},readOnly:u,...k(Z.addonId)},Z.addonId)),!u&&K.map(Z=>o(Zr,{addon:Z,onClick:()=>{const j=Kr(Z);ue({...B,children:B.children.map(re=>re.addonId===U.addonId?{...re,children:[...re.children,j]}:re)})}},Z.id))]})]},U.addonId)}),!u&&se.map(U=>o(Zr,{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 f("div",{className:"space-y-4",children:[!m&&o("div",{className:"rounded-lg border border-border bg-surface p-3",children:f("div",{className:"flex items-center gap-2",children:[o("div",{className:"relative flex-1 min-w-0",children:f("select",{value:s??"",onChange:H,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))]})}),A&&o("span",{className:"h-1.5 w-1.5 rounded-full bg-amber-500 shrink-0"}),o("button",{onClick:oe,disabled:!s||u,title:"Save",className:N("p-2 rounded-lg border border-border transition-colors",s&&!u?"text-foreground-subtle hover:bg-surface-hover":"text-foreground-subtle/30 cursor-not-allowed"),children:o(Od,{className:"h-4 w-4"})}),o("button",{onClick:le,disabled:u,title:"Save As",className:N("p-2 rounded-lg border border-border transition-colors",u?"text-foreground-subtle/30 cursor-not-allowed":"text-foreground-subtle hover:bg-surface-hover"),children:o(wd,{className:"h-4 w-4"})}),o("button",{onClick:ge,disabled:!s||u,title:"Delete",className:N("p-2 rounded-lg border border-border transition-colors",s&&!u?"text-foreground-subtle hover:text-danger":"text-foreground-subtle/30 cursor-not-allowed"),children:o(qe,{className:"h-4 w-4"})})]})}),E.length>0&&f("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-3 text-xs text-amber-400 space-y-1",children:[f("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(Pe,{className:"h-3.5 w-3.5"})})]}),E.map((z,B)=>f("div",{children:["• ",z]},B))]}),T.map(z=>{const B=t.filter(j=>j.slot===z.id&&!M.has(j.addonId)),se=h?B.filter(j=>j.enabled):B,U=h?[]:z.addons.filter(j=>!W.has(j.id)&&!M.has(j.id)),K=new Map,Z=[];for(const j of se)j.group?(K.has(j.group)||K.set(j.group,[]),K.get(j.group).push(j)):Z.push(j);return f("div",{className:"space-y-2",children:[g&&f("span",{className:"text-[10px] font-semibold uppercase tracking-widest text-foreground-subtle/50",children:["Slot: ",z.label]}),Z.map(j=>fe(j)),[...K.entries()].map(([j,re])=>f("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:j}),re.map(Y=>fe(Y))]},j)),!u&&U.map(j=>o(Zr,{addon:j,onClick:()=>{r([...t,Kr(j)])}},j.id))]},z.id)})]})}var rr={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"],ov="#f59e42";function Be(e,t){if(t?.[e])return t[e];if(t?.[e.toLowerCase()])return t[e.toLowerCase()];if(rr[e])return rr[e];if(rr[e.toLowerCase()])return rr[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 sv({src:e,imageWidth:t,imageHeight:r,detections:n=[],classColors:s,aspectRatio:a,className:i,placeholder:l,showConfidence:c=!0,minConfidence:u=0,borderWidth:d=2}){function m(y){return Be(y,s)}const h=a??(t&&r?`${t}/${r}`:"16/9"),g=n.filter(y=>y.score>=u),b=g.filter(y=>y.kind==="first-level"),v=g.filter(y=>y.kind==="detail"),x=zm(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?f(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($m,{mask:y.debug.mask,maskWidth:y.debug.maskWidth,maskHeight:y.debug.maskHeight,bbox:y.bbox,imageWidth:t,imageHeight:r,color:m(y.macroClass)},`mask-${w}`):null),b.map(y=>{const w=x.get(y.id)??[];return o(Vo,{detection:y,imageWidth:t,imageHeight:r,color:m(y.macroClass),showConfidence:c,borderWidth:y.debug?.mask?1:d,children:w.map(k=>o(Bm,{child:k,parentBbox:y.bbox,color:m(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:m(y.macroClass),showConfidence:c,borderWidth:d},`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:u,height:d}=e.bbox,m=f("div",{className:"absolute left-0 flex flex-col items-start gap-px",style:{bottom:"100%",marginBottom:"2px"},children:[f("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)=>f("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 f("div",{className:"absolute rounded-sm",style:{left:`${l/t*100}%`,top:`${c/r*100}%`,width:`${u/t*100}%`,height:`${d/r*100}%`,borderWidth:`${a}px`,borderStyle:"solid",borderColor:n},children:[m,i]})}function $m({mask:e,maskWidth:t,maskHeight:r,bbox:n,imageWidth:s,imageHeight:a,color:i}){const l=q(null);return Q(()=>{const c=l.current;if(!c)return;const u=c.getContext("2d");if(!u)return;const d=atob(e),m=new Uint8Array(d.length);for(let y=0;y<d.length;y++)m[y]=d.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=u.createImageData(t,r),x=t*r;for(let y=0;y<x;y++){const w=y<m.length?m[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)}u.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 Bm({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:f("div",{className:"absolute left-0 flex flex-col items-start gap-px",style:{bottom:"100%",marginBottom:"1px"},children:[f("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,u)=>f("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-${u}`))]})})}function zm(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 av({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(d=>d.kind==="first-level"),l=e.filter(d=>d.kind==="detail"),c=new Map;for(const d of l){if(!d.parentId)continue;const m=c.get(d.parentId)??[];m.push(d),c.set(d.parentId,m)}const u=l.filter(d=>!d.parentId||!i.some(m=>m.id===d.parentId));return f("div",{className:r,children:[f("div",{className:"text-xs font-medium text-foreground-subtle uppercase tracking-wide mb-2",children:["Detections (",e.length,")"]}),f("div",{className:"space-y-2",children:[i.map(d=>o(qo,{detection:d,children_:c.get(d.id)??[],colors:a,hiddenKeys:n,onToggleVisibility:s},d.id)),u.map(d=>o(qo,{detection:d,children_:[],colors:a,hiddenKeys:n,onToggleVisibility:s},d.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,u=e.debug?.maskHeight,d=e.debug?.alternateLabels;return f("div",{className:`rounded-md border border-border bg-surface p-3 space-y-1 ${i?"":"opacity-40"}`,children:[f("div",{className:"flex justify-between items-center",children:[f("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&&u&&f("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded bg-primary/10 text-primary",children:["mask ",c,"x",u]})]}),o(jm,{confidence:e.score})]}),f("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((m,h)=>f("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{backgroundColor:Be(m.label,r)+"20",color:Be(m.label,r)},children:[m.label,f("span",{className:"opacity-60",children:[(m.score*100).toFixed(0),"%"]}),m.detectionId&&f("span",{className:"opacity-40 text-[8px]",children:["→ ",m.detectionId]})]},h))}),d&&Object.keys(d).length>0&&o(Gm,{alternateLabels:d,colors:r}),t.length>0&&o(Fm,{items:t,colors:r,hiddenKeys:n,onToggleVisibility:s})]})}function Fm({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,u=s.debug?.maskHeight;return f("div",{className:`text-xs space-y-0.5 ${i?"":"opacity-40"}`,children:[f("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}),f("span",{className:"text-foreground-subtle",children:[(s.score*100).toFixed(0),"%"]}),l&&c&&u&&f("span",{className:"text-[9px] font-mono px-1 py-0.5 rounded bg-primary/10 text-primary",children:["mask ",c,"x",u]})]}),s.labels.length>0&&o("div",{className:"flex flex-wrap gap-1 ml-5 mt-0.5",children:s.labels.map((d,m)=>f("span",{className:"inline-flex items-center gap-0.5 text-[9px] font-medium px-1 py-0.5 rounded-full",style:{backgroundColor:Be(d.label,t)+"20",color:Be(d.label,t)},children:[d.label," ",f("span",{className:"opacity-60",children:[(d.score*100).toFixed(0),"%"]})]},m))})]},s.id)})})}function Gm({alternateLabels:e,colors:t}){const[r,n]=S(!1),s=Object.keys(e);return f("div",{className:"mt-1",children:[f("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:f("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)=>f("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,f("span",{className:"opacity-60",children:[(l.score*100).toFixed(1),"%"]})]},c))})]},a)})})]})}function jm({confidence:e}){return f("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 iv({timings:e,totalMs:t,className:r}){const n=Object.entries(e);return n.length===0&&t===void 0?null:f("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"}),f("div",{className:"space-y-1 text-xs",children:[n.map(([s,a])=>f("div",{className:"flex justify-between",children:[o("span",{className:"text-foreground-subtle",children:s}),f("span",{className:"font-mono text-foreground",children:[a.toFixed(1),"ms"]})]},s)),t!==void 0&&f("div",{className:"flex justify-between pt-1 border-t border-border font-medium text-foreground",children:[o("span",{children:"Total"}),f("span",{className:"font-mono",children:[t.toFixed(1),"ms"]})]})]})]})}function lv({images:e,selectedFilename:t,uploadedName:r,onSelect:n,onUpload:s,className:a,accept:i="image/*",uploadLabel:l="Upload..."}){const c=()=>{const u=document.createElement("input");u.type="file",u.accept=i,u.onchange=()=>{const d=u.files?.[0];if(!d)return;const m=new FileReader;m.onload=()=>{const h=m.result,g=h.split(",")[1];g&&s(g,d.name,h)},m.readAsDataURL(d)},u.click()};return f("div",{className:`flex flex-wrap items-center gap-2 ${a??""}`,children:[e.map(u=>o("button",{onClick:()=>n(u.filename),className:`px-3 py-1.5 text-xs rounded-md border transition-colors ${t===u.filename?"bg-primary text-primary-foreground border-primary":"bg-surface border-border text-foreground hover:border-primary/50"}`,children:u.id??u.filename.replace(/\.[^.]+$/,"")},u.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 nr="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 cv({runtime:e,backend:t,modelId:r,agentId:n="hub",runtimes:s,backends:a,models:i,agents:l=[],onRuntimeChange:c,onBackendChange:u,onModelChange:d,onAgentChange:m,layout:h="grid",className:g,showAgent:b=!1}){return f("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&&f("label",{className:"space-y-1",children:[o("span",{className:"text-xs font-medium text-foreground-subtle",children:"Agent"}),o("select",{value:n,onChange:v=>m?.(v.target.value),className:nr,children:l.map(v=>f("option",{value:v.id,children:[v.name," (",v.status,")"]},v.id))})]}),f("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:nr,children:s.map(v=>f("option",{value:v.value,disabled:!v.available,children:[v.label,v.available?"":" (unavailable)"]},v.value))})]}),f("label",{className:"space-y-1",children:[o("span",{className:"text-xs font-medium text-foreground-subtle",children:"Backend"}),o("select",{value:t,onChange:v=>u(v.target.value),className:nr,children:a.map(v=>f("option",{value:v.id,disabled:!v.available,children:[v.label,v.available?"":" (unavailable)"]},v.id))})]}),f("label",{className:"space-y-1",children:[o("span",{className:"text-xs font-medium text-foreground-subtle",children:"Model"}),o("select",{value:r,onChange:v=>d(v.target.value),className:nr,children:i.length===0?o("option",{value:"",children:"No compatible models"}):i.map(v=>f("option",{value:v.id,children:[v.name,v.downloaded?" ✓":""]},v.id))})]})]})}var Qm=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()}},Ri=class{constructor(e){this.generateIdentifier=e,this.kv=new Qm}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)}},Hm=class extends Ri{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 Um(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 Vm(e,t){const r=Um(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 br(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 qm=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return Vm(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},Wm=e=>Object.prototype.toString.call(e).slice(8,-1),_i=e=>typeof e>"u",Km=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),Zm=e=>typeof e=="string",Ym=e=>typeof e=="number"&&!isNaN(e),Xm=e=>typeof e=="boolean",Jm=e=>e instanceof RegExp,Ht=e=>e instanceof Map,Ut=e=>e instanceof Set,Ii=e=>Wm(e)==="Symbol",ef=e=>e instanceof Date&&!isNaN(e.valueOf()),Ti=e=>e instanceof Error,Ko=e=>typeof e=="number"&&isNaN(e),tf=e=>Xm(e)||Km(e)||_i(e)||Ym(e)||Zm(e)||Ii(e),rf=e=>typeof e=="bigint",nf=e=>e===1/0||e===-1/0,of=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),sf=e=>e instanceof URL,kn=e=>e.replace(/\\/g,"\\\\").replace(/\./g,"\\."),Yr=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 Di=[Ue(_i,"undefined",()=>null,()=>{}),Ue(rf,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):(console.error("Please add a BigInt polyfill."),e)),Ue(ef,"Date",e=>e.toISOString(),e=>new Date(e)),Ue(Ti,"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(Jm,"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)||nf(e),"number",e=>Ko(e)?"NaN":e>0?"Infinity":"-Infinity",Number),Ue(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),Ue(sf,"URL",e=>e.toString(),e=>new URL(e))];function Ir(e,t,r,n){return{isApplicable:e,annotation:t,transform:r,untransform:n}}var Li=Ir((e,t)=>Ii(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}),af=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),Oi=Ir(of,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const r=af[t[1]];if(!r)throw new Error("Trying to deserialize unknown typed array");return new r(e)});function $i(e,t){return e?.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var Bi=Ir($i,(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)}),zi=Ir((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)}),lf=[Bi,Li,zi,Oi],Zo=(e,t)=>{const r=Wo(lf,s=>s.isApplicable(e,t));if(r)return{value:r.transform(e,t),type:r.annotation(e,t)};const n=Wo(Di,s=>s.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation}},Fi={};Di.forEach(e=>{Fi[e.annotation]=e});var cf=(e,t,r)=>{if(rt(t))switch(t[0]){case"symbol":return Li.untransform(e,t,r);case"class":return Bi.untransform(e,t,r);case"custom":return zi.untransform(e,t,r);case"typed-array":return Oi.untransform(e,t,r);default:throw new Error("Unknown transformation: "+t)}else{const n=Fi[t];if(!n)throw new Error("Unknown transformation: "+t);return n.untransform(e,r)}},wt=(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 Gi(e){if(br(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(br(e,"prototype"))throw new Error("prototype is not allowed as a property");if(br(e,"constructor"))throw new Error("constructor is not allowed as a property")}var uf=(e,t)=>{Gi(t);for(let r=0;r<t.length;r++){const n=t[r];if(Ut(e))e=wt(e,+n);else if(Ht(e)){const s=+n,a=+t[++r]==0?"key":"value",i=wt(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(Gi(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=wt(n,l)}else if(Ht(n)){if(a===t.length-2)break;const l=+i,c=+t[++a]==0?"key":"value",u=wt(n,l);switch(c){case"key":n=u;break;case"value":n=n.get(u);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=wt(n,+s),i=r(a);a!==i&&(n.delete(a),n.add(i))}if(Ht(n)){const a=+t[t.length-2],i=wt(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 df(e,t,r,n){return Sn(t,(s,a)=>{e=Nn(e,a,i=>cf(i,s,n))},r),e}function pf(e,t,r){const n=ji(r);function s(a,i){const l=uf(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 mf=(e,t)=>Qt(e)||rt(e)||Ht(e)||Ut(e)||Ti(e)||$i(e,t);function ff(e,t,r){const n=r.get(e);n?n.push(t):r.set(e,[t])}function hf(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(Yr):r[Yr(a)]=i.map(Yr)}),n?wn(r)?[n]:[n,r]:wn(r)?void 0:r}var Qi=(e,t,r,n,s=[],a=[],i=new Map)=>{const l=tf(e);if(!l){ff(e,s,t);const g=i.get(e);if(g)return n?{transformedValue:null}:g}if(!mf(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(br(a,e))return{transformedValue:null};const c=Zo(e,r),u=c?.value??e,d=rt(u)?[]:{},m={};Pt(u,(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=Qi(g,t,r,n,[...s,b],[...a,e],i);d[b]=v.transformedValue,rt(v.annotations)?m[kn(b)]=v.annotations:Qt(v.annotations)&&Pt(v.annotations,(x,y)=>{m[kn(b)+"."+y]=x})});const h=wn(m)?{transformedValue:d,annotations:c?[c.type]:void 0}:{transformedValue:d,annotations:c?[c.type,m]:m};return l||i.set(e,h),h};function Hi(e){return Object.prototype.toString.call(e).slice(8,-1)}function Yo(e){return Hi(e)==="Array"}function gf(e){if(Hi(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function bf(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(!gf(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 bf(s,a,Cn(i,t),e,t.nonenumerable),s},{})}var de=class{constructor({dedupe:e=!1}={}){this.classRegistry=new Hm,this.symbolRegistry=new Ri(t=>t.description??""),this.customTransformerRegistry=new qm,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,r=Qi(e,t,this,this.dedupe),n={json:r.transformedValue};r.annotations&&(n.meta={...n.meta,values:r.annotations});const s=hf(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=df(s,n.values,n.v??0,this)),n?.referentialEqualities&&(s=pf(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)}};de.defaultInstance=new de;de.serialize=de.defaultInstance.serialize.bind(de.defaultInstance);de.deserialize=de.defaultInstance.deserialize.bind(de.defaultInstance);de.stringify=de.defaultInstance.stringify.bind(de.defaultInstance);de.parse=de.defaultInstance.parse.bind(de.defaultInstance);de.registerClass=de.defaultInstance.registerClass.bind(de.defaultInstance);de.registerSymbol=de.defaultInstance.registerSymbol.bind(de.defaultInstance);de.registerCustom=de.defaultInstance.registerCustom.bind(de.defaultInstance);de.allowErrorProps=de.defaultInstance.allowErrorProps.bind(de.defaultInstance);de.serialize;de.deserialize;de.stringify;de.parse;de.registerClass;de.registerCustom;de.registerSymbol;de.allowErrorProps;function vf({className:e}){return f("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 yf({className:e}){return f("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 xf({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 wf({onLogin:e,serverUrl:t,logoSrc:r,error:n,className:s}){const[a,i]=S(""),[l,c]=S(""),[u,d]=S(!1),[m,h]=S(!1),[g,b]=S(null),v=n??g,x=async y=>{if(y.preventDefault(),!m){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:f("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}),f("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}),f("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"})]}),f("div",{className:"space-y-1.5",children:[o("label",{className:"text-xs font-medium text-foreground-subtle",children:"Password"}),f("div",{className:"relative",children:[o("input",{type:u?"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:()=>d(y=>!y),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground",tabIndex:-1,children:u?o(yf,{className:"h-4 w-4"}):o(vf,{className:"h-4 w-4"})})]})]}),f("button",{type:"submit",disabled:m,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:[m&&o(xf,{className:"h-4 w-4 animate-spin"}),m?"Logging in...":"Log in"]})]})]})})}var Mn="camstack_dev_token",Ui=Ye(null);function uv(){const e=Ae(Ui);if(!e)throw new Error("useDevShell must be used within a DevShell");return e}function kf(){return typeof window>"u"?null:localStorage.getItem(Mn)}function Nf({className:e}){return f("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 Sf({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 Cf({children:e,serverUrl:t,title:r,token:n,onLogout:s}){const a=wl(),i=J(()=>[al({condition:h=>h.type==="subscription",true:il({client:ll({url:t.replace(/^http/,"ws")+"/trpc",connectionParams:()=>({token:n})}),transformer:de}),false:vs({url:`${t}/trpc`,transformer:de,headers:()=>({authorization:`Bearer ${n}`})})})],[t,n]),l=J(()=>bs({links:i}),[i]),c=J(()=>p.createClient({links:i}),[i]),u=J(()=>ml({serverUrl:t,token:n}),[t,n]);Q(()=>(u.init().catch(()=>{}),()=>{u.close()}),[u]);const d=J(()=>new ol,[]),m=J(()=>({trpc:l,token:n,logout:s}),[l,n,s]);return o(Rp,{system:u,children:o(p.Provider,{client:c,queryClient:d,children:o(sl,{client:d,children:o(Ui.Provider,{value:m,children:f("div",{className:"min-h-screen bg-background text-foreground",children:[f("div",{className:"flex items-center justify-between border-b border-border bg-surface px-4 py-2",children:[f("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})]}),f("div",{className:"flex items-center gap-2",children:[f("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(Nf,{className:"h-3.5 w-3.5"}):o(Sf,{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 Mf({children:e,serverUrl:t="https://localhost:4443",title:r}){const[n,s]=S(kf),a=I(async(l,c)=>{const u=await bs({links:[vs({url:`${t}/trpc`,transformer:de})]}).auth.login.mutate({username:l,password:c});if(!u.token)throw new Error("No token returned");localStorage.setItem(Mn,u.token),s(u.token)},[t]),i=I(()=>{localStorage.removeItem(Mn),s(null)},[]);return n?o(no,{children:o(Cf,{serverUrl:t,title:r,token:n,onLogout:i,children:e})}):o(no,{children:o(wf,{onLogin:a,serverUrl:t})})}function dv(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}rl(a).render($t(Mf,{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 Vi=ot("camstack:custom-field-renderers",{});function pv({renderers:e,children:t}){return o(Vi.Provider,{value:e,children:t})}function Ef(e){return Ae(Vi)[e]??null}var Kn=ot("camstack:device-context",null);function mv({deviceId:e,device:t,children:r}){const n={deviceId:e,device:t??null};return o(Kn.Provider,{value:n,children:r})}function Af(){return Ae(Kn)?.deviceId??null}function fv(){return Ae(Kn)?.device??null}var hv=p.accessories.getStatus.useQuery,gv=p.addonPages.listPages.useQuery,Pf=p.addons.list.useQuery,bv=p.addons.getLogs.useQuery,vv=p.addons.listPackages.useQuery,yv=p.addons.installPackage.useMutation,xv=p.addons.installFromWorkspace.useMutation,wv=p.addons.isWorkspaceAvailable.useQuery,kv=p.addons.listWorkspacePackages.useQuery,Nv=p.addons.uninstallPackage.useMutation,Sv=p.addons.reloadPackages.useMutation,Cv=p.addons.searchAvailable.useQuery,Mv=p.addons.listUpdates.useQuery,Ev=p.addons.updatePackage.useMutation,Av=p.addons.rollbackPackage.useMutation,Pv=p.addons.forceRefresh.useMutation,Rv=p.addons.restartServer.useMutation,_v=p.addons.getVersions.useQuery,Iv=p.addons.restartAddon.useMutation,Tv=p.addons.retryLoad.useMutation,Dv=p.addons.getAutoUpdateSettings.useQuery,Lv=p.addons.setAutoUpdateSettings.useMutation,Ov=p.addons.getAddonAutoUpdate.useQuery,$v=p.addons.setAddonAutoUpdate.useMutation,Bv=p.addons.applyAutoUpdateToAll.useMutation,zv=p.addons.custom.useMutation,Fv=p.addons.onAddonLogs.useSubscription,Gv=p.addonSettings.getGlobalSettings.useQuery,jv=p.addonSettings.updateGlobalSettings.useMutation,Qv=p.addonSettings.getDeviceSettings.useQuery,Hv=p.addonSettings.updateDeviceSettings.useMutation,Rf=p.addonWidgets.listWidgets.useQuery,Uv=p.alerts.emit.useMutation,Vv=p.alerts.update.useMutation,qv=p.alerts.list.useQuery,Wv=p.alerts.getUnreadCount.useQuery,Kv=p.alerts.markRead.useMutation,Zv=p.alerts.markAllRead.useMutation,Yv=p.alerts.dismiss.useMutation,Xv=p.audioAnalysis.resolveDeviceSettings.useQuery,Jv=p.audioAnalysis.getDeviceSettingsContribution.useQuery,ey=p.audioAnalysis.getDeviceLiveContribution.useQuery,ty=p.audioAnalysis.applyDeviceSettingsPatch.useMutation,ry=p.audioAnalyzer.analyseChunk.useMutation,ny=p.audioAnalyzer.classify.useQuery,oy=p.audioAnalyzer.isReady.useQuery,sy=p.audioAnalyzer.dispose.useMutation,ay=p.audioAnalyzer.reprobeAudioEngine.useMutation,iy=p.audioCodec.listSupportedCodecs.useQuery,ly=p.audioCodec.canHandle.useQuery,cy=p.audioCodec.createDecodeSession.useMutation,uy=p.audioCodec.createEncodeSession.useMutation,dy=p.audioCodec.closeSession.useMutation,py=p.audioCodec.pushEncodedFrame.useMutation,my=p.audioCodec.pullPcm.useQuery,fy=p.audioCodec.pushPcm.useMutation,hy=p.audioCodec.pullEncoded.useQuery,gy=p.audioCodec.flushEncode.useMutation,by=p.audioCodec.listActiveSessions.useQuery,vy=p.audioMetrics.getCurrentSnapshot.useQuery,yy=p.audioMetrics.getHistory.useQuery,xy=p.authentication.listProviders.useQuery,wy=p.authentication.setProviderEnabled.useMutation,ky=p.backup.listDestinations.useQuery,Ny=p.backup.trigger.useMutation,Sy=p.backup.list.useQuery,Cy=p.backup.listLocations.useQuery,My=p.backup.getEntries.useQuery,Ey=p.backup.restore.useMutation,Ay=p.backup.delete.useMutation,Py=p.backup.listArchives.useQuery,Ry=p.backup.upsertDestinationPolicy.useMutation,_y=p.backup.previewSchedule.useQuery,Iy=p.battery.getStatus.useQuery,Ty=p.brightness.setBrightness.useMutation,Dy=p.brightness.getStatus.useQuery,Ly=p.cameraCredentials.getCredentials.useQuery,Oy=p.cameraCredentials.getStatus.useQuery,$y=p.cameraStreams.getCameraStreams.useQuery,By=p.cameraStreams.getBrokerStreams.useQuery,_f=p.cameraStreams.getRtspEntries.useQuery,zy=p.decoder.supportsCodec.useQuery,Fy=p.decoder.getInfo.useQuery,Gy=p.decoder.createSession.useQuery,jy=p.decoder.destroySession.useQuery,Qy=p.decoder.pushPacket.useQuery,Hy=p.decoder.openStream.useQuery,Uy=p.decoder.pullFrames.useQuery,Vy=p.decoder.updateConfig.useQuery,qy=p.decoder.getStats.useQuery,Wy=p.decoder.listActiveSessions.useQuery,Ky=p.decoder.reprobeHwaccel.useMutation,Zy=p.detectionPipeline.getDeviceSettingsContribution.useQuery,Yy=p.detectionPipeline.getDeviceLiveContribution.useQuery,Xy=p.detectionPipeline.applyDeviceSettingsPatch.useMutation,Jy=p.deviceDiscovery.listDiscovered.useQuery,ex=p.deviceDiscovery.refreshDiscovery.useMutation,tx=p.deviceDiscovery.adoptDevice.useMutation,rx=p.deviceDiscovery.releaseDevice.useMutation,nx=p.deviceDiscovery.getStatus.useQuery,ox=p.deviceExport.getStatus.useQuery,sx=p.deviceExport.listSupportedDeviceKinds.useQuery,ax=p.deviceExport.listExposedDevices.useQuery,ix=p.deviceExport.exposeDevice.useMutation,lx=p.deviceExport.unexposeDevice.useMutation,cx=p.deviceExport.getDeviceSettingsContribution.useQuery,ux=p.deviceExport.getDeviceLiveContribution.useQuery,dx=p.deviceExport.applyDeviceSettingsPatch.useMutation,px=p.deviceManager.allocateDeviceId.useMutation,mx=p.deviceManager.registerDevice.useMutation,fx=p.deviceManager.removeDevice.useMutation,hx=p.deviceManager.persistConfig.useMutation,gx=p.deviceManager.loadConfig.useQuery,bx=p.deviceManager.loadRuntimeState.useQuery,vx=p.deviceManager.loadMeta.useQuery,yx=p.deviceManager.setName.useMutation,xx=p.deviceManager.setLocation.useMutation,wx=p.deviceManager.setMetadata.useMutation,kx=p.deviceManager.listLocations.useQuery,Nx=p.deviceManager.addLocation.useMutation,Sx=p.deviceManager.removeLocation.useMutation,Cx=p.deviceManager.setDisabled.useMutation,Mx=p.deviceManager.listPersistedByAddon.useQuery,If=p.deviceManager.listAll.useQuery,Ex=p.deviceManager.getDevice.useQuery,Ax=p.deviceManager.getChildren.useQuery,Px=p.deviceManager.getStreamSources.useQuery,Rx=p.deviceManager.getConfigSchema.useQuery,_x=p.deviceManager.getSettingsSchema.useQuery,Ix=p.deviceManager.updateConfig.useMutation,Tx=p.deviceManager.enable.useMutation,Dx=p.deviceManager.disable.useMutation,Lx=p.deviceManager.remove.useMutation,Ox=p.deviceManager.getStreamProfileMap.useQuery,$x=p.deviceManager.setStreamProfileMap.useMutation,Bx=p.deviceManager.probeStreams.useMutation,zx=p.deviceManager.getBindings.useQuery,Fx=p.deviceManager.getAllBindings.useQuery,Gx=p.deviceManager.setWrapperActive.useMutation,jx=p.deviceManager.listWrappersForCap.useQuery,Qx=p.deviceManager.listBindableCapsForDeviceType.useQuery,Hx=p.deviceManager.getDeviceSettingsAggregate.useQuery,Ux=p.deviceManager.getDeviceLiveInfoAggregate.useQuery,Vx=p.deviceManager.getDeviceAggregate.useQuery,qx=p.deviceManager.updateDeviceField.useMutation,Wx=p.deviceManager.updateDeviceFieldsBatch.useMutation,Kx=p.deviceManager.discoverDevices.useMutation,Zx=p.deviceManager.adoptDevice.useMutation,Yx=p.deviceManager.getCreationSchema.useQuery,Xx=p.deviceManager.createDevice.useMutation,Jx=p.deviceManager.testCreationField.useMutation,e0=p.deviceManager.testField.useMutation,t0=p.deviceManager.getDeviceStatusAggregate.useQuery,r0=p.deviceOps.getStreamSources.useQuery,n0=p.deviceOps.getConfigEntries.useQuery,o0=p.deviceOps.setConfig.useMutation,s0=p.deviceOps.removeDevice.useMutation,a0=p.deviceOps.getSettingsSchema.useQuery,i0=p.deviceProvider.start.useMutation,l0=p.deviceProvider.stop.useMutation,c0=p.deviceProvider.getStatus.useQuery,u0=p.deviceProvider.getDevices.useQuery,d0=p.deviceProvider.supportsDiscovery.useQuery,p0=p.deviceProvider.discoverDevices.useMutation,m0=p.deviceProvider.adoptDiscoveredDevice.useMutation,f0=p.deviceProvider.supportsManualCreation.useQuery,h0=p.deviceProvider.getChildCreationSchema.useQuery,g0=p.deviceProvider.createDevice.useMutation,b0=p.deviceProvider.testCreationField.useMutation,v0=p.deviceState.getSnapshot.useQuery,y0=p.deviceState.getCapSlice.useQuery,x0=p.deviceState.getAllSnapshots.useQuery,w0=p.deviceState.setCapSlice.useMutation,k0=p.deviceStatus.getStatus.useQuery,N0=p.doorbell.getStatus.useQuery,S0=p.events.getEvents.useQuery,C0=p.events.getEventThumbnail.useQuery,M0=p.events.getEventClipUrl.useQuery,E0=p.featureProbe.getStatus.useQuery,A0=p.integrations.list.useQuery,P0=p.integrations.get.useQuery,R0=p.integrations.getByAddonId.useQuery,_0=p.integrations.create.useMutation,I0=p.integrations.update.useMutation,T0=p.integrations.delete.useMutation,D0=p.integrations.getSettings.useQuery,L0=p.integrations.setSettings.useMutation,O0=p.integrations.getAvailableTypes.useQuery,$0=p.integrations.testConnection.useMutation,B0=p.intercom.startSession.useMutation,z0=p.intercom.handleAnswer.useMutation,F0=p.intercom.stopSession.useMutation,G0=p.intercom.startTalkSession.useMutation,j0=p.intercom.pushTalkPcm.useMutation,Q0=p.intercom.endTalkSession.useMutation,H0=p.intercom.getStatus.useQuery,U0=p.localNetwork.list.useQuery,V0=p.localNetwork.getPreferred.useQuery,q0=p.localNetwork.getConnectionEndpoints.useQuery,W0=p.localNetwork.getAllowedAddresses.useQuery,K0=p.localNetwork.setAllowedAddresses.useMutation,Z0=p.localNetwork.resetAllowlistToBestMatch.useMutation,Y0=p.meshNetwork.getStatus.useQuery,X0=p.meshNetwork.join.useMutation,J0=p.meshNetwork.startLogin.useMutation,e1=p.meshNetwork.leave.useMutation,t1=p.meshNetwork.logout.useMutation,r1=p.meshNetwork.listPeers.useQuery,n1=p.meshNetwork.testConnection.useMutation,o1=p.meshOrchestrator.listProviders.useQuery,s1=p.meshOrchestrator.joinProvider.useMutation,a1=p.meshOrchestrator.leaveProvider.useMutation,i1=p.meshOrchestrator.startLoginProvider.useMutation,l1=p.meshOrchestrator.logoutProvider.useMutation,c1=p.meshOrchestrator.listProviderPeers.useQuery,u1=p.metricsProvider.collectSnapshot.useQuery,d1=p.metricsProvider.getCached.useQuery,p1=p.metricsProvider.getCurrent.useQuery,m1=p.metricsProvider.getDiskSpace.useQuery,f1=p.metricsProvider.getGpuInfo.useQuery,h1=p.metricsProvider.getCpuTemperature.useQuery,g1=p.metricsProvider.getProcessStats.useQuery,b1=p.metricsProvider.listAddonInstances.useQuery,v1=p.metricsProvider.getAddonStats.useQuery,y1=p.metricsProvider.listNodeProcesses.useQuery,x1=p.metricsProvider.killProcess.useMutation,w1=p.motion.isDetected.useQuery,k1=p.motion.getStatus.useQuery,N1=p.motionDetection.analyze.useMutation,S1=p.motionDetection.removeCamera.useMutation,C1=p.motionDetection.reset.useMutation,M1=p.motionDetection.getDeviceSettingsContribution.useQuery,E1=p.motionDetection.getDeviceLiveContribution.useQuery,A1=p.motionDetection.applyDeviceSettingsPatch.useMutation,P1=p.motionTrigger.setMotionTrigger.useMutation,R1=p.motionTrigger.getStatus.useQuery,_1=p.mqttBroker.listBrokers.useQuery,I1=p.mqttBroker.getBrokerConfig.useQuery,T1=p.mqttBroker.addBroker.useMutation,D1=p.mqttBroker.removeBroker.useMutation,L1=p.mqttBroker.testConnection.useMutation,O1=p.mqttBroker.startEmbeddedBroker.useMutation,$1=p.mqttBroker.stopEmbeddedBroker.useMutation,B1=p.mqttBroker.getStatus.useQuery,z1=p.nativeObjectDetection.getStatus.useQuery,F1=p.networkQuality.getDeviceStats.useQuery,G1=p.networkQuality.getAllStats.useQuery,j1=p.networkQuality.reportClientStats.useMutation,Q1=p.nodes.topology.useQuery,H1=p.nodes.deployAddon.useMutation,U1=p.nodes.undeployAddon.useMutation,V1=p.nodes.restartAddon.useMutation,q1=p.nodes.restartProcess.useMutation,W1=p.nodes.restartNode.useMutation,K1=p.nodes.shutdownNode.useMutation,Z1=p.nodes.renameNode.useMutation,Y1=p.nodes.clusterAddonStatus.useQuery,X1=p.nodes.getNodeAddons.useQuery,J1=p.nodes.setProcessLogLevel.useMutation,ew=p.nodes.executeQuery.useMutation,tw=p.notificationOutput.send.useMutation,rw=p.notificationOutput.sendTest.useMutation,nw=p.osd.setOverlay.useMutation,ow=p.osd.getStatus.useQuery,sw=p.pipelineAnalytics.getActiveTracks.useQuery,aw=p.pipelineAnalytics.getTrack.useQuery,iw=p.pipelineAnalytics.listTracks.useQuery,lw=p.pipelineAnalytics.clearTracks.useMutation,cw=p.pipelineAnalytics.getMotionEvents.useQuery,uw=p.pipelineAnalytics.getObjectEvents.useQuery,dw=p.pipelineAnalytics.getAudioEvents.useQuery,pw=p.pipelineAnalytics.getEventMedia.useQuery,mw=p.pipelineAnalytics.getTrackMedia.useQuery,fw=p.pipelineAnalytics.getDeviceSettingsContribution.useQuery,hw=p.pipelineAnalytics.getDeviceLiveContribution.useQuery,gw=p.pipelineAnalytics.applyDeviceSettingsPatch.useMutation,bw=p.pipelineExecutor.getAvailableEngines.useQuery,vw=p.pipelineExecutor.getSelectedEngine.useQuery,yw=p.pipelineExecutor.getDefaultSteps.useQuery,xw=p.pipelineExecutor.reprobeEngine.useMutation,ww=p.pipelineExecutor.getVideoPipelineSteps.useQuery,kw=p.pipelineExecutor.setVideoPipelineSteps.useMutation,Nw=p.pipelineExecutor.getSchema.useQuery,Sw=p.pipelineExecutor.getGlobalSteps.useQuery,Cw=p.pipelineExecutor.getGlobalPipelineConfig.useQuery,Mw=p.pipelineExecutor.getOrchestratorConfigSchema.useQuery,Ew=p.pipelineExecutor.listTemplates.useQuery,Aw=p.pipelineExecutor.saveTemplate.useMutation,Pw=p.pipelineExecutor.updateTemplate.useMutation,Rw=p.pipelineExecutor.deleteTemplate.useMutation,_w=p.pipelineExecutor.getCapabilities.useQuery,Iw=p.pipelineExecutor.getAddonModels.useQuery,Tw=p.pipelineExecutor.downloadModel.useMutation,Dw=p.pipelineExecutor.deleteModel.useMutation,Lw=p.pipelineExecutor.detect.useQuery,Ow=p.pipelineExecutor.runPipeline.useMutation,$w=p.pipelineExecutor.runPipelineBatch.useMutation,Bw=p.pipelineExecutor.cacheFrameInPool.useMutation,zw=p.pipelineExecutor.inferCached.useMutation,Fw=p.pipelineExecutor.uncacheFrame.useMutation,Gw=p.pipelineExecutor.getEffectiveTuning.useQuery,jw=p.pipelineExecutor.listLoadedEngines.useQuery,Qw=p.pipelineExecutor.spinEngine.useMutation,Hw=p.pipelineExecutor.killEngine.useMutation,Uw=p.pipelineExecutor.listReferenceImages.useQuery,Vw=p.pipelineExecutor.getReferenceImage.useQuery,qw=p.pipelineExecutor.getReferenceAudioFiles.useQuery,Ww=p.pipelineExecutor.getReferenceAudio.useQuery,Kw=p.pipelineExecutor.getAudioCapabilities.useQuery,Zw=p.pipelineExecutor.runAudioTest.useMutation,Yw=p.pipelineExecutor.getDetectionConfigSchema.useQuery,Xw=p.pipelineOrchestrator.assignPipeline.useMutation,Jw=p.pipelineOrchestrator.unassignPipeline.useMutation,ek=p.pipelineOrchestrator.rebalance.useMutation,tk=p.pipelineOrchestrator.getPipelineAssignments.useQuery,rk=p.pipelineOrchestrator.getPipelineAssignment.useQuery,nk=p.pipelineOrchestrator.getAgentLoad.useQuery,ok=p.pipelineOrchestrator.getGlobalMetrics.useQuery,sk=p.pipelineOrchestrator.getCameraMetrics.useQuery,ak=p.pipelineOrchestrator.getCapabilityBindings.useQuery,ik=p.pipelineOrchestrator.setCapabilityBinding.useMutation,lk=p.pipelineOrchestrator.assignDecoder.useMutation,ck=p.pipelineOrchestrator.unassignDecoder.useMutation,uk=p.pipelineOrchestrator.getDecoderAssignments.useQuery,dk=p.pipelineOrchestrator.assignAudio.useMutation,pk=p.pipelineOrchestrator.unassignAudio.useMutation,mk=p.pipelineOrchestrator.getAudioAssignment.useQuery,fk=p.pipelineOrchestrator.getAudioNodeLoad.useQuery,hk=p.pipelineOrchestrator.getAudioAssignments.useQuery,gk=p.pipelineOrchestrator.getDecoderAssignment.useQuery,bk=p.pipelineOrchestrator.getAgentSettings.useQuery,vk=p.pipelineOrchestrator.listAgentSettings.useQuery,yk=p.pipelineOrchestrator.setAgentAddonDefaults.useMutation,xk=p.pipelineOrchestrator.removeAgentSettings.useMutation,wk=p.pipelineOrchestrator.getCameraSettings.useQuery,kk=p.pipelineOrchestrator.setCameraStepToggle.useMutation,Nk=p.pipelineOrchestrator.getCameraStepOverrides.useQuery,Sk=p.pipelineOrchestrator.setCameraStepOverride.useMutation,Ck=p.pipelineOrchestrator.setCameraPipelineForAgent.useMutation,Mk=p.pipelineOrchestrator.resolvePipeline.useQuery,Ek=p.pipelineOrchestrator.listTemplates.useQuery,Ak=p.pipelineOrchestrator.saveTemplate.useMutation,Pk=p.pipelineOrchestrator.updateTemplate.useMutation,Rk=p.pipelineOrchestrator.deleteTemplate.useMutation,_k=p.pipelineOrchestrator.getDeviceSettingsContribution.useQuery,Ik=p.pipelineOrchestrator.getDeviceLiveContribution.useQuery,Tk=p.pipelineOrchestrator.applyDeviceSettingsPatch.useMutation,Dk=p.pipelineRunner.attachCamera.useMutation,Lk=p.pipelineRunner.detachCamera.useMutation,Ok=p.pipelineRunner.reportMotion.useMutation,$k=p.pipelineRunner.getLocalLoad.useQuery,Bk=p.pipelineRunner.getLocalMetrics.useQuery,zk=p.pipelineRunner.getCameraMetrics.useQuery,Fk=p.pipelineRunner.getAllCameraMetrics.useQuery,Gk=p.pipelineRunner.getLocalCameras.useQuery,jk=p.platformProbe.getCapabilities.useQuery,Qk=p.platformProbe.getHardware.useQuery,Hk=p.platformProbe.resolveInferenceConfig.useQuery,Uk=p.platformProbe.resolveHwAccel.useQuery,Vk=p.platformProbe.getHardwareEncoders.useQuery,qk=p.platformProbe.refreshHardwareEncoders.useMutation,Wk=p.ptz.move.useMutation,Kk=p.ptz.continuousMove.useMutation,Zk=p.ptz.stop.useMutation,Yk=p.ptz.getPresets.useQuery,Xk=p.ptz.goToPreset.useMutation,Jk=p.ptz.goHome.useMutation,e2=p.ptz.getPosition.useQuery,t2=p.ptz.getStatus.useQuery,r2=p.ptzAutotrack.getStatus.useQuery,n2=p.ptzAutotrack.setEnabled.useMutation,o2=p.ptzAutotrack.getSettings.useQuery,s2=p.ptzAutotrack.setSettings.useMutation,a2=p.reboot.reboot.useMutation,i2=p.recording.getSegments.useQuery,l2=p.recording.getPlaybackUrl.useQuery,c2=p.recording.getThumbnailAt.useQuery,u2=p.recordingEngine.getStatus.useQuery,d2=p.recordingEngine.enable.useMutation,p2=p.recordingEngine.disable.useMutation,m2=p.recordingEngine.getConfig.useQuery,f2=p.recordingEngine.updateConfig.useMutation,h2=p.recordingEngine.getPlaylist.useQuery,g2=p.recordingEngine.getThumbnail.useQuery,b2=p.recordingEngine.getSegments.useQuery,v2=p.recordingEngine.getAvailability.useQuery,y2=p.recordingEngine.estimateStorage.useQuery,x2=p.recordingEngine.estimateGlobalStorage.useQuery,w2=p.recordingEngine.getStorageUsage.useQuery,k2=p.recordingEngine.setPolicy.useMutation,N2=p.recordingEngine.getPolicy.useQuery,S2=p.recordingEngine.getPolicyStatus.useQuery,C2=p.recordingEngine.getRetentionConfig.useQuery,M2=p.recordingEngine.updateRetentionConfig.useMutation,E2=p.recordingEngine.getMotionStats.useQuery,A2=p.remoteAccess.listProviders.useQuery,P2=p.remoteAccess.startProvider.useMutation,R2=p.remoteAccess.stopProvider.useMutation,_2=p.settingsStore.get.useQuery,I2=p.settingsStore.set.useMutation,T2=p.settingsStore.query.useQuery,D2=p.settingsStore.insert.useMutation,L2=p.settingsStore.update.useMutation,O2=p.settingsStore.delete.useMutation,$2=p.settingsStore.count.useQuery,B2=p.settingsStore.isEmpty.useQuery,z2=p.settingsStore.declareCollection.useMutation,F2=p.snapshot.getSnapshot.useQuery,G2=p.snapshot.invalidateCache.useMutation,j2=p.snapshot.getStatus.useQuery,Q2=p.snapshot.getDeviceSettingsContribution.useQuery,H2=p.snapshot.getDeviceLiveContribution.useQuery,U2=p.snapshot.applyDeviceSettingsPatch.useMutation,V2=p.snapshotProvider.supportsDevice.useQuery,q2=p.snapshotProvider.getSnapshot.useQuery,W2=p.storage.resolve.useQuery,K2=p.storage.write.useMutation,Z2=p.storage.read.useQuery,Y2=p.storage.exists.useQuery,X2=p.storage.list.useQuery,J2=p.storage.delete.useMutation,eN=p.storage.getAvailableSpace.useQuery,tN=p.storage.beginUpload.useMutation,rN=p.storage.writeChunk.useMutation,nN=p.storage.finalizeUpload.useMutation,oN=p.storage.abortUpload.useMutation,sN=p.storage.beginDownload.useMutation,aN=p.storage.readChunk.useQuery,iN=p.storage.endDownload.useMutation,lN=p.storage.listLocations.useQuery,cN=p.storage.getDefaultLocation.useQuery,uN=p.storage.upsertLocation.useMutation,dN=p.storage.deleteLocation.useMutation,pN=p.storage.testLocation.useQuery,mN=p.storage.listProviders.useQuery,fN=p.storage.testConfig.useQuery,hN=p.streamBroker.publishCameraStream.useMutation,gN=p.streamBroker.retractCameraStream.useMutation,bN=p.streamBroker.assignProfile.useMutation,vN=p.streamBroker.unassignProfile.useMutation,yN=p.streamBroker.listAllCameraStreams.useQuery,xN=p.streamBroker.listAllProfileSlots.useQuery,wN=p.streamBroker.getBrokerStats.useQuery,kN=p.streamBroker.listClients.useQuery,NN=p.streamBroker.killClient.useMutation,SN=p.streamBroker.restartProfile.useMutation,CN=p.streamBroker.getStreamUrl.useQuery,MN=p.streamBroker.getStreamWithCodec.useMutation,EN=p.streamBroker.releaseStreamWithCodec.useMutation,AN=p.streamBroker.getBroker.useQuery,PN=p.streamBroker.setPreBufferDuration.useMutation,RN=p.streamBroker.getPreBufferInfo.useQuery,_N=p.streamBroker.getRtspPort.useQuery,IN=p.streamBroker.getAllRtspEntries.useQuery,TN=p.streamBroker.getRtspEntry.useQuery,DN=p.streamBroker.regenerateRtspToken.useMutation,LN=p.streamBroker.setRtspEnabled.useMutation,ON=p.streamBroker.isRtspEnabled.useQuery,$N=p.streamBroker.getDeviceSettingsContribution.useQuery,BN=p.streamBroker.getDeviceLiveContribution.useQuery,zN=p.streamBroker.applyDeviceSettingsPatch.useMutation,FN=p.switch.setState.useMutation,GN=p.switch.getStatus.useQuery,jN=p.system.info.useQuery,QN=p.system.health.useQuery,HN=p.system.featureFlags.useQuery,UN=p.system.networkAddresses.useQuery,VN=p.system.getRetentionConfig.useQuery,qN=p.system.setRetentionConfig.useMutation,WN=p.system.forceRetentionCleanup.useMutation,KN=p.toast.onToast.useSubscription,ZN=p.turnOrchestrator.listProviders.useQuery,YN=p.turnOrchestrator.getAllServers.useQuery,XN=p.turnOrchestrator.setProviderEnabled.useMutation,JN=p.turnProvider.getTurnServers.useQuery,eS=p.userManagement.listUsers.useQuery,tS=p.userManagement.createUser.useMutation,rS=p.userManagement.updateUser.useMutation,nS=p.userManagement.deleteUser.useMutation,oS=p.userManagement.resetPassword.useMutation,sS=p.userManagement.setUserScopes.useMutation,aS=p.userManagement.validateCredentials.useMutation,iS=p.userManagement.listApiKeys.useQuery,lS=p.userManagement.createApiKey.useMutation,cS=p.userManagement.revokeApiKey.useMutation,uS=p.userManagement.validateApiKey.useMutation,dS=p.userManagement.createScopedToken.useMutation,pS=p.userManagement.revokeScopedToken.useMutation,mS=p.userManagement.validateScopedToken.useQuery,fS=p.userManagement.listScopedTokens.useQuery,hS=p.userManagement.setupTotp.useMutation,gS=p.userManagement.confirmTotp.useMutation,bS=p.userManagement.disableTotp.useMutation,vS=p.userManagement.getTotpStatus.useQuery,yS=p.userManagement.verifyTotp.useMutation,xS=p.webrtcSession.listStreams.useQuery,wS=p.webrtcSession.createSession.useMutation,kS=p.webrtcSession.handleOffer.useMutation,NS=p.webrtcSession.handleAnswer.useMutation,SS=p.webrtcSession.closeSession.useMutation,CS=p.webrtcSession.hasAdaptiveBitrate.useQuery,MS=p.zoneAnalytics.getCurrentSnapshot.useQuery,ES=p.zoneAnalytics.getZoneHistory.useQuery,AS=p.zoneAnalytics.getCameraHistory.useQuery,PS=p.zoneAnalytics.getUnzonedHistory.useQuery,RS=p.zoneRules.listRules.useQuery,_S=p.zoneRules.setRules.useMutation,IS=p.zones.listZones.useQuery,TS=p.zones.addZone.useMutation,DS=p.zones.removeZone.useMutation,LS=p.zones.updateZone.useMutation,qi=ot("camstack:widget-registry",null),Sr=new Map,or=new Map,Xo=new Set;function Tf(e){if(!e||typeof e!="object")return!1;const t=e.default;return t!==null&&typeof t=="object"}function Df(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 Lf(e,t){const r=Sr.get(e);if(r)return r;const n=or.get(e);if(n)return n;Xo.has(e)||(Xu(),qu([{name:e,entry:t,type:"module"}],{force:!1}),Xo.add(e));const s=Vu(`${e}/widgets`).then(a=>{if(!Tf(a)){const l=Df(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 Sr.set(e,i),or.delete(e),i}).catch(a=>{throw or.delete(e),a});return or.set(e,s),s}var Of=3e4,$f=2e3;function OS({children:e}){const t=Rn(),r=q(Date.now()),{data:n}=Rf(void 0,{staleTime:0,refetchOnMount:"always",refetchInterval:l=>{const c=l.state.data;return c&&c.length>0||Date.now()-r.current>=Of?!1:$f}});Rr("addon.widget-ready",()=>{t.invalidateQueries({queryKey:[["addonWidgets","listWidgets"]]})});const[s,a]=S(0);Q(()=>{if(!n)return;let l=!1;const c=new Set;for(const u of n){if(c.has(u.remoteName)||(c.add(u.remoteName),Sr.has(u.remoteName)))continue;const d=u.bundleUrl;Lf(u.remoteName,d).then(()=>{l||a(m=>m+1)}).catch(m=>{const h=m instanceof Error?m.message:String(m);(typeof globalThis<"u"?globalThis.console:void 0)?.error?.("[WidgetRegistry] Failed to load widget remote",{remoteName:u.remoteName,entryUrl:d,reason:h})})}return()=>{l=!0}},[n]);const i=J(()=>{const l=n??[],c=new Map;for(const d of l)c.set(`${d.addonId}/${d.stableId}`,d);const u=(d,m)=>({widgetId:d,addonId:m.addonId,stableId:m.stableId,label:m.label,description:m.description,icon:m.icon,remoteName:m.remoteName,bundleUrl:m.bundleUrl,hosts:m.hosts,requires:m.requires,defaultSize:m.defaultSize,allowedSizes:m.allowedSizes,defaultColumns:m.defaultColumns,defaultRows:m.defaultRows});return{resolve:d=>{const m=c.get(d);if(!m)return;const h=Sr.get(m.remoteName);if(!h)return null;const g=h[m.stableId];if(g)return g},metadata:d=>{const m=c.get(d);if(m)return u(d,m)},listAll:()=>{const d=[];for(const[m,h]of c)d.push(u(m,h));return d}}},[n,s]);return o(qi.Provider,{value:i,children:e})}function Bf(e){return Zn().resolve(e)}function zf(e){return Zn().metadata(e)}function $S(){return Zn().listAll()}function Zn(){const e=Ff();if(!e)throw new Error("useWidgetRegistry(): no <WidgetRegistryProvider> in tree");return e}function Ff(){return Gf(qi)}function Gf(e){return Ae(e)}function jf(e){const{widgetId:t,host:r="device-tab",config:n,deviceId:s,integrationId:a,instanceId:i,size:l,columns:c,rows:u}=e,d=Bf(t),m=zf(t),h=J(()=>i??t,[i,t]);if(d===void 0&&m===void 0)return o(sr,{widgetId:t,reason:"unknown"});if(d===void 0)return o(sr,{widgetId:t,reason:"missing-export"});if(d===null)return o(Qf,{});if(m){if(m.requires.deviceContext&&s===void 0)return o(sr,{widgetId:t,reason:"missing-device-context"});if(m.requires.integrationContext&&a===void 0)return o(sr,{widgetId:t,reason:"missing-integration-context"})}return o(d,{instanceId:h,host:r,config:n,deviceId:s,integrationId:a,size:l,columns:c,rows:u})}function Qf(){return f("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 sr({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 ht="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",Tr="block text-[11px] font-medium text-foreground mb-1",Hf="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 f("div",{className:i,children:[l!==void 0&&l!==""&&f("label",{className:Tr,children:[l,r&&o("span",{className:"text-danger ml-0.5",children:"*"})]}),s,c&&o("p",{className:Hf,children:c})]})}function Uf({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:ht,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 Vf({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const[a,i]=S(t==null?"":String(t)),l=q(!1);Q(()=>{l.current||i(t==null?"":String(t))},[t]);const c=u=>{if(i(u),u===""||u==="-"){r(void 0);return}const d=Number(u);Number.isNaN(d)||r(d)};return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:f("div",{className:"flex items-center gap-1",children:[o("input",{type:"number",className:ht,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:u=>c(u.target.value)}),e.unit&&o("span",{className:"text-xs text-foreground-subtle whitespace-nowrap",children:e.unit})]})})}function qf({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:f("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:f("div",{className:"flex items-center justify-between",children:[f("span",{className:Tr+" 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 Wf({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:f("select",{className:ht,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 Kf({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 f("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 Zf({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:f("div",{className:"relative",children:[o("input",{type:a?"text":"password",className:ht+(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(La,{className:"h-3.5 w-3.5"}):o(qt,{className:"h-3.5 w-3.5"})})]})})}function Yf({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:ht+" 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 Xf({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,u=e.nullLabel??"Auto",d=n||e.disabled,m=e.displayScale??1,h=e.min/m,g=e.max/m,b=l/m,v=(e.step??1)/m;if(i&&a)return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:f("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:d,onClick:()=>r(e.default??e.min),children:[u," — 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:f("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[f("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:d,onChange:k=>r(Number(k.target.value)*m)}),o("span",{className:"text-[10px] text-foreground-subtle tabular-nums shrink-0",children:g})]}),(c||i||e.unit)&&f("div",{className:"flex shrink-0 items-center gap-2",children:[x&&o("button",{type:"button",className:w,disabled:d||l<=e.min,onClick:()=>y(-1),title:`Decrease by ${e.step??1}`,"aria-label":"Decrement",children:o(Fa,{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:d,onChange:k=>{if(k.target.value===""){r(i?null:e.min);return}const M=Number(k.target.value)*m,C=e.step??1,E=M-e.min,_=e.min+Math.round(E/C)*C;r(Math.min(e.max,Math.max(e.min,_)))}}),x&&o("button",{type:"button",className:w,disabled:d||l>=e.max,onClick:()=>y(1),title:`Increase by ${e.step??1}`,"aria-label":"Increment",children:o(Wt,{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 ${u}`,disabled:d,onClick:()=>r(null),children:u})]})]})})}function Jf({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=Array.isArray(t)?t:[],[i,l]=S(""),c=q(null),u=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]),d=g=>r(a.filter(b=>b!==g)),m=g=>{g.key==="Enter"||g.key===","?(g.preventDefault(),u(i)):g.key==="Backspace"&&i===""&&a.length>0&&d(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:f("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=>f("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:()=>d(g),className:"hover:text-danger",children:o(Pe,{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:m,onBlur:()=>{i.trim()&&u(i)}}),e.suggestions&&o("datalist",{id:`tags-suggestions-${e.key}`,children:e.suggestions.map(g=>o("option",{value:g},g))})]})})}function eh({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:f("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=>f("option",{value:c.id,disabled:!c.isOnline,children:[c.shortName,c.isOnline?"":" (offline)"]},c.id))]})})}function th({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(u=>u.isOnline),c=u=>{const d=new Set(i);d.has(u)?d.delete(u):d.add(u),r([...d])};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(u=>{const d=i.has(u.id);return o("button",{type:"button",onClick:()=>c(u.id),disabled:n||!u.isOnline,className:`px-2.5 py-1 text-xs font-medium rounded-md border transition-colors ${d?"border-primary bg-primary/10 text-primary":"border-border bg-surface text-foreground-subtle hover:bg-surface-hover"} ${u.isOnline?"":"opacity-50 cursor-not-allowed"}`,children:u.shortName},u.id)})})})}function rh({field:e,value:t,onChange:r,disabled:n,translationFn:s}){const a=t==null?"#000000":String(t);return f(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:[f("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:ht+" 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 nh({field:e,value:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i,externalProbe:l}){const[c,u]=S("idle"),[d,m]=S(null),h=l?.status??c,g=l?.result??d,b=!!a||!!i,v=I(async()=>{if(b){u("probing"),m(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"};m(k),u(k.status==="ok"?"ok":"error")}catch(w){m({status:"error",error:w instanceof Error?w.message:String(w)}),u("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(je,{className:"h-3 w-3 animate-spin"}):h==="ok"?o(hd,{className:"h-3 w-3"}):h==="error"?o(Ar,{className:"h-3 w-3"}):o(Va,{className:"h-3 w-3"});return f(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,translationFn:s,children:[f("div",{className:"@container flex items-center gap-2",style:{containerType:"inline-size"},children:[f("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:ht+" 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"&&(u("idle"),m(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 oh({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:f("div",{className:"rounded-lg border border-border bg-surface/50 overflow-hidden",children:[f("div",{className:["px-3 py-2 flex items-center justify-between",c?"cursor-pointer hover:bg-surface":""].join(" "),onClick:c?()=>l(u=>!u):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(u=>o(Yt,{field:u,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a},u.key))})]})})}function sh({field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i}){const[l,c]=S(e.tabs[0]?.id??""),u=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:f("div",{className:u,children:[e.label&&o("div",{className:Tr,children:Qe(e.label,s)}),f("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(d=>{const m=d.id===l;return f("button",{type:"button",role:"tab","aria-selected":m,onClick:()=>c(d.id),className:`inline-flex items-center gap-1.5 whitespace-nowrap rounded-md px-2.5 py-1 text-[11px] transition-colors ${m?"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(d.label,s)}),d.badge&&o("span",{className:`text-[9px] px-1 py-0.5 rounded-full font-medium ${m?"bg-primary-foreground/20 text-primary-foreground":"bg-primary/10 text-primary"}`,children:d.badge})]},d.id)})}),e.tabs.map(d=>d.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:d.fields.map((m,h)=>{const g="key"in m&&typeof m.key=="string"?m.key:`__${d.id}__${h}`;return o(Yt,{field:m,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i},g)})},d.id))]})]})}function ah({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 ih(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 u=r.createTextNode(l.textContent??"");l.replaceWith(u);continue}const c=l.tagName==="A"?new Set(["href"]):new Set;for(const u of Array.from(l.attributes))c.has(u.name)||l.removeAttribute(u.name);if(l.tagName==="A"){const u=l.getAttribute("href")??"";!/^https?:\/\//i.test(u)&&!u.startsWith("mailto:")?l.removeAttribute("href"):(l.setAttribute("target","_blank"),l.setAttribute("rel","noopener noreferrer"))}s(l)}};return s(n),n.innerHTML}function lh({field:e}){const t=Jo[e.variant??"info"]??Jo.info,r=e.format==="html";return o("div",{className:"col-span-full",children:f("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:ih(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 ch(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 uh(e){return!Number.isFinite(e)||e<=0?"—":new Date(e).toLocaleTimeString()}function dh({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"?f("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:ch(t)}):e==="timestamp"&&typeof t=="number"?o("span",{className:"font-mono text-[11px]",children:uh(t)}):o("span",{children:String(t)})}function ph({field:e}){const t=e.value??[],r=e.description;return f("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:f("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(dh,{kind:a.kind,value:n[a.key]})},a.key))},s))})]})})]})}function mh({field:e,value:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:i}){const l=Array.isArray(t)?t:[],c=e.minRows??0,u=e.maxRows??Number.POSITIVE_INFINITY,d=(x,y,w)=>{const k=l.slice();k[x]={...k[x]??{},[y]:w},r(k)},m=x=>{l.length<=c||r(l.filter((y,w)=>w!==x))},h=()=>{if(l.length>=u)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<u;return f("div",{className:"col-span-full space-y-2",children:[f("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)=>f("div",{className:"rounded-md border border-border bg-background",children:[f("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)}),f("button",{type:"button",onClick:()=>m(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(Fa,{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(Yt,{field:w,values:x,onChange:(k,M)=>d(y,k,M),disabled:n,translationFn:s,onTestField:a,allFields:e.itemFields,onAction:i},w.key))})]},y))}),f("div",{children:[f("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(Wt,{className:"h-3 w-3"}),e.addLabel??"Add"]}),!v&&Number.isFinite(u)&&f("span",{className:"ml-2 text-[10px] text-foreground-subtle",children:["(limit: ",u,")"]})]})]})}function fh({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 Wi(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 hh({field:e,value:t,values:r,onChange:n,disabled:s,onAction:a}){const[i,l]=S(!1),[c,u]=S(null),[d,m]=S(null),h=Wi(e,r),g=Object.keys(e.paramsFromForm??{}).some(y=>h[y]===void 0);Q(()=>{if(!a||g){m(null),u(null);return}let y=!1;return l(!0),u(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 E=k[C];if(Array.isArray(E)){M=E;break}}m(M)}).catch(w=>{y||(u(w instanceof Error?w.message:String(w)),m([]))}).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?f("div",{className:"flex items-center gap-2 text-[11px] text-foreground-subtle",children:[o(je,{className:"h-3 w-3 animate-spin"})," Loading options…"]}):c?o("div",{className:"text-[11px] text-danger",children:c}):d&&d.length===0?o("div",{className:"text-[11px] text-foreground-subtle italic",children:e.emptyResultsMessage??"No options returned."}):(()=>{const y=(d??[]).some(w=>{const k=w[b];return k===""||k===void 0});return f("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 —"}),(d??[]).map((w,k)=>{const M=w[b],C=w[v],E=x?w[x]:void 0,_=typeof M=="string"&&M!==""?M:`row-${k}`;return f("option",{value:typeof M=="string"?M:String(M??""),children:[typeof C=="string"?C:String(C??_),E!==void 0?` (${String(E)})`:""]},_)})]})})()})}function gh({field:e,values:t,disabled:r,onAction:n}){const[s,a]=S(!1),[i,l]=S(null),c=Wn(),u=async()=>{if(e.confirmMessage&&!await c({title:e.label,message:e.confirmMessage,confirmLabel:e.buttonLabel,variant:e.variant==="danger"?"danger":"default"})||!n)return;const m=Wi(e,t);a(!0),l(null);try{const h=await n(e.action,e.key,m),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)}},d={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:f("div",{className:"flex flex-col gap-1.5",children:[o("button",{onClick:u,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 ${d[e.variant??"default"]??d.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 bh({field:e}){const t=Af();return o(Ce,{label:e.label,description:e.description,required:e.required,span:e.span,children:o(jf,{widgetId:e.widgetId,host:"device-tab",config:e.widgetConfig,deviceId:t??void 0,instanceId:e.key})})}function vh(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 yh({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=vh(i,"unit"in e?e.unit:void 0),c="label"in e?e.label:void 0,u="description"in e?e.description:void 0,d="span"in e?e.span:void 0,m="actions"in e?e.actions??[]:[];return o(Ce,{label:c,description:u,span:d,translationFn:n,children:f("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}),m.length>0&&o("div",{className:"flex items-center gap-1",children:m.map(h=>o(wh,{action:h,fieldKey:s,value:i,onAction:r},h.action))})]})})}function xh({name:e}){const t="h-3.5 w-3.5";switch(e){case"copy":return o(at,{className:t});case"refresh-cw":return o(jn,{className:t});case"external-link":return o(Da,{className:t});case"trash-2":return o(qe,{className:t});case"download":return o(fn,{className:t});case"upload":return o(Ua,{className:t});default:return o(Qn,{className:t})}}function wh({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(xh,{name:e.icon})})}function kh(e){return"multiple"in e&&e.multiple!=null}function Nh({field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,externalProbe:i,allFields:l,onAction:c}){const u=e.multiple,d=u.min,m=u.max,h=t[e.key],g=[...Array.isArray(h)?h:h!=null?[h]:[]],b=u.itemDefault!==void 0?u.itemDefault:"default"in e&&e.default!==void 0?e.default:"";for(;g.length<d;)g.push(b);const v=M=>r(e.key,[...M]),x=(M,C)=>{const E=[...g];E[M]=C,v(E)},y=()=>{g.length>=m||v([...g,b])},w=M=>{g.length<=d||v(g.filter((C,E)=>E!==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:d>0?e.required:!1,span:e.span,translationFn:s,children:f("div",{className:"space-y-2",children:[g.map((M,C)=>{const E=u.itemLabel?.replace("${n}",String(C+1));return f("div",{className:"space-y-1",children:[E&&o("div",{className:Tr,children:E}),f("div",{className:"flex items-center gap-2",children:[o("div",{className:"flex-1 min-w-0",children:o(Yt,{field:k(),values:{...t,[e.key]:M},onChange:(_,A)=>x(C,A),disabled:n,translationFn:s,onTestField:a,onAction:c,allFields:l})}),g.length>d&&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(qe,{className:"h-3.5 w-3.5"})})]})]},C)}),f("div",{className:"flex items-center justify-between pt-1",children:[g.length<m?f("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(Wt,{className:"h-3 w-3"}),u.addLabel??"Add"]}):o("span",{}),f("span",{className:"text-[10px] text-foreground-subtle tabular-nums",children:[g.length,"/",m]})]})]})})}function Sh(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 Yt({field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,externalProbe:i,allFields:l,onAction:c}){if(kh(e))return o(Nh,{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(yh,{field:e,values:t,onAction:c,translationFn:s});if(!Sh(e,t,l))return null;const u=t[e.key],d=u!==void 0?u:"default"in e?e.default:void 0,m=g=>r(e.key,g),h=Ef(e.type);switch(e.type){case"text":return o(Uf,{field:e,value:d,onChange:m,disabled:n,translationFn:s});case"number":return o(Vf,{field:e,value:d,onChange:m,disabled:n,translationFn:s});case"boolean":return o(qf,{field:e,value:d,onChange:m,disabled:n,translationFn:s});case"select":return o(Wf,{field:e,value:d,onChange:m,disabled:n,translationFn:s});case"multiselect":return o(Kf,{field:e,value:d,onChange:m,disabled:n,translationFn:s});case"password":return o(Zf,{field:e,value:d,onChange:m,disabled:n,translationFn:s});case"textarea":return o(Yf,{field:e,value:d,onChange:m,disabled:n,translationFn:s});case"slider":return o(Xf,{field:e,value:d,onChange:m,disabled:n,translationFn:s});case"tags":return o(Jf,{field:e,value:d,onChange:m,disabled:n,translationFn:s});case"color":return o(rh,{field:e,value:d,onChange:m,disabled:n,translationFn:s});case"node-select":return o(eh,{field:e,value:d,onChange:m,disabled:n,translationFn:s});case"node-multiselect":return o(th,{field:e,value:d,onChange:m,disabled:n,translationFn:s});case"probe":return o(nh,{field:e,value:d,onChange:m,disabled:n,translationFn:s,onTestField:a,onAction:c,externalProbe:i});case"group":return o(oh,{field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a});case"sub-tabs":return o(sh,{field:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,onAction:c});case"separator":return o(ah,{});case"info":return o(lh,{field:e});case"object-array":return o(ph,{field:e});case"editable-array":return o(mh,{field:e,value:d,onChange:m,disabled:n,translationFn:s,onTestField:a,onAction:c});case"button":return o(fh,{field:e,disabled:n,onAction:c});case"addon-action-select":return o(hh,{field:e,value:d,values:t,onChange:m,disabled:n,onAction:c});case"addon-action-button":return o(gh,{field:e,values:t,disabled:n,onAction:c});case"widget":return o(bh,{field:e});default:return h?o(h,{field:e,value:d,onChange:m,disabled:n}):null}}function Ch(e){return/^[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)+$/.test(e)}function Qe(e,t){if(e!==void 0)return t&&Ch(e)?t(e):e}function Mh({section:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,probeResults:i}){const[l,c]=S(e.defaultCollapsed??!1),u=e.style==="accordion",d=e.columns??2,m=d===1?"grid-cols-1":d===3?"grid-cols-1 @[480px]:grid-cols-2 @[880px]:grid-cols-3":d===4?"grid-cols-1 @[480px]:grid-cols-2 @[1140px]:grid-cols-4":"grid-cols-1 @[640px]:grid-cols-2";return f("div",{className:"@container rounded-lg border border-border bg-surface p-3",style:{containerType:"inline-size"},children:[f("div",{className:["flex items-center justify-between mb-2",u?"cursor-pointer":""].join(" "),onClick:u?()=>c(h=>!h):void 0,children:[f("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)})]}),u&&o("span",{className:"text-foreground-subtle text-xs ml-2",children:l?"▸":"▾"})]}),!l&&o("div",{className:`grid ${m} gap-x-3 gap-y-2.5`,children:e.fields.map(h=>o(Yt,{field:h,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,externalProbe:i?.[h.key]},h.key))})]})}function Eh({schema:e,values:t,onChange:r,disabled:n,translationFn:s,onTestField:a,probeResults:i,onClearProbe:l}){const c=(u,d)=>{r({...t,[u]:d}),l?.(u)};return o("div",{className:"space-y-4",children:e.sections.map(u=>o(Mh,{section:u,values:t,onChange:c,disabled:n,translationFn:s,onTestField:a,probeResults:i},u.id))})}var Ah=({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 Ph(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 BS({trpc:e,addonId:t,nodeId:r,title:n,disabled:s,onAfterChange:a,refreshToken:i,collapsible:l,defaultOpen:c,mode:u,onOverrideChange:d}){const m=u??"persist",[h,g]=S(null),[b,v]=S(!0),[x,y]=S(null),[w,k]=S(!1),[M,C]=S(c??!1),[E,_]=S({}),[A,H]=S(null);Q(()=>{H(null),_({})},[e,t,r,i,m]),Q(()=>{let ie=!1;v(!0),y(null);const ne=m==="override"&&Object.keys(E).length>0?E:void 0;return e.addonSettings.getGlobalSettings.query({addonId:t,nodeId:r,...ne?{overlay:ne}:{}}).then(W=>{ie||(g(W),ne||H(ts(W)),v(!1))}).catch(W=>{ie||(y(W instanceof Error?W.message:String(W)),v(!1))}),()=>{ie=!0}},[e,t,r,i,m,JSON.stringify(E)]);const oe=J(()=>ts(h),[h]),le=J(()=>h?Ph(h):null,[h]),ge=async ie=>{if(m==="override"){const W=A??oe,ye={};for(const T of Object.keys(ie))ie[T]!==W[T]&&(ye[T]=ie[T]);const fe={...W,...ye};_(ye),d?.(ye,fe);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 f("div",{className:"text-xs text-foreground-subtle animate-pulse",children:["Loading ",n??t,"…"]});if(x)return f("div",{className:"text-xs text-red-400",children:[n??t,": ",x]});if(!h||!le)return f("div",{className:"text-xs text-foreground-subtle",children:[n??t," not available on ",r,"."]});const ue=m==="override"?{...oe,...E}:oe,pe=f(Ne,{children:[m==="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(Eh,{schema:le,values:ue,onChange:ge,disabled:s===!0||w})]});return l===!0?f("section",{className:"rounded-lg border border-border bg-surface overflow-hidden",children:[f("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(Ah,{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?f("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 Rh({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,u=a&&t&&t.boxes.length>0,d=i&&r&&r.detections.length>0;return!c&&!u&&!d&&!l?null:f("div",{className:"absolute inset-0 pointer-events-none z-10",children:[l&&o(_h,{phase:n}),u&&o(Ih,{raw:t}),c&&o(Th,{motion:e}),d&&o(Dh,{detections:r.detections,frameWidth:r.frameWidth,frameHeight:r.frameHeight})]})}function _h({phase:e}){const t=js(e);return f("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 Ih({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,u=(a-n)/e.frameWidth*100,d=(i-s)/e.frameHeight*100,m=Math.max(.05,Math.min(.25,t.changeScore*.3));return o("div",{className:"absolute rounded-sm",style:{left:`${l}%`,top:`${c}%`,width:`${u}%`,height:`${d}%`,backgroundColor:`rgba(239, 68, 68, ${m})`}},`mr-${r}`)})})}function Th({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 Dh({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,u=a/r*100,d=i/t*100,m=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:`${u}%`,width:`${d}%`,height:`${m}%`,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 Lh(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 Oh=3e3,$h=5;function Bh({serverUrl:e,streamKey:t,label:r,autoPlay:n=!0,muted:s=!0,showControls:a=!0,className:i="",onStateChange:l,onError:c,overlay:u,createSession:d,sendAnswer:m,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),[E,_]=S("idle"),[A,H]=S(""),[oe,le]=S(s),[ge,ue]=S(!1),[pe,ie]=S(!1),ne=q(null),W=q(!1);(m||d)&&(W.current=!0);const ye=W.current,fe=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||!d||!m)return;T(),fe("connecting");const X=new AbortController;w.current=X;try{const{sessionId:me,sdpOffer:xe}=await d({...Lh(v.current),...g});if(y.current.add(me),!C.current||X.signal.aborted){h?.(me).catch(()=>{}),y.current.delete(me);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,fe("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")&&(fe("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 P=await we.createAnswer();if(await we.setLocalDescription(P),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:me.slice(0,8)}),await m(me,we.localDescription?.sdp??""),console.debug("[WebRTC] Answer sent successfully");const ee=we,ae=()=>{const L=ee.connectionState;if(L==="closed"||L==="failed")return;const te=b.current;te&&te.readyState===0&&console.log(`[WebRTC] no video data yet (ice=${ee.iceConnectionState})`)};setTimeout(ae,3e3),setTimeout(ae,8e3)}catch(me){if(!C.current)return;const xe=me instanceof Error?me.message:String(me);H(xe),fe("error"),c?.(xe),K()}},[e,t,d,m,T,fe,c,g]),B=I(async()=>{if(C.current){T(),fe("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 me=new MediaStream;X.ontrack=D=>{me.addTrack(D.track),b.current&&(b.current.srcObject=me,b.current.play().catch(()=>{}))},X.oniceconnectionstatechange=()=>{if(!C.current)return;const D=X.iceConnectionState;D==="connected"||D==="completed"?(M.current=0,fe("playing"),b.current?.paused&&b.current.play().catch(()=>{})):(D==="failed"||D==="disconnected"||D==="closed")&&(fe("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 P=await O.text();await X.setRemoteDescription({type:"answer",sdp:P})}catch(X){if(!C.current)return;const me=X instanceof Error?X.message:String(X);H(me),fe("error"),c?.(me),K()}}},[e,t,T,fe,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()},Oh)))},[]);Q(()=>(C.current=!0,M.current=0,n&&se(),()=>{C.current=!1,T()}),[e,t]);const Z=q(!1);Q(()=>{!n||!ye||!d||!m||Z.current||x.current||(Z.current=!0,se())},[n,ye,d,m,se]);const j=()=>{M.current=0,se()},re=()=>{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}`)}},Re=()=>{if(!b.current)return;const X=document.createElement("canvas");X.width=b.current.videoWidth||1280,X.height=b.current.videoHeight||720;const me=X.getContext("2d");if(!me)return;me.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()};Q(()=>{const X=()=>ue(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",X),()=>document.removeEventListener("fullscreenchange",X)},[]);const _e=()=>{ie(!0),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>ie(!1),3e3)};return f("div",{ref:v,className:`relative bg-black overflow-hidden group ${i}`,onMouseMove:_e,onMouseEnter:_e,children:[o("video",{ref:b,autoPlay:n,muted:oe,playsInline:!0,className:"w-full h-full object-contain"}),r&&E==="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}),u,E==="connecting"&&f("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…"})]}),(E==="error"||E==="disconnected")&&f("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:E==="error"?A||"Connection failed":"Disconnected"}),o("button",{onClick:j,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&&E==="playing"&&f("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(Xr,{onClick:re,title:oe?"Unmute":"Mute",children:oe?f("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"})]}):f("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"})]})})}),f("div",{className:"flex items-center gap-1",children:[o(Xr,{onClick:Re,title:"Take snapshot",children:f("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(Xr,{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 Xr({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 zS({children:e}){const[t,r]=S(()=>new Map),[n,s]=S(()=>new Map),a=I(m=>{r(h=>{const g=new Map(h);return g.set(m.id,m),g})},[]),i=I(m=>{r(h=>{if(!h.has(m))return h;const g=new Map(h);return g.delete(m),g})},[]),l=I(m=>{s(h=>{const g=new Map(h);return g.set(m.id,m),g})},[]),c=I(m=>{s(h=>{if(!h.has(m))return h;const g=new Map(h);return g.delete(m),g})},[]),u=J(()=>({layers:t,buttons:n}),[t,n]),d=J(()=>({setLayer:a,removeLayer:i,setButton:l,removeButton:c}),[a,i,l,c]);return o(Yn.Provider,{value:u,children:o(Xn.Provider,{value:d,children:e})})}function FS(){const e=Ae(Yn);return J(()=>e?[...e.layers.values()].sort((t,r)=>t.order-r.order):[],[e])}function zh(){const e=Ae(Yn);return J(()=>e?[...e.buttons.values()].sort((t,r)=>t.order-r.order):[],[e])}function GS(e){const t=Ae(Xn);Q(()=>{if(!(!t||!e))return t.setLayer(e),()=>t.removeLayer(e.id)},[t,e])}function jS(e){const t=Ae(Xn);Q(()=>{if(!(!t||!e))return t.setButton(e),()=>t.removeButton(e.id)},[t,e])}function Fh(e){return e==="streaming"?"bg-emerald-500":e==="connecting"?"bg-amber-500":e==="error"?"bg-rose-500":"bg-zinc-500"}function Gh(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 jh({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 Qh({className:e}){return f("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 Hh({className:e}){return f("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 Jr({label:e,active:t,onClick:r}){return f("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 Ki({className:e}){return f("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 Uh({className:e}){return f("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 QS({serverUrl:e,createSession:t,sendAnswer:r,closeSession:n,streams:s,activeStreamId:a,onStreamChange:i,deviceName:l,phase:c,pipelineMetrics:u,detections:d,defaultShowDetections:m=!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:E=!1,ptzShown:_=!1,ptzOverlay:A,onPtzToggle:H,intercomAvailable:oe=!1,intercomShown:le=!1,onIntercomToggle:ge,chromeless:ue=!1,className:pe}){const ie=zh(),[ne,W]=S(b),[ye,fe]=S(m),[T,z]=S(h),[B,se]=S(null),[U,K]=S(!1),Z=q(null);Q(()=>{if(!U)return;function L(te){Z.current&&!Z.current.contains(te.target)&&K(!1)}return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[U]);const j=a??B??s?.[0]?.id??"",re=s?.find(L=>L.id===j)??s?.[0],Y=re?.inputFps!=null?{status:re.status??"unknown",inputFps:re.inputFps,bitrateKbps:re.bitrateKbps??0}:null,Re=L=>{se(L),i?.(L),ne&&v&&(W(!1),setTimeout(()=>W(!0),50))},_e=J(()=>{const L=re?.target;if(L)return te=>t(L,te)},[t,re]),X=s,me=()=>W(!0),xe=()=>W(!1),we=u?.phase??c,O=we==="active",P=!!d,D=P&&(ye||T),ee=E&&_&&!!A,ae=v?ne:!0;return f("div",{className:`overflow-hidden ${ue?"":"rounded-xl border border-border bg-surface"} ${pe??""}`,children:[f("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[f("div",{className:"flex items-center gap-2",children:[(g??Y)&&o("span",{className:`w-2 h-2 rounded-full ${Fh((g??Y).status)}`}),l&&o("span",{className:"text-xs font-medium text-foreground",children:l}),X&&X.length>1&&f("div",{className:"relative",children:[o("select",{"data-testid":"stream-profile-select",value:j,onChange:L=>Re(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"})})})]})]}),f("div",{className:"flex items-center gap-1.5",children:[oe&&f("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(Qh,{className:"h-3 w-3"}),o("span",{className:"hidden xl:inline",children:"Intercom"})]}),ie.map(L=>{const te=L.tone==="primary"?"bg-primary text-primary-foreground":"bg-primary/15 text-primary";return f("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?te:"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&&f("button",{"data-testid":"stream-play-toggle","data-stream-playing":ae?"true":"false",onClick:ae?xe:me,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(jh,{className:"h-3 w-3"}):o(En,{className:"h-3 w-3"}),o("span",{className:"hidden xl:inline",children:ae?"Stop":"Play"})]}),w&&f("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(Ki,{className:`h-3 w-3 ${y?"animate-spin":""}`}),o("span",{className:"hidden xl:inline",children:"Snapshot"})]}),(P||E||u||we||g||Y&&Y.inputFps>0)&&f("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(Hh,{className:"h-3.5 w-3.5"})}),U&&f("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&&f("div",{className:"px-3 py-1.5 text-[10px] text-foreground-subtle border-b border-border-subtle",children:[f("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Input"}),f("span",{className:"tabular-nums text-foreground",children:[g.inputFps.toFixed(1)," fps"]})]}),f("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Decode"}),f("span",{className:"tabular-nums text-foreground",children:[g.decodeFps.toFixed(1)," fps"]})]}),f("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Uptime"}),o("span",{className:"tabular-nums text-foreground",children:Gh(g.uptimeMs)})]})]}),!k&&Y&&Y.inputFps>0&&f("div",{className:"px-3 py-1.5 text-[10px] text-foreground-subtle border-b border-border-subtle",children:[f("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Input"}),f("span",{className:"tabular-nums text-foreground",children:[Y.inputFps.toFixed(1)," fps"]})]}),Y.bitrateKbps>0&&f("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Bitrate"}),f("span",{className:"tabular-nums text-foreground",children:[Y.bitrateKbps," kbps"]})]})]}),(u||P&&we)&&f("div",{className:"px-3 py-1.5 text-[10px] text-foreground-subtle border-b border-border-subtle",children:[f("div",{className:"flex justify-between gap-3 items-center",children:[o("span",{children:"Phase"}),f("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"]})]}),u&&u.detectionFps>0&&f("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Detection"}),f("span",{className:"tabular-nums text-foreground",children:[u.detectionFps.toFixed(1)," det/s"]})]}),u&&u.avgInferenceMs>0&&f("div",{className:"flex justify-between gap-3",children:[o("span",{children:"Inference"}),f("span",{className:"tabular-nums text-foreground",children:[u.avgInferenceMs.toFixed(0)," ms"]})]})]}),P&&f(Ne,{children:[o(Jr,{label:"Show detections",active:ye,onClick:()=>fe(L=>!L)}),o(Jr,{label:"Show motion",active:T,onClick:()=>z(L=>!L)})]}),E&&o(Jr,{label:"PTZ controls",active:_,onClick:()=>{H?.(),K(!1)}})]})]})]})]}),ae?o("div",{className:"aspect-video relative",children:o(Bh,{serverUrl:e,streamKey:j,autoPlay:!0,className:"w-full h-full",createSession:_e,sendAnswer:r,closeSession:n,overlay:D||C||ee?f(Ne,{children:[D&&o(Rh,{detections:d,showPhaseIndicator:!1,showMotionZones:T,showMotionRaw:T,showDetections:ye}),C,ee&&A]}):void 0},j)}):o(Vh,{src:x??null,isLoading:y,onPlay:me,onRetry:w,extraOverlay:C||ee?f(Ne,{children:[C,ee&&A]}):null,suppressPlayHover:!!C||ee}),M]})}function Vh({src:e,isLoading:t,onPlay:r,onRetry:n,extraOverlay:s,suppressPlayHover:a=!1}){return e?f("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:f("div",{className:"flex flex-col items-center gap-2 text-white/40",children:[o(Uh,{className:"h-8 w-8"}),o("span",{className:"text-xs",children:"No snapshot available"}),f("div",{className:"flex items-center gap-2 mt-1",children:[n&&f("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(Ki,{className:"h-3 w-3"}),"Retry"]}),f("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"]})]})]})})}var ns={value:"auto",label:"Auto (best available)"};function qh(e){return e.charAt(0).toUpperCase()+e.slice(1)}function HS({deviceId:e,value:t,onChange:r,disabled:n,label:s,className:a}){const i=dt(),l=_f({deviceId:e},{refetchOnWindowFocus:!1}),[c,u]=S([ns]);Q(()=>{if(!l.data)return;const h=`${e}/`,g=[ns];for(const b of l.data){if(!b.enabled)continue;const v=b.brokerId.startsWith(h)?b.brokerId.slice(h.length):b.brokerId;g.push({value:v,label:qh(v)})}u(g)},[l.data,e]);const d=s??"Preferred stream",m=l.isLoading?"Loading available streams…":l.isError?"Could not load streams — only Auto available.":c.length===1?"No enabled streams found — only Auto available.":null;return f("div",{className:a,children:[o("label",{id:i,className:"text-xs font-medium text-foreground-muted block mb-1",children:d}),o(Nr,{"aria-labelledby":i,options:c,value:t,disabled:n,onChange:h=>r(h.target.value)}),m!==null&&o("p",{className:"text-foreground-subtle text-[10px] mt-1",children:m})]})}function US({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 d=i.current,m=l.current;if(!d||!m||!e||e.length===0)return;const h=m.clientWidth;if(h===0)return;const g=window.devicePixelRatio||1;d.width=h*g,d.height=r*g,d.style.width=`${h}px`,d.style.height=`${r}px`;const b=d.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 H=w;H<k;H++){const oe=e[H];oe<M&&(M=oe),oe>C&&(C=oe)}const E=x-C*x,_=x-M*x,A=Math.max(1,_-E);b.fillRect(y,E,1,A)}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]);Q(()=>{c()},[c]),Q(()=>{const d=new ResizeObserver(()=>c()),m=l.current;return m&&d.observe(m),()=>d.disconnect()},[c]);const u=((e&&t?Math.round(e.length/t*1e3):0)/1e3).toFixed(1);return f("div",{ref:l,className:`relative ${n}`,children:[o("canvas",{ref:i,className:"w-full rounded-md"}),e&&e.length>0&&f("div",{className:"absolute bottom-1 right-2 text-[10px] text-foreground-subtle/60 font-mono",children:[u,"s · ",t/1e3,"kHz · ",e.length.toLocaleString()," samples"]})]})}function VS({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 u=q(null),d=q(null),[m,h]=S([]);Q(()=>{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=u.current,x=d.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),m.length===0))return;const M=m[m.length-1].timestamp,C=t*1e3,E=M-C,_=m.filter(le=>le.timestamp>=E);if(_.length===0)return;const A=Math.max(1,Math.floor(y/(t*2))),H=Math.abs(c);for(const le of _){const ge=le.timestamp-E,ue=Math.floor(ge/C*y),pe=(Math.max(c,Math.min(0,le.dbfs))-c)/H,ie=Math.max(1,pe*n);k.fillStyle=le.dbfs>=l?i:a,k.globalAlpha=.8,k.fillRect(ue,n-ie,A,ie)}k.globalAlpha=1;const oe=n-(l-c)/H*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},[m,t,n,a,i,l,c]);Q(()=>{g()},[g]),Q(()=>{const v=new ResizeObserver(()=>g()),x=d.current;return x&&v.observe(x),()=>v.disconnect()},[g]);const b=m.length>0?m[m.length-1].dbfs:null;return f("div",{ref:d,className:`relative ${s}`,children:[o("canvas",{ref:u,className:"w-full rounded-md"}),f("div",{className:"absolute top-1 left-2 text-[9px] text-foreground-subtle/50 font-mono",children:[t,"s"]}),b!==null&&f("div",{className:"absolute bottom-1 right-2 text-[9px] text-foreground-subtle/50 font-mono",children:[b.toFixed(1)," dBFS · ",m.length," samples"]})]})}function Wh(e){return e>=.8?"bg-emerald-500":e>=.5?"bg-amber-500":e>=.3?"bg-orange-500":"bg-zinc-500"}function Kh(e){return e>=.8?"text-emerald-400":e>=.5?"text-amber-400":e>=.3?"text-orange-400":"text-zinc-400"}function qS({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"})}):f("div",{className:`rounded-xl border border-border bg-surface overflow-hidden ${s}`,children:[f("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"}),f("div",{className:"flex items-center gap-3 text-[10px] text-foreground-subtle",children:[a.length<e.length&&f("span",{children:["showing ",a.length," of ",e.length]}),r!==void 0&&f("span",{className:"font-mono",children:[r.toFixed(1),"ms"]})]})]}),o("div",{className:"divide-y divide-border/50",children:a.map((l,c)=>{const u=i>0?l.score/i*100:0;return f("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 ${Wh(l.score)}`,style:{width:`${u}%`}})}),f("span",{className:`text-xs font-mono font-semibold w-14 text-right ${Kh(l.score)}`,children:[(l.score*100).toFixed(1),"%"]})]},`${l.className}-${c}`)})})]})}function WS({data:e,label:t="Response",className:r=""}){const[n,s]=S(!1);if(!e)return null;const a=JSON.stringify(e,null,2);return f("div",{className:`rounded-xl border border-border bg-surface overflow-hidden ${r}`,children:[f("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:[f("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 Zh={Activity:et,Eye:qt,AlertTriangle:Kt,PauseCircle:vd,PowerOff:Dd};function KS({phase:e,...t}){const r=Zh[js(e).icon];return o(r,{...t})}function Ct(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 J(()=>({entries:t,append:n,reset:s}),[t,n,s])}function os(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 ss={error:{icon:Ar,color:"text-red-400"},warn:{icon:Kt,color:"text-amber-400"},info:{icon:Ed,color:"text-blue-400"},debug:{icon:pd,color:"text-gray-500"}},as={debug:0,info:1,warn:2,error:3},Yh=["all","debug","info","warn","error"],Xh=500;function Jh(e,t){return t?(as[e]??0)>=(as[t]??0):!0}function Zi({agentId:e,addonId:t,deviceId:r,integrationId:n,requestId:s,level:a,maxHeight:i="max-h-96",showScope:l=!1,showFilters:c=!0,limit:u=100,liveBuffer:d,onClose:m,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),E=n,_=s,A=J(()=>{const P={};return k&&(P.agentId=k),M&&(P.addonId=M),C!==void 0&&Number.isFinite(C)&&(P.deviceId=C),E&&(P.integrationId=E),_&&(P.requestId=_),Object.keys(P).length>0?P:void 0},[k,M,C,E,_]),H=Ct(Xh),oe=d??H,le=oe.entries,[ge,ue]=S(0),[pe,ie]=S(!1),[ne,W]=S(!1),[ye,fe]=S(new Set),[T,z]=S(""),B=q(null),se=`${k??""}:${M??""}:${String(C??"")}:${E??""}:${_??""}`,U=q(se);Q(()=>{U.current!==se&&(U.current=se,oe.reset(),ue(0),fe(new Set))},[se,oe]);const{data:K,isLoading:Z}=p.logs.query.useQuery({...A?{tags:A}:{},limit:u},{staleTime:3e4});p.logs.subscribe.useSubscription({...A?{tags:A}:{}},{onData:P=>{oe.append(P)}});const j=q(le.length);Q(()=>{const P=B.current;if(!P){j.current=le.length;return}const D=j.current;if(j.current=le.length,!(le.length<=D)){if(pe&&P.scrollTop<=8)P.scrollTo({top:0});else if(!pe&&P.scrollTop>0){const ee=P.querySelector("tbody tr"),ae=ee instanceof HTMLElement?ee.offsetHeight:24;P.scrollTop+=ae*(le.length-D)}}},[le.length,pe]);const re=J(()=>{const P=(K??[]).map(te=>({timestamp:te.timestamp,level:te.level,message:te.message,scope:te.scope,tags:te.tags,meta:te.meta})),D=new Set,ee=[];for(const te of[...le].reverse()){const ke=`${te.timestamp}|${te.level}|${te.scope??""}|${te.message}`;D.has(ke)||(D.add(ke),ee.push(te))}for(const te of P){const ke=`${te.timestamp}|${te.level}|${te.scope??""}|${te.message}`;D.has(ke)||(D.add(ke),ee.push(te))}const ae=(ge>0?ee.filter(te=>new Date(te.timestamp).getTime()>ge):ee).filter(te=>Jh(te.level,y)),L=T.trim().toLowerCase();return L?ae.filter(te=>{if(te.message.toLowerCase().includes(L)||te.scope&&te.scope.toLowerCase().includes(L))return!0;if(te.tags){for(const ke of Object.values(te.tags))if(ke!==void 0&&String(ke).toLowerCase().includes(L))return!0}if(te.meta){for(const ke of Object.values(te.meta))if(ke!=null&&os(ke).toLowerCase().includes(L))return!0}return!1}):ae},[K,le,y,ge,T]),Y=I(()=>{const P=re.map(D=>{const ee=new Date(D.timestamp).toLocaleTimeString(),ae=D.tags?" "+Object.entries(D.tags).filter(([,L])=>L).map(([L,te])=>`${L}=${te}`).join(" "):"";return`${ee} [${D.level.toUpperCase()}]${D.scope?` [${D.scope}]`:""}${ae} ${D.message}`});navigator.clipboard.writeText(P.join(`
78
- `)).then(()=>{W(!0),setTimeout(()=>W(!1),1500)})},[re]),Re=p.logs.clear.useMutation(),_e=I(()=>{ue(Date.now()),oe.reset(),Re.mutate({...A?{tags:A}:{}})},[oe,Re,A]),X=I(P=>{fe(D=>{const ee=new Set(D);return ee.has(P)?ee.delete(P):ee.add(P),ee})},[]),[me,xe]=S(null),we=I((P,D)=>{const ee=new Date(P.timestamp).toISOString(),ae=P.tags?" "+Object.entries(P.tags).filter(([,ke])=>ke).map(([ke,Ke])=>`${ke}=${Ke}`).join(" "):"",L=P.meta&&Object.keys(P.meta).length>0?` meta=${JSON.stringify(P.meta)}`:"",te=`${ee} [${P.level.toUpperCase()}]${P.scope?` [${P.scope}]`:""}${ae} ${P.message}${L}`;navigator.clipboard.writeText(te).then(()=>{xe(D),setTimeout(()=>xe(ke=>ke===D?null:ke),1200)})},[]),O=I(P=>`${P.timestamp}|${P.level}|${P.scope??""}|${P.message}`,[]);return f("div",{className:N("h-full min-h-0 flex flex-col",h),onClick:P=>P.stopPropagation(),children:[f("div",{className:"flex items-center justify-between px-3 py-1.5 bg-surface-hover/30 gap-2 shrink-0",children:[f("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(en,{label:"agent",value:k}),M&&o(en,{label:"addon",value:M}),C!==void 0&&o(en,{label:"device",value:`#${C}`}),o("div",{className:"flex rounded border border-border overflow-hidden text-[9px]",children:Yh.map(P=>f("button",{type:"button",onClick:()=>w(P==="all"?void 0:P),className:N("px-1.5 py-0.5 capitalize transition-colors",P==="all"&&!y||y===P?"bg-primary/10 text-primary":"text-foreground-subtle hover:bg-surface-hover",P!=="all"&&"border-l border-border"),children:[P,P!=="all"?"+":""]},P))}),o(tn,{icon:zn,label:pe?"Auto":"Paused",active:!pe,onClick:()=>{ie(P=>!P),!pe&&B.current&&B.current.scrollTo({top:0,behavior:"smooth"})}}),o(tn,{icon:at,label:ne?"Copied!":"Copy",onClick:Y,disabled:re.length===0}),o(tn,{icon:qe,label:"Clear",onClick:_e}),f("div",{className:"relative",children:[o("input",{type:"text",value:T,onChange:P=>z(P.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(Pe,{className:"h-2.5 w-2.5"})})]}),le.length>0&&f("span",{className:"text-[9px] text-emerald-400 font-medium",children:["+",le.length," live"]})]}),m&&o("button",{type:"button",onClick:m,className:"text-foreground-subtle hover:text-foreground",children:o(Pe,{className:"h-3.5 w-3.5"})})]}),c&&(!t||!r)&&f("div",{className:"flex items-center gap-2 px-3 py-1 border-b border-border/50 bg-surface/50 text-[10px]",children:[!t&&f("label",{className:"flex items-center gap-1",children:[o("span",{className:"text-foreground-subtle",children:"Addon:"}),o("input",{type:"text",value:g,onChange:P=>b(P.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&&f("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:P=>x(P.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"})]})]}),f("div",{ref:B,className:N("flex-1 min-h-0 overflow-auto font-mono text-[10px]",i),children:[Z&&f("div",{className:"flex items-center justify-center gap-2 py-6 text-foreground-subtle",children:[o(je,{className:"h-3.5 w-3.5 animate-spin"}),"Loading logs..."]}),!Z&&re.length===0&&o("div",{className:"py-4 text-center text-foreground-subtle",children:"No logs found"}),re.length>0&&o("table",{className:"w-full",children:o("tbody",{children:re.map(P=>{const D=ss[P.level]??ss.info,ee=D.icon,ae=O(P),L=ye.has(ae),te=P.tags&&Object.keys(P.tags).length>0,ke=P.meta&&Object.keys(P.meta).length>0,Ke=te||ke;return f("tr",{className:N("hover:bg-surface-hover/30 border-b border-border/30",Ke&&"cursor-pointer"),onClick:Ke?()=>X(ae):void 0,children:[o("td",{className:"px-2 py-1 text-foreground-subtle whitespace-nowrap align-top w-[70px]",children:new Date(P.timestamp).toLocaleTimeString()}),o("td",{className:N("px-1 py-1 align-top w-5",D.color),children:o(ee,{className:"h-3 w-3"})}),l&&o("td",{className:"px-2 py-1 text-foreground-subtle align-top truncate max-w-[120px]",title:P.scope,children:P.scope?.replace(/^addon:/,"")??""}),o("td",{className:"px-2 py-1 text-foreground break-all",children:f("div",{className:"flex items-start gap-1",children:[Ke&&(L?o(mt,{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"})),f("div",{className:"flex-1 min-w-0",children:[P.message,L&&Ke&&f("div",{className:"mt-1 text-[9px] text-foreground-subtle bg-surface rounded px-2 py-1 space-y-0.5",children:[ke&&Object.entries(P.meta).filter(([,De])=>De!==void 0&&De!=="").map(([De,gt])=>f("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:os(gt)})]},`m-${De}`)),te&&Object.entries(P.tags).filter(([,De])=>De!==void 0).map(([De,gt])=>f("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:gt})]},`t-${De}`))]})]})]})}),o("td",{className:"px-1 py-1 align-top w-5",children:o(eg,{copied:me===ae,onCopy:()=>we(P,ae)})})]},ae)})})})]})]})}function ZS({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 en({label:e,value:t}){return f("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:[e,": ",t]})}function eg({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 tn({icon:e,label:t,onClick:r,disabled:n,active:s}){return f("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 tg(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 rg={[V.AddonStarted]:{icon:gn,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:jn,color:"bg-blue-500/15 text-blue-400 border-blue-500/30",label:"Restarted"},[V.AddonUpdated]:{icon:Ua,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:qe,color:"bg-foreground-subtle/10 text-foreground-subtle border-border",label:"Uninstalled"},[V.AddonCrashed]:{icon:Ar,color:"bg-red-500/15 text-red-400 border-red-500/30",label:"Crashed"},[V.AddonError]:{icon:Kt,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:$d,color:"bg-purple-500/15 text-purple-400 border-purple-500/30",label:"Detection"},[V.DetectionEvent]:{icon:qt,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:za,color:"bg-pink-500/15 text-pink-400 border-pink-500/30",label:"Audio"},[V.AgentOnline]:{icon:gn,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:qe,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=rg[e]??{icon:gn,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 yt=Object.freeze([...new Set(Object.values(V))].sort()),ng=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]),og=new Set(ng),sg=Object.freeze(yt.filter(e=>!og.has(e)));function vr(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,u=typeof c=="string"?c:"";u&&a.set(u,(a.get(u)??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:"",u=i.score;return u?`${c} (${Math.round(u*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,u=typeof c=="string"?c:"";u&&a.set(u,(a.get(u)??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 ag(e){const t=e.category;return t===V.DetectionResult||t===V.PipelineAudioInferenceResult?vr(t,e.data)!==null:!0}var ig=300;function Yi({agentId:e,addonId:t,deviceId:r,defaultCategories:n,categories:s,category:a,maxHeight:i="max-h-96",limit:l=50,showCategoryFilter:c=!0,showFilters:u=!1,liveBuffer:d,onClose:m,className:h}){const g=J(()=>n??s??sg,[n,s]),b=J(()=>[...g].sort().join(","),[g]),[v,x]=S(()=>new Set(g)),y=q(b);Q(()=>{y.current!==b&&(y.current=b,x(new Set(g)))},[b,g]);const w=Ct(ig),k=d??w,M=k.entries,[C,E]=S(!0),[_,A]=S(new Set),[H,oe]=S(""),[le,ge]=S(!1),[ue,pe]=S(""),[ie,ne]=S(0),W=q(null),ye=q(null),fe=`${e??""}:${t??""}:${String(r??"")}:${a??""}`,T=q(fe);Q(()=>{T.current!==fe&&(T.current=fe,k.reset(),A(new Set),ne(0))},[fe,k]),Q(()=>{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=J(()=>{const $={};return e&&($.agentId=e),t&&($.addonId=t),r!==void 0&&($.deviceId=r),a&&($.category=a),$},[e,t,r,a]),B=J(()=>[...v].sort(),[v]),se=J(()=>{const $={...z,limit:l};return B.length>0&&B.length<yt.length&&($.category=B),$},[z,l,J(()=>B.join(","),[B]),B]),{data:U,isLoading:K}=p.systemEvents.getRecent.useQuery(se,{staleTime:3e4}),Z=q(v);Q(()=>{Z.current=v},[v]);const j=z;p.systemEvents.subscribe.useSubscription(j,{onData:$=>{const he=$;he?.id&&tg(he,e,t,r)&&Z.current.has(he.category)&&k.append(he)}});const re=q(M.length);Q(()=>{const $=W.current;if(!$){re.current=M.length;return}const he=re.current;if(re.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=J(()=>{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(ag);ie>0&&(he=he.filter(ve=>new Date(ve.timestamp).getTime()>ie));const be=H.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=vr(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,H,ie]),Re=I($=>{A(he=>{const be=new Set(he);return be.has($)?be.delete($):be.add($),be})},[]),_e=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]),me=I(()=>{ne(Date.now()),k.reset()},[k]),[xe,we]=S(!1),[O,P]=S(null),D=I($=>{const he=new Date($.timestamp).toISOString(),be=vr($.category,$.data)??"",ve=be?` ${be}`:"";return`${he} [${$.category}]${ve} data=${JSON.stringify($.data)}`},[]),ee=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(()=>{P($.id),setTimeout(()=>P(he=>he===$.id?null:he),1200)})},[D]),L=I(()=>{x(new Set(yt))},[]),te=I(()=>{x(new Set)},[]),ke=J(()=>{const $=ue.trim().toLowerCase();return $?yt.filter(he=>he.toLowerCase().includes($)):yt},[ue]),Ke=yt.length,De=v.size,gt=De===Ke,Ji=gt?"All":`${De}/${Ke}`;return f("div",{className:N("h-full min-h-0 flex flex-col",h),onClick:$=>$.stopPropagation(),children:[f("div",{className:"flex items-center justify-between px-3 py-1.5 bg-surface-hover/30 gap-2 shrink-0",children:[f("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(ar,{label:"agent",value:e}),t&&o(ar,{label:"addon",value:t}),r!==void 0&&o(ar,{label:"device",value:`#${r}`}),a&&o(ar,{label:"category",value:a}),f("button",{type:"button",onClick:()=>{E($=>!$),!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&&f("div",{className:"relative",ref:ye,children:[f("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",gt?"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(Oa,{className:"h-2.5 w-2.5"}),"Filter (",Ji,")"]}),le&&o(lg,{search:ue,onSearchChange:pe,categories:ke,active:v,onToggle:_e,onSelectAll:L,onSelectNone:te,onResetDefaults:X})]}),f("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"]}),f("button",{type:"button",onClick:me,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(qe,{className:"h-2.5 w-2.5"}),"Clear"]}),f("button",{type:"button",onClick:ee,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"]}),f("div",{className:"relative",children:[o("input",{type:"text",value:H,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"}),H&&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(Pe,{className:"h-2.5 w-2.5"})})]}),M.length>0&&f("span",{className:"text-[9px] text-emerald-400 font-medium",children:["+",M.length," live"]})]}),m&&o("button",{type:"button",onClick:m,className:"text-foreground-subtle hover:text-foreground",children:o(Pe,{className:"h-3.5 w-3.5"})})]}),f("div",{ref:W,className:N("flex-1 min-h-0 overflow-auto text-[10px]",i),children:[K&&f("div",{className:"flex items-center justify-center gap-2 py-6 text-foreground-subtle",children:[o(je,{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=vr($.category,$.data),it=_.has($.id);return f("div",{className:"flex items-start gap-2 px-3 py-1.5 hover:bg-surface-hover/30 cursor-pointer",onClick:()=>Re($.id),children:[o("span",{className:"text-foreground-subtle whitespace-nowrap w-[70px] shrink-0 pt-0.5",children:new Date($.timestamp).toLocaleTimeString()}),o(cg,{copied:O===$.id,onCopy:()=>ae($)}),f("div",{className:"flex-1 min-w-0",children:[f("div",{className:"flex items-center gap-1.5",children:[it?o(mt,{className:"h-3 w-3 text-foreground-subtle shrink-0"}):o(st,{className:"h-3 w-3 text-foreground-subtle shrink-0"}),f("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&&f("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:[f("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)})]}),f("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,Dr])=>f("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 Dr=="object"?JSON.stringify(Dr):String(Dr)})]},Jn))]})]})]},$.id)})})]})]})}function lg({search:e,onSearchChange:t,categories:r,active:n,onToggle:s,onSelectAll:a,onSelectNone:i,onResetDefaults:l}){return f("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:[f("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border/50",children:[o(jt,{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(Pe,{className:"h-2.5 w-2.5"})})]}),f("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"})]}),f("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 u=n.has(c),d=An(c),m=d.icon;return f("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:u,className:"accent-violet-500"}),f("span",{className:N("inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[9px] font-medium shrink-0",d.color),children:[o(m,{className:"h-2.5 w-2.5"}),d.label]}),o("span",{className:"text-foreground-subtle font-mono truncate",children:c})]},c)})]})]})}function YS({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(Yi,{maxHeight:"max-h-48",...r})})}function ar({label:e,value:t}){return f("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:[e,": ",t]})}function cg({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 XS({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})}}),[u,d]=S(null),{available:m,adopted:h}=J(()=>{const k=s.data??[],M=E=>typeof E.metadata.rtspChannel=="number"?E.metadata.rtspChannel:Number.POSITIVE_INFINITY,C=(E,_)=>{const A=M(E),H=M(_);return A!==H?A-H:E.name.localeCompare(_.name)};return{available:k.filter(E=>!E.alreadyAdopted).sort(C),adopted:k.filter(E=>E.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){d(k.childNativeId);try{await l.mutateAsync({deviceId:e,childNativeId:k.childNativeId})}finally{d(null)}}async function w(k){if(k.adoptedDeviceId!=null){d(k.childNativeId);try{await c.mutateAsync({deviceId:e,childDeviceId:k.adoptedDeviceId})}finally{d(null)}}}return f("div",{className:`rounded-xl border border-border bg-surface ${t}`,children:[f("div",{className:"flex items-start justify-between gap-2 border-b border-border px-3 py-2 sm:px-5 sm:py-3",children:[f("div",{className:"min-w-0",children:[o("h3",{className:"text-sm font-semibold text-foreground",children:"Discovered devices"}),f("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."]})]}),f("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(je,{className:"h-3.5 w-3.5 animate-spin"}):o(jn,{className:"h-3.5 w-3.5"}),o("span",{className:"hidden sm:inline",children:"Refresh"})]})]}),b?f("div",{className:"flex items-start gap-2 border-b border-border bg-destructive/10 px-5 py-2 text-[11px] text-destructive",children:[o(Kt,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),f("span",{children:["Last refresh failed: ",b]})]}):null,s.isLoading?o("div",{className:"flex items-center justify-center py-8 text-foreground-subtle",children:o(je,{className:"h-5 w-5 animate-spin"})}):m.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."}):f(Ne,{children:[m.length>0?o(is,{title:"Available to add",count:m.length,tone:"primary",children:m.map(k=>o(ls,{child:k,busy:u===k.childNativeId,onAdopt:y,onRelease:w,onOpenChild:r},k.childNativeId))}):null,h.length>0?o(is,{title:"Already adopted",count:h.length,tone:"muted",children:h.map(k=>o(ls,{child:k,busy:u===k.childNativeId,onAdopt:y,onRelease:w,onOpenChild:r},k.childNativeId))}):null]}),v!=null?f("div",{className:"border-t border-border px-5 py-2 text-[10px] text-foreground-subtle",children:["Last refreshed ",new Date(v).toLocaleString()]}):null]})}function is({title:e,count:t,tone:r,children:n}){return f("div",{className:"border-t border-border",children:[f("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 ls({child:e,busy:t,onAdopt:r,onRelease:n,onOpenChild:s}){return f("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:[f("div",{className:"min-w-0 flex-1",children:[f("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[o(ug,{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]}),f("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"?f("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?f("span",{className:"font-mono truncate max-w-[140px]",children:[e.metadata.uid.slice(0,12),"…"]}):null]})]}),e.alreadyAdopted?f("div",{className:"flex items-center gap-2",children:[s&&e.adoptedDeviceId!==null?f("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(Da,{className:"h-3.5 w-3.5"}),"Open"]}):null,f("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(je,{className:"h-3.5 w-3.5 animate-spin"}):o(qe,{className:"h-3.5 w-3.5"}),"Remove"]})]}):f("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(je,{className:"h-3.5 w-3.5 animate-spin"}):o(Wt,{className:"h-3.5 w-3.5"}),"Add"]})]})}function ug({status:e}){switch(e){case"online":return f("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(Va,{className:"h-2.5 w-2.5"})," online"]});case"sleeping":return f("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(Gn,{className:"h-2.5 w-2.5"})," sleeping"]});case"offline":return f("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(Kd,{className:"h-2.5 w-2.5"})," offline"]});default:return f("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(Ra,{className:"h-2.5 w-2.5"})," unknown"]})}}function dg(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 rn(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 pg=300,mg=Object.freeze([...new Set(dl.filter(e=>e.scope==="device").map(e=>e.name))].sort());function fg({deviceId:e,defaultCaps:t,maxHeight:r="max-h-96",limit:n=50,liveBuffer:s,onClose:a,className:i}){const[l,c]=S(J(()=>new Set(t??[]),[t])),[u,d]=S(""),[m,h]=S(!0),[g,b]=S(new Set),[v,x]=S(0),[y,w]=S(!1),[k,M]=S(""),C=q(null),E=Ct(pg),_=s??E,A=_.entries,H=q(null),oe=q(e);Q(()=>{oe.current!==e&&(oe.current=e,_.reset(),b(new Set),x(0))},[e,_]);const le=J(()=>({deviceId:e,category:V.DeviceStateChanged,limit:n}),[e,n]),{data:ge,isLoading:ue}=p.systemEvents.getRecent.useQuery(le,{staleTime:3e4}),pe=q(l);Q(()=>{pe.current=l},[l]),p.systemEvents.subscribe.useSubscription({deviceId:e,category:V.DeviceStateChanged},{onData:O=>{if(!dg(O,e))return;const P=rn(O);if(!P)return;const D=pe.current;D.size>0&&!D.has(P.capName)||_.append(P)}});const ie=q(A.length);Q(()=>{const O=H.current;if(!O){ie.current=A.length;return}const P=ie.current;if(ie.current=A.length,!(A.length<=P)){if(m&&O.scrollTop<=8)O.scrollTo({top:0});else if(!m&&O.scrollTop>0){const D=O.firstElementChild?.firstElementChild,ee=D instanceof HTMLElement?D.offsetHeight:28,ae=A.length-P;O.scrollTop+=ee*ae}}},[A.length,m]);const ne=J(()=>{const O=new Map;for(const ee of ge??[]){const ae=rn(ee);ae&&O.set(ae.id,ae)}for(const ee of A)O.set(ee.id,ee);let P=[...O.values()];v>0&&(P=P.filter(ee=>new Date(ee.timestamp).getTime()>v)),l.size>0&&(P=P.filter(ee=>l.has(ee.capName)));const D=u.trim().toLowerCase();return D&&(P=P.filter(ee=>{if(ee.capName.toLowerCase().includes(D))return!0;try{if(new Date(ee.timestamp).toLocaleTimeString().toLowerCase().includes(D))return!0}catch{}try{if(Object.entries(ee.slice).map(([ae,L])=>`${ae}=${nn(L)}`).join(" · ").toLowerCase().includes(D))return!0}catch{}try{if(JSON.stringify(ee.slice).toLowerCase().includes(D))return!0}catch{}return!1})),P.sort((ee,ae)=>new Date(ae.timestamp).getTime()-new Date(ee.timestamp).getTime())},[ge,A,l,u,v]),W=J(()=>{const O=new Set(mg);for(const P of ge??[]){const D=rn(P);D&&O.add(D.capName)}for(const P of A)O.add(P.capName);return[...O].sort()},[ge,A]),ye=I(O=>{b(P=>{const D=new Set(P);return D.has(O)?D.delete(O):D.add(O),D})},[]),fe=I(O=>{c(P=>{const D=new Set(P);return D.has(O)?D.delete(O):D.add(O),D})},[]),T=I(()=>{c(new Set(t??[])),d("")},[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)}`,[]),j=I(()=>{const O=ne.map(Z);navigator.clipboard.writeText(O.join(`
80
- `)).then(()=>{se(!0),setTimeout(()=>se(!1),1500)})},[ne,Z]),re=I(O=>{navigator.clipboard.writeText(Z(O)).then(()=>{K(O.id),setTimeout(()=>K(P=>P===O.id?null:P),1200)})},[Z]),Y=I(()=>{c(new Set(W))},[W]),Re=I(()=>{c(new Set)},[]),_e=J(()=>{const O=k.trim().toLowerCase();return O?W.filter(P=>P.toLowerCase().includes(O)):W},[k,W]),X=W.length,me=l.size,xe=me===0||me===X,we=xe?"All":`${me}/${X}`;return Q(()=>{if(!y)return;const O=P=>{const D=C.current;D&&!D.contains(P.target)&&w(!1)};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[y]),f("div",{className:N("h-full min-h-0 flex flex-col",i),onClick:O=>O.stopPropagation(),children:[f("div",{className:"flex items-center justify-between px-3 py-1.5 bg-surface-hover/30 gap-2 shrink-0",children:[f("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(hg,{label:"device",value:`#${e}`}),f("button",{type:"button",onClick:()=>{h(O=>!O),!m&&H.current&&H.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",m?"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"}),m?"Auto":"Paused"]}),f("div",{className:"relative",ref:C,children:[f("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(Oa,{className:"h-2.5 w-2.5"}),"Filter (",we,")"]}),y&&o(gg,{search:k,onSearchChange:M,caps:_e,active:l,onToggle:fe,onSelectAll:Y,onSelectNone:Re,onResetDefaults:T})]}),f("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"]}),f("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(qe,{className:"h-2.5 w-2.5"}),"Clear"]}),f("button",{type:"button",onClick:j,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"]}),f("div",{className:"relative",children:[o("input",{type:"text",value:u,onChange:O=>d(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"}),u&&o("button",{type:"button",onClick:()=>d(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground",title:"Clear search",children:o(Pe,{className:"h-2.5 w-2.5"})})]}),A.length>0&&f("span",{className:"text-[9px] text-emerald-400 font-medium",children:["+",A.length," live"]})]}),a&&o("button",{type:"button",onClick:a,className:"text-foreground-subtle hover:text-foreground",children:o(Pe,{className:"h-3.5 w-3.5"})})]}),f("div",{ref:H,className:N("flex-1 min-h-0 overflow-auto text-[10px]",r),children:[ue&&f("div",{className:"flex items-center justify-center gap-2 py-6 text-foreground-subtle",children:[o(je,{className:"h-3.5 w-3.5 animate-spin"}),"Loading state changes..."]}),!ue&&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 P=g.has(O.id),D=Object.entries(O.slice),ee=D.slice(0,3).map(([ae,L])=>`${ae}=${nn(L)}`).join(" · ");return f("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(bg,{copied:U===O.id,onCopy:()=>re(O)}),f("div",{className:"flex-1 min-w-0",children:[f("div",{className:"flex items-center gap-1.5",children:[P?o(mt,{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&&f("span",{className:"text-[9px] text-foreground-subtle",children:["+",D.length-3," more"]})]}),ee&&o("p",{className:"text-foreground-subtle text-[10px] mt-0.5 ml-5 truncate",children:ee}),P&&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])=>f("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:nn(L)})]},ae))})]})]},O.id)})})]})]})}function nn(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 hg({label:e,value:t}){return f("span",{className:"text-[9px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:[e,": ",t]})}function gg({search:e,onSearchChange:t,caps:r,active:n,onToggle:s,onSelectAll:a,onSelectNone:i,onResetDefaults:l}){return f("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:[f("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b border-border/50",children:[o(jt,{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(Pe,{className:"h-2.5 w-2.5"})})]}),f("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"})]}),f("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=>f("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 bg({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 on=500,vg=[{id:"logs",label:"Logs",icon:Bd},{id:"events",label:"Events",icon:Er},{id:"state",label:"State",icon:Nd}];function JS({deviceId:e,defaultEventCategories:t,defaultStateCaps:r,initialTab:n="events",className:s,maxHeight:a="max-h-96"}){const[i,l]=S(n),c=Ct(on),u=Ct(on),d=Ct(on),m=c.reset,h=u.reset,g=d.reset;return Q(()=>{m(),h(),g()},[e,m,h,g]),f("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:vg.map(({id:b,label:v,icon:x})=>f("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))}),f("div",{className:"flex-1 min-h-0 overflow-hidden",children:[i==="logs"&&o(Zi,{deviceId:e,maxHeight:a,showFilters:!1,liveBuffer:c}),i==="events"&&o(Yi,{deviceId:e,defaultCategories:t,maxHeight:a,showCategoryFilter:!0,liveBuffer:u}),i==="state"&&o(fg,{deviceId:e,defaultCaps:r,maxHeight:a,liveBuffer:d})]})]})}function e5({label:e,icon:t,title:r="Confirm action",description:n,confirmLabel:s,triggerVariant:a="outline",confirmVariant:i="danger",size:l="sm",disabled:c,className:u,action:d,onSuccess:m}){const[h,g]=S(!1),[b,v]=S(!1),[x,y]=S(null),w=async()=>{y(null),v(!0);try{const k=await d();m?.(k),g(!1)}catch(k){y(k instanceof Error?k.message:String(k))}finally{v(!1)}};return f(Ne,{children:[f(gr,{type:"button",variant:a,size:l,disabled:c,onClick:()=>{y(null),g(!0)},className:u,children:[t&&o(t,{className:"h-3.5 w-3.5"}),e]}),o(ip,{open:h,onOpenChange:k=>!b&&g(k),children:f(Ja,{children:[f(cp,{children:[f(dp,{className:"flex items-center gap-2",children:[o(Kt,{className:"h-4 w-4 text-amber-400"}),r]}),typeof n=="string"?o(pp,{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}),f(up,{children:[o(gr,{type:"button",variant:"ghost",size:l,disabled:b,onClick:()=>g(!1),children:"Cancel"}),f(gr,{type:"button",variant:i,size:l,disabled:b,onClick:()=>{w()},children:[b&&o(je,{className:"h-3.5 w-3.5 animate-spin"}),s??e]})]})]})})]})}function ir({direction:e,icon:t,disabled:r,className:n,variant:s,onMove:a,onStart:i,onStop:l}){const[c,u]=S(null),[d,m]=S(!1),h=I(y=>{if(r)return;y.currentTarget.setPointerCapture(y.pointerId),u(Date.now()),m(!1);const w=setTimeout(()=>{m(!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="",d?l():c!==null&&a(e),u(null),m(!1)},[d,e,a,l,c]),b=I(y=>{const w=Number(y.currentTarget.dataset.timer);w&&clearTimeout(w),y.currentTarget.dataset.timer="",d&&l(),u(null),m(!1)},[d,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 t5({controls:e,mode:t="overlay",showPresets:r,showZoom:n=!0,showHome:s=!0,className:a}){const{move:i,startContinuous:l,stopContinuous:c,zoom:u,goHome:d,goToPreset:m,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",E=w?"h-4 w-4":"h-3.5 w-3.5",_=w?"text-foreground hover:bg-surface-hover":"text-white hover:bg-white/15",A=w?"h-12 w-px bg-border mx-1":"h-12 w-px bg-white/15 mx-1";return f("div",{className:N(k,a),children:[b&&f("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]}),f("div",{className:N(M,w&&"justify-center"),children:[f("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(ir,{direction:"up",icon:id,variant:t,onMove:i,onStart:l,onStop:c}),o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"}),o(ir,{direction:"left",icon:sd,variant:t,onMove:i,onStart:l,onStop:c}),o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"}),o(ir,{direction:"right",icon:ad,variant:t,onMove:i,onStart:l,onStop:c}),o("span",{"aria-hidden":!0,className:w?"h-9 w-9":"h-7 w-7"}),o(ir,{direction:"down",icon:od,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:A}),f("div",{className:"flex flex-col gap-0.5",children:[n&&f(Ne,{children:[o("button",{type:"button",onClick:()=>u("in"),disabled:g,title:"Zoom in",className:N("flex items-center justify-center rounded disabled:opacity-40",C,_),children:o(Zd,{className:E})}),o("button",{type:"button",onClick:()=>u("out"),disabled:g,title:"Zoom out",className:N("flex items-center justify-center rounded disabled:opacity-40",C,_),children:o(Yd,{className:E})})]}),s&&o("button",{type:"button",onClick:()=>d(),disabled:g,title:"Go home",className:N("flex items-center justify-center rounded disabled:opacity-40",C,_),children:o($a,{className:E})})]}),y&&f("div",{className:"relative",children:[f("button",{type:"button",onClick:()=>x(H=>!H),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(mt,{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(H=>o("button",{type:"button",onClick:()=>{m(H.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:H.name||H.id},H.id))})]})]})]})}function yg(e,t){const r=document.createElement("a");r.href=t,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)}function r5({trpc:e,deviceId:t,deviceName:r,size:n="sm",className:s}){const[a,i]=S(!1),[l,c]=S(!1),[u,d]=S(null),m=r.replace(/[^a-zA-Z0-9_.-]+/g,"_"),h=I(async C=>{i(!0),d(null),c(!1);try{const E=await e.snapshot.getSnapshot.query({deviceId:t,force:!0});if(!E)throw new Error("No snapshot available");const _=`data:${E.contentType};base64,${E.base64}`;if(C==="copy")try{await navigator.clipboard.writeText(_)}catch{throw new Error("Clipboard unavailable")}else{const A=E.contentType.includes("png")?"png":"jpg";yg(`${m}-${new Date().toISOString().replace(/[:.]/g,"-")}.${A}`,_)}c(!0),setTimeout(()=>c(!1),1500)}catch(E){d(E instanceof Error?E.message:String(E))}finally{i(!1)}},[e,t,m]),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 f("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,u&&"border-danger/40 text-danger",s),children:[a?o(je,{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 xg(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 n5({history:e,limit:t=5,latestIsFresh:r,className:n}){if(e.length===0)return null;const s=r?dd:Er,a=e.slice(0,t);return f("div",{className:N("rounded-lg border border-border bg-surface px-3 py-2",n),children:[f("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=>f("li",{className:"flex items-center justify-between text-[11px]",title:new Date(i.timestamp).toLocaleString(),children:[o("span",{className:"text-foreground",children:xg(i.timestamp)}),o("span",{className:"text-foreground-subtle font-mono text-[10px]",children:new Date(i.timestamp).toLocaleTimeString()})]},`${i.deviceId}-${i.timestamp}`))})]})}function o5({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:f(mp,{open:s,onOpenChange:a,children:[o(fp,{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(Ta,{className:"h-4 w-4"})}),f(hp,{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)=>f("li",{children:[l.separatorBefore&&c>0&&o("div",{className:"my-1 h-px bg-border"}),f("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")}),f("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 wg=[{value:"view",label:"View",icon:qt,hint:"Read-only — queries + subscriptions"},{value:"create",label:"Create",icon:Id,hint:"Mutations that create or update"},{value:"delete",label:"Delete",icon:qe,hint:"Destructive ops (delete/revoke/reset/…)"}],kg=["device","system"];function Ng(){return{type:"capability",target:"",access:["view"]}}function Sg(e){if(e==null)return[];const t=new Set;for(const r of e)if(r.type==="device")for(const n of r.targets)t.add(n);return[...t]}function Cg(e,t,r,n){let s;switch(e){case"addon":s=r;break;case"capability":s=n;break;case"category":s=kg.map(i=>({value:i,label:i}));break}if(t==null)return s;const a=new Set(t.filter(i=>i.type!=="device"&&i.type===e).map(i=>i.target));return s.filter(i=>a.has(i.value))}function Mg(e,t){if(t==null)return["view","create","delete"];const r=t.filter(s=>s.type!==e.type?!1:s.type==="device"&&e.type==="device"?s.targets.some(a=>e.targets.includes(a)):s.type!=="device"&&e.type!=="device"?s.target===e.target:!1);if(r.length===0)return[];const n=new Set;for(const s of r)for(const a of s.access)n.add(a);return[...n]}function s5({value:e,onChange:t,clampToParent:r,emptyHint:n}){const{data:s}=Pf(),{data:a}=If({}),i=J(()=>(s??[]).map(b=>({value:b.manifest.id,label:b.manifest.id})).sort((b,v)=>b.label.localeCompare(v.label)),[s]),l=J(()=>[...ul].sort().map(b=>({value:b,label:b})),[]),c=J(()=>(a??[]).map(b=>({value:String(b.id),label:`${b.name} (#${b.id} · ${b.addonId})`})).sort((b,v)=>b.label.localeCompare(v.label)),[a]),u=J(()=>r==null?null:Sg(r),[r]),d=(b,v)=>{const x=[...v];switch(b){case"category":return{type:"category",target:"device",access:x};case"capability":return{type:"capability",target:"",access:x};case"addon":return{type:"addon",target:"",access:x};case"device":return{type:"device",targets:[],access:x}}},m=(b,v)=>{t(e.map((x,y)=>{if(y!==b)return x;if(v.type!==void 0&&v.type!==x.type)return d(v.type,v.access??x.access);const w=[...v.access??x.access];return x.type==="device"?{type:"device",targets:[...v.targets??x.targets],access:w}:x.type==="category"?{type:"category",target:v.target??x.target,access:w}:x.type==="capability"?{type:"capability",target:v.target??x.target,access:w}:{type:"addon",target:v.target??x.target,access:w}}))},h=b=>{t(e.filter((v,x)=>x!==b))},g=()=>{t([...e,Ng()])};return f("div",{className:"space-y-2",children:[e.length===0&&n&&o("div",{className:"text-[10px] text-foreground-subtle italic px-2 py-2",children:n}),e.map((b,v)=>{const x=Mg(b,r);return f("div",{className:"flex flex-wrap items-start gap-1.5 rounded border border-border bg-surface px-2 py-1.5",children:[f("select",{value:b.type,onChange:y=>m(v,{type:y.target.value}),className:"rounded border border-border bg-background px-2 py-1 text-[11px] focus:outline-none focus:ring-1 focus:ring-primary",children:[o("option",{value:"category",children:"category"}),o("option",{value:"capability",children:"capability"}),o("option",{value:"addon",children:"addon"}),o("option",{value:"device",children:"device"})]}),b.type==="device"?o(Eg,{value:b.targets,choices:c,clampToParent:u,onChange:y=>m(v,{targets:y})}):f("select",{value:b.target,onChange:y=>m(v,{target:y.target.value}),className:"flex-1 min-w-[160px] rounded border border-border bg-background px-2 py-1 text-[11px] font-mono focus:outline-none focus:ring-1 focus:ring-primary",children:[f("option",{value:"",children:["— pick ",b.type," —"]}),Cg(b.type,r,i,l).map(y=>o("option",{value:y.value,children:y.label},y.value))]}),o("div",{className:"flex items-center gap-1",children:wg.map(({value:y,label:w,icon:k,hint:M})=>{const C=b.access.includes(y),E=r!=null&&!x.includes(y)&&!C;return f("label",{title:E?`${M} — not granted by your scope`:M,className:`inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] cursor-pointer transition-colors ${C?"bg-primary/15 text-primary font-medium":"text-foreground-subtle hover:bg-foreground-subtle/10"} ${E?"opacity-40 cursor-not-allowed":""}`,children:[o("input",{type:"checkbox",checked:C,disabled:E,onChange:_=>{const A=new Set(b.access);_.target.checked?A.add(y):A.delete(y),m(v,{access:[...A]})},className:"sr-only"}),o(k,{className:"h-3 w-3"}),w]},y)})}),o("button",{type:"button",onClick:()=>h(v),className:"rounded p-1 text-foreground-subtle hover:bg-danger/10 hover:text-danger transition-colors",title:"Remove scope",children:o(Pe,{className:"h-3 w-3"})})]},v)}),f("button",{type:"button",onClick:g,className:"inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] text-foreground-subtle hover:text-foreground hover:bg-foreground-subtle/10 transition-colors",children:[o(Wt,{className:"h-3 w-3"}),"Add scope"]})]})}function Eg({value:e,choices:t,clampToParent:r,onChange:n}){const[s,a]=S(""),i=J(()=>{const d=r==null?t:t.filter(h=>r.includes(h.value)),m=new Set(e);return d.filter(h=>!m.has(h.value))},[t,r,e]),l=d=>t.find(m=>m.value===d)?.label??`#${d}`,c=d=>{d&&(n([...e,d]),a(""))},u=d=>{n(e.filter(m=>m!==d))};return f("div",{className:"flex-1 min-w-[160px] flex flex-wrap items-center gap-1",children:[e.length===0&&o("span",{className:"text-[10px] text-foreground-subtle italic px-1",children:"no devices selected"}),e.map(d=>f("span",{className:"inline-flex items-center gap-1 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-mono text-primary",children:[l(d),o("button",{type:"button",onClick:()=>u(d),className:"hover:text-danger transition-colors",title:"Remove device",children:o(Pe,{className:"h-2.5 w-2.5"})})]},d)),i.length>0&&f("select",{value:s,onChange:d=>c(d.target.value),className:"rounded border border-border bg-background px-1.5 py-0.5 text-[10px] focus:outline-none focus:ring-1 focus:ring-primary",children:[o("option",{value:"",children:"+ add device…"}),i.map(d=>o("option",{value:d.value,children:d.label},d.value))]})]})}function a5(e){for(const t of e){if(t.type==="device"){if(t.targets.length===0)return"Scope device: pick at least one device"}else if(t.target.trim().length===0)return`Scope ${t.type}: pick a target`;if(t.access.length===0){const r=t.type==="device"?`[${t.targets.join(",")}]`:t.target;return`Scope ${t.type}:${r}: pick at least one access`}}return null}var Xi=ot("camstack:zone-editing",null);function i5({children:e}){const[t,r]=S(!1),[n,s]=S(null),[a,i]=S(null),[l,c]=S(null),u=I(w=>{r(w),w||(s(null),i(null),c(null))},[]),d=I(w=>{s(w)},[]),m=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=J(()=>({editing:t,drawingKind:n,selectedZoneId:a,editingDraft:l,setEditing:u,setDrawingKind:d,setSelectedZoneId:m,startDrawing:h,exitEditing:g,enterDraft:b,updateDraft:v,discardDraft:x}),[t,n,a,l,u,d,m,h,g,b,v,x]);return o(Xi.Provider,{value:y,children:e})}function l5(){return Ae(Xi)}var cs=500,Ag=800;function lr(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 cr(e,t){return e?.id===t}function c5(e,t){const[r,n]=S(null),[s,a]=S(null),[i,l]=S(null),[c,u]=S("watching"),d=q(void 0),m=q(void 0),h=q(void 0);return Q(()=>{if(t===null)return;const g=lr(e,"detection.motion-analysis",b=>{const v=b;if(!cr(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}),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>n(null),cs))});return()=>{g?.unsubscribe(),d.current&&clearTimeout(d.current)}},[e,t]),Q(()=>{if(t===null)return;const g=lr(e,"detection.motion-zones-raw",b=>{const v=b;if(!cr(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}),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>a(null),cs))});return()=>{g?.unsubscribe(),m.current&&clearTimeout(m.current)}},[e,t]),Q(()=>{if(t===null)return;const g=lr(e,"detection.result",b=>{const v=b;if(!cr(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),Ag))});return()=>{g?.unsubscribe(),h.current&&clearTimeout(h.current)}},[e,t]),Q(()=>{if(t===null)return;const g=lr(e,"detection.phase-transition",b=>{const v=b;cr(v?.source,t)&&v.data?.to&&u(v.data.to)});return()=>{g?.unsubscribe()}},[e,t]),{motion:r,motionRaw:s,detection:i,phase:c}}function u5(e,t,r=5e3){const[n,s]=S([]);Q(()=>{if(t===null)return;let u=!1;const d=()=>{e.webrtcSession.listStreams.query({deviceId:t}).then(h=>{u||s(h)}).catch(()=>{})};d();const m=setInterval(d,r);return()=>{u=!0,clearInterval(m)}},[e,t,r]);const[a,i]=S(null);Q(()=>{if(t===null)return;let u=!1;return e.pipelineOrchestrator&&e.pipelineOrchestrator.getCameraMetrics.query({deviceId:t}).then(d=>{u||!d||i({phase:d.phase,detectionFps:d.actualFps,avgInferenceMs:d.avgInferenceTimeMs,droppedFrames:d.droppedFrames})}).catch(()=>{}),()=>{u=!0}},[e,t]),Rr("pipeline.camera-metrics-snapshot",u=>{if(t===null)return;const d=u.data;d.deviceId!==t||!d.metrics||i({phase:d.metrics.phase,detectionFps:d.metrics.actualFps,avgInferenceMs:d.metrics.avgInferenceTimeMs,droppedFrames:d.metrics.droppedFrames})});const{streams:l,hasWebrtc:c}=J(()=>t===null||n.length===0?{streams:[],hasWebrtc:!1}:{streams:n.map(u=>({id:u.id,label:u.label,target:u.target,status:u.status,inputFps:u.inputFps,decodeFps:u.decodeFps,bitrateKbps:u.bitrateKbps})),hasWebrtc:!0},[t,n]);return{streams:l,hasWebrtc:c,pipelineMetrics:a,createSession:I(async(u,d)=>{if(t===null)throw new Error("No device selected");const m=await e.webrtcSession.createSession.mutate({deviceId:t,target:u,hints:d});return{sessionId:m.sessionId,sdpOffer:m.sdpOffer}},[e,t]),sendAnswer:I(async(u,d)=>{if(t===null)throw new Error("No device selected");await e.webrtcSession.handleAnswer.mutate({deviceId:t,sessionId:u,sdpAnswer:d})},[e,t]),closeSession:I(async u=>{t!==null&&await e.webrtcSession.closeSession.mutate({deviceId:t,sessionId:u}).catch(()=>{})},[e,t])}}var us={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 d5(e,t,r){const n=r?.defaultSpeed??.5,s=r?.pulseMs??250,a=r?.enabled??!0,i=_r(e,a?t:null)?.ptz,[l,c]=S([]),[u,d]=S(!1),[m,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]);Q(()=>{g()},[g]);const b=I(async v=>{if(!(!a||!i)){h(null),d(!0);try{return await v()}catch(x){h(x instanceof Error?x.message:String(x));return}finally{d(!1)}}},[a,i]);return{move:I(async(v,x)=>{if(!i)return;const y=us[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=us[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:u,error:m}}function p5(e){const t=e?.deviceId??null,r=e?.historyLimit??20,n=hi("doorbell.onPressed",t!==null?i=>i.deviceId===t:void 0),[s,a]=S([]);return Q(()=>{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 m5(e){const t=Rt(),r=J(()=>e?JSON.stringify(e):"",[e]),[n,s]=S(()=>t.listDevices(e));return Q(()=>{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(u=>{u==="connected"&&a()});return()=>{i?.(),l?.(),c()}},[t,e,r]),n}function f5(e){const t=Rt(),[r,n]=S(()=>e===null?null:t.getDevice(e));return Q(()=>{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 h5(e,t,r){const n=Rt();return hs({queryKey:e,queryFn:()=>t(n)(),...r})}function g5(e,t){const r=Rt();return nl({mutationFn:n=>e(r)(n),...t})}function b5(e,t){const r=Rt(),n=Rn(),[s,a]=S(r.connectionVersion);Q(()=>r.subscribeConnectionEvents((c,u)=>{c==="connected"&&a(u)}),[r]);const i=t.join("|"),l=JSON.stringify(e);Q(()=>{const c=[],u=()=>{const d=JSON.parse(l),m=d.length===1&&Array.isArray(d[0])?d:[d];n.invalidateQueries({queryKey:m})};u();for(const d of i.split("|"))if(d)try{c.push(r.subscribeEvent(d,u))}catch{}return()=>{for(const d of c)d()}},[r,n,i,l,s])}export{BS as AddonGlobalSettingsForm,Lb as AgentStepEditor,Yb as AppShell,qS as AudioClassificationList,VS as AudioLevelWaveform,US as AudioWaveform,sb as BTN_COMPACT,ib as BTN_COMPACT_DANGER,ab as BTN_COMPACT_PRIMARY,lb as BTN_COMPACT_WARNING,Lt as Badge,mm as BatteryBadge,ai as BottomSheet,Rb as Breadcrumb,gr as Button,db as CHIP_ACTIVE,ub as CHIP_BASE,pb as CHIP_INACTIVE,rr as CLASS_COLORS,Bh as CameraStreamPlayer,Wa as Card,sp as Checkbox,Kb as CodeBlock,rp as CollapsibleCard,Eh as ConfigFormBuilder,Yt as ConfigFormField,Un as ConfigSchemaField,e5 as ConfirmActionButton,Vb as ConfirmDialogProvider,pv as CustomFieldRenderersProvider,ov as DEFAULT_COLOR,_b as DataTable,sv as DetectionCanvas,Rh as DetectionOverlay,av as DetectionResultTree,Mf as DevShell,JS as DeviceActivityPanel,Xb as DeviceCard,mv as DeviceContextProvider,Jb as DeviceGrid,xn as DeviceItem,tv as DeviceList,ip as Dialog,Ja as DialogContent,pp as DialogDescription,up as DialogFooter,cp as DialogHeader,dp as DialogTitle,gb as DialogTrigger,XS as DiscoveryPanel,n5 as DoorbellRecentPanel,bb as Dropdown,yb as DropdownContent,xb as DropdownItem,vb as DropdownTrigger,Ub as EmptyState,Yi as EventStream,Zb as FilterBar,YS as FloatingEventStream,ZS as FloatingLogStream,Pb as FloatingPanel,Qb as FormField,Wg as GRID_GAP,Yg as GRID_PAIRED,Zg as GRID_QUICK_STATS,cb as INPUT_COMPACT,qa as IconButton,lv as ImageSelector,cv as InferenceConfigSelector,bn as Input,o5 as KebabMenu,Wb as KeyValueList,Kg as LIST_ROW,Ka as Label,Zi as LogStream,wf as LoginForm,gp as MobileDrawer,th as NodeMultiSelectField,zb as NodePicker,eh as NodeSelectField,uo as PHASE_CONFIG,t5 as PTZOverlay,Hb as PageHeader,KS as PhaseIcon,nv as PipelineBuilder,rv as PipelineRuntimeSelector,Qr as PipelineStep,Ob as PipelineTreeMatrix,zS as PlayerOverlaysProvider,mp as Popover,hp as PopoverContent,fp as PopoverTrigger,Gb as ProviderBadge,WS as ResponseLog,Vg as SECTION_BODY,Hg as SECTION_CARD,Ug as SECTION_HEADER,Xg as SPLIT_PANEL_OUTER,Jg as SPLIT_PANEL_SIDE,qg as STACK_GAP,s5 as ScopePicker,di as ScrollArea,Nr as Select,Dp as SemanticBadge,Za as Separator,Oo as Sidebar,Lo as SidebarItem,op as Skeleton,Ib as SlideOverPanel,r5 as SnapshotButton,qb as StatCard,fg as StateValuesStream,Fb as StatusBadge,iv as StepTimings,Tb as StepTreeMaster,HS as StreamBrokerSelector,QS as StreamPanel,ap as Switch,Rp as SystemProvider,tb as TEXT_FIELD_LABEL,rb as TEXT_HINT,ob as TEXT_METRIC,eb as TEXT_SECTION_LABEL,nb as TEXT_VALUE,Cb as Tabs,Ab as TabsContent,Mb as TabsList,Eb as TabsTrigger,no as ThemeProvider,wb as Tooltip,Nb as TooltipContent,kb as TooltipTrigger,jb as VersionBadge,OS as WidgetRegistryProvider,jf as WidgetSlot,i5 as ZoneEditingProvider,Db as buildStepTreeFromSchema,N as cn,ot as createSharedContext,jg as createTheme,fl as darkColors,eo as defaultTheme,ev as deriveDeviceKind,Xu as ensureMfHostInit,Be as getClassColor,js as getPhaseVisual,Sh as isFieldVisible,hl as lightColors,mb as mirror,dv as mountAddonPage,fb as providerIcons,hb as statusIcons,Qg as themeToCss,p as trpc,hv as useAccessoriesGetStatus,gv as useAddonPagesListPages,Qv as useAddonSettingsGetDeviceSettings,Gv as useAddonSettingsGetGlobalSettings,Hv as useAddonSettingsUpdateDeviceSettings,jv as useAddonSettingsUpdateGlobalSettings,Rf as useAddonWidgetsListWidgets,Bv as useAddonsApplyAutoUpdateToAll,zv as useAddonsCustom,Pv as useAddonsForceRefresh,Ov as useAddonsGetAddonAutoUpdate,Dv as useAddonsGetAutoUpdateSettings,bv as useAddonsGetLogs,_v as useAddonsGetVersions,xv as useAddonsInstallFromWorkspace,yv as useAddonsInstallPackage,wv as useAddonsIsWorkspaceAvailable,Pf as useAddonsList,vv as useAddonsListPackages,Mv as useAddonsListUpdates,kv as useAddonsListWorkspacePackages,Fv as useAddonsOnAddonLogs,Sv as useAddonsReloadPackages,Iv as useAddonsRestartAddon,Rv as useAddonsRestartServer,Tv as useAddonsRetryLoad,Av as useAddonsRollbackPackage,Cv as useAddonsSearchAvailable,$v as useAddonsSetAddonAutoUpdate,Lv as useAddonsSetAutoUpdateSettings,Nv as useAddonsUninstallPackage,Ev as useAddonsUpdatePackage,Yv as useAlertsDismiss,Uv as useAlertsEmit,Wv as useAlertsGetUnreadCount,qv as useAlertsList,Zv as useAlertsMarkAllRead,Kv as useAlertsMarkRead,Vv as useAlertsUpdate,$S as useAllWidgets,ty as useAudioAnalysisApplyDeviceSettingsPatch,ey as useAudioAnalysisGetDeviceLiveContribution,Jv as useAudioAnalysisGetDeviceSettingsContribution,Xv as useAudioAnalysisResolveDeviceSettings,ry as useAudioAnalyzerAnalyseChunk,ny as useAudioAnalyzerClassify,sy as useAudioAnalyzerDispose,oy as useAudioAnalyzerIsReady,ay as useAudioAnalyzerReprobeAudioEngine,ly as useAudioCodecCanHandle,dy as useAudioCodecCloseSession,cy as useAudioCodecCreateDecodeSession,uy as useAudioCodecCreateEncodeSession,gy as useAudioCodecFlushEncode,by as useAudioCodecListActiveSessions,iy as useAudioCodecListSupportedCodecs,hy as useAudioCodecPullEncoded,my as useAudioCodecPullPcm,py as useAudioCodecPushEncodedFrame,fy as useAudioCodecPushPcm,vy as useAudioMetricsGetCurrentSnapshot,yy as useAudioMetricsGetHistory,xy as useAuthenticationListProviders,wy as useAuthenticationSetProviderEnabled,Ay as useBackupDelete,My as useBackupGetEntries,Sy as useBackupList,Py as useBackupListArchives,ky as useBackupListDestinations,Cy as useBackupListLocations,_y as useBackupPreviewSchedule,Ey as useBackupRestore,Ny as useBackupTrigger,Ry as useBackupUpsertDestinationPolicy,Iy as useBatteryGetStatus,Dy as useBrightnessGetStatus,Ty as useBrightnessSetBrightness,Ly as useCameraCredentialsGetCredentials,Oy as useCameraCredentialsGetStatus,By as useCameraStreamsGetBrokerStreams,$y as useCameraStreamsGetCameraStreams,_f as useCameraStreamsGetRtspEntries,qn as useClusterNodes,Wn as useConfirm,Ef as useCustomFieldRenderer,bm as useDebouncedString,Gy as useDecoderCreateSession,jy as useDecoderDestroySession,Fy as useDecoderGetInfo,qy as useDecoderGetStats,Wy as useDecoderListActiveSessions,Hy as useDecoderOpenStream,Uy as useDecoderPullFrames,Qy as useDecoderPushPacket,Ky as useDecoderReprobeHwaccel,zy as useDecoderSupportsCodec,Vy as useDecoderUpdateConfig,Xy as useDetectionPipelineApplyDeviceSettingsPatch,Yy as useDetectionPipelineGetDeviceLiveContribution,Zy as useDetectionPipelineGetDeviceSettingsContribution,uv as useDevShell,f5 as useDevice,cm as useDeviceBattery,Zt as useDeviceCapability,c5 as useDeviceDetections,tx as useDeviceDiscoveryAdoptDevice,nx as useDeviceDiscoveryGetStatus,Jy as useDeviceDiscoveryListDiscovered,ex as useDeviceDiscoveryRefreshDiscovery,rx as useDeviceDiscoveryReleaseDevice,dx as useDeviceExportApplyDeviceSettingsPatch,ix as useDeviceExportExposeDevice,ux as useDeviceExportGetDeviceLiveContribution,cx as useDeviceExportGetDeviceSettingsContribution,ox as useDeviceExportGetStatus,ax as useDeviceExportListExposedDevices,sx as useDeviceExportListSupportedDeviceKinds,lx as useDeviceExportUnexposeDevice,Af as useDeviceId,Nx as useDeviceManagerAddLocation,Zx as useDeviceManagerAdoptDevice,px as useDeviceManagerAllocateDeviceId,Xx as useDeviceManagerCreateDevice,Dx as useDeviceManagerDisable,Kx as useDeviceManagerDiscoverDevices,Tx as useDeviceManagerEnable,Fx as useDeviceManagerGetAllBindings,zx as useDeviceManagerGetBindings,Ax as useDeviceManagerGetChildren,Rx as useDeviceManagerGetConfigSchema,Yx as useDeviceManagerGetCreationSchema,Ex as useDeviceManagerGetDevice,Vx as useDeviceManagerGetDeviceAggregate,Ux as useDeviceManagerGetDeviceLiveInfoAggregate,Hx as useDeviceManagerGetDeviceSettingsAggregate,t0 as useDeviceManagerGetDeviceStatusAggregate,_x as useDeviceManagerGetSettingsSchema,Ox as useDeviceManagerGetStreamProfileMap,Px as useDeviceManagerGetStreamSources,If as useDeviceManagerListAll,Qx as useDeviceManagerListBindableCapsForDeviceType,kx as useDeviceManagerListLocations,Mx as useDeviceManagerListPersistedByAddon,jx as useDeviceManagerListWrappersForCap,gx as useDeviceManagerLoadConfig,vx as useDeviceManagerLoadMeta,bx as useDeviceManagerLoadRuntimeState,hx as useDeviceManagerPersistConfig,Bx as useDeviceManagerProbeStreams,mx as useDeviceManagerRegisterDevice,Lx as useDeviceManagerRemove,fx as useDeviceManagerRemoveDevice,Sx as useDeviceManagerRemoveLocation,Cx as useDeviceManagerSetDisabled,xx as useDeviceManagerSetLocation,wx as useDeviceManagerSetMetadata,yx as useDeviceManagerSetName,$x as useDeviceManagerSetStreamProfileMap,Gx as useDeviceManagerSetWrapperActive,Jx as useDeviceManagerTestCreationField,e0 as useDeviceManagerTestField,Ix as useDeviceManagerUpdateConfig,qx as useDeviceManagerUpdateDeviceField,Wx as useDeviceManagerUpdateDeviceFieldsBatch,n0 as useDeviceOpsGetConfigEntries,a0 as useDeviceOpsGetSettingsSchema,r0 as useDeviceOpsGetStreamSources,s0 as useDeviceOpsRemoveDevice,o0 as useDeviceOpsSetConfig,m0 as useDeviceProviderAdoptDiscoveredDevice,g0 as useDeviceProviderCreateDevice,p0 as useDeviceProviderDiscoverDevices,h0 as useDeviceProviderGetChildCreationSchema,u0 as useDeviceProviderGetDevices,c0 as useDeviceProviderGetStatus,i0 as useDeviceProviderStart,l0 as useDeviceProviderStop,d0 as useDeviceProviderSupportsDiscovery,f0 as useDeviceProviderSupportsManualCreation,b0 as useDeviceProviderTestCreationField,_r as useDeviceProxy,fv as useDeviceSnapshot,um as useDeviceSnapshotImage,$p as useDeviceState,x0 as useDeviceStateGetAllSnapshots,y0 as useDeviceStateGetCapSlice,v0 as useDeviceStateGetSnapshot,w0 as useDeviceStateSetCapSlice,bi as useDeviceStateSlice,k0 as useDeviceStatusGetStatus,u5 as useDeviceWebrtc,m5 as useDevices,p5 as useDoorbellEvents,N0 as useDoorbellGetStatus,b5 as useEventInvalidation,hi as useEventStreamLatest,Bb as useEventStreamMap,M0 as useEventsGetEventClipUrl,C0 as useEventsGetEventThumbnail,S0 as useEventsGetEvents,E0 as useFeatureProbeGetStatus,_0 as useIntegrationsCreate,T0 as useIntegrationsDelete,P0 as useIntegrationsGet,O0 as useIntegrationsGetAvailableTypes,R0 as useIntegrationsGetByAddonId,D0 as useIntegrationsGetSettings,A0 as useIntegrationsList,L0 as useIntegrationsSetSettings,$0 as useIntegrationsTestConnection,I0 as useIntegrationsUpdate,Q0 as useIntercomEndTalkSession,H0 as useIntercomGetStatus,z0 as useIntercomHandleAnswer,j0 as useIntercomPushTalkPcm,B0 as useIntercomStartSession,G0 as useIntercomStartTalkSession,F0 as useIntercomStopSession,Sb as useIsMidWidth,Pr as useIsMobile,Ct as useLiveBuffer,Rr as useLiveEvent,W0 as useLocalNetworkGetAllowedAddresses,q0 as useLocalNetworkGetConnectionEndpoints,V0 as useLocalNetworkGetPreferred,U0 as useLocalNetworkList,Z0 as useLocalNetworkResetAllowlistToBestMatch,K0 as useLocalNetworkSetAllowedAddresses,Y0 as useMeshNetworkGetStatus,X0 as useMeshNetworkJoin,e1 as useMeshNetworkLeave,r1 as useMeshNetworkListPeers,t1 as useMeshNetworkLogout,J0 as useMeshNetworkStartLogin,n1 as useMeshNetworkTestConnection,s1 as useMeshOrchestratorJoinProvider,a1 as useMeshOrchestratorLeaveProvider,c1 as useMeshOrchestratorListProviderPeers,o1 as useMeshOrchestratorListProviders,l1 as useMeshOrchestratorLogoutProvider,i1 as useMeshOrchestratorStartLoginProvider,u1 as useMetricsProviderCollectSnapshot,v1 as useMetricsProviderGetAddonStats,d1 as useMetricsProviderGetCached,h1 as useMetricsProviderGetCpuTemperature,p1 as useMetricsProviderGetCurrent,m1 as useMetricsProviderGetDiskSpace,f1 as useMetricsProviderGetGpuInfo,g1 as useMetricsProviderGetProcessStats,x1 as useMetricsProviderKillProcess,b1 as useMetricsProviderListAddonInstances,y1 as useMetricsProviderListNodeProcesses,N1 as useMotionDetectionAnalyze,A1 as useMotionDetectionApplyDeviceSettingsPatch,E1 as useMotionDetectionGetDeviceLiveContribution,M1 as useMotionDetectionGetDeviceSettingsContribution,S1 as useMotionDetectionRemoveCamera,C1 as useMotionDetectionReset,k1 as useMotionGetStatus,w1 as useMotionIsDetected,R1 as useMotionTriggerGetStatus,P1 as useMotionTriggerSetMotionTrigger,T1 as useMqttBrokerAddBroker,I1 as useMqttBrokerGetBrokerConfig,B1 as useMqttBrokerGetStatus,_1 as useMqttBrokerListBrokers,D1 as useMqttBrokerRemoveBroker,O1 as useMqttBrokerStartEmbeddedBroker,$1 as useMqttBrokerStopEmbeddedBroker,L1 as useMqttBrokerTestConnection,z1 as useNativeObjectDetectionGetStatus,G1 as useNetworkQualityGetAllStats,F1 as useNetworkQualityGetDeviceStats,j1 as useNetworkQualityReportClientStats,Y1 as useNodesClusterAddonStatus,H1 as useNodesDeployAddon,ew as useNodesExecuteQuery,X1 as useNodesGetNodeAddons,Z1 as useNodesRenameNode,V1 as useNodesRestartAddon,W1 as useNodesRestartNode,q1 as useNodesRestartProcess,J1 as useNodesSetProcessLogLevel,K1 as useNodesShutdownNode,Q1 as useNodesTopology,U1 as useNodesUndeployAddon,tw as useNotificationOutputSend,rw as useNotificationOutputSendTest,$b as useOptionalSystem,Ff as useOptionalWidgetRegistry,ow as useOsdGetStatus,nw as useOsdSetOverlay,d5 as usePTZ,gw as usePipelineAnalyticsApplyDeviceSettingsPatch,lw as usePipelineAnalyticsClearTracks,sw as usePipelineAnalyticsGetActiveTracks,dw as usePipelineAnalyticsGetAudioEvents,hw as usePipelineAnalyticsGetDeviceLiveContribution,fw as usePipelineAnalyticsGetDeviceSettingsContribution,pw as usePipelineAnalyticsGetEventMedia,cw as usePipelineAnalyticsGetMotionEvents,uw as usePipelineAnalyticsGetObjectEvents,aw as usePipelineAnalyticsGetTrack,mw as usePipelineAnalyticsGetTrackMedia,iw as usePipelineAnalyticsListTracks,Bw as usePipelineExecutorCacheFrameInPool,Dw as usePipelineExecutorDeleteModel,Rw as usePipelineExecutorDeleteTemplate,Lw as usePipelineExecutorDetect,Tw as usePipelineExecutorDownloadModel,Iw as usePipelineExecutorGetAddonModels,Kw as usePipelineExecutorGetAudioCapabilities,bw as usePipelineExecutorGetAvailableEngines,_w as usePipelineExecutorGetCapabilities,yw as usePipelineExecutorGetDefaultSteps,Yw as usePipelineExecutorGetDetectionConfigSchema,Gw as usePipelineExecutorGetEffectiveTuning,Cw as usePipelineExecutorGetGlobalPipelineConfig,Sw as usePipelineExecutorGetGlobalSteps,Mw as usePipelineExecutorGetOrchestratorConfigSchema,Ww as usePipelineExecutorGetReferenceAudio,qw as usePipelineExecutorGetReferenceAudioFiles,Vw as usePipelineExecutorGetReferenceImage,Nw as usePipelineExecutorGetSchema,vw as usePipelineExecutorGetSelectedEngine,ww as usePipelineExecutorGetVideoPipelineSteps,zw as usePipelineExecutorInferCached,Hw as usePipelineExecutorKillEngine,jw as usePipelineExecutorListLoadedEngines,Uw as usePipelineExecutorListReferenceImages,Ew as usePipelineExecutorListTemplates,xw as usePipelineExecutorReprobeEngine,Zw as usePipelineExecutorRunAudioTest,Ow as usePipelineExecutorRunPipeline,$w as usePipelineExecutorRunPipelineBatch,Aw as usePipelineExecutorSaveTemplate,kw as usePipelineExecutorSetVideoPipelineSteps,Qw as usePipelineExecutorSpinEngine,Fw as usePipelineExecutorUncacheFrame,Pw as usePipelineExecutorUpdateTemplate,Tk as usePipelineOrchestratorApplyDeviceSettingsPatch,dk as usePipelineOrchestratorAssignAudio,lk as usePipelineOrchestratorAssignDecoder,Xw as usePipelineOrchestratorAssignPipeline,Rk as usePipelineOrchestratorDeleteTemplate,nk as usePipelineOrchestratorGetAgentLoad,bk as usePipelineOrchestratorGetAgentSettings,mk as usePipelineOrchestratorGetAudioAssignment,hk as usePipelineOrchestratorGetAudioAssignments,fk as usePipelineOrchestratorGetAudioNodeLoad,sk as usePipelineOrchestratorGetCameraMetrics,wk as usePipelineOrchestratorGetCameraSettings,Nk as usePipelineOrchestratorGetCameraStepOverrides,ak as usePipelineOrchestratorGetCapabilityBindings,gk as usePipelineOrchestratorGetDecoderAssignment,uk as usePipelineOrchestratorGetDecoderAssignments,Ik as usePipelineOrchestratorGetDeviceLiveContribution,_k as usePipelineOrchestratorGetDeviceSettingsContribution,ok as usePipelineOrchestratorGetGlobalMetrics,rk as usePipelineOrchestratorGetPipelineAssignment,tk as usePipelineOrchestratorGetPipelineAssignments,vk as usePipelineOrchestratorListAgentSettings,Ek as usePipelineOrchestratorListTemplates,ek as usePipelineOrchestratorRebalance,xk as usePipelineOrchestratorRemoveAgentSettings,Mk as usePipelineOrchestratorResolvePipeline,Ak as usePipelineOrchestratorSaveTemplate,yk as usePipelineOrchestratorSetAgentAddonDefaults,Ck as usePipelineOrchestratorSetCameraPipelineForAgent,Sk as usePipelineOrchestratorSetCameraStepOverride,kk as usePipelineOrchestratorSetCameraStepToggle,ik as usePipelineOrchestratorSetCapabilityBinding,pk as usePipelineOrchestratorUnassignAudio,ck as usePipelineOrchestratorUnassignDecoder,Jw as usePipelineOrchestratorUnassignPipeline,Pk as usePipelineOrchestratorUpdateTemplate,Dk as usePipelineRunnerAttachCamera,Lk as usePipelineRunnerDetachCamera,Fk as usePipelineRunnerGetAllCameraMetrics,zk as usePipelineRunnerGetCameraMetrics,Gk as usePipelineRunnerGetLocalCameras,$k as usePipelineRunnerGetLocalLoad,Bk as usePipelineRunnerGetLocalMetrics,Ok as usePipelineRunnerReportMotion,jk as usePlatformProbeGetCapabilities,Qk as usePlatformProbeGetHardware,Vk as usePlatformProbeGetHardwareEncoders,qk as usePlatformProbeRefreshHardwareEncoders,Uk as usePlatformProbeResolveHwAccel,Hk as usePlatformProbeResolveInferenceConfig,GS as usePlayerOverlayLayer,FS as usePlayerOverlayLayers,jS as usePlayerToolbarButton,zh as usePlayerToolbarButtons,o2 as usePtzAutotrackGetSettings,r2 as usePtzAutotrackGetStatus,n2 as usePtzAutotrackSetEnabled,s2 as usePtzAutotrackSetSettings,Kk as usePtzContinuousMove,e2 as usePtzGetPosition,Yk as usePtzGetPresets,t2 as usePtzGetStatus,Jk as usePtzGoHome,Xk as usePtzGoToPreset,Wk as usePtzMove,Zk as usePtzStop,a2 as useRebootReboot,p2 as useRecordingEngineDisable,d2 as useRecordingEngineEnable,x2 as useRecordingEngineEstimateGlobalStorage,y2 as useRecordingEngineEstimateStorage,v2 as useRecordingEngineGetAvailability,m2 as useRecordingEngineGetConfig,E2 as useRecordingEngineGetMotionStats,h2 as useRecordingEngineGetPlaylist,N2 as useRecordingEngineGetPolicy,S2 as useRecordingEngineGetPolicyStatus,C2 as useRecordingEngineGetRetentionConfig,b2 as useRecordingEngineGetSegments,u2 as useRecordingEngineGetStatus,w2 as useRecordingEngineGetStorageUsage,g2 as useRecordingEngineGetThumbnail,k2 as useRecordingEngineSetPolicy,f2 as useRecordingEngineUpdateConfig,M2 as useRecordingEngineUpdateRetentionConfig,l2 as useRecordingGetPlaybackUrl,i2 as useRecordingGetSegments,c2 as useRecordingGetThumbnailAt,A2 as useRemoteAccessListProviders,P2 as useRemoteAccessStartProvider,R2 as useRemoteAccessStopProvider,$2 as useSettingsStoreCount,z2 as useSettingsStoreDeclareCollection,O2 as useSettingsStoreDelete,_2 as useSettingsStoreGet,D2 as useSettingsStoreInsert,B2 as useSettingsStoreIsEmpty,T2 as useSettingsStoreQuery,I2 as useSettingsStoreSet,L2 as useSettingsStoreUpdate,U2 as useSnapshotApplyDeviceSettingsPatch,H2 as useSnapshotGetDeviceLiveContribution,Q2 as useSnapshotGetDeviceSettingsContribution,F2 as useSnapshotGetSnapshot,j2 as useSnapshotGetStatus,G2 as useSnapshotInvalidateCache,q2 as useSnapshotProviderGetSnapshot,V2 as useSnapshotProviderSupportsDevice,oN as useStorageAbortUpload,sN as useStorageBeginDownload,tN as useStorageBeginUpload,J2 as useStorageDelete,dN as useStorageDeleteLocation,iN as useStorageEndDownload,Y2 as useStorageExists,nN as useStorageFinalizeUpload,eN as useStorageGetAvailableSpace,cN as useStorageGetDefaultLocation,X2 as useStorageList,lN as useStorageListLocations,mN as useStorageListProviders,Z2 as useStorageRead,aN as useStorageReadChunk,W2 as useStorageResolve,fN as useStorageTestConfig,pN as useStorageTestLocation,uN as useStorageUpsertLocation,K2 as useStorageWrite,rN as useStorageWriteChunk,zN as useStreamBrokerApplyDeviceSettingsPatch,bN as useStreamBrokerAssignProfile,IN as useStreamBrokerGetAllRtspEntries,AN as useStreamBrokerGetBroker,wN as useStreamBrokerGetBrokerStats,BN as useStreamBrokerGetDeviceLiveContribution,$N as useStreamBrokerGetDeviceSettingsContribution,RN as useStreamBrokerGetPreBufferInfo,TN as useStreamBrokerGetRtspEntry,_N as useStreamBrokerGetRtspPort,CN as useStreamBrokerGetStreamUrl,MN as useStreamBrokerGetStreamWithCodec,ON as useStreamBrokerIsRtspEnabled,NN as useStreamBrokerKillClient,yN as useStreamBrokerListAllCameraStreams,xN as useStreamBrokerListAllProfileSlots,kN as useStreamBrokerListClients,hN as useStreamBrokerPublishCameraStream,DN as useStreamBrokerRegenerateRtspToken,EN as useStreamBrokerReleaseStreamWithCodec,SN as useStreamBrokerRestartProfile,gN as useStreamBrokerRetractCameraStream,PN as useStreamBrokerSetPreBufferDuration,LN as useStreamBrokerSetRtspEnabled,vN as useStreamBrokerUnassignProfile,GN as useSwitchGetStatus,FN as useSwitchSetState,Rt as useSystem,HN as useSystemFeatureFlags,WN as useSystemForceRetentionCleanup,VN as useSystemGetRetentionConfig,QN as useSystemHealth,jN as useSystemInfo,g5 as useSystemMutation,UN as useSystemNetworkAddresses,h5 as useSystemQuery,qN as useSystemSetRetentionConfig,wl as useThemeMode,KN as useToastOnToast,YN as useTurnOrchestratorGetAllServers,ZN as useTurnOrchestratorListProviders,XN as useTurnOrchestratorSetProviderEnabled,JN as useTurnProviderGetTurnServers,gS as useUserManagementConfirmTotp,lS as useUserManagementCreateApiKey,dS as useUserManagementCreateScopedToken,tS as useUserManagementCreateUser,nS as useUserManagementDeleteUser,bS as useUserManagementDisableTotp,vS as useUserManagementGetTotpStatus,iS as useUserManagementListApiKeys,fS as useUserManagementListScopedTokens,eS as useUserManagementListUsers,oS as useUserManagementResetPassword,cS as useUserManagementRevokeApiKey,pS as useUserManagementRevokeScopedToken,sS as useUserManagementSetUserScopes,hS as useUserManagementSetupTotp,rS as useUserManagementUpdateUser,uS as useUserManagementValidateApiKey,aS as useUserManagementValidateCredentials,mS as useUserManagementValidateScopedToken,yS as useUserManagementVerifyTotp,SS as useWebrtcSessionCloseSession,wS as useWebrtcSessionCreateSession,NS as useWebrtcSessionHandleAnswer,kS as useWebrtcSessionHandleOffer,CS as useWebrtcSessionHasAdaptiveBitrate,xS as useWebrtcSessionListStreams,Bf as useWidget,zf as useWidgetMetadata,Zn as useWidgetRegistry,AS as useZoneAnalyticsGetCameraHistory,MS as useZoneAnalyticsGetCurrentSnapshot,PS as useZoneAnalyticsGetUnzonedHistory,ES as useZoneAnalyticsGetZoneHistory,l5 as useZoneEditing,RS as useZoneRulesListRules,_S as useZoneRulesSetRules,TS as useZonesAddZone,IS as useZonesListZones,DS as useZonesRemoveZone,LS as useZonesUpdateZone,a5 as validateScopes};