@camstack/addon-admin-ui 1.1.18 → 1.1.19
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.
- package/dist/assets/{AddLocationWizard-BSAorNxx.js → AddLocationWizard-DlIuy7PK.js} +1 -1
- package/dist/assets/{AddonCollectionPage-wr63l6CJ.js → AddonCollectionPage-B4YZsZ2N.js} +1 -1
- package/dist/assets/{Addons-CCu9KkD9.js → Addons-CF3JeZJs.js} +1 -1
- package/dist/assets/{AdminTabs-m8tLAejz.js → AdminTabs-Cyrx86NX.js} +1 -1
- package/dist/assets/{BrokerForm-D5X7ElT-.js → BrokerForm-BU7fpWoT.js} +1 -1
- package/dist/assets/{Capabilities-DC_JRuiW.js → Capabilities-BEyROSgm.js} +1 -1
- package/dist/assets/{CapabilityBadges-DH4Q-Etp.js → CapabilityBadges-C7OuLfh8.js} +1 -1
- package/dist/assets/{Cluster-R47NhOdT.js → Cluster-tcDpGJRa.js} +1 -1
- package/dist/assets/{Dashboard-99pp6GEH.js → Dashboard-DOxZXqyK.js} +1 -1
- package/dist/assets/{Data-CjGyMZA8.js → Data-t_YbtZxL.js} +1 -1
- package/dist/assets/{DetectionIntelligence-PgT0GEOx.js → DetectionIntelligence-DqOJ15Er.js} +1 -1
- package/dist/assets/{DeviceDetail-D5VfOgmh.js → DeviceDetail-DQbwOLvC.js} +1 -1
- package/dist/assets/{Devices-D3L0VfVU.js → Devices-C3jy25Bw.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-CG-ioO0R.js → EmbedPlayerPage-C4PqItRF.js} +1 -1
- package/dist/assets/{FormBuilder-zyMCOhuI.js → FormBuilder-B7tUioUm.js} +1 -1
- package/dist/assets/{Identity-D1JnXext.js → Identity-BEvc1UzE.js} +1 -1
- package/dist/assets/{IntegrationDetail-BrPHapeM.js → IntegrationDetail-lPxvINqs.js} +1 -1
- package/dist/assets/{Integrations-DayJSTiK.js → Integrations-CNJgYeN5.js} +1 -1
- package/dist/assets/{Integrations-DTGXl1Ur.js → Integrations-DsYPT3r2.js} +1 -1
- package/dist/assets/{Logs-CpG3Oq7W.js → Logs-5bYEoeMq.js} +1 -1
- package/dist/assets/{MyAccess-BfsppvsN.js → MyAccess-0WTyoQQ1.js} +1 -1
- package/dist/assets/{Network-CjIhXL12.js → Network-BggdRVzo.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-DBNKikBW.js → NodeAddonsSettingsPanel-oVi7MC28.js} +1 -1
- package/dist/assets/{NotificationTargets-ip8v0_gg.js → NotificationTargets-CI-nn-rf.js} +1 -1
- package/dist/assets/Pipeline-BI2SWq0a.js +1 -0
- package/dist/assets/{PrivacyMaskSettings-BaWtZUaS.js → PrivacyMaskSettings-CrOgd9eg.js} +1 -1
- package/dist/assets/{ProviderIcon-r37coe5_.js → ProviderIcon-BlnoCop3.js} +1 -1
- package/dist/assets/{ScanNetworkModal-BM4LZZGz.js → ScanNetworkModal-CxjeMDho.js} +1 -1
- package/dist/assets/{Settings-JgMgqfxb.js → Settings-5VzV0eVZ.js} +1 -1
- package/dist/assets/{Showroom-DD4nO3bB.js → Showroom-DrEy5G_m.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DZuPeYa3.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CLDXRGbV.js} +1 -1
- package/dist/assets/circle-check-big-MfDWxk9K.js +1 -0
- package/dist/assets/{copy-D905mbwE.js → copy-C4G6c4Ys.js} +1 -1
- package/dist/assets/{download-CRt3yUK3.js → download-BXqeElYK.js} +1 -1
- package/dist/assets/{esm-B4H3LqM1.js → esm-C86u2nhh.js} +1 -1
- package/dist/assets/{hostInit-qaKjJotG.js → hostInit-eCexcRoY.js} +1 -1
- package/dist/assets/{index-NMHNU-e8.js → index-idVLv2oj.js} +3 -3
- package/dist/assets/{key-round-p2A3Fbuu.js → key-round-BNduVRhj.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-dd1b0e8c.js → mf-entry-bootstrap-0-62a708e5.js} +2 -2
- package/dist/assets/{pencil-CpJIJ9Uy.js → pencil-x4bNLykx.js} +1 -1
- package/dist/assets/plus-ByEqM_KR.js +1 -0
- package/dist/assets/{radio-RcoVZmtM.js → radio-D7QKOm_q.js} +1 -1
- package/dist/assets/{refresh-cw-D6BYsgNx.js → refresh-cw-sAaM2a8A.js} +1 -1
- package/dist/assets/remoteEntry-CorFK6mn.js +1 -0
- package/dist/assets/{rotate-ccw-wFxrc6l5.js → rotate-ccw-DmmfCbwP.js} +1 -1
- package/dist/assets/rotate-cw-Dq3dsGth.js +1 -0
- package/dist/assets/search-Cbx2Urnx.js +1 -0
- package/dist/assets/{server-DOFYQi_I.js → server-9jJq82Vu.js} +1 -1
- package/dist/assets/{sparkles-DBG9vp4A.js → sparkles-Cf43SJhp.js} +1 -1
- package/dist/assets/square-C0pQT5rA.js +1 -0
- package/dist/assets/{square-check-big-rAJ2A2-o.js → square-check-big-CKe1iFeG.js} +1 -1
- package/dist/assets/{src-1618avTR.js → src-B7BVQkY2.js} +4 -4
- package/dist/assets/{upload-5GQoWO_K.js → upload-DeGWObu4.js} +1 -1
- package/dist/assets/{useDevice-DHi9vYPM.js → useDevice-D_sz9YbZ.js} +1 -1
- package/dist/assets/{useEventInvalidation-orMzg97E.js → useEventInvalidation-BMv3kB-_.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Bj4tGzk2.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_--tYWwZy7.js} +2 -2
- package/dist/assets/{wifi-5-JmPgz2.js → wifi-dLfxxYcz.js} +1 -1
- package/dist/assets/{zap--D6I-5eT.js → zap-lXnTrd14.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/server/addon.js +1 -1
- package/package.json +1 -1
- package/dist/assets/Pipeline-DHnGCOi7.js +0 -1
- package/dist/assets/circle-check-big-qiIAVDDz.js +0 -1
- package/dist/assets/plus-OLMgcI14.js +0 -1
- package/dist/assets/remoteEntry-BYprJ3Bc.js +0 -1
- package/dist/assets/rotate-cw-CxsIcHYk.js +0 -1
- package/dist/assets/search-5vt1VPCs.js +0 -1
- package/dist/assets/square-BY1YswJx.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$r as e,Ar as t,Br as n,C as r,Cr as i,Dr as a,Ea as o,Er as s,Fr as c,Gr as l,Hi as u,Hr as d,Ir as f,Ji as p,Jr as m,Ki as h,Nr as g,Or as _,Pr as v,Q as y,Qi as b,Rr as x,T as S,Tr as C,Ur as w,X as T,Xr as E,Yi as D,Yr as O,Zi as k,_ as A,ai as j,ba as M,ci as N,ea as P,ei as F,fi as ee,gi as te,jr as ne,kr as re,mi as ie,oi as ae,pi as oe,qi as se,qr as ce,si as le,ta as ue,ui as de,zr as fe}from"./src-1618avTR.js";import{G as pe,I as me,K as I,S as L,T as he,W as R,Z as z,a as ge,b as B,o as V,x as H,z as U}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CCjPq1YD.js";import{p as _e}from"./player-overlays-BK-_BrgW.js";import{D as W,O as ve}from"./src-D7qnpDWK.js";import{t as ye}from"./download-CRt3yUK3.js";import{i as be,n as xe,r as Se,t as Ce}from"./AddLocationWizard-BSAorNxx.js";import{n as we,r as Te,t as Ee}from"./zap--D6I-5eT.js";import{t as De}from"./pencil-CpJIJ9Uy.js";import{t as Oe}from"./plus-OLMgcI14.js";import{t as ke}from"./refresh-cw-D6BYsgNx.js";import{t as Ae}from"./search-5vt1VPCs.js";import{t as je}from"./server-DOFYQi_I.js";import{t as Me}from"./square-check-big-rAJ2A2-o.js";import{t as Ne}from"./square-BY1YswJx.js";import{A as Pe,F as Fe,G as Ie,M as Le,P as Re,V as G,i as ze,j as Be,k as K,o as Ve,s as He,w as Ue,x as q}from"./index-NMHNU-e8.js";import{t as We}from"./AdminPage-vtcsGqRq.js";import{r as Ge}from"./useDevice-DHi9vYPM.js";import{t as J}from"./useEventInvalidation-orMzg97E.js";import{n as Ke}from"./format-size-CO9d3C3-.js";import{t as qe}from"./NodeAddonsSettingsPanel-DBNKikBW.js";import{a as Y,i as Je,n as Ye,r as X,t as Xe}from"./esm-B4H3LqM1.js";var Ze=G(`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`}]]),Qe=G(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),$e=G(`flame`,[[`path`,{d:`M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z`,key:`96xj49`}]]),et=G(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]);z();var tt=`enabledDecoderNodes`,nt=`enabledNodes`,rt=`enabledAudioNodes`,it=[`hub`];function at(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function ot(e){let t=e.sections;if(!Array.isArray(t))return e;let n={};for(let e of t){if(!e||typeof e!=`object`)continue;let t=e.fields;if(Array.isArray(t))for(let e of t){if(!e||typeof e!=`object`)continue;let t=e.key;typeof t==`string`&&(t in n||(n[t]=e.value))}}return n}function st(e,t,n){let r=e[t];return(at(r)?r:it).includes(n)}function ct(e,t){if(e==null)return{decode:!0,pipeline:!0,audio:!0};let n=ot(e);return{decode:st(n,tt,t),pipeline:st(n,nt,t),audio:st(n,rt,t)}}var lt=`pipeline-orchestrator`;function ut({selectedNodeId:e,onSelect:t,refreshToken:n}){let{data:r}=i(void 0),{data:a}=ce(void 0),{data:o}=T({addonId:lt}),s=new Map;for(let e of a??[])s.set(e.agentNodeId,(s.get(e.agentNodeId)??0)+1);let c=r??[],l=c.filter(e=>e.isOnline).length,u=c.filter(e=>!e.isOnline).length;return L(`div`,{className:`flex flex-col h-full`,children:[L(`button`,{type:`button`,onClick:()=>t(tr),className:`flex items-center gap-3 px-4 py-3 border-b border-border text-left transition-colors ${e===`__cluster__`?`bg-primary/10 text-primary`:`text-foreground hover:bg-surface-hover`}`,children:[H(Ue,{className:`h-4 w-4 flex-shrink-0`}),L(`div`,{className:`min-w-0 flex-1`,children:[H(`div`,{className:`text-xs font-semibold truncate`,children:`Cluster`}),H(`div`,{className:`text-[10px] text-foreground-subtle`,children:`Balancer + failover + assignments`})]})]}),H(`div`,{className:`flex-1 overflow-y-auto`,children:c.map(n=>{let r=e===n.id,i=s.get(n.id)??0,a=n.isHub?je:K,c=ct(o,n.id);return L(`button`,{type:`button`,onClick:()=>t(n.id),className:`flex items-center gap-3 w-full px-4 py-3 border-b border-border text-left transition-colors ${r?`bg-primary/10 text-primary`:`text-foreground hover:bg-surface-hover`}`,children:[H(a,{className:`h-4 w-4 flex-shrink-0`}),L(`div`,{className:`min-w-0 flex-1`,children:[L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`text-xs font-semibold truncate`,children:n.name}),n.isHub&&H(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`}),!n.isOnline&&H(`span`,{className:`h-1.5 w-1.5 rounded-full bg-destructive flex-shrink-0`}),n.isOnline&&H(`span`,{className:`h-1.5 w-1.5 rounded-full bg-success flex-shrink-0`})]}),L(`div`,{className:`text-[10px] text-foreground-subtle flex items-center gap-2 mt-0.5`,children:[L(`span`,{children:[n.cpuCores,` cores`]}),H(`span`,{children:`•`}),L(`span`,{children:[Math.round(n.memoryMB/1024),` GB`]}),i>0&&L(B,{children:[H(`span`,{children:`•`}),L(`span`,{className:`inline-flex items-center gap-0.5 text-foreground`,children:[H(we,{className:`h-2.5 w-2.5`}),i]})]})]}),L(`div`,{className:`mt-0.5 flex items-center gap-1`,children:[H(M,{variant:c.decode?`success`:`danger`,className:`px-1 py-0 text-[9px] leading-3`,title:c.decode?`Decode: enabled`:`Decode: not enabled (enabledDecoderNodes)`,children:`Dec`}),H(M,{variant:c.pipeline?`success`:`danger`,className:`px-1 py-0 text-[9px] leading-3`,title:c.pipeline?`Pipeline: enabled`:`Pipeline: not enabled (enabledNodes)`,children:`Pipe`}),H(M,{variant:c.audio?`success`:`danger`,className:`px-1 py-0 text-[9px] leading-3`,title:c.audio?`Audio: enabled`:`Audio: not enabled (enabledAudioNodes)`,children:`Aud`})]})]})]},n.id)})}),L(`div`,{className:`px-4 py-2 border-t border-border text-[10px] text-foreground-subtle flex items-center justify-between`,children:[L(`span`,{children:[l,` online`]}),u>0&&L(`span`,{className:`text-destructive`,children:[u,` offline`]})]})]})}function dt({nodeId:e,refreshToken:t}){let{data:n}=i(void 0),r=n?.find(t=>t.id===e),a=se(`pipeline.runner-load-snapshot`,t=>t.nodeId===e)?.load??null;return r?L(`div`,{className:`px-6 py-4 border-b border-border`,children:[L(`div`,{className:`flex items-center gap-2 mb-1`,children:[H(`h2`,{className:`text-base font-semibold text-foreground`,children:r.name}),r.isOnline?H(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-success/10 text-success`,children:`online`}):H(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-destructive/10 text-destructive`,children:`offline`}),r.isHub&&H(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`})]}),L(`div`,{className:`text-[11px] text-foreground-subtle flex items-center gap-2 flex-wrap`,children:[H(`span`,{children:r.cpuModel??`CPU`}),H(`span`,{children:`•`}),L(`span`,{children:[r.cpuCores,` cores`]}),H(`span`,{children:`•`}),L(`span`,{children:[Math.round(r.memoryMB/1024),` GB`]}),a&&L(B,{children:[H(`span`,{children:`•`}),L(`span`,{children:[a.attachedCameras,` cameras (`,a.activeCameras,` active)`]}),H(`span`,{children:`•`}),L(`span`,{children:[a.avgInferenceTimeMs.toFixed(0),`ms avg inference`]}),H(`span`,{children:`•`}),L(`span`,{children:[`queue `,a.queueDepthTotal]}),a.hardware.hasGpu&&L(B,{children:[H(`span`,{children:`•`}),H(`span`,{className:`text-success`,children:`GPU`})]})]})]})]}):H(`div`,{className:`px-6 py-4 border-b border-border`,children:L(`div`,{className:`text-xs text-foreground-subtle`,children:[`Node not found: `,e]})})}function ft({refreshToken:e,nodeId:t}){let[r,i]=I(new Map),{nodes:a}=h();D(`pipeline.camera-metrics-snapshot`,e=>{let t=e.data;typeof t?.deviceId==`number`&&i(e=>{let n=new Map(e);return n.set(t.deviceId,t),n})});let{data:o}=n(void 0),s=R(()=>{let e=new Map;for(let t of o??[])e.set(t.nodeId,t.deviceCount);return e},[o]),c=R(()=>{let e=new Map,t=Date.now()-3e4;for(let n of r.values()){if(n.timestamp<t)continue;let r=n.nodeId??`hub`,i=e.get(r)??{attachedCameras:0,activeCameras:0,totalFps:0,totalInferenceWeighted:0,queueDepth:0};i.attachedCameras++,n.metrics.phase===`active`&&i.activeCameras++,i.totalFps+=n.metrics.actualFps,i.totalInferenceWeighted+=n.metrics.avgInferenceTimeMs,i.queueDepth+=n.metrics.queueDepth,e.set(r,i)}return e},[r]),l=R(()=>{let e=new Map;for(let t of a)e.set(t.id,t.shortName);return e},[a]),u=R(()=>{let e=0,t=0,n=0,r=0,i=0;for(let a of c.values())e+=a.attachedCameras,t+=a.activeCameras,n+=a.totalFps,r+=a.totalInferenceWeighted,i+=a.queueDepth;let o=e>0?r/e:0;return{totalAgents:a.length,onlineAgents:a.filter(e=>e.isOnline).length,attachedCameras:e,activeCameras:t,avgInferenceTimeMs:o,queueDepth:i,totalFps:n}},[c,a]);if(t){let e=c.get(t);return L(`div`,{className:`@container/liveload`,children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),L(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 mb-3`,children:[H(Z,{label:`FPS`,value:e?e.totalFps.toFixed(1):`—`}),H(Z,{label:`Cameras`,value:e?`${e.activeCameras}/${e.attachedCameras}`:`—`}),H(Z,{label:`Avg infer ms`,value:e&&e.attachedCameras>0?(e.totalInferenceWeighted/e.attachedCameras).toFixed(0):`—`}),H(Z,{label:`Queue`,value:e?String(e.queueDepth):`—`}),H(Z,{label:`Audio`,value:String(s.get(t)??`—`)})]})]})}let d=[...c.entries()].toSorted(([e],[t])=>e===`hub`?-1:t===`hub`?1:e.localeCompare(t));return L(`div`,{className:`@container/liveload`,children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),L(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 sm:gap-3 mb-3`,children:[H(Z,{label:`Total agents`,value:`${u.onlineAgents}/${u.totalAgents}`}),H(Z,{label:`Cameras`,value:`${u.activeCameras}/${u.attachedCameras}`}),H(Z,{label:`Total FPS`,value:u.totalFps.toFixed(1)}),H(Z,{label:`Avg inference ms`,value:u.avgInferenceTimeMs.toFixed(0)}),H(Z,{label:`Queue depth`,value:String(u.queueDepth)})]}),H(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:L(`table`,{className:`w-full text-xs min-w-[480px]`,children:[H(`thead`,{className:`bg-surface`,children:L(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[H(`th`,{className:`text-left px-3 py-2`,children:`Agent`}),H(`th`,{className:`text-right px-3 py-2`,children:`FPS`}),H(`th`,{className:`text-right px-3 py-2`,children:`Cameras`}),H(`th`,{className:`text-right px-3 py-2`,children:`Inference ms`}),H(`th`,{className:`text-right px-3 py-2`,children:`Queue`}),H(`th`,{className:`text-right px-3 py-2`,children:`Audio`})]})}),L(`tbody`,{children:[d.map(([e,t])=>L(`tr`,{className:`border-t border-border`,children:[H(`td`,{className:`px-3 py-2 text-foreground font-medium`,children:l.get(e)??e}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.totalFps.toFixed(1)}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras>0?(t.totalInferenceWeighted/t.attachedCameras).toFixed(0):`—`}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.queueDepth}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:s.get(e)??`—`})]},e)),d.length===0&&H(`tr`,{children:H(`td`,{colSpan:6,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`No camera metrics received yet`})})]})]})})]})}function Z({label:e,value:t}){return L(`div`,{className:`rounded-lg border border-border bg-surface/60 p-3`,children:[H(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle mb-1`,children:e}),H(`div`,{className:`text-lg font-semibold text-foreground`,children:t})]})}z();var pt={active:!1,pinned:!1,nodeId:null,reason:``},mt=[`pipeline.camera-assigned`,`pipeline.camera-unassigned`,`pipeline.camera-updated`,`agent.online`,`agent.offline`],ht={pipeline:K,decoder:Qe,audio:Te},gt={pipeline:`Pipeline`,decoder:`Decoder`,audio:`Audio`};function _t({mode:e,nodeId:t,compact:n=!1}){if(e===`agent`&&!t)throw Error(`CameraAssignmentsTable: nodeId is required when mode === "agent"`);let r=V(),[i,a]=I(null),[o,s]=I(null),[u,d]=I(new Map);J([`pipelineOrchestrator`,`getPipelineAssignments`],mt),J([`pipelineOrchestrator`,`getDecoderAssignments`],mt),J([`pipelineOrchestrator`,`getAudioAssignments`],mt);let{data:f}=ce(void 0),{data:p}=l(void 0),{data:m}=fe(void 0),{nodes:_}=h(),{data:y}=Ge();D(`pipeline.camera-metrics-snapshot`,e=>{let t=e.data;typeof t.deviceId==`number`&&d(e=>{let n=new Map(e);return n.set(t.deviceId,t),n})}),U(()=>{if(u.size===0)return;let e=setInterval(()=>{d(e=>{let t=Date.now()-1e4,n=!1,r=new Map(e);for(let[i,a]of e)a.timestamp<t&&(r.delete(i),n=!0);return n?r:e})},5e3);return()=>clearInterval(e)},[u.size]);let b=R(()=>{let e=new Map;for(let t of y??[])e.set(t.id,t.name);return e},[y]),x=R(()=>{let n=new Map,r=e=>{let t=n.get(e);if(t)return t;let r={deviceId:e,deviceName:b.get(e)??`Device ${e}`,pipeline:pt,decoder:pt,audio:pt};return n.set(e,r),r};for(let i of f??[]){let a=r(i.deviceId);n.set(i.deviceId,{...a,pipeline:{active:e===`cluster`?!0:i.agentNodeId===t,pinned:i.pinned,nodeId:i.agentNodeId,reason:i.reason??``}})}for(let i of p??[]){let a=r(i.deviceId);n.set(i.deviceId,{...a,decoder:{active:e===`cluster`?!0:i.decoderNodeId===t,pinned:i.pinned,nodeId:i.decoderNodeId,reason:i.reason??``}})}for(let i of m??[]){let a=r(i.deviceId);n.set(i.deviceId,{...a,audio:{active:e===`cluster`?!0:i.nodeId===t,pinned:i.pinned,nodeId:i.nodeId,reason:`capacity`}})}let i=[...n.values()];return e===`agent`&&(i=i.filter(e=>e.pipeline.active||e.decoder.active||e.audio.active)),i.sort((e,t)=>e.deviceId-t.deviceId),i},[f,p,m,b,e,t]),C=R(()=>(_??[]).filter(e=>e.isOnline).map(e=>({id:e.id,name:e.name})),[_]),w=()=>{r.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),r.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getDecoderAssignments`]]}),r.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]})},T=c({onSuccess:w}),E=le({onSuccess:w}),O=v({onSuccess:w}),k=ae({onSuccess:w}),A=g({onSuccess:w}),M=j({onSuccess:w}),N=(e,t,n)=>{t===`pipeline`?T.mutate({deviceId:e,agentNodeId:n}):t===`decoder`?O.mutate({deviceId:e,nodeId:n}):A.mutate({deviceId:e,nodeId:n}),a(null)},P=(e,t)=>{t===`pipeline`?E.mutate({deviceId:e}):t===`decoder`?k.mutate({deviceId:e}):M.mutate({deviceId:e}),a(null)};return H(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:L(`table`,{className:`w-full text-xs min-w-[640px]`,children:[H(`thead`,{className:`bg-surface`,children:L(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[!n&&H(`th`,{className:`w-6`}),H(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Camera`}),H(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Pipeline`}),H(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Decoder`}),H(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Audio`}),H(`th`,{className:`text-left px-3 py-2 align-middle`,children:`Status`})]})}),L(`tbody`,{children:[x.map(t=>{let r=u.get(t.deviceId),c=o===t.deviceId;return L(he.Fragment,{children:[L(`tr`,{className:`border-t border-border align-middle relative`,children:[!n&&H(`td`,{className:`px-2 py-2 align-middle`,children:H(`button`,{type:`button`,onClick:()=>s(c?null:t.deviceId),className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle`,"aria-label":c?`Collapse broker details`:`Expand broker details`,children:H(c?Re:Le,{className:`h-3.5 w-3.5`})})}),L(`td`,{className:`px-3 py-2 align-middle`,children:[H(`div`,{className:`text-foreground font-medium leading-tight`,children:t.deviceName}),L(`div`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[`#`,t.deviceId]})]}),H(vt,{role:`pipeline`,state:t.pipeline,mode:e,deviceId:t.deviceId,onlineNodes:C,isMenuOpen:i?.deviceId===t.deviceId&&i.role===`pipeline`,onToggleMenu:()=>a(i?.deviceId===t.deviceId&&i.role===`pipeline`?null:{deviceId:t.deviceId,role:`pipeline`}),onCloseMenu:()=>a(null),onMove:e=>N(t.deviceId,`pipeline`,e),onUnpin:()=>P(t.deviceId,`pipeline`)}),H(vt,{role:`decoder`,state:t.decoder,mode:e,deviceId:t.deviceId,onlineNodes:C,isMenuOpen:i?.deviceId===t.deviceId&&i.role===`decoder`,onToggleMenu:()=>a(i?.deviceId===t.deviceId&&i.role===`decoder`?null:{deviceId:t.deviceId,role:`decoder`}),onCloseMenu:()=>a(null),onMove:e=>N(t.deviceId,`decoder`,e),onUnpin:()=>P(t.deviceId,`decoder`)}),H(vt,{role:`audio`,state:t.audio,mode:e,deviceId:t.deviceId,onlineNodes:C,isMenuOpen:i?.deviceId===t.deviceId&&i.role===`audio`,onToggleMenu:()=>a(i?.deviceId===t.deviceId&&i.role===`audio`?null:{deviceId:t.deviceId,role:`audio`}),onCloseMenu:()=>a(null),onMove:e=>N(t.deviceId,`audio`,e),onUnpin:()=>P(t.deviceId,`audio`)}),H(`td`,{className:`px-3 py-2 align-middle`,children:H(xt,{snap:r})})]}),c&&!n&&L(`tr`,{className:`bg-surface/50`,children:[H(`td`,{}),H(`td`,{colSpan:5,className:`px-3 py-2`,children:H(S,{widgetId:`stream-broker/stream-broker-panel`,host:`device-tab`,deviceId:t.deviceId,instanceId:`pipeline-row/${t.deviceId}`,config:{variant:`compact`,title:`Stream brokers & clients`}})})]})]},t.deviceId)}),x.length===0&&H(`tr`,{children:H(`td`,{colSpan:n?5:6,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:e===`agent`?`No cameras assigned to this node`:`No cameras currently assigned`})})]})]})})}function vt({role:e,state:t,mode:n,onlineNodes:r,isMenuOpen:i,onToggleMenu:a,onCloseMenu:o,onMove:s,onUnpin:c}){let l=ht[e],u=r.filter(e=>e.id!==(t.nodeId??``)),d=(t.active||n===`cluster`)&&(u.length>0||t.pinned);return L(`td`,{className:`px-3 py-2 align-middle relative`,children:[L(`div`,{className:`flex items-center gap-2`,children:[H(n===`agent`?yt:bt,{state:t,Icon:l}),H(`div`,{className:`ml-auto`,children:d&&H(`button`,{type:`button`,onClick:a,className:`p-1 rounded hover:bg-surface-hover`,"aria-label":`${gt[e]} actions`,children:H(Ze,{className:`h-3 w-3 text-foreground-subtle`})})})]}),i&&d&&H(St,{title:gt[e],targets:u,pinned:t.pinned,onMove:s,onUnpin:c,onClose:o})]})}function yt({state:e,Icon:t}){return L(`div`,{className:`flex items-center gap-1.5`,children:[H(e.active?Me:Ne,{className:`h-3.5 w-3.5 ${e.active?`text-success`:`text-foreground-subtle/50`}`}),H(t,{className:`h-3 w-3 ${e.active?`text-foreground-subtle`:`text-foreground-subtle/40`}`}),e.pinned&&H(et,{className:`h-2.5 w-2.5 text-amber-400`})]})}function bt({state:e,Icon:t}){return!e.active||!e.nodeId?L(`div`,{className:`flex items-center gap-1.5 text-foreground-subtle/60`,children:[H(t,{className:`h-3 w-3`}),H(`span`,{className:`text-[10px] italic`,children:`—`})]}):L(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[H(t,{className:`h-3 w-3 text-foreground-subtle shrink-0`}),L(`div`,{className:`flex flex-col leading-tight min-w-0`,children:[H(`span`,{className:`font-mono text-[11px] text-foreground truncate`,children:e.nodeId}),H(`span`,{className:`flex items-center gap-1 text-[10px]`,children:e.pinned?L(`span`,{className:`inline-flex items-center gap-0.5 text-amber-400`,children:[H(et,{className:`h-2.5 w-2.5`}),` manual`]}):L(`span`,{className:`text-foreground-subtle truncate`,children:[`auto · `,e.reason||`capacity`]})})]})]})}function xt({snap:e}){if(!e)return H(`span`,{className:`text-[10px] text-foreground-subtle italic`,children:`—`});let{phase:t,actualFps:n,avgInferenceTimeMs:r,queueDepth:i,configuredFps:a}=e.metrics,s=o(t);return L(`div`,{className:`flex flex-col gap-0.5 font-mono text-[10px] tabular-nums leading-tight`,children:[L(`span`,{className:`inline-flex items-center gap-1 ${s.textColor}`,children:[H(A,{phase:t,className:`h-2.5 w-2.5`}),H(`span`,{className:`font-semibold uppercase tracking-wider`,children:s.label})]}),L(`span`,{className:`text-foreground-subtle`,children:[H(`span`,{className:`text-foreground`,children:n.toFixed(1)}),L(`span`,{children:[`/`,a.toFixed(0),` fps`]})]}),L(`span`,{className:`text-foreground-subtle`,children:[H(`span`,{className:`text-foreground`,children:r.toFixed(0)}),H(`span`,{children:` ms`}),i>0&&L(`span`,{className:`text-warning ml-1`,children:[`q`,i]})]})]})}function St({title:e,targets:t,pinned:n,onMove:r,onUnpin:i,onClose:a}){let o=pe(null);return U(()=>{let e=e=>{o.current?.contains(e.target)||a()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[a]),L(`div`,{ref:o,className:`absolute right-2 top-full mt-1 w-48 rounded-lg border border-border bg-surface shadow-lg z-20 text-left`,children:[H(`div`,{className:`px-3 py-1 text-[9px] uppercase tracking-wider text-foreground-subtle border-b border-border`,children:e}),t.length>0&&H(`div`,{className:`py-1`,children:t.map(e=>L(`button`,{type:`button`,onClick:()=>r(e.id),className:`block w-full text-left px-3 py-1 text-[11px] text-foreground hover:bg-surface-hover`,children:[`Move to `,e.name]},e.id))}),n&&L(`button`,{type:`button`,onClick:i,className:`block w-full text-left px-3 py-1.5 text-[11px] text-destructive hover:bg-destructive/10 border-t border-border`,children:[`Unpin `,e.toLowerCase()]}),t.length===0&&!n&&H(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle italic`,children:`Already auto · no other nodes online`})]})}function Ct({nodeId:e,refreshToken:t}){return L(`div`,{className:`space-y-6`,children:[H(ft,{refreshToken:t,nodeId:e}),L(`div`,{children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Cameras on this node`}),L(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`Checkboxes mark the roles currently running on `,e,`. Use the kebab to move a role to another node or unpin it; live KPIs come from the runner snapshot stream.`]})]}),H(_t,{mode:`agent`,nodeId:e,compact:!0})]})}z();function wt(e,t){let n=Math.max(0,t-e);return`${Math.floor(e/1e3)}s idle · ${Math.floor(n/1e3)}s left`}function Tt({nodeId:e,refreshToken:n}){let r=V(),i=t({onSettled:()=>{r.invalidateQueries({queryKey:[`pipelineExecutor`,`listLoadedEngines`]})}}),{data:a}=ne({nodeId:e}),o=se(`pipeline.engine-metrics-snapshot`,t=>t.nodeId===e)?.engines??a??null,s=o===null;J([`pipelineRunner`,`getLocalCameras`],[`pipeline.camera-assigned`,`pipeline.camera-unassigned`]);let{data:c}=de({nodeId:e}),{values:l}=p(`pipeline.camera-metrics-snapshot`,e=>e.deviceId,t=>t.nodeId===e),u=R(()=>l.filter(e=>e.metrics.phase===`active`).length,[l]),d=t=>{let n=c??[];n.length>0&&!window.confirm(`${n.length} camera(s) are dispatching through this engine. Killing it forces a respawn on the next frame. Continue?`)||i.mutate({nodeId:e,engine:t,force:n.length>0})};return L(`div`,{className:`space-y-6`,children:[L(`div`,{children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Inference engines on this node`}),L(`p`,{className:`text-[11px] text-foreground-subtle`,children:[(o??[]).length,` engine(s) resident in RAM. `,(c??[]).length,` `,`camera(s) attached, `,u,` actively dispatching frames. Refreshes every 5s.`]})]}),H(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:L(`table`,{className:`w-full text-xs min-w-[640px]`,children:[H(`thead`,{className:`bg-surface`,children:L(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[H(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Kind`}),H(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Runtime / Backend / Device`}),H(`th`,{className:`text-left px-3 py-2`,children:`Models`}),H(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Pool PID`}),H(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Auto-kill`}),H(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`In use`}),H(`th`,{className:`w-20`})]})}),L(`tbody`,{children:[s&&H(`tr`,{children:H(`td`,{colSpan:7,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`Loading…`})}),!s&&(o??[]).map(e=>{let t=e.kind===`warm-override`;return L(`tr`,{className:`border-t border-border ${t?`bg-amber-500/5`:``}`,children:[H(`td`,{className:`px-3 py-2`,children:L(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-medium ${t?`bg-amber-500/15 text-amber-400`:`bg-success/15 text-success`}`,children:[H(t?$e:K,{className:`h-3 w-3`}),t?`warm`:`runtime`]})}),H(`td`,{className:`px-3 py-2`,children:L(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-sky-400`,children:[H(Ee,{className:`h-3 w-3`}),e.engine.runtime,`/`,e.engine.backend,e.engine.device?`/${e.engine.device}`:``,e.engine.format?` · ${e.engine.format}`:``]})}),H(`td`,{className:`px-3 py-2`,children:e.modelsLoaded.length===0?H(`span`,{className:`text-foreground-subtle text-[11px]`,children:`—`}):H(`div`,{className:`flex flex-wrap gap-1`,children:e.modelsLoaded.map(e=>H(`span`,{className:`inline-block rounded bg-surface px-1.5 py-0.5 text-[10px] font-mono text-foreground-subtle`,children:e},e))})}),H(`td`,{className:`px-3 py-2 text-right font-mono text-foreground`,children:e.poolPid??`—`}),H(`td`,{className:`px-3 py-2 text-right text-[11px]`,children:e.idleMs!==null&&e.idleTtlMs!==null?H(`span`,{className:`text-foreground-subtle`,children:wt(e.idleMs,e.idleTtlMs)}):H(`span`,{className:`text-foreground-subtle/50`,children:`never`})}),H(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t?`—`:(c??[]).length}),H(`td`,{className:`px-3 py-2 text-right`,children:L(`button`,{type:`button`,disabled:i.isPending,onClick:()=>d(e.engine),className:`inline-flex items-center gap-1 px-2 py-1 rounded border border-destructive/30 text-destructive text-[11px] hover:bg-destructive/10 disabled:opacity-50`,children:[H(He,{className:`h-3 w-3`}),`Kill`]})})]},e.engineKey)}),!s&&(o??[]).length===0&&H(`tr`,{children:H(`td`,{colSpan:7,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`No engines resident — the factory spins up on the first pipeline run.`})})]})]})}),L(`div`,{className:`text-[10px] text-foreground-subtle leading-relaxed`,children:[H(`strong`,{className:`text-foreground`,children:`runtime`}),`: main camera-serving engine; never auto-killed while cameras attached. `,H(`strong`,{className:`text-foreground`,children:`warm`}),`: benchmark/test override held in cache for fast re-use; auto-disposed after the idle TTL.`]}),i.isError&&L(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-[11px] text-destructive`,children:[`Kill failed:`,` `,i.error instanceof Error?i.error.message:`unknown`]})]})}z();var Et=new Set(ve);function Dt(e){return Et.has(e)}function Ot(e,t,n){return`${e}/${t}/${n}`}function kt(e){return{coreml:`CoreML`,openvino:`OpenVINO`,onnx:`ONNX`}[e.format]??e.format.toUpperCase()}function At(e){return{coreml:`Apple Neural Engine / GPU — .mlpackage`,openvino:`Intel CPU / GPU / NPU — .xml`,onnx:`CPU, CUDA, Node.js — .onnx`}[e.format]??`.${e.format}`}function Q(e){return e.format}function jt(e,t){let n=0,r=0,i=0;for(let a of e)for(let e of a.addons)for(let a of e.models){let e=a.formats[t];e&&(n++,e.downloaded&&(r++,i+=e.sizeMB))}return{total:n,downloaded:r,downloadedSizeMB:i}}function Mt({addonId:e,model:t,format:n,isActive:r,progress:i,errorMsg:a,onDownload:o,onDelete:s}){let c=t.formats[n];return c?L(`div`,{className:`flex items-center gap-3 px-4 py-3 border-b border-border/50 last:border-b-0 hover:bg-surface-hover/30 transition-colors`,children:[H(`div`,{className:`h-2 w-2 rounded-full shrink-0 ${c.downloaded?`bg-success`:`bg-foreground-subtle/30`}`}),L(`div`,{className:`flex-1 min-w-0`,children:[L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`text-sm font-medium text-foreground`,children:t.name}),L(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:[`(`,t.id,`)`]})]}),i&&i.progress>=0&&i.progress<100&&L(`div`,{className:`mt-1.5 flex items-center gap-2 max-w-xs`,children:[H(`div`,{className:`flex-1 h-1 bg-surface-hover rounded-full overflow-hidden`,children:H(`div`,{className:`bg-primary h-full rounded-full transition-all duration-300`,style:{width:`${i.progress}%`}})}),L(`span`,{className:`text-[9px] text-primary font-mono tabular-nums shrink-0`,children:[Math.round(i.progress),`%`]})]})]}),H(`span`,{className:`text-xs text-foreground-subtle tabular-nums shrink-0`,children:Ke(c.sizeMB)}),a&&L(`span`,{className:`flex items-center gap-1 text-[10px] text-danger max-w-[160px] truncate shrink-0`,title:a,children:[H(Be,{className:`h-3 w-3 shrink-0`}),a]}),c.downloaded?L(`button`,{onClick:s,disabled:r,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-medium rounded-md border border-danger/30 text-danger hover:bg-danger/10 disabled:opacity-50 transition-colors shrink-0`,children:[r?H(q,{className:`h-3 w-3 animate-spin`}):H(He,{className:`h-3 w-3`}),r?`Deleting...`:`Delete`]}):L(`button`,{onClick:o,disabled:r,className:`inline-flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors shrink-0`,children:[r?H(q,{className:`h-3 w-3 animate-spin`}):H(ye,{className:`h-3 w-3`}),r?`Downloading...`:`Download`]})]}):null}function Nt({engines:e,activeEngine:t,viewEngine:n,onSelect:r}){let[i,a]=I(!1);return L(`div`,{className:`relative`,children:[L(`button`,{type:`button`,onClick:()=>a(!i),className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-4 py-2.5 w-full text-left hover:bg-surface-hover transition-colors`,children:[H(K,{className:`h-4 w-4 text-primary shrink-0`}),L(`div`,{className:`flex-1 min-w-0`,children:[L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`text-sm font-medium text-foreground`,children:kt(n)}),Q(n)===Q(t)&&H(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),H(`div`,{className:`text-[10px] text-foreground-subtle`,children:At(n)})]}),H(Re,{className:`h-4 w-4 text-foreground-subtle transition-transform ${i?`rotate-180`:``}`})]}),i&&H(`div`,{className:`absolute top-full left-0 right-0 mt-1 rounded-lg border border-border bg-surface shadow-lg z-50 overflow-hidden`,children:e.map(e=>{let i=Q(e)===Q(n),o=Q(e)===Q(t);return L(`button`,{type:`button`,onClick:()=>{r(e),a(!1)},className:`flex items-center gap-3 px-4 py-2.5 w-full text-left transition-colors ${i?`bg-primary/5`:`hover:bg-surface-hover`}`,children:[H(K,{className:`h-4 w-4 shrink-0 ${i?`text-primary`:`text-foreground-subtle`}`}),L(`div`,{className:`flex-1`,children:[L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`text-sm font-medium ${i?`text-primary`:`text-foreground`}`,children:kt(e)}),o&&H(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),H(`div`,{className:`text-[10px] text-foreground-subtle`,children:At(e)})]}),i&&H(Pe,{className:`h-4 w-4 text-primary shrink-0`})]},Q(e))})})]})}function Pt({embedded:e=!1,nodeId:t}={}){let n=V(),r=t??`hub`,[i,o]=I(null),[c,l]=I(new Set),[u,d]=I(new Map),[f,p]=I(new Map),[m,h]=I(``),{data:g=[]}=a({nodeId:r}),v=g.filter((e,t,n)=>n.findIndex(t=>t.format===e.format)===t),{data:y}=re({nodeId:r}),b=y,{data:x,isLoading:S}=_({nodeId:r}),w=s(),T=C();D(`model.download.progress`,e=>{let t=e.data,r=typeof t.modelId==`string`?t.modelId:void 0,i=typeof t.progress==`number`?t.progress:void 0,a=typeof t.totalMB==`number`?t.totalMB:0;r===void 0||i===void 0||(d(e=>{let t=new Map(e);return i===100||i===-1?t.delete(r):t.set(r,{modelId:r,progress:i,totalMB:a}),t}),i===100&&n.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]}))});let E=b??{runtime:`node`,backend:`cpu`,format:`onnx`},O=v.find(e=>e.format===i)??E,k=O.format,A=x?.slots??[],j=A.map(e=>({...e,addons:e.addons.map(e=>({...e,models:e.models.filter(e=>e.formats[k]!==void 0)})).filter(e=>e.models.length>0)})).filter(e=>e.addons.length>0),M=jt(j,k),N=me(async(e,t,i)=>{if(!Dt(i))return;let a=Ot(e,t,i);l(e=>new Set([...e,a])),p(e=>{let t=new Map(e);return t.delete(a),t});try{await w.mutateAsync({addonId:e,modelId:t,format:i,nodeId:r}),n.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]})}catch(e){p(t=>new Map([...t,[a,e instanceof Error?e.message:`Download failed`]]))}finally{l(e=>{let t=new Set(e);return t.delete(a),t})}},[w,n,r]),P=me(async(e,t,i)=>{if(!Dt(i))return;let a=Ot(e,t,i);l(e=>new Set([...e,a])),p(e=>{let t=new Map(e);return t.delete(a),t});try{await T.mutateAsync({addonId:e,modelId:t,format:i,nodeId:r}),n.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]})}catch(e){p(t=>new Map([...t,[a,e instanceof Error?e.message:`Delete failed`]]))}finally{l(e=>{let t=new Set(e);return t.delete(a),t})}},[T,n,r]),F=me(e=>{o(e.format)},[]),ee=m.trim()?j.map(e=>({...e,addons:e.addons.map(e=>({...e,models:e.models.filter(t=>t.name.toLowerCase().includes(m.toLowerCase())||t.id.toLowerCase().includes(m.toLowerCase())||e.name.toLowerCase().includes(m.toLowerCase()))})).filter(e=>e.models.length>0)})).filter(e=>e.addons.length>0):j,te=L(B,{children:[S&&H(`div`,{className:`flex items-center justify-center py-16`,children:H(q,{className:`h-5 w-5 animate-spin text-foreground-subtle`})}),!S&&A.length===0&&L(`div`,{className:`flex flex-col items-center justify-center py-16 text-foreground-subtle`,children:[H(be,{className:`h-8 w-8 mb-3 opacity-30`}),H(`span`,{className:`text-sm`,children:`No pipeline steps available`}),H(`span`,{className:`text-xs mt-1`,children:`Configure the detection pipeline to see available models.`})]}),!S&&A.length>0&&L(B,{children:[H(Nt,{engines:v,activeEngine:E,viewEngine:O,onSelect:F}),L(`div`,{className:`flex items-center gap-4 text-xs text-foreground-subtle`,children:[L(`span`,{children:[H(`span`,{className:`font-semibold text-foreground tabular-nums`,children:M.total}),H(`span`,{className:`ml-1`,children:`compatible models`})]}),H(`span`,{className:`text-border`,children:`|`}),L(`span`,{children:[H(`span`,{className:`font-semibold text-success tabular-nums`,children:M.downloaded}),H(`span`,{className:`ml-1`,children:`downloaded`})]}),H(`span`,{className:`text-border`,children:`|`}),L(`span`,{className:`tabular-nums`,children:[Ke(M.downloadedSizeMB),H(`span`,{className:`ml-1`,children:`on disk`})]})]}),M.total>5&&L(`div`,{className:`relative`,children:[H(Ae,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),H(`input`,{type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:`Search models...`,className:`w-full pl-9 pr-3 py-2 text-sm rounded-lg border border-border bg-surface text-foreground placeholder:text-foreground-subtle/50 focus:outline-none focus:ring-1 focus:ring-primary`})]}),ee.map(e=>{let t=e.addons.reduce((e,t)=>e+t.models.length,0),n=e.addons.reduce((e,t)=>e+t.models.filter(e=>e.formats[k]?.downloaded).length,0);return L(`div`,{children:[L(`div`,{className:`flex items-center gap-2 mb-2`,children:[H(`h2`,{className:`text-sm font-semibold text-foreground`,children:e.label}),H(`div`,{className:`flex-1 h-px bg-border`}),L(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:[n,`/`,t]})]}),H(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:e.addons.map(e=>e.models.map(t=>{let n=Ot(e.id,t.id,k);return H(Mt,{addonId:e.id,model:t,format:k,isActive:c.has(n),progress:u.get(t.id),errorMsg:f.get(n),onDownload:()=>N(e.id,t.id,k),onDelete:()=>P(e.id,t.id,k)},`${e.id}/${t.id}`)}))})]},e.id)}),ee.length===0&&H(`div`,{className:`text-center py-8 text-sm text-foreground-subtle`,children:m.trim()?L(B,{children:[`No models matching “`,m,`”`]}):L(B,{children:[`No models available for `,kt(O),` format`]})})]})]});return e?H(`div`,{className:`space-y-4`,children:te}):H(We,{children:te})}function Ft({nodeId:e,refreshToken:t}){return H(Pt,{embedded:!0,nodeId:e})}var It=[{concern:`pipeline`,label:`Pipeline`,advisory:!1},{concern:`audio`,label:`Audio`,advisory:!1},{concern:`decode`,label:`Decode`,advisory:!0,advisoryNote:`Advisory: decode currently runs co-located with the stream source (hub). Pins are stored and take effect with Phase-2 stream load-balancing.`}];function Lt(e,t){return e.filter(e=>e.currentNodeId!==t)}var Rt=`This node is not decoder-enabled (enabledDecoderNodes). Pinning detection here strands frames (0 fps) until frame-source-aware placement ships. Enable decode on this node first, or pick a decoder-enabled node.`;function zt(e,t,n){return t.includes(e)?{verdict:`ok`}:n?{verdict:`warn`,reason:Rt}:{verdict:`block`,reason:Rt}}z();var Bt=`pipeline-orchestrator`,Vt=`enabledDecoderNodes`;function Ht(e,t){if(!e||typeof e!=`object`)return;let n=e.sections;if(Array.isArray(n))for(let e of n){if(!e||typeof e!=`object`)continue;let n=e.fields;if(Array.isArray(n))for(let e of n){if(!e||typeof e!=`object`)continue;let n=e;if(n.key!==t)continue;let r=n.value;return Array.isArray(r)&&r.every(e=>typeof e==`string`)?r:void 0}}}function Ut({nodeId:e,nodeName:t,concern:n,open:r,onClose:i}){let a=V(),o=Ge(),s=ce(void 0),u=l(void 0),d=fe(void 0),f=T({addonId:Bt}),p=c(),m=v(),h=g(),[_,y]=I(new Set),[b,x]=I(!1),[S,C]=I(null),[w,E]=I([]),[D,O]=I(null),k=It.find(e=>e.concern===n),A=R(()=>{let e=new Map;if(n===`pipeline`)for(let t of s.data??[])e.set(t.deviceId,t.agentNodeId);else if(n===`decode`)for(let t of u.data??[])e.set(t.deviceId,t.decoderNodeId);else for(let t of d.data??[])e.set(t.deviceId,t.nodeId);return e},[n,s.data,u.data,d.data]),j=R(()=>(o.data??[]).filter(e=>e.isCamera).map(e=>({deviceId:e.id,name:e.name,currentNodeId:A.get(e.id)??null})),[o.data,A]),M=R(()=>Lt(j,e),[j,e]),N=Ht(f.data,Vt),P=n===`pipeline`?zt(e,N??[],!1):{verdict:`ok`},[F,ee]=I(!1);if(!r)return null;let te=P.verdict===`block`,ne=P.verdict===`warn`&&!F,re=_.size>0&&!b&&!te&&!ne,ie=e=>{y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ae=M.length>0&&M.every(e=>_.has(e.deviceId)),oe=()=>{y(ae?new Set:new Set(M.map(e=>e.deviceId)))},se=async t=>{n===`pipeline`?await p.mutateAsync({deviceId:t,agentNodeId:e}):n===`decode`?await m.mutateAsync({deviceId:t,nodeId:e}):await h.mutateAsync({deviceId:t,nodeId:e})},le=new Map(j.map(e=>[e.deviceId,e.name]));return L(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[H(`div`,{className:`absolute inset-0 bg-black/60`,onClick:i}),L(`div`,{className:`relative z-10 flex w-full max-w-2xl flex-col h-[80vh] rounded-xl border border-border bg-background shadow-2xl`,children:[L(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[L(`div`,{className:`min-w-0`,children:[L(`h2`,{className:`text-sm font-semibold text-foreground`,children:[`Batch assign `,k?.label??n,` → `,t]}),L(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:[`Pick the cameras whose `,k?.label.toLowerCase()??n,` should run on this node.`]})]}),H(`button`,{type:`button`,onClick:i,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover`,"aria-label":`Close`,children:H(ze,{className:`h-4 w-4`})})]}),L(`div`,{className:`flex-1 min-h-0 px-5 py-3 flex flex-col gap-2 overflow-hidden`,children:[k?.advisory&&k.advisoryNote&&H(`div`,{className:`rounded-lg border border-warning/30 bg-warning/5 px-3 py-2 shrink-0`,children:L(`div`,{className:`flex items-start gap-2`,children:[H(Ve,{className:`h-3.5 w-3.5 text-warning mt-0.5 shrink-0`}),H(`p`,{className:`text-[11px] text-warning`,children:k.advisoryNote})]})}),P.verdict!==`ok`&&H(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 shrink-0`,children:L(`div`,{className:`flex items-start gap-2`,children:[H(Ve,{className:`h-3.5 w-3.5 text-destructive mt-0.5 shrink-0`}),L(`div`,{className:`min-w-0`,children:[H(`p`,{className:`text-[11px] text-destructive`,children:P.reason}),P.verdict===`warn`&&L(`label`,{className:`mt-1 flex items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[H(`input`,{type:`checkbox`,checked:F,onChange:e=>ee(e.target.checked),className:`accent-primary`}),`I understand — assign anyway`]})]})]})}),M.length>0&&L(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle shrink-0`,children:[H(`input`,{type:`checkbox`,"aria-label":`Select all`,checked:ae,onChange:oe,className:`accent-primary`}),`Select all (`,M.length,`)`]}),H(`div`,{className:`flex-1 min-h-0 overflow-y-auto rounded-lg border border-border divide-y divide-border`,children:M.length===0?L(`div`,{className:`px-3 py-6 text-center text-[11px] text-foreground-subtle`,children:[`No eligible cameras — all cameras are already assigned to `,t,`.`]}):M.map(e=>L(`label`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-foreground hover:bg-surface-hover cursor-pointer`,children:[H(`input`,{type:`checkbox`,"aria-label":`Select ${e.name}`,checked:_.has(e.deviceId),onChange:()=>ie(e.deviceId),className:`accent-primary`}),H(`span`,{className:`truncate`,children:e.name}),e.currentNodeId&&L(`span`,{className:`ml-auto text-[10px] text-foreground-subtle shrink-0`,children:[`on `,e.currentNodeId]})]},e.deviceId))}),(D!==null||w.length>0)&&L(`div`,{className:`space-y-1 text-[10px] shrink-0`,children:[D!==null&&D>0&&L(`p`,{className:`text-success`,children:[`Assigned `,D,` camera(s) to `,t,`.`]}),w.map(e=>L(`p`,{className:`text-destructive`,children:[e.name,`: `,e.message]},e.deviceId))]})]}),L(`div`,{className:`flex items-center justify-between border-t border-border px-5 py-3 shrink-0`,children:[H(`span`,{className:`text-[10px] text-foreground-subtle`,children:b&&S?`${S.done} / ${S.total}…`:``}),L(`div`,{className:`flex items-center gap-2`,children:[H(`button`,{type:`button`,onClick:i,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground`,children:`Close`}),L(`button`,{type:`button`,onClick:async()=>{let e=[..._];if(e.length===0)return;x(!0),E([]),O(null),C({done:0,total:e.length});let t=[],n=0;for(let r=0;r<e.length;r+=1){let i=e[r];try{await se(i),n+=1}catch(e){t.push({deviceId:i,name:le.get(i)??String(i),message:e instanceof Error?e.message:String(e)})}C({done:r+1,total:e.length})}x(!1),E(t),O(n),y(new Set),a.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),a.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getDecoderAssignments`]]}),a.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]})},disabled:!re,className:`inline-flex items-center gap-1.5 rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50 disabled:cursor-not-allowed`,children:[b&&H(q,{className:`h-3.5 w-3.5 animate-spin`}),`Assign `,_.size,` to `,t]})]})]})]})]})}z();function Wt({nodeId:e,title:t}){let{data:n}=Ge(),{data:r}=ce(void 0),i=R(()=>{let e=new Map;for(let t of n??[])e.set(t.id,t.name);return e},[n]),a=R(()=>{if(!e)return null;let t=new Set;for(let n of r??[])n.agentNodeId===e&&t.add(n.deviceId);return t},[e,r]),[s,c]=I(new Map);D(`pipeline.camera-metrics-snapshot`,t=>{let n=t.data;typeof n.deviceId==`number`&&(e&&n.nodeId!==e||c(e=>{let t=new Map(e);return t.set(n.deviceId,n),t}))}),U(()=>{if(s.size===0)return;let e=setInterval(()=>{c(e=>{let t=Date.now()-1e4,n=!1,r=new Map(e);for(let[i,a]of e)a.timestamp<t&&(r.delete(i),n=!0);return n?r:e})},5e3);return()=>clearInterval(e)},[s.size]);let l=R(()=>{let e=[];for(let t of s.values())a&&!a.has(t.deviceId)||e.push(t);return e.sort((e,t)=>e.deviceId-t.deviceId),e},[s,a]);return l.length===0?L(`div`,{className:`rounded-md border border-border bg-surface px-3 py-2 text-[11px] text-foreground-subtle italic`,children:[t??`Cameras`,`: no live snapshots yet`]}):L(`div`,{className:`rounded-md border border-border bg-surface px-3 py-2`,children:[L(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[H(`span`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:t??`Cameras`}),H(`span`,{className:`text-[10px] text-foreground-subtle`,children:l.length})]}),H(`div`,{className:`flex flex-wrap gap-1.5`,children:l.map(e=>{let t=i.get(e.deviceId)??`#${e.deviceId}`,n=o(e.metrics.phase);return L(`div`,{title:`${t} · ${n.label} · ${e.metrics.actualFps.toFixed(1)} fps · ${e.metrics.avgInferenceTimeMs.toFixed(0)}ms infer · q=${e.metrics.queueDepth}`,className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] ${n.badgeClass}`,children:[H(A,{phase:e.metrics.phase,className:`h-2.5 w-2.5`}),H(`span`,{className:`font-medium text-foreground/90 max-w-[120px] truncate`,children:t}),H(`span`,{className:`font-mono tabular-nums`,children:e.metrics.actualFps.toFixed(1)}),H(`span`,{className:`opacity-60`,children:`fps`})]},e.deviceId)})})]})}var Gt={key:`maxCameras`,type:`slider`,label:`Max cameras`,description:`Hard cap on cameras the balancer may assign to this node.`,min:1,max:64,step:1,showValue:!0,showStepper:!0,nullable:!0,nullLabel:`Unlimited`};function Kt(e){if(e.length===0)return{kind:`empty`};let t=e[0].maxCameras;return e.every(e=>e.maxCameras===t)?{kind:`uniform`,value:t}:{kind:`mixed`,perNode:e}}function qt(e,t,n){let r=new Map(e.map(e=>[e.agentNodeId,e.maxCameras]));return t.filter(e=>(r.get(e)??null)!==n)}z();var Jt=350;function Yt(e){return typeof e==`number`&&e>0?Math.floor(e):null}function Xt({value:e,pending:t,errorMessage:n,onCommit:i}){let[a,o]=I(e);U(()=>{o(e)},[e]);let s=pe(i);return s.current=i,U(()=>{if(a===e)return;let t=setTimeout(()=>s.current(a),Jt);return()=>clearTimeout(t)},[a,e]),L(`div`,{className:`flex items-center gap-3 text-xs text-foreground`,children:[H(`div`,{className:`max-w-md flex-1`,children:H(r,{field:Gt,values:{maxCameras:a},disabled:t,onChange:(e,t)=>o(Yt(t))})}),t&&H(`span`,{className:`text-[10px] text-muted-foreground animate-pulse`,children:`Saving…`}),n&&L(`span`,{className:`text-[10px] text-destructive`,children:[`Save failed: `,n]})]})}z();function Zt(e,t){if(!e)return null;for(let n of e.slots)for(let e of n.addons)if(e.id===t)return e;return null}function Qt({nodeId:t,refreshToken:n}){let r=V(),[a,o]=I(null),[s,c]=I(null),[l,u]=I(null),d=(i(void 0).data??[]).find(e=>e.id===t)?.name??t,f=_({nodeId:t},{refetchOnMount:`always`}),p=x({agentNodeId:t},{refetchOnMount:`always`}),m=()=>{r.invalidateQueries({queryKey:[[`addonSettings`]]}),r.invalidateQueries({queryKey:[[`pipelineOrchestrator`]]}),r.invalidateQueries({queryKey:[[`pipelineExecutor`]]})},h=e({onSuccess:m}),g=F({onSuccess:m}),v=f.data??null,y=p.data,S=v?.selectedEngine.format??`coreml`,C=R(()=>v?P(v):[],[v]),w=R(()=>[{agentNodeId:t,engineLabel:S}],[t,S]),T=(e,t)=>{let n=y?.addonDefaults[e];return!Zt(v,e)?.models.some(e=>!!e.formats[S])||!n?{kind:`na`}:n.enabled?{kind:`enabled`,modelId:n.modelId}:{kind:`disabled`}},E=a&&v?Zt(v,a.addonId):null,D=e=>{let n=y?.addonDefaults[e]??null;o({addonId:e,agentNodeId:t}),c(n)},O=(e,n)=>{if(!y)return;let r=y.addonDefaults[e],i=Zt(v,e);if(!r&&!i)return;let a={enabled:n,modelId:r?.modelId??i?.defaultModelId??``,settings:r?.settings??{}};h.mutate({agentNodeId:t,defaults:{...y.addonDefaults,[e]:a}})},A=()=>{o(null),c(null)},j=()=>{!s||!a||!y||h.mutate({agentNodeId:t,defaults:{...y.addonDefaults,[a.addonId]:s}},{onSuccess:A})};if(f.isLoading||p.isLoading)return H(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading pipeline…`});if(f.error)return L(`div`,{className:`text-xs text-red-400`,children:[`Failed to load catalog: `,String(f.error)]});if(!v)return H(`div`,{className:`text-xs text-foreground-subtle`,children:`Catalog unavailable for this node (runner offline?).`});let M=a!==null&&E!==null&&s!==null,N=p.data?.maxCameras??null;return L(`div`,{className:`relative h-full w-full space-y-3`,children:[H(Wt,{nodeId:t}),H(Xt,{value:N,pending:g.isPending,errorMessage:g.isError?g.error instanceof Error?g.error.message:`Unknown error`:null,onCommit:e=>g.mutate({agentNodeId:t,maxCameras:e})}),L(`div`,{className:`flex items-center gap-2 text-xs`,children:[H(`span`,{className:`font-medium text-muted-foreground`,children:`Batch assign:`}),H(`button`,{type:`button`,onClick:()=>u(`pipeline`),className:`rounded border border-border bg-surface px-2 py-0.5 text-xs hover:bg-surface-hover`,children:`Pipeline…`}),H(`button`,{type:`button`,onClick:()=>u(`audio`),className:`rounded border border-border bg-surface px-2 py-0.5 text-xs hover:bg-surface-hover`,children:`Audio…`}),H(`button`,{type:`button`,onClick:()=>u(`decode`),className:`rounded border border-border bg-surface px-2 py-0.5 text-xs text-foreground-subtle hover:bg-surface-hover`,children:`Decode… (advisory)`})]}),l&&H(Ut,{nodeId:t,nodeName:d,concern:l,open:l!==null,onClose:()=>u(null)}),H(`div`,{className:M?`pr-[360px]`:``,children:C.length>0?H(k,{tree:C,agents:w,getCellState:T,onCellClick:D,selectedCell:a,onToggleEnabled:O}):H(`div`,{className:`text-xs text-foreground-subtle`,children:`Catalog empty.`})}),H(ue,{open:M,onClose:A,title:E?.name??``,subtitle:a?`${a.agentNodeId} · ${S}`:``,footer:L(B,{children:[H(`button`,{type:`button`,className:`px-3 py-1 text-xs border border-border rounded bg-surface hover:bg-muted`,onClick:A,children:`Cancel`}),H(`button`,{type:`button`,disabled:!s||!a||h.isPending,className:`px-3 py-1 text-xs bg-primary text-primary-foreground rounded disabled:opacity-50`,onClick:j,children:h.isPending?`Saving…`:`Save`})]}),children:E&&s&&a&&H(b,{mode:`agent`,addon:E,agentDefault:s,agentNodeId:a.agentNodeId,engineFormat:S,onChangeAgentConfig:e=>c(e)})})]})}var $t=[`detection-pipeline`,`decoder-nodeav`,`audio-analyzer`,`pipeline-runner`];function en({nodeId:e,refreshToken:t}){return L(`div`,{className:`flex flex-col h-full`,children:[H(dt,{nodeId:e,refreshToken:t}),H(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-6`,children:H(qe,{nodeId:e,addonIds:$t,level:`global`,extraTabs:[{id:`assignments`,label:`Assignments`,order:-10,content:H(Ct,{nodeId:e,refreshToken:t})},{id:`tree`,label:`Pipeline`,order:39,content:H(Qt,{nodeId:e,refreshToken:t})},{id:`engines`,label:`Warm instances`,order:180,content:H(Tt,{nodeId:e,refreshToken:t})},{id:`models`,label:`Models`,order:200,content:H(Ft,{nodeId:e,refreshToken:t})}]})})]})}function tn({refreshToken:e}){let t=V(),n=E({onSuccess:()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getDecoderAssignments`]]}),t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]})}});return L(`div`,{className:`space-y-6`,children:[H(ft,{refreshToken:e}),L(`div`,{className:`flex flex-col gap-3 @md/clustertab:flex-row @md/clustertab:items-center @md/clustertab:justify-between`,children:[L(`div`,{className:`min-w-0`,children:[H(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Placement matrix`}),H(`p`,{className:`text-[11px] text-foreground-subtle`,children:`Pipeline · decoder · audio assignments per camera. Click the kebab to pin / unpin / move any role; expand the chevron for the per-camera broker drill-down.`})]}),L(`button`,{type:`button`,onClick:()=>n.mutate(void 0),disabled:n.isPending,className:`inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-white hover:bg-primary/90 disabled:opacity-50 shrink-0 self-start @md/clustertab:self-auto whitespace-nowrap`,children:[H(Ee,{className:`h-3.5 w-3.5`}),n.isPending?`Rebalancing…`:`Rebalance pipelines`]})]}),H(_t,{mode:`cluster`})]})}z();var nn={...Gt,label:`Max cameras (all nodes)`};function rn(e){return typeof e==`number`&&e>0?Math.floor(e):null}function an(e){return e===null?`∞`:String(e)}function on(){let e=V(),t=i(void 0),n=m(void 0),a=F(),o=t.data??[],s=n.data??[],c=new Map(o.map(e=>[e.id,e.name])),l=o.map(e=>e.id),u=s.map(e=>({agentNodeId:e.nodeId,maxCameras:e.settings.maxCameras})),d=Kt(u),[f,p]=I(null),[h,g]=I(!1),[_,v]=I(null),y=pe(!1);U(()=>{y.current||t.isLoading||n.isLoading||(y.current=!0,p(d.kind===`uniform`?d.value:null))},[t.isLoading,n.isLoading,d]);let b=qt(u,l,f);return L(`div`,{className:`rounded-lg border border-border bg-surface p-4 space-y-3`,children:[L(`div`,{children:[H(`h3`,{className:`text-xs font-semibold text-foreground`,children:`Max cameras — all nodes`}),H(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:`Set the per-node camera cap across the whole cluster. Applies to every node whose current value differs; per-node tabs remain independently editable.`})]}),H(`div`,{className:`max-w-md`,children:H(r,{field:nn,values:{maxCameras:f},disabled:h,onChange:(e,t)=>p(rn(t))})}),d.kind===`mixed`&&L(`p`,{className:`text-[10px] text-warning`,children:[`Mixed (per-node values differ):`,` `,d.perNode.map(e=>`${c.get(e.agentNodeId)??e.agentNodeId} ${an(e.maxCameras)}`).join(` · `)]}),L(`div`,{className:`flex items-center gap-3`,children:[H(`button`,{type:`button`,onClick:async()=>{g(!0),v(null);let t=0,n=[];for(let e of b)try{await a.mutateAsync({agentNodeId:e,maxCameras:f}),t+=1}catch(t){n.push({nodeId:e,message:t instanceof Error?t.message:String(t)})}g(!1),v({ok:t,failures:n}),e.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`listAgentSettings`]]}),e.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAgentSettings`]]})},disabled:h||b.length===0,className:`rounded bg-primary px-3 py-1 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:h?`Applying…`:`Apply to all nodes (${b.length})`}),b.length===0&&!h&&H(`span`,{className:`text-[10px] text-foreground-subtle`,children:`All nodes already match.`})]}),_&&L(`div`,{className:`space-y-1 text-[10px]`,children:[_.ok>0&&L(`p`,{className:`text-success`,children:[`Applied to `,_.ok,` node(s).`]}),_.failures.map(e=>L(`p`,{className:`text-destructive`,children:[c.get(e.nodeId)??e.nodeId,`: `,e.message]},e.nodeId))]})]})}var sn=[`pipeline-orchestrator`];function cn({refreshToken:e}){return L(`div`,{className:`space-y-4 max-w-3xl`,children:[H(on,{}),H(qe,{nodeId:`hub`,addonIds:sn,level:`global`,title:`Cluster settings`,description:`Cluster-wide orchestration knobs: enabled nodes, load balancer thresholds, and failover policy. Per-camera pipelines live in Device Overrides; live cluster load is on the Assignments tab.`})]})}z();function ln({refreshToken:e}){let t=V(),{data:n,isLoading:r}=O(),[i,a]=I(null),[o,s]=I(``),[c,l]=I(``),u=()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`listTemplates`]]})},d=N({onSuccess:()=>{a(null),u()}}),p=f({onSuccess:u}),m=e=>{a(e.id),s(e.name),l(e.description??``)},h=()=>{a(null),s(``),l(``)},g=()=>{if(!i)return;let e=c.trim();d.mutate({id:i,name:o.trim()||`Untitled`,...e?{description:e}:{}})};if(r)return H(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading templates…`});let _=[...n??[]].toSorted((e,t)=>e.name.localeCompare(t.name));return H(`div`,{className:`space-y-6 max-w-4xl`,children:L(`section`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[L(`div`,{className:`border-b border-border px-4 py-3 flex items-center justify-between`,children:[L(`div`,{children:[H(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Templates`}),H(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:`Curated pipeline presets operators can apply to any camera. Apply-time is a copy — future edits to a template don't retroactively change cameras that were seeded from it. Save a template from the device Pipeline tab.`})]}),L(`div`,{className:`text-[11px] text-foreground-subtle`,children:[_.length,` template`,_.length===1?``:`s`]})]}),_.length===0?L(`div`,{className:`px-4 py-8 text-xs text-foreground-subtle flex flex-col items-center gap-2`,children:[H(Oe,{className:`h-6 w-6 opacity-40`}),H(`div`,{children:`No templates yet. Create one from a device Pipeline tab ("Save as template").`})]}):H(`ul`,{className:`divide-y divide-border`,children:_.map(e=>{let t=i===e.id;return H(`li`,{className:`px-4 py-3 text-xs`,children:L(`div`,{className:`flex items-start gap-3`,children:[H(`div`,{className:`flex-1 min-w-0`,children:t?L(`div`,{className:`space-y-2`,children:[H(`input`,{className:`w-full rounded border border-border bg-surface-hover px-2 py-1 text-xs text-foreground focus:outline-none focus:border-primary`,value:o,onChange:e=>s(e.target.value),placeholder:`Template name`,autoFocus:!0}),H(`input`,{className:`w-full rounded border border-border bg-surface-hover px-2 py-1 text-[11px] text-foreground focus:outline-none focus:border-primary`,value:c,onChange:e=>l(e.target.value),placeholder:`Description (optional)`})]}):L(B,{children:[H(`div`,{className:`font-medium text-foreground`,children:e.name}),e.description&&H(`div`,{className:`text-foreground-subtle mt-0.5`,children:e.description}),L(`div`,{className:`mt-1 font-mono text-[10px] text-foreground-subtle`,children:[`engine `,e.config.engine.runtime,`/`,e.config.engine.backend,` ·`,` `,e.config.steps.length,` step(s)`,e.config.audio?.enabled?` · audio`:``,L(`span`,{className:`ml-2`,children:[`updated `,new Date(e.updatedAt).toLocaleString()]})]})]})}),H(`div`,{className:`flex items-center gap-1 shrink-0`,children:t?L(B,{children:[L(`button`,{type:`button`,onClick:g,disabled:d.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium bg-primary text-white hover:bg-primary/90 disabled:opacity-50`,children:[H(Fe,{className:`h-3 w-3`}),`Save`]}),L(`button`,{type:`button`,onClick:h,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover`,children:[H(ze,{className:`h-3 w-3`}),`Cancel`]})]}):L(B,{children:[H(`button`,{type:`button`,onClick:()=>m(e),title:`Rename`,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground hover:bg-surface-hover`,children:H(De,{className:`h-3 w-3`})}),H(`button`,{type:`button`,onClick:()=>{confirm(`Delete template "${e.name}"?`)&&p.mutate({id:e.id})},disabled:p.isPending,title:`Delete`,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] text-foreground-subtle hover:text-red-400 hover:bg-surface-hover disabled:opacity-50`,children:H(He,{className:`h-3 w-3`})})]})})]})},e.id)})})]})})}z();function un(e,t){if(!e)return null;for(let n of e.slots)for(let e of n.addons)if(e.id===t)return e;return null}function dn({nodeId:t,refreshToken:n}){let r=V(),a=_e().trpcClient,[o,s]=I(null),[c,l]=I(null),u=m(void 0,{refetchOnMount:`always`});J([`nodes`,`topology`],[`agent.online`,`agent.offline`,`agent.unregistered`,`addon.installed`,`addon.uninstalled`,`addon.updated`]);let d=i(void 0,{refetchOnMount:`always`}),f=R(()=>{let e=new Set;for(let t of d.data??[])t.isOnline&&e.add(t.id);return e},[d.data]),p=_({nodeId:t},{refetchOnMount:`always`}),h=R(()=>(u.data??[]).filter(e=>f.has(e.nodeId)).map(e=>e.nodeId),[u.data,f]),g=ge({enabled:h.length>0,queryKey:[[`pipelineExecutor`,`getSchema`],`schema-by-agent`,h.join(`,`),n],queryFn:async()=>{let e={};for(let t of h)try{e[t]=(await a.pipelineExecutor.getSchema.query({nodeId:t})).selectedEngine.format}catch{e[t]=`coreml`}return e}}),v=e({onSuccess:()=>{r.invalidateQueries({queryKey:[[`pipelineOrchestrator`]]}),r.invalidateQueries({queryKey:[[`pipelineExecutor`]]}),r.invalidateQueries({queryKey:[[`addonSettings`]]})}}),y=R(()=>p.data?P(p.data):[],[p.data]),x=R(()=>{let e=u.data??[],t=f;return(t.size===0?[]:e.filter(e=>t.has(e.nodeId))).map(e=>{let t=g.data?.[e.nodeId];return{agentNodeId:e.nodeId,engineLabel:t??`(engine unknown)`}})},[u.data,g.data,f]),S=(e,t)=>{let n=(u.data?.find(e=>e.nodeId===t))?.settings.addonDefaults[e],r=g.data?.[t];return!un(p.data??null,e)?.models.some(e=>r!==void 0&&!!e.formats[r])||!n?{kind:`na`}:n.enabled?{kind:`enabled`,modelId:n.modelId}:{kind:`disabled`}},C=o?u.data?.find(e=>e.nodeId===o.agentNodeId)??null:null,w=o&&p.data?un(p.data,o.addonId):null,T=o?g.data?.[o.agentNodeId]??`coreml`:`coreml`,E=()=>{s(null),l(null)},D=(e,t)=>{let n=(u.data?.find(e=>e.nodeId===t))?.settings.addonDefaults[e]??null;s({addonId:e,agentNodeId:t}),l(n)},O=()=>{!c||!o||!C||v.mutate({agentNodeId:o.agentNodeId,defaults:{...C.settings.addonDefaults,[o.addonId]:c}},{onSuccess:E})};if(u.isLoading||p.isLoading)return H(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading agents…`});if(!p.data)return L(`div`,{className:`text-xs text-foreground-subtle`,children:[`Catalog unavailable for `,t,`.`]});let A=o!==null&&w!==null&&c!==null;return L(`div`,{className:`relative h-full w-full space-y-3`,children:[H(Wt,{title:`Cluster cameras`}),H(`div`,{className:A?`pr-[360px]`:``,children:y.length>0&&x.length>0?H(k,{tree:y,agents:x,getCellState:S,onCellClick:D,selectedCell:o}):H(`div`,{className:`text-xs text-foreground-subtle`,children:`No agents or catalog empty.`})}),H(ue,{open:A,onClose:E,title:w?.name??``,subtitle:o?`${o.agentNodeId} · ${T}`:``,footer:L(B,{children:[H(`button`,{type:`button`,className:`px-3 py-1 text-xs border border-border rounded bg-surface hover:bg-muted`,onClick:E,children:`Cancel`}),H(`button`,{type:`button`,disabled:!c||!o||v.isPending,className:`px-3 py-1 text-xs bg-primary text-primary-foreground rounded disabled:opacity-50`,onClick:O,children:v.isPending?`Saving…`:`Save`})]}),children:w&&c&&o&&H(b,{mode:`agent`,addon:w,agentDefault:c,agentNodeId:o.agentNodeId,engineFormat:T,onChangeAgentConfig:e=>l(e)})})]})}z();function fn({types:e}){let t=V(),n=u(),{data:r}=ie({}),i=oe(),a=R(()=>i.data??[],[i.data]),[o,s]=I(null),[c,l]=I(null),d=()=>{t.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})},f=te({onSuccess:d}),p=ee({onSuccess:d}),m=R(()=>{let e=new Map;for(let t of r??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[r]),h=e=>{e.isDefault||f.mutate({id:e.id,type:e.type,providerId:e.providerId,displayName:e.displayName,config:e.config,isDefault:!0})},g=async e=>{if(e.isDefault){await n({title:`Cannot delete default location`,message:`"${e.displayName}" is the default for type "${e.type}". Mark another as default first.`,confirmLabel:`OK`,variant:`warning`});return}await n({title:`Delete location "${e.displayName}"?`,message:`Removes the record; files on disk are untouched.`,confirmLabel:`Delete`,variant:`danger`})&&p.mutate({id:e.id})},_=e.map(e=>a.find(t=>t.id===e)).filter(e=>e!==void 0);return L(`div`,{className:`space-y-3`,children:[_.length===0?H(`p`,{className:`text-[11px] text-foreground-subtle italic`,children:`No storage locations declared for this purpose.`}):_.map(e=>H(Se,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:m.get(e.id)??[],onAdd:e=>s(e),onEdit:e=>l(e),onDelete:e=>{g(e)},onSetDefault:e=>h(e)},e.id)),o!==null&&H(Ce,{initialType:o,onClose:()=>s(null),onCreated:()=>{d(),s(null)}}),c!==null&&H(xe,{location:c,onClose:()=>l(null),onSaved:()=>{d(),l(null)}})]})}z();var pn=`pipeline-analytics`;function mn(e){for(let t of e?.sections??[])for(let e of t.fields??[])if(e.key===`postProcessingNodeId`&&typeof e.value==`string`)return e.value;return`hub`}function hn(){let e=V(),{data:t}=i(void 0),{data:n,isLoading:r}=T({addonId:pn}),a=mn(n),o=y({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),s=R(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,a,...e])].filter(Boolean)},[t,a]);return L(`div`,{className:`flex flex-col gap-6`,children:[L(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[H(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Post-processing node`}),H(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that runs detection post-processing (events, media, audio & motion). Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`}),L(`div`,{className:`mt-3 flex items-center gap-2`,children:[r?H(q,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):H(`select`,{value:a,onChange:e=>{e.target.value!==a&&o.mutate({addonId:pn,patch:{postProcessingNodeId:e.target.value}})},disabled:o.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:s.map(e=>H(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),o.isPending&&H(q,{className:`h-4 w-4 animate-spin text-primary`})]})]}),L(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[H(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Events folder`}),H(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where event crops / full frames are stored. A single folder — no collection / equal-splitting.`}),H(fn,{types:[`eventMedia`]})]})]})}z();var gn=`recorder`;function _n(e,t,n){for(let n of e?.sections??[])for(let e of n.fields??[])if(e.key===t&&typeof e.value==`string`)return e.value;return n}function vn(){let e=V(),{data:t}=i(void 0),{data:n,isLoading:r}=T({addonId:gn}),a=_n(n,`recordingNodeId`,`hub`),o=y({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),s=R(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,a,...e])].filter(Boolean)},[t,a]);return L(`div`,{className:`flex flex-col gap-6`,children:[L(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[H(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Recording node`}),H(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that records (continuous & events) and serves playback. Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`}),L(`div`,{className:`mt-3 flex items-center gap-2`,children:[r?H(q,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):H(`select`,{value:a,onChange:e=>{e.target.value!==a&&o.mutate({addonId:gn,patch:{recordingNodeId:e.target.value}})},disabled:o.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:s.map(e=>H(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),o.isPending&&H(q,{className:`h-4 w-4 animate-spin text-primary`})]}),a!==`hub`&&L(`p`,{className:`mt-2 text-[11px] text-amber-500`,children:[`The stream-broker is hub-only — an agent recorder pulls streams from the hub over the network. The hub's RTSP restream port must be reachable from`,` `,H(`span`,{className:`font-medium`,children:a}),`. If the auto-derived host doesn't work, set the recorder's`,H(`span`,{className:`font-medium`,children:` recordingHubHostname`}),` global setting.`]})]}),L(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[H(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Recordings folders`}),H(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where recordings are stored. Multi-location collections — segments are split across the locations of a type. Add a location to grow capacity; mark one default per type.`}),H(fn,{types:[`recordings`,`recordingsLow`]})]})]})}z();var yn=[{id:`assignments`,label:`Assignments`},{id:`pipeline`,label:`Pipeline`},{id:`events`,label:`Events`},{id:`recording`,label:`Recording`},{id:`settings`,label:`Settings`},{id:`templates`,label:`Templates`}];function bn({refreshToken:e}){let[t,n]=I(`assignments`),{data:r}=i(void 0),a=r?.find(e=>e.isHub&&e.isOnline)?.id??r?.find(e=>e.isOnline)?.id??null;return L(`div`,{className:`flex flex-col h-full`,children:[L(`div`,{className:`px-4 sm:px-6 py-4 border-b border-border`,children:[H(`h2`,{className:`text-base font-semibold text-foreground`,children:`Cluster Orchestration`}),H(`div`,{className:`text-[11px] text-foreground-subtle mt-1`,children:`Assignments with live load, cluster-wide settings, pipeline template library, per-camera pipeline overrides.`})]}),H(`div`,{className:`flex items-center gap-1 px-4 sm:px-6 border-b border-border overflow-x-auto`,children:yn.map(e=>H(`button`,{type:`button`,onClick:()=>n(e.id),className:`shrink-0 whitespace-nowrap px-3 py-2 text-xs font-medium border-b-2 transition-colors ${t===e.id?`border-primary text-primary`:`border-transparent text-foreground-subtle hover:text-foreground`}`,children:e.label},e.id))}),L(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4 sm:p-6 @container/clustertab`,children:[t===`assignments`&&H(tn,{refreshToken:e}),t===`pipeline`&&(a?H(dn,{nodeId:a,refreshToken:e}):H(`div`,{className:`text-xs text-foreground-subtle`,children:`No online node available — schema unreachable.`})),t===`events`&&H(hn,{}),t===`recording`&&H(vn,{}),t===`settings`&&H(cn,{refreshToken:e}),t===`templates`&&H(ln,{refreshToken:e})]})]})}function xn(e){let{assignment:t,detection:n}=e;return n!==null&&n.provisioning.state===`failed`||t.detectionNodeId===null&&n===null?`error`:n!==null&&n.phase===`active`?`healthy`:`idle`}z();var Sn={healthy:`bg-green-500`,idle:`bg-yellow-400`,error:`bg-red-500`},Cn={healthy:`Healthy`,idle:`Idle`,error:`Error`};function wn({health:e}){return H(`span`,{className:`inline-block h-2 w-2 rounded-full shrink-0 ${Sn[e]}`,title:Cn[e],"aria-label":Cn[e],role:`img`})}function Tn({selectedDeviceId:e,onSelect:t}){let{data:n}=Ge(),{data:r}=w({}),i=R(()=>{let e=new Map;for(let t of r??[])e.set(t.deviceId,t);return e},[r]),a=R(()=>(n??[]).filter(e=>e.isCamera).map(e=>{let t=i.get(e.id);return{deviceId:e.id,name:e.name,health:t===void 0?`idle`:xn(t)}}),[n,i]);return a.length===0?H(`div`,{className:`px-4 py-6 text-center text-[11px] text-foreground-subtle italic`,children:`No cameras found`}):H(`ul`,{className:`divide-y divide-border`,children:a.map(n=>{let r=n.deviceId===e;return H(`li`,{children:L(`button`,{type:`button`,onClick:()=>t(n.deviceId),className:[`w-full flex items-center gap-2.5 px-4 py-3 text-left transition-colors`,r?`bg-surface-active text-foreground`:`hover:bg-surface-hover text-foreground-subtle hover:text-foreground`].join(` `),"aria-pressed":r,children:[H(wn,{health:n.health}),L(`span`,{className:`flex-1 min-w-0`,children:[H(`span`,{className:`block truncate text-[12px] font-medium leading-tight`,children:n.name}),L(`span`,{className:`block text-[10px] text-foreground-subtle leading-tight mt-0.5`,children:[`#`,n.deviceId]})]})]})},n.deviceId)})})}var $={camera:0,source:200,broker:400,decoder:600,motion:800,detection:800,audio:800,recorder:800},En=120;function Dn(e,t){return e===null||t===null?!1:e!==t}function On(e){let t=e.profiles.reduce((e,t)=>e+t.subscribers,0),n=e.profiles.reduce((e,t)=>e+t.inFps,0),r=e.profiles.reduce((e,t)=>e+t.outFps,0);return`${t} subs · ${n.toFixed(1)}→${r.toFixed(1)} fps`}function kn(e){return`${e.actualFps.toFixed(1)} fps · q${e.queueDepth} · ${e.avgInferenceMs.toFixed(1)}ms`}function An(e){return`shm ${e.shm.getFrameHits+e.shm.getFrameMisses>0?Math.round(e.shm.getFrameHits/(e.shm.getFrameHits+e.shm.getFrameMisses)*100):0}% hit`}function jn(e){let t=[],n=[],r={id:`camera`,kind:`camera`,nodeId:null,data:{deviceId:e.deviceId},position:{x:$.camera,y:0}};t.push(r);let i={id:`source`,kind:`source`,nodeId:null,data:{streams:e.source.streams},position:{x:$.source,y:0}};t.push(i),n.push({id:`camera->source`,source:`camera`,target:`source`,crossNode:!1});let a=e.broker;if(a!==null){let e={id:`broker`,kind:`broker`,nodeId:null,data:{profiles:a.profiles,webrtcSessions:a.webrtcSessions,rtspRestream:a.rtspRestream},position:{x:$.broker,y:0}};t.push(e),n.push({id:`source->broker`,source:`source`,target:`broker`,crossNode:!1})}let o=e.decoder;if(o!==null){let r={id:`decoder`,kind:`decoder`,nodeId:o.nodeId,data:{nodeId:o.nodeId,formats:o.formats,sessionCount:o.sessionCount,shm:o.shm},position:{x:$.decoder,y:0}};t.push(r);let i=a===null?`source`:`broker`,s=a===null?void 0:On(a),c=a===null?An(o):s;n.push({id:`${i}->decoder`,source:i,target:`decoder`,crossNode:Dn(null,o.nodeId),...c===void 0?{}:{label:c}});let l=0,u=e.motion;if(u!==null){let e={id:`motion`,kind:`motion`,nodeId:null,data:{enabled:u.enabled,fps:u.fps},position:{x:$.motion,y:l*En}};t.push(e),n.push({id:`decoder->motion`,source:`decoder`,target:`motion`,crossNode:!1}),l++}let d=e.detection;if(d!==null){let e={id:`detection`,kind:`detection`,nodeId:d.nodeId,data:{nodeId:d.nodeId,engine:d.engine,phase:d.phase,configuredFps:d.configuredFps,actualFps:d.actualFps,queueDepth:d.queueDepth,avgInferenceMs:d.avgInferenceMs,provisioning:d.provisioning},position:{x:$.detection,y:l*En}};t.push(e),n.push({id:`decoder->detection`,source:`decoder`,target:`detection`,crossNode:Dn(o.nodeId,d.nodeId),label:kn(d)}),l++}let f=e.audio;if(f!==null){let e={id:`audio`,kind:`audio`,nodeId:f.nodeId,data:{nodeId:f.nodeId,enabled:f.enabled},position:{x:$.audio,y:l*En}};t.push(e),n.push({id:`decoder->audio`,source:`decoder`,target:`audio`,crossNode:Dn(o.nodeId,f.nodeId)}),l++}let p=e.recording;if(p!==null){let e={id:`recorder`,kind:`recorder`,nodeId:null,data:{mode:p.mode,active:p.active,storageBytes:p.storageBytes},position:{x:$.recorder,y:l*En}};t.push(e),n.push({id:`decoder->recorder`,source:`decoder`,target:`recorder`,crossNode:!1})}}return{nodes:t,edges:n}}z();function Mn(e){let{data:t,isLoading:n}=d({deviceId:e}),[r,i]=I(void 0);return U(()=>{t!==void 0&&i(t)},[t]),D(W.PipelineCameraMetricsSnapshot,t=>{let n=t.data;n.deviceId===e&&i(e=>e===void 0||e.detection===null?e:{...e,detection:{...e.detection,phase:n.metrics.phase,actualFps:n.metrics.actualFps,queueDepth:n.metrics.queueDepth,avgInferenceMs:n.metrics.avgInferenceTimeMs}})}),D(W.PipelineEngineProvisioning,e=>{let t=e.data;i(n=>{if(n===void 0||n.detection===null)return n;let r=n.detection.nodeId??n.assignment?.detectionNodeId??null;return r===null||e.source.type!==`node`||e.source.id!==r?n:{...n,detection:{...n.detection,provisioning:{state:t.state,error:t.error}}}})}),D(W.MotionAnalysis,t=>{t.source.type!==`device`||t.source.id!==e||i(e=>e===void 0||e.motion===null?e:{...e,motion:{...e.motion,enabled:!0}})}),D(W.StreamBrokerMetricsSnapshot,t=>{let n=t.data;n.deviceId===e&&i(e=>e===void 0||e.broker===null?e:{...e,broker:{...e.broker,profiles:e.broker.profiles.map(e=>e.profile===n.profile?{...e,subscribers:n.stats.encodedSubscribers+n.stats.decodedSubscribers,inFps:n.stats.inputFps,outFps:n.stats.decodeFps}:e)}})}),D(W.PipelineAudioInferenceResult,t=>{t.data.deviceId===e&&i(e=>e===void 0||e.audio===null?e:{...e,audio:{...e.audio,enabled:!0}})}),D(W.RecordingStarted,t=>{t.data.deviceId===e&&i(e=>e===void 0||e.recording===null?e:{...e,recording:{...e.recording,active:!0}})}),D(W.RecordingStopped,t=>{t.data.deviceId===e&&i(e=>e===void 0||e.recording===null?e:{...e,recording:{...e.recording,active:!1}})}),{status:r,isLoading:n}}function Nn({data:e}){return L(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[H(X,{type:`source`,position:Y.Right}),L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`h-2 w-2 rounded-full bg-green-500 shrink-0`,"aria-label":`healthy`}),L(`span`,{className:`text-sm font-semibold truncate`,children:[`Camera #`,e.deviceId]})]}),H(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`source`})]})}function Pn(e){return e>0?`bg-green-500`:`bg-yellow-500`}function Fn({data:e}){let t=e.streams[0],n=e.streams.length;return L(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[H(X,{type:`target`,position:Y.Left}),H(X,{type:`source`,position:Y.Right}),L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${Pn(n)}`,"aria-label":n>0?`healthy`:`idle`}),H(`span`,{className:`text-sm font-semibold`,children:`Source`}),L(`span`,{className:`text-xs text-muted-foreground`,children:[n,` streams`]})]}),t!==void 0&&L(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[t.codec,` `,t.width,`×`,t.height,` `,t.fps,`fps`]})]})}function In(e){return e>0?`bg-green-500`:`bg-yellow-500`}function Ln({data:e}){let t=e.profiles.reduce((e,t)=>e+t.subscribers,0),n=e.profiles.length;return L(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[H(X,{type:`target`,position:Y.Left}),H(X,{type:`source`,position:Y.Right}),L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${In(t)}`,"aria-label":t>0?`healthy`:`idle`}),H(`span`,{className:`text-sm font-semibold`,children:`Broker`}),L(`span`,{className:`text-xs text-muted-foreground`,children:[n,` profiles`]})]}),L(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[t,` subs · WebRTC `,e.webrtcSessions,e.rtspRestream&&` · RTSP`]})]})}function Rn(e){return e>0?`bg-green-500`:`bg-yellow-500`}function zn(e,t){let n=e+t;return n>0?Math.round(e/n*100):0}function Bn({data:e}){let t=zn(e.shm.getFrameHits,e.shm.getFrameMisses);return L(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[H(X,{type:`target`,position:Y.Left}),H(X,{type:`source`,position:Y.Right}),L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${Rn(e.sessionCount)}`,"aria-label":e.sessionCount>0?`healthy`:`idle`}),H(`span`,{className:`text-sm font-semibold`,children:`Decoder`}),L(`span`,{className:`text-xs text-muted-foreground`,children:[`@`,e.nodeId]})]}),L(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.formats.join(`, `),` · `,e.sessionCount,` sessions`]}),L(`div`,{className:`text-xs text-muted-foreground`,children:[`shm `,t,`% hit`]})]})}function Vn(e){return e?`bg-green-500`:`bg-yellow-500`}function Hn({data:e}){return L(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[H(X,{type:`target`,position:Y.Left}),L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${Vn(e.enabled)}`,"aria-label":e.enabled?`enabled`:`disabled`}),H(`span`,{className:`text-sm font-semibold`,children:`Motion`})]}),L(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.enabled?`enabled`:`disabled`,` · `,e.fps,` fps`]})]})}function Un(e){return e.provisioning.state===`failed`?`bg-red-500`:e.phase===`active`?`bg-green-500`:(e.phase,`bg-yellow-500`)}function Wn(e){return e===`ready`?`bg-green-500 text-white`:e===`failed`?`bg-red-500 text-white`:`bg-yellow-500 text-white`}function Gn({data:e}){return L(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[180px] px-3 py-2`,children:[H(X,{type:`target`,position:Y.Left}),L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${Un(e)}`,"aria-label":e.phase}),H(`span`,{className:`text-sm font-semibold`,children:`Detection`}),L(`span`,{className:`text-xs text-muted-foreground`,children:[`@`,e.nodeId]})]}),L(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.engine.backend,`·`,e.engine.device,` · `,e.phase]}),L(`div`,{className:`text-xs text-muted-foreground`,children:[e.actualFps.toFixed(1),`/`,e.configuredFps,` fps · q`,e.queueDepth,` ·`,` `,e.avgInferenceMs.toFixed(1),`ms`]}),L(`div`,{className:`flex items-center gap-1 mt-1`,children:[H(`span`,{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded ${Wn(e.provisioning.state)}`,"aria-label":`provisioning ${e.provisioning.state}`,children:e.provisioning.state}),e.provisioning.state===`failed`&&e.provisioning.error!==void 0&&H(`span`,{className:`text-[10px] text-red-500 truncate`,children:e.provisioning.error})]})]})}function Kn(e){return e?`bg-green-500`:`bg-yellow-500`}function qn({data:e}){return L(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[H(X,{type:`target`,position:Y.Left}),L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${Kn(e.enabled)}`,"aria-label":e.enabled?`enabled`:`disabled`}),H(`span`,{className:`text-sm font-semibold`,children:`Audio`}),L(`span`,{className:`text-xs text-muted-foreground`,children:[`@`,e.nodeId]})]}),H(`div`,{className:`text-xs text-muted-foreground mt-1`,children:e.enabled?`enabled`:`disabled`})]})}function Jn(e){return e.mode===`off`?`bg-red-500`:e.active?`bg-green-500`:`bg-yellow-500`}function Yn(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GB`:`${(e/1048576).toFixed(1)} MB`}function Xn({data:e}){return L(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[H(X,{type:`target`,position:Y.Left}),L(`div`,{className:`flex items-center gap-2`,children:[H(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${Jn(e)}`,"aria-label":e.active?`active`:e.mode===`off`?`off`:`inactive`}),H(`span`,{className:`text-sm font-semibold`,children:`Recorder`}),H(`span`,{className:`text-xs text-muted-foreground`,children:e.mode})]}),L(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.active?`active`:`inactive`,` · `,Yn(e.storageBytes)]})]})}z();var Zn={camera:Nn,source:Fn,broker:Ln,decoder:Bn,motion:Hn,detection:Gn,audio:qn,recorder:Xn},Qn={stroke:`#f59e0b`,strokeWidth:2},$n={strokeWidth:1.5};function er({deviceId:e}){let{status:t,isLoading:n}=Mn(e),{rfNodes:r,rfEdges:i}=R(()=>{if(t===void 0)return{rfNodes:[],rfEdges:[]};let e=jn(t);return{rfNodes:e.nodes.map(e=>({id:e.id,type:e.kind,position:{x:e.position.x,y:e.position.y},data:{...e.data}})),rfEdges:e.edges.map(e=>({id:e.id,source:e.source,target:e.target,animated:e.crossNode,style:e.crossNode?Qn:$n,label:e.label}))}},[t]);return n?H(`div`,{className:`flex items-center justify-center h-full text-sm text-muted-foreground`,children:`Loading…`}):t===void 0?H(`div`,{className:`flex items-center justify-center h-full text-sm text-muted-foreground`,children:`No pipeline data`}):H(`div`,{className:`w-full h-full`,children:L(Je,{nodes:r,edges:i,nodeTypes:Zn,fitView:!0,proOptions:{hideAttribution:!0},children:[H(Xe,{gap:20,size:1}),H(Ye,{showInteractive:!1})]})})}z();var tr=`__cluster__`;function nr(e){return e===`cameras`?`cameras`:`nodes`}function rr(){let[e,t]=Ie(),n=nr(e.get(`view`)),r=e.get(`node`)??`__cluster__`,i=e.get(`camera`),a=i===null?null:parseInt(i,10),[o,s]=I(0);return U(()=>{n===`nodes`&&!e.get(`node`)&&t({view:`nodes`,node:tr},{replace:!0})},[n,e,t]),L(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[L(`div`,{className:`flex items-center justify-between gap-4 px-4 py-3 border-b border-border shrink-0`,children:[L(`div`,{className:`flex items-center gap-1 rounded-lg border border-border p-0.5 bg-surface`,children:[H(`button`,{type:`button`,onClick:()=>{t({view:`nodes`,node:r},{replace:!0})},className:[`px-3 py-1 rounded-md text-[11px] font-medium transition-colors`,n===`nodes`?`bg-background text-foreground shadow-sm`:`text-foreground-subtle hover:text-foreground`].join(` `),children:`Nodes`}),H(`button`,{type:`button`,onClick:()=>{let e={view:`cameras`};a!==null&&(e.camera=String(a)),t(e,{replace:!0})},className:[`px-3 py-1 rounded-md text-[11px] font-medium transition-colors`,n===`cameras`?`bg-background text-foreground shadow-sm`:`text-foreground-subtle hover:text-foreground`].join(` `),children:`Cameras`})]}),L(`button`,{type:`button`,onClick:()=>s(e=>e+1),title:`Refresh`,className:`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:[H(ke,{className:`h-3.5 w-3.5`}),`Refresh`]})]}),H(`div`,{className:`flex-1 flex flex-col md:flex-row overflow-hidden min-h-0`,children:n===`nodes`?L(B,{children:[H(`aside`,{className:`w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-border overflow-y-auto`,children:H(ut,{selectedNodeId:r,onSelect:e=>{t({view:`nodes`,node:e},{replace:!0})},refreshToken:o})}),H(`section`,{className:`flex-1 min-h-0 overflow-hidden`,children:r===`__cluster__`?H(bn,{refreshToken:o}):H(en,{nodeId:r,refreshToken:o})})]}):L(B,{children:[H(`aside`,{className:`w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-border overflow-y-auto`,children:H(Tn,{selectedDeviceId:a,onSelect:e=>{t({view:`cameras`,camera:String(e)},{replace:!0})}})}),H(`section`,{className:`flex-1 min-h-0 overflow-hidden`,children:a!==null&&Number.isFinite(a)&&!Number.isNaN(a)?H(er,{deviceId:a}):H(`div`,{className:`flex items-center justify-center h-full text-sm text-foreground-subtle`,children:`Select a camera to view its pipeline flow`})})]})})]})}export{rr as PipelinePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{V as e}from"./index-NMHNU-e8.js";var t=e(`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`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{V as e}from"./index-NMHNU-e8.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Bj4tGzk2.js";export{t as get,e as init};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{V as e}from"./index-NMHNU-e8.js";var t=e(`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`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{V as e}from"./index-NMHNU-e8.js";var t=e(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{V as e}from"./index-NMHNU-e8.js";var t=e(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]);export{t};
|