@camstack/addon-admin-ui 1.1.63 → 1.1.76

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 (78) hide show
  1. package/dist/assets/{AddLocationWizard-VuBsssbs.js → AddLocationWizard-2u_gFK5r.js} +1 -1
  2. package/dist/assets/{AddonCollectionPage-rY0iw4Lx.js → AddonCollectionPage-BtQi77vB.js} +1 -1
  3. package/dist/assets/{Addons-waDrxMrF.js → Addons-q0boPiKK.js} +1 -1
  4. package/dist/assets/{AdminTabs-DdlxkzYF.js → AdminTabs-CfA0_5OD.js} +1 -1
  5. package/dist/assets/{AiProfiles-CXfreEns.js → AiProfiles-12yfskcw.js} +1 -1
  6. package/dist/assets/{BrokerForm-Bi1zDzJU.js → BrokerForm-nhcwidi1.js} +1 -1
  7. package/dist/assets/{Capabilities-CBqnCVAQ.js → Capabilities-BjMQsKTo.js} +1 -1
  8. package/dist/assets/{CapabilityBadges-bb3Kp76B.js → CapabilityBadges-BakiZcjD.js} +1 -1
  9. package/dist/assets/{Cluster-CkmNDo_z.js → Cluster-BwgzopHZ.js} +1 -1
  10. package/dist/assets/{ClusterRecordingTab-qj7qdRav.js → ClusterRecordingTab-B0_gkStF.js} +1 -1
  11. package/dist/assets/{Dashboard-0L-WtwHw.js → Dashboard-pQbzHfgq.js} +1 -1
  12. package/dist/assets/{Data-B-KdcyYb.js → Data-CzQQRAUi.js} +1 -1
  13. package/dist/assets/{DetectionIntelligence-DH2CerYz.js → DetectionIntelligence-soDZAfMX.js} +1 -1
  14. package/dist/assets/{DeviceDetail-C0xHmlNy.js → DeviceDetail-CDSavlTS.js} +1 -1
  15. package/dist/assets/{Devices-BqWTi9bF.js → Devices-B6mG0goh.js} +1 -1
  16. package/dist/assets/{EmbedPlayerPage-BmllV_ir.js → EmbedPlayerPage-DvdfwqWo.js} +1 -1
  17. package/dist/assets/{Events-Cg33ehHw.js → Events-C4TJ3f2M.js} +1 -1
  18. package/dist/assets/{FormBuilder-DDOu77Pz.js → FormBuilder-CJZT56JQ.js} +1 -1
  19. package/dist/assets/{Identity-DokGTNX5.js → Identity-DJpfxWAy.js} +1 -1
  20. package/dist/assets/{IntegrationDetail-HKDhoWtW.js → IntegrationDetail-D_3Eadi3.js} +1 -1
  21. package/dist/assets/{Integrations-qqFL0Gs0.js → Integrations-BlgB2KB5.js} +1 -1
  22. package/dist/assets/{Integrations-as3Ez0fd.js → Integrations-CUYz_Tx5.js} +1 -1
  23. package/dist/assets/{Logs-C0i-qXwM.js → Logs-woqSpCCD.js} +1 -1
  24. package/dist/assets/{MyAccess-52fP18AF.js → MyAccess-lJjPepDE.js} +1 -1
  25. package/dist/assets/{Network-s1InxtpH.js → Network-DEyTei_w.js} +1 -1
  26. package/dist/assets/{NodeAddonsSettingsPanel-PSaY411C.js → NodeAddonsSettingsPanel-xN6mgN_r.js} +1 -1
  27. package/dist/assets/NodeInferenceDevices-BE0uWzGx.js +1 -0
  28. package/dist/assets/{NotificationTargets-BYTjEwxL.js → NotificationTargets-CBBur-rQ.js} +1 -1
  29. package/dist/assets/Pipeline-BZDLzg9Y.js +1 -0
  30. package/dist/assets/{Plates-BwI8RHl9.js → Plates-DjJCFBtx.js} +1 -1
  31. package/dist/assets/{PrivacyMaskSettings-DDk6LoXQ.js → PrivacyMaskSettings-sho_DfbI.js} +1 -1
  32. package/dist/assets/{ProviderIcon-CWyyzoZB.js → ProviderIcon-D0fT0ngj.js} +1 -1
  33. package/dist/assets/{Recordings-D5IKi_ba.js → Recordings-BwUOe7Le.js} +1 -1
  34. package/dist/assets/{ScanNetworkModal-B2bUhuZ1.js → ScanNetworkModal-DH_k2Fpq.js} +1 -1
  35. package/dist/assets/{Settings-DKkqVGNC.js → Settings-CcUo6aya.js} +1 -1
  36. package/dist/assets/{Showroom-ablwi-TX.js → Showroom-CG48sUa4.js} +1 -1
  37. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CCcHjOIo.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DUxbvgWS.js} +1 -1
  38. package/dist/assets/{build-cluster-graph-C1vd_7m_.js → build-cluster-graph-DHfHni5F.js} +1 -1
  39. package/dist/assets/circle-check-big-CI9FWu6l.js +1 -0
  40. package/dist/assets/clock-4_YZJVgL.js +1 -0
  41. package/dist/assets/{copy-St-1O01R.js → copy-BQOTIQgm.js} +1 -1
  42. package/dist/assets/{debounced-invalidate-DlIKzA73.js → debounced-invalidate-DugdMzxI.js} +1 -1
  43. package/dist/assets/{download-CJ-1cdDh.js → download-CkwWo7hu.js} +1 -1
  44. package/dist/assets/{face-bbox-CTcnAI8I.js → face-bbox-baLQCp2_.js} +1 -1
  45. package/dist/assets/{hostInit-D4IGCyt3.js → hostInit-BMvgR8TY.js} +1 -1
  46. package/dist/assets/{index-Cjto-EXm.js → index-Cf-I6XLC.js} +3 -3
  47. package/dist/assets/{key-round-LcTErOxf.js → key-round-Bmr95jCJ.js} +1 -1
  48. package/dist/assets/{mf-entry-bootstrap-0-c57c6485.js → mf-entry-bootstrap-0-0623438d.js} +2 -2
  49. package/dist/assets/{pencil-BkXeyiDf.js → pencil-B1DqIkdM.js} +1 -1
  50. package/dist/assets/plus-MB1SLBFq.js +1 -0
  51. package/dist/assets/{radio-CGyv3voN.js → radio-BZuhT7Gn.js} +1 -1
  52. package/dist/assets/{refresh-cw-DC4KMLsa.js → refresh-cw-BmmNps1s.js} +1 -1
  53. package/dist/assets/remoteEntry-CoA55rjc.js +1 -0
  54. package/dist/assets/{rotate-ccw-DlNmHkpr.js → rotate-ccw-ShbJ-WX6.js} +1 -1
  55. package/dist/assets/rotate-cw-BVat1OfU.js +1 -0
  56. package/dist/assets/search-BmUqqa8F.js +1 -0
  57. package/dist/assets/{send-CeJ2J9V3.js → send-BeH97ECp.js} +1 -1
  58. package/dist/assets/{server-CArIZ-KL.js → server-v0X3NJkl.js} +1 -1
  59. package/dist/assets/square-DNYsOuV5.js +1 -0
  60. package/dist/assets/{square-check-big--y441eG8.js → square-check-big-DnKLHlgq.js} +1 -1
  61. package/dist/assets/{src-CfZUxvPx.js → src-CjsGEszD.js} +5 -5
  62. package/dist/assets/{upload-D6H_84gF.js → upload-DDoEZa7L.js} +1 -1
  63. package/dist/assets/{useEventInvalidation-DxjiYIcd.js → useEventInvalidation-DXhf2xEu.js} +1 -1
  64. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-zgU2Aw4J.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BcCLnA5F.js} +2 -2
  65. package/dist/assets/{wifi-B0toFYT9.js → wifi-FAJILiwT.js} +1 -1
  66. package/dist/assets/{zap-d6IKZFEN.js → zap-Daoo8ovU.js} +1 -1
  67. package/dist/index.html +3 -3
  68. package/dist/server/addon.js +1 -1
  69. package/package.json +1 -1
  70. package/dist/assets/NodeInferenceDevices-CoLAPH96.js +0 -1
  71. package/dist/assets/Pipeline-D3jI3Huf.js +0 -1
  72. package/dist/assets/circle-check-big-GmO5fdEl.js +0 -1
  73. package/dist/assets/clock-OUNfpFX_.js +0 -1
  74. package/dist/assets/plus-DXXZ8pd7.js +0 -1
  75. package/dist/assets/remoteEntry-CXtVdVO7.js +0 -1
  76. package/dist/assets/rotate-cw-d8IjPUYX.js +0 -1
  77. package/dist/assets/search-DkClo4ZA.js +0 -1
  78. package/dist/assets/square-BFjZ9GUs.js +0 -1
@@ -1 +0,0 @@
1
- import{$r as e,Ci as t,Ei as n,Eo as r,Ha as i,Ii as a,La as o,Mi as s,Ni as c,Pi as l,Qr as u,Si as d,T as f,To as p,Ua as m,Va as h,Vr as g,Wa as _,_ as v,_i as y,ai as b,bi as x,ci as S,di as C,ei as w,ft as T,g as E,gi as D,ii as O,ji as k,li as A,lt as j,mi as M,ni as N,oi as ee,ri as te,si as ne,ti as re,ut as P,vi as ie,wi as ae,xi as oe,yi as se,yo as ce}from"./src-CfZUxvPx.js";import{I as le,K as ue,Q as F,S as I,T as de,W as L,b as R,o as z,q as B,x as V,z as H}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{G as fe,K as pe,X as me}from"./src-CCZM6rtM.js";import{c as he,o as ge,r as _e,s as ve,t as ye}from"./NodeInferenceDevices-CoLAPH96.js";import{t as be}from"./download-CJ-1cdDh.js";import{i as xe}from"./AddLocationWizard-VuBsssbs.js";import{n as Se,r as Ce,t as we}from"./zap-d6IKZFEN.js";import{t as Te}from"./pencil-BkXeyiDf.js";import{t as Ee}from"./plus-DXXZ8pd7.js";import{t as De}from"./radio-CGyv3voN.js";import{t as Oe}from"./refresh-cw-DC4KMLsa.js";import{t as ke}from"./search-DkClo4ZA.js";import{t as Ae}from"./server-CArIZ-KL.js";import{t as je}from"./square-check-big--y441eG8.js";import{t as Me}from"./square-BFjZ9GUs.js";import{E as Ne,I as Pe,J as Fe,L as Ie,M as Le,N as Re,P as ze,S as U,T as Be,W as Ve,i as He,j as W,o as Ue,s as We}from"./index-Cjto-EXm.js";import{t as Ge}from"./AdminPage-BwmGKnRf.js";import{t as G}from"./useEventInvalidation-DxjiYIcd.js";import{r as Ke,t as qe}from"./build-cluster-graph-C1vd_7m_.js";import{n as Je}from"./format-size-CO9d3C3-.js";import{t as Ye}from"./NodeAddonsSettingsPanel-PSaY411C.js";import{n as Xe,t as Ze}from"./ClusterRecordingTab-qj7qdRav.js";var Qe=Ve(`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`}]]),$e=Ve(`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=Ve(`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`}]]);F();function tt(e){return e}function nt(e,t){for(let[n,r]of Object.entries(e??{}))if(n===t)return r}function rt(e,t){return typeof e==`boolean`?e:tt(t)}function it(e,t){return{pipeline:rt(nt(e,`detect`),t),audio:rt(nt(e,`audio`),t),ingest:rt(nt(e,`ingest`),t)}}function at(e,t,n){let r=e?.find(e=>e.nodeId===t);return it(r?.settings,n)}function ot({selectedNodeId:e,onSelect:t,refreshToken:n}){let{data:i}=g(void 0),{data:a}=D(void 0),{data:o}=ie(void 0),s=new Map;for(let e of a??[])s.set(e.agentNodeId,(s.get(e.agentNodeId)??0)+1);let c=i??[],l=c.filter(e=>e.isOnline).length,u=c.filter(e=>!e.isOnline).length;return I(`div`,{className:`flex flex-col h-full`,children:[I(`button`,{type:`button`,onClick:()=>t(ur),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:[V(Be,{className:`h-4 w-4 flex-shrink-0`}),I(`div`,{className:`min-w-0 flex-1`,children:[V(`div`,{className:`text-xs font-semibold truncate`,children:`Cluster`}),V(`div`,{className:`text-[10px] text-foreground-subtle`,children:`Balancer + failover + assignments`})]})]}),V(`div`,{className:`flex-1 overflow-y-auto`,children:c.map(n=>{let i=e===n.id,a=s.get(n.id)??0,c=n.isHub?Ae:W,l=at(o,n.id,n.isHub),u=n.isOnline?null:r(Ke(n.lastSeen));return I(`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 ${i?`bg-primary/10 text-primary`:`text-foreground hover:bg-surface-hover`}${n.isOnline?``:` opacity-60`}`,children:[V(c,{className:`h-4 w-4 flex-shrink-0`}),I(`div`,{className:`min-w-0 flex-1`,children:[I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`text-xs font-semibold truncate`,children:n.name}),n.isHub&&V(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`}),!n.isOnline&&V(`span`,{className:`h-1.5 w-1.5 rounded-full bg-destructive flex-shrink-0`}),n.isOnline&&V(`span`,{className:`h-1.5 w-1.5 rounded-full bg-success flex-shrink-0`})]}),I(`div`,{className:`text-[10px] text-foreground-subtle flex items-center gap-2 mt-0.5`,children:[I(`span`,{children:[n.cpuCores,` cores`]}),V(`span`,{children:`•`}),I(`span`,{children:[Math.round(n.memoryMB/1024),` GB`]}),a>0&&I(R,{children:[V(`span`,{children:`•`}),I(`span`,{className:`inline-flex items-center gap-0.5 text-foreground`,children:[V(Se,{className:`h-2.5 w-2.5`}),a]})]}),!n.isOnline&&I(R,{children:[V(`span`,{children:`•`}),I(`span`,{className:`text-destructive`,children:[`offline`,u===null?``:` · ${u}`]})]})]}),I(`div`,{className:`mt-0.5 flex items-center gap-1`,children:[V(ce,{variant:l.pipeline?`success`:`danger`,className:`px-1 py-0 text-[9px] leading-3`,title:l.pipeline?`Pipeline: enabled`:`Pipeline: not enabled (agent capability)`,children:`Pipe`}),V(ce,{variant:l.audio?`success`:`danger`,className:`px-1 py-0 text-[9px] leading-3`,title:l.audio?`Audio: enabled`:`Audio: not enabled (agent capability)`,children:`Aud`})]})]})]},n.id)})}),I(`div`,{className:`px-4 py-2 border-t border-border text-[10px] text-foreground-subtle flex items-center justify-between`,children:[I(`span`,{children:[l,` online`]}),u>0&&I(`span`,{className:`text-destructive`,children:[u,` offline`]})]})]})}function st({nodeId:e,refreshToken:t}){let{data:n}=g(void 0),r=n?.find(t=>t.id===e),a=i(`pipeline.runner-load-snapshot`,t=>t.nodeId===e)?.load??null;return r?I(`div`,{className:`px-6 py-4 border-b border-border`,children:[I(`div`,{className:`flex items-center gap-2 mb-1`,children:[V(`h2`,{className:`text-base font-semibold text-foreground`,children:r.name}),r.isOnline?V(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-success/10 text-success`,children:`online`}):V(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-destructive/10 text-destructive`,children:`offline`}),r.isHub&&V(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`})]}),I(`div`,{className:`text-[11px] text-foreground-subtle flex items-center gap-2 flex-wrap`,children:[V(`span`,{children:r.cpuModel??`CPU`}),V(`span`,{children:`•`}),I(`span`,{children:[r.cpuCores,` cores`]}),V(`span`,{children:`•`}),I(`span`,{children:[Math.round(r.memoryMB/1024),` GB`]}),a&&I(R,{children:[V(`span`,{children:`•`}),I(`span`,{children:[a.attachedCameras,` cameras (`,a.activeCameras,` active)`]}),V(`span`,{children:`•`}),I(`span`,{children:[a.avgInferenceTimeMs.toFixed(0),`ms avg inference`]}),V(`span`,{children:`•`}),I(`span`,{children:[`queue `,a.queueDepthTotal]}),a.hardware.hasGpu&&I(R,{children:[V(`span`,{children:`•`}),V(`span`,{className:`text-success`,children:`GPU`})]})]})]})]}):V(`div`,{className:`px-6 py-4 border-b border-border`,children:I(`div`,{className:`text-xs text-foreground-subtle`,children:[`Node not found: `,e]})})}function ct({refreshToken:e,nodeId:t}){let[n,r]=B(new Map),{nodes:i}=h();_(`pipeline.camera-metrics-snapshot`,e=>{let t=e.data;typeof t?.deviceId==`number`&&r(e=>{let n=new Map(e);return n.set(t.deviceId,t),n})});let{data:a}=A(void 0),o=L(()=>{let e=new Map;for(let t of a??[])e.set(t.nodeId,t.deviceCount);return e},[a]),s=L(()=>{let e=new Map,t=Date.now()-3e4;for(let r of n.values()){if(r.timestamp<t)continue;let n=r.nodeId??`hub`,i=e.get(n)??{attachedCameras:0,activeCameras:0,totalFps:0,totalInferenceWeighted:0,queueDepth:0};i.attachedCameras++,r.metrics.phase===`active`&&i.activeCameras++,i.totalFps+=r.metrics.actualFps,i.totalInferenceWeighted+=r.metrics.avgInferenceTimeMs,i.queueDepth+=r.metrics.queueDepth,e.set(n,i)}return e},[n]),c=L(()=>{let e=new Map;for(let t of i)e.set(t.id,t.shortName);return e},[i]),l=L(()=>{let e=0,t=0,n=0,r=0,a=0;for(let i of s.values())e+=i.attachedCameras,t+=i.activeCameras,n+=i.totalFps,r+=i.totalInferenceWeighted,a+=i.queueDepth;let o=e>0?r/e:0;return{totalAgents:i.length,onlineAgents:i.filter(e=>e.isOnline).length,attachedCameras:e,activeCameras:t,avgInferenceTimeMs:o,queueDepth:a,totalFps:n}},[s,i]);if(t){let e=s.get(t);return I(`div`,{className:`@container/liveload`,children:[V(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),I(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 mb-3`,children:[V(K,{label:`FPS`,value:e?e.totalFps.toFixed(1):`—`}),V(K,{label:`Active / Attached`,value:e?`${e.activeCameras}/${e.attachedCameras}`:`—`}),V(K,{label:`Avg infer ms`,value:e&&e.attachedCameras>0?(e.totalInferenceWeighted/e.attachedCameras).toFixed(0):`—`}),V(K,{label:`Queue`,value:e?String(e.queueDepth):`—`}),V(K,{label:`Audio`,value:String(o.get(t)??`—`)})]})]})}let u=[...s.entries()].toSorted(([e],[t])=>e===`hub`?-1:t===`hub`?1:e.localeCompare(t));return I(`div`,{className:`@container/liveload`,children:[V(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),I(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 sm:gap-3 mb-3`,children:[V(K,{label:`Total agents`,value:`${l.onlineAgents}/${l.totalAgents}`}),V(K,{label:`Active / Attached`,value:`${l.activeCameras}/${l.attachedCameras}`}),V(K,{label:`Total FPS`,value:l.totalFps.toFixed(1)}),V(K,{label:`Avg inference ms`,value:l.avgInferenceTimeMs.toFixed(0)}),V(K,{label:`Queue depth`,value:String(l.queueDepth)})]}),V(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:I(`table`,{className:`w-full text-xs min-w-[480px]`,children:[V(`thead`,{className:`bg-surface`,children:I(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[V(`th`,{className:`text-left px-3 py-2`,children:`Agent`}),V(`th`,{className:`text-right px-3 py-2`,children:`FPS`}),V(`th`,{className:`text-right px-3 py-2`,children:`Cameras`}),V(`th`,{className:`text-right px-3 py-2`,children:`Inference ms`}),V(`th`,{className:`text-right px-3 py-2`,children:`Queue`}),V(`th`,{className:`text-right px-3 py-2`,children:`Audio`})]})}),I(`tbody`,{children:[u.map(([e,t])=>I(`tr`,{className:`border-t border-border`,children:[V(`td`,{className:`px-3 py-2 text-foreground font-medium`,children:c.get(e)??e}),V(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.totalFps.toFixed(1)}),V(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras}),V(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras>0?(t.totalInferenceWeighted/t.attachedCameras).toFixed(0):`—`}),V(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.queueDepth}),V(`td`,{className:`px-3 py-2 text-right text-foreground`,children:o.get(e)??`—`})]},e)),u.length===0&&V(`tr`,{children:V(`td`,{colSpan:6,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`No camera metrics received yet`})})]})]})})]})}function K({label:e,value:t}){return I(`div`,{className:`rounded-lg border border-border bg-surface/60 p-3`,children:[V(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle mb-1`,children:e}),V(`div`,{className:`text-lg font-semibold text-foreground`,children:t})]})}F();var lt={active:!1,pinned:!1,nodeId:null,reason:``},ut=[`pipeline.camera-assigned`,`pipeline.camera-unassigned`,`pipeline.camera-updated`,`agent.online`,`agent.offline`],dt={pipeline:W,decoder:Ne,audio:Ce},ft={pipeline:`Pipeline`,decoder:`Decoder`,audio:`Audio`};function pt({mode:e,nodeId:t,compact:n=!1}){if(e===`agent`&&!t)throw Error(`CameraAssignmentsTable: nodeId is required when mode === "agent"`);let r=z(),[i,a]=B(null),[o,l]=B(null),[u,d]=B(new Map);G([`pipelineOrchestrator`,`getPipelineAssignments`],ut),G([`pipelineOrchestrator`,`getAudioAssignments`],ut),G([`pipelineOrchestrator`,`getCameraStatuses`],ut);let{data:p}=D(void 0),{data:m}=S(void 0),{data:g}=C({},{enabled:e===`agent`}),{nodes:v}=h(),{data:y}=ge();_(`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})}),H(()=>{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 x=L(()=>{let e=new Map;for(let t of y??[])e.set(t.id,t.name);return e},[y]),w=L(()=>{if(e===`agent`){let e=[];for(let n of g??[]){let r=n.assignment,i=(e,n,r)=>({active:e!==null&&e===t,pinned:n,nodeId:e,reason:r??``}),a=i(r.detectionNodeId,r.pinned.detection,r.reasons.detection),o=i(r.decoderNodeId,r.pinned.decoder,r.reasons.decoder),s=i(r.audioNodeId,r.pinned.audio,r.reasons.audio);!a.active&&!o.active&&!s.active||e.push({deviceId:n.deviceId,deviceName:x.get(n.deviceId)??`Device ${n.deviceId}`,pipeline:a,decoder:o,audio:s})}return e.sort((e,t)=>e.deviceId-t.deviceId),e}let n=new Map,r=e=>{let t=n.get(e);if(t)return t;let r={deviceId:e,deviceName:x.get(e)??`Device ${e}`,pipeline:lt,decoder:lt,audio:lt};return n.set(e,r),r};for(let i of p??[]){let a=r(i.deviceId);n.set(i.deviceId,{...a,pipeline:{active:!0,pinned:i.pinned,nodeId:i.agentNodeId,reason:i.reason??``},decoder:{active:e===`cluster`?!0:i.agentNodeId===t,pinned:!1,nodeId:i.agentNodeId,reason:`co-located`}})}for(let e of m??[]){let t=r(e.deviceId);n.set(e.deviceId,{...t,audio:{active:!0,pinned:e.pinned,nodeId:e.nodeId,reason:`capacity`}})}let i=[...n.values()];return i.sort((e,t)=>e.deviceId-t.deviceId),i},[p,m,g,x,e,t]),T=L(()=>(v??[]).filter(e=>e.isOnline).map(e=>({id:e.id,name:e.name})),[v]),E=()=>{r.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),r.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]}),r.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getCameraStatuses`]]})},O=ee({onSuccess:E}),k=c({onSuccess:E}),A=b({onSuccess:E}),j=s({onSuccess:E}),M=(e,t,n)=>{t===`pipeline`?O.mutate({deviceId:e,agentNodeId:n}):A.mutate({deviceId:e,nodeId:n}),a(null)},N=(e,t)=>{t===`pipeline`?k.mutate({deviceId:e}):j.mutate({deviceId:e}),a(null)};return V(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:I(`table`,{className:`w-full text-xs min-w-[760px] table-fixed`,children:[V(`thead`,{className:`bg-surface`,children:I(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[!n&&V(`th`,{className:`w-10`}),V(`th`,{className:`min-w-[200px] text-left px-3 py-2 align-middle`,children:`Camera`}),e===`cluster`?I(R,{children:[V(`th`,{className:`w-[168px] text-left px-3 py-2 align-middle`,children:`Auto | Pin`}),V(`th`,{className:`w-[188px] text-left px-3 py-2 align-middle`,children:`Resolved placement`})]}):I(R,{children:[V(`th`,{className:`w-[120px] text-left px-3 py-2 align-middle`,children:`Pipeline`}),V(`th`,{className:`w-[120px] text-left px-3 py-2 align-middle`,children:`Decoder`}),V(`th`,{className:`w-[120px] text-left px-3 py-2 align-middle`,children:`Audio`})]}),V(`th`,{className:`w-[132px] text-left px-3 py-2 align-middle`,children:`Status`})]})}),I(`tbody`,{children:[w.map(t=>{let r=u.get(t.deviceId),s=o===t.deviceId;return I(de.Fragment,{children:[I(`tr`,{className:`border-t border-border align-middle relative`,children:[!n&&V(`td`,{className:`px-2 py-2 align-middle`,children:V(`button`,{type:`button`,onClick:()=>l(s?null:t.deviceId),className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle`,"aria-label":s?`Collapse broker details`:`Expand broker details`,children:V(s?Pe:ze,{className:`h-3.5 w-3.5`})})}),I(`td`,{className:`px-3 py-2 align-middle min-w-0`,children:[V(`div`,{className:`text-foreground font-medium leading-tight line-clamp-2 break-words`,title:t.deviceName,children:t.deviceName}),I(`div`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[`#`,t.deviceId]})]}),e===`cluster`?I(R,{children:[V(`td`,{className:`px-3 py-2 align-middle`,children:V(ht,{state:t.pipeline,onlineNodes:T,pending:O.isPending||k.isPending,onChange:e=>{e===`auto`?N(t.deviceId,`pipeline`):M(t.deviceId,`pipeline`,e)}})}),V(`td`,{className:`px-3 py-2 align-middle`,children:V(gt,{state:t.pipeline})})]}):I(R,{children:[V(_t,{role:`pipeline`,state:t.pipeline,mode:e,deviceId:t.deviceId,onlineNodes:T,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=>M(t.deviceId,`pipeline`,e),onUnpin:()=>N(t.deviceId,`pipeline`)}),V(_t,{role:`decoder`,state:t.decoder,mode:e,deviceId:t.deviceId,onlineNodes:T,readOnly:!0,isMenuOpen:!1,onToggleMenu:()=>void 0,onCloseMenu:()=>void 0,onMove:()=>void 0,onUnpin:()=>void 0}),V(_t,{role:`audio`,state:t.audio,mode:e,deviceId:t.deviceId,onlineNodes:T,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=>M(t.deviceId,`audio`,e),onUnpin:()=>N(t.deviceId,`audio`)})]}),V(`td`,{className:`px-3 py-2 align-middle`,children:V(xt,{snap:r})})]}),s&&!n&&I(`tr`,{className:`bg-surface/50`,children:[V(`td`,{}),I(`td`,{colSpan:e===`cluster`?4:5,className:`px-3 py-2 space-y-3`,children:[t.pipeline.nodeId&&V(mt,{deviceId:t.deviceId,nodeId:t.pipeline.nodeId}),V(f,{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)}),w.length===0&&V(`tr`,{children:V(`td`,{colSpan:n?e===`cluster`?4:5:e===`cluster`?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 mt({deviceId:e,nodeId:t}){let n=z(),{data:r}=M({nodeId:t}),{data:i}=y({deviceId:e}),a=k({onSuccess:()=>{n.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineDevicePin`]]})}}),o=r?.devices??[],s=i?.deviceKey??`auto`,c=s!==`auto`&&!o.some(e=>e.key===s);return I(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[V(`span`,{className:`shrink-0 font-medium text-foreground`,children:`Inference device`}),I(`select`,{value:s,disabled:a.isPending,"aria-label":`Inference device pin`,onChange:t=>a.mutate({deviceId:e,deviceKey:t.target.value}),className:`rounded-md border border-border bg-background px-2 py-1 text-xs text-foreground`,children:[V(`option`,{value:`auto`,children:`Auto (balanced)`}),c&&I(`option`,{value:s,children:[`Pin → `,s,` (not on this node)`]}),o.map(e=>I(`option`,{value:e.key,children:[`Pin → `,e.key,e.available?``:` (unavailable)`]},e.key))]}),a.isPending&&V(`span`,{className:`text-[10px] opacity-70`,children:`saving…`})]})}function ht({state:e,onlineNodes:t,pending:n,onChange:r}){let i=e.pinned&&e.nodeId?e.nodeId:`auto`,a=[...new Set([...e.nodeId?[e.nodeId]:[],...t.map(e=>e.id)])];return I(`select`,{value:i,disabled:n,"aria-label":`Pipeline placement pin`,onChange:e=>r(e.target.value),className:`w-full min-w-0 rounded-md border border-border bg-background px-2 py-1 text-xs text-foreground`,children:[V(`option`,{value:`auto`,children:`Auto`}),a.map(e=>I(`option`,{value:e,children:[`Pin → `,t.find(t=>t.id===e)?.name??e]},e))]})}function gt({state:e}){if(!e.active||!e.nodeId)return V(`span`,{className:`text-[10px] text-foreground-subtle italic`,children:`—`});let t=e.pinned?`pinned · manual`:`auto · ${e.reason||`capacity`}`;return I(`div`,{className:`flex flex-col leading-tight min-w-0`,children:[V(`span`,{className:`font-mono text-[11px] text-foreground truncate`,title:e.nodeId,children:e.nodeId}),V(`span`,{className:`truncate ${e.pinned?`text-amber-400 text-[10px]`:`text-foreground-subtle text-[10px]`}`,title:t,children:t})]})}function _t({role:e,state:t,mode:n,onlineNodes:r,readOnly:i=!1,isMenuOpen:a,onToggleMenu:o,onCloseMenu:s,onMove:c,onUnpin:l}){let u=dt[e],d=r.filter(e=>e.id!==(t.nodeId??``)),f=!i&&(t.active||n===`cluster`)&&(d.length>0||t.pinned);return I(`td`,{className:`px-3 py-2 align-middle relative min-w-0`,children:[I(`div`,{className:`flex items-center gap-2 min-w-0`,children:[V(n===`agent`?vt:yt,{state:t,Icon:u}),V(`div`,{className:`ml-auto shrink-0`,children:f&&V(`button`,{type:`button`,onClick:o,className:`p-1 rounded hover:bg-surface-hover`,"aria-label":`${ft[e]} actions`,children:V(Qe,{className:`h-3 w-3 text-foreground-subtle`})})})]}),a&&f&&V(St,{title:ft[e],targets:d,pinned:t.pinned,onMove:c,onUnpin:l,onClose:s})]})}function vt({state:e,Icon:t}){return I(`div`,{className:`flex items-center gap-1.5`,children:[V(e.active?je:Me,{className:`h-3.5 w-3.5 ${e.active?`text-success`:`text-foreground-subtle/50`}`}),V(t,{className:`h-3 w-3 ${e.active?`text-foreground-subtle`:`text-foreground-subtle/40`}`}),e.pinned&&V(et,{className:`h-2.5 w-2.5 text-amber-400`})]})}function yt({state:e,Icon:t}){return!e.active||!e.nodeId?I(`div`,{className:`flex items-center gap-1.5 text-foreground-subtle/60`,children:[V(t,{className:`h-3 w-3`}),V(`span`,{className:`text-[10px] italic`,children:`—`})]}):I(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[V(t,{className:`h-3 w-3 text-foreground-subtle shrink-0`}),I(`div`,{className:`flex flex-col leading-tight min-w-0`,children:[V(`span`,{className:`font-mono text-[11px] text-foreground truncate`,children:e.nodeId}),V(`span`,{className:`flex items-center gap-1 text-[10px]`,children:e.pinned?I(`span`,{className:`inline-flex items-center gap-0.5 text-amber-400`,children:[V(et,{className:`h-2.5 w-2.5`}),` manual`]}):I(`span`,{className:`text-foreground-subtle truncate`,children:[`auto · `,e.reason||`capacity`]})})]})]})}var bt=`min-h-[3.25rem]`;function xt({snap:e}){if(!e)return V(`div`,{className:`flex items-center ${bt}`,children:V(`span`,{className:`text-[10px] text-foreground-subtle italic`,children:`—`})});let{phase:t,actualFps:n,avgInferenceTimeMs:r,queueDepth:i,configuredFps:a,droppedFrames:o}=e.metrics,s=p(t);return I(`div`,{className:`flex flex-col justify-center gap-0.5 font-mono text-[10px] tabular-nums leading-tight min-w-0 ${bt}`,children:[I(`span`,{className:`inline-flex items-center gap-1 min-w-0 ${s.textColor}`,children:[V(v,{phase:t,className:`h-2.5 w-2.5 shrink-0`}),V(`span`,{className:`font-semibold uppercase tracking-wider truncate`,children:s.label})]}),I(`span`,{className:`text-foreground-subtle whitespace-nowrap truncate`,children:[V(`span`,{className:`text-foreground`,children:n.toFixed(1)}),I(`span`,{children:[`/`,a.toFixed(0),` fps`]})]}),I(`span`,{className:`text-foreground-subtle whitespace-nowrap truncate`,children:[V(`span`,{className:`text-foreground`,children:r.toFixed(0)}),V(`span`,{children:` ms`}),i>0&&I(`span`,{className:`text-warning ml-1`,children:[`q`,i]})]}),I(`span`,{className:`whitespace-nowrap truncate ${o>0?`text-warning`:`text-foreground-subtle`}`,children:[`drops `,V(`span`,{className:`text-foreground`,children:o})]})]})}function St({title:e,targets:t,pinned:n,onMove:r,onUnpin:i,onClose:a}){let o=ue(null);return H(()=>{let e=e=>{o.current?.contains(e.target)||a()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[a]),I(`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:[V(`div`,{className:`px-3 py-1 text-[9px] uppercase tracking-wider text-foreground-subtle border-b border-border`,children:e}),t.length>0&&V(`div`,{className:`py-1`,children:t.map(e=>I(`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&&I(`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&&V(`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 I(`div`,{className:`space-y-6`,children:[V(ct,{refreshToken:t,nodeId:e}),I(`div`,{children:[V(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Cameras on this node`}),I(`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.`]})]}),V(pt,{mode:`agent`,nodeId:e,compact:!0})]})}F();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:t}){let n=z(),r=te({onSettled:()=>{n.invalidateQueries({queryKey:[`pipelineExecutor`,`listLoadedEngines`]})}}),{data:o}=O({nodeId:e}),s=i(`pipeline.engine-metrics-snapshot`,t=>t.nodeId===e)?.engines??o??null,c=s===null;G([`pipelineRunner`,`getLocalCameras`],[`pipeline.camera-assigned`,`pipeline.camera-unassigned`]);let{data:l}=a({nodeId:e}),{values:u}=m(`pipeline.camera-metrics-snapshot`,e=>e.deviceId,t=>t.nodeId===e),d=L(()=>u.filter(e=>e.metrics.phase===`active`).length,[u]),f=t=>{let n=l??[];n.length>0&&!window.confirm(`${n.length} camera(s) are dispatching through this engine. Killing it forces a respawn on the next frame. Continue?`)||r.mutate({nodeId:e,engine:t,force:n.length>0})};return I(`div`,{className:`space-y-6`,children:[I(`div`,{children:[V(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Inference engines on this node`}),I(`p`,{className:`text-[11px] text-foreground-subtle`,children:[(s??[]).length,` engine(s) resident in RAM. `,(l??[]).length,` `,`camera(s) attached, `,d,` actively dispatching frames. Refreshes every 5s.`]})]}),V(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:I(`table`,{className:`w-full text-xs min-w-[640px]`,children:[V(`thead`,{className:`bg-surface`,children:I(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[V(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Kind`}),V(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Runtime / Backend / Device`}),V(`th`,{className:`text-left px-3 py-2`,children:`Models`}),V(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Pool PID`}),V(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Auto-kill`}),V(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`In use`}),V(`th`,{className:`w-20`})]})}),I(`tbody`,{children:[c&&V(`tr`,{children:V(`td`,{colSpan:7,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`Loading…`})}),!c&&(s??[]).map(e=>{let t=e.kind===`warm-override`,n=e.kind===`device-pool`;return I(`tr`,{className:`border-t border-border ${t?`bg-amber-500/5`:n?`bg-primary/[0.05]`:``}`,children:[V(`td`,{className:`px-3 py-2`,children:I(`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`:n?`bg-primary/15 text-primary`:`bg-success/15 text-success`}`,children:[V(t?$e:n?he:W,{className:`h-3 w-3`}),t?`warm`:n?`pool`:`runtime`]})}),V(`td`,{className:`px-3 py-2`,children:I(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-sky-400`,children:[V(we,{className:`h-3 w-3`}),e.engine.runtime,`/`,e.engine.backend,e.engine.device?`/${e.engine.device}`:``,e.engine.format?` · ${e.engine.format}`:``]})}),V(`td`,{className:`px-3 py-2`,children:e.modelsLoaded.length===0?V(`span`,{className:`text-foreground-subtle text-[11px]`,children:`—`}):V(`div`,{className:`flex flex-wrap gap-1`,children:e.modelsLoaded.map(e=>V(`span`,{className:`inline-block rounded bg-surface px-1.5 py-0.5 text-[10px] font-mono text-foreground-subtle`,children:e},e))})}),V(`td`,{className:`px-3 py-2 text-right font-mono text-foreground`,children:e.poolPid??`—`}),V(`td`,{className:`px-3 py-2 text-right text-[11px]`,children:e.idleMs!==null&&e.idleTtlMs!==null?V(`span`,{className:`text-foreground-subtle`,children:wt(e.idleMs,e.idleTtlMs)}):V(`span`,{className:`text-foreground-subtle/50`,children:`never`})}),V(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t?`—`:(l??[]).length}),V(`td`,{className:`px-3 py-2 text-right`,children:n?V(`span`,{className:`text-[11px] text-foreground-subtle`,children:`auto`}):I(`button`,{type:`button`,disabled:r.isPending,onClick:()=>f(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:[V(We,{className:`h-3 w-3`}),`Kill`]})})]},e.engineKey)}),!c&&(s??[]).length===0&&V(`tr`,{children:V(`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.`})})]})]})}),I(`div`,{className:`text-[10px] text-foreground-subtle leading-relaxed`,children:[V(`strong`,{className:`text-foreground`,children:`runtime`}),`: main camera-serving engine; never auto-killed while cameras attached. `,V(`strong`,{className:`text-foreground`,children:`warm`}),`: benchmark/test override held in cache for fast re-use; auto-disposed after the idle TTL.`,` `,V(`strong`,{className:`text-foreground`,children:`pool`}),`: a per-device balanced inference pool (one per enabled accelerator, running concurrently); reaper-managed on its own idle TTL.`]}),r.isError&&I(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-[11px] text-destructive`,children:[`Kill failed:`,` `,r.error instanceof Error?r.error.message:`unknown`]})]})}F();var Et=new Set(me);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?I(`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:[V(`div`,{className:`h-2 w-2 rounded-full shrink-0 ${c.downloaded?`bg-success`:`bg-foreground-subtle/30`}`}),I(`div`,{className:`flex-1 min-w-0`,children:[I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`text-sm font-medium text-foreground`,children:t.name}),I(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:[`(`,t.id,`)`]})]}),i&&i.progress>=0&&i.progress<100&&I(`div`,{className:`mt-1.5 flex items-center gap-2 max-w-xs`,children:[V(`div`,{className:`flex-1 h-1 bg-surface-hover rounded-full overflow-hidden`,children:V(`div`,{className:`bg-primary h-full rounded-full transition-all duration-300`,style:{width:`${i.progress}%`}})}),I(`span`,{className:`text-[9px] text-primary font-mono tabular-nums shrink-0`,children:[Math.round(i.progress),`%`]})]})]}),V(`span`,{className:`text-xs text-foreground-subtle tabular-nums shrink-0`,children:Je(c.sizeMB)}),a&&I(`span`,{className:`flex items-center gap-1 text-[10px] text-danger max-w-[160px] truncate shrink-0`,title:a,children:[V(Re,{className:`h-3 w-3 shrink-0`}),a]}),c.downloaded?I(`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?V(U,{className:`h-3 w-3 animate-spin`}):V(We,{className:`h-3 w-3`}),r?`Deleting...`:`Delete`]}):I(`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?V(U,{className:`h-3 w-3 animate-spin`}):V(be,{className:`h-3 w-3`}),r?`Downloading...`:`Download`]})]}):null}function Nt({engines:e,activeEngine:t,viewEngine:n,onSelect:r}){let[i,a]=B(!1);return I(`div`,{className:`relative`,children:[I(`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:[V(W,{className:`h-4 w-4 text-primary shrink-0`}),I(`div`,{className:`flex-1 min-w-0`,children:[I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`text-sm font-medium text-foreground`,children:kt(n)}),q(n)===q(t)&&V(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),V(`div`,{className:`text-[10px] text-foreground-subtle`,children:At(n)})]}),V(Pe,{className:`h-4 w-4 text-foreground-subtle transition-transform ${i?`rotate-180`:``}`})]}),i&&V(`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 I(`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:[V(W,{className:`h-4 w-4 shrink-0 ${i?`text-primary`:`text-foreground-subtle`}`}),I(`div`,{className:`flex-1`,children:[I(`div`,{className:`flex items-center gap-2`,children:[V(`span`,{className:`text-sm font-medium ${i?`text-primary`:`text-foreground`}`,children:kt(e)}),o&&V(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),V(`div`,{className:`text-[10px] text-foreground-subtle`,children:At(e)})]}),i&&V(Le,{className:`h-4 w-4 text-primary shrink-0`})]},q(e))})})]})}function Pt({embedded:t=!1,nodeId:n}={}){let r=z(),i=n??`hub`,[a,o]=B(null),[s,c]=B(new Set),[l,d]=B(new Map),[f,p]=B(new Map),[m,h]=B(``),{data:g=[]}=w({nodeId:i}),v=g.filter((e,t,n)=>n.findIndex(t=>t.format===e.format)===t),{data:y}=N({nodeId:i}),b=y,{data:x,isLoading:S}=re({nodeId:i}),C=e(),T=u();_(`model.download.progress`,e=>{let t=e.data,n=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;n===void 0||i===void 0||(d(e=>{let t=new Map(e);return i===100||i===-1?t.delete(n):t.set(n,{modelId:n,progress:i,totalMB:a}),t}),i===100&&r.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]}))});let E=b??{runtime:`node`,backend:`cpu`,format:`onnx`},D=v.find(e=>e.format===a)??E,O=D.format,k=x?.slots??[],A=k.map(e=>({...e,addons:e.addons.map(e=>({...e,models:e.models.filter(e=>e.formats[O]!==void 0)})).filter(e=>e.models.length>0)})).filter(e=>e.addons.length>0),j=jt(A,O),M=le(async(e,t,n)=>{if(!Dt(n))return;let a=Ot(e,t,n);c(e=>new Set([...e,a])),p(e=>{let t=new Map(e);return t.delete(a),t});try{await C.mutateAsync({addonId:e,modelId:t,format:n,nodeId:i}),r.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]})}catch(e){p(t=>new Map([...t,[a,e instanceof Error?e.message:`Download failed`]]))}finally{c(e=>{let t=new Set(e);return t.delete(a),t})}},[C,r,i]),ee=le(async(e,t,n)=>{if(!Dt(n))return;let a=Ot(e,t,n);c(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:n,nodeId:i}),r.invalidateQueries({queryKey:[[`pipelineExecutor`,`getSchema`]]})}catch(e){p(t=>new Map([...t,[a,e instanceof Error?e.message:`Delete failed`]]))}finally{c(e=>{let t=new Set(e);return t.delete(a),t})}},[T,r,i]),te=le(e=>{o(e.format)},[]),ne=m.trim()?A.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):A,P=I(R,{children:[S&&V(`div`,{className:`flex items-center justify-center py-16`,children:V(U,{className:`h-5 w-5 animate-spin text-foreground-subtle`})}),!S&&k.length===0&&I(`div`,{className:`flex flex-col items-center justify-center py-16 text-foreground-subtle`,children:[V(xe,{className:`h-8 w-8 mb-3 opacity-30`}),V(`span`,{className:`text-sm`,children:`No pipeline steps available`}),V(`span`,{className:`text-xs mt-1`,children:`Configure the detection pipeline to see available models.`})]}),!S&&k.length>0&&I(R,{children:[V(Nt,{engines:v,activeEngine:E,viewEngine:D,onSelect:te}),I(`div`,{className:`flex items-center gap-4 text-xs text-foreground-subtle`,children:[I(`span`,{children:[V(`span`,{className:`font-semibold text-foreground tabular-nums`,children:j.total}),V(`span`,{className:`ml-1`,children:`compatible models`})]}),V(`span`,{className:`text-border`,children:`|`}),I(`span`,{children:[V(`span`,{className:`font-semibold text-success tabular-nums`,children:j.downloaded}),V(`span`,{className:`ml-1`,children:`downloaded`})]}),V(`span`,{className:`text-border`,children:`|`}),I(`span`,{className:`tabular-nums`,children:[Je(j.downloadedSizeMB),V(`span`,{className:`ml-1`,children:`on disk`})]})]}),j.total>5&&I(`div`,{className:`relative`,children:[V(ke,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),V(`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`})]}),ne.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[O]?.downloaded).length,0);return I(`div`,{children:[I(`div`,{className:`flex items-center gap-2 mb-2`,children:[V(`h2`,{className:`text-sm font-semibold text-foreground`,children:e.label}),V(`div`,{className:`flex-1 h-px bg-border`}),I(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:[n,`/`,t]})]}),V(`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,O);return V(Mt,{addonId:e.id,model:t,format:O,isActive:s.has(n),progress:l.get(t.id),errorMsg:f.get(n),onDownload:()=>M(e.id,t.id,O),onDelete:()=>ee(e.id,t.id,O)},`${e.id}/${t.id}`)}))})]},e.id)}),ne.length===0&&V(`div`,{className:`text-center py-8 text-sm text-foreground-subtle`,children:m.trim()?I(R,{children:[`No models matching “`,m,`”`]}):I(R,{children:[`No models available for `,kt(D),` format`]})})]})]});return t?V(`div`,{className:`space-y-4`,children:P}):V(Ge,{children:P})}function Ft({nodeId:e,refreshToken:t}){return V(Pt,{embedded:!0,nodeId:e})}var It=`pipeline-runner`,Lt=200;function Rt({nodeId:e}){return I(`div`,{className:`flex flex-col gap-3`,children:[I(`div`,{children:[V(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Runner logs`}),I(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`pipeline-runner activity on `,e,` — camera attach/detach, engine phases and pipeline errors. Streaming live; the device chip on a line tells which camera it refers to.`]})]}),V(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:V(E,{agentId:e,addonId:It,limit:Lt,maxHeight:`max-h-[calc(100vh-360px)]`,showScope:!0,showDeviceChip:!0,showFilters:!1})})]})}F(),F();function zt({nodeId:e,title:t}){let{data:n}=ge(),{data:r}=D(void 0),i=L(()=>{let e=new Map;for(let t of n??[])e.set(t.id,t.name);return e},[n]),a=L(()=>{if(!e)return null;let t=new Set;for(let n of r??[])n.agentNodeId===e&&t.add(n.deviceId);return t},[e,r]),[o,s]=B(new Map);_(`pipeline.camera-metrics-snapshot`,t=>{let n=t.data;typeof n.deviceId==`number`&&(e&&n.nodeId!==e||s(e=>{let t=new Map(e);return t.set(n.deviceId,n),t}))}),H(()=>{if(o.size===0)return;let e=setInterval(()=>{s(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)},[o.size]);let c=L(()=>{let e=[];for(let t of o.values())a&&!a.has(t.deviceId)||e.push(t);return e.sort((e,t)=>e.deviceId-t.deviceId),e},[o,a]);return c.length===0?I(`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`]}):I(`div`,{className:`rounded-md border border-border bg-surface px-3 py-2`,children:[I(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[V(`span`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:t??`Cameras`}),V(`span`,{className:`text-[10px] text-foreground-subtle`,children:c.length})]}),V(`div`,{className:`flex flex-wrap gap-1.5`,children:c.map(e=>{let t=i.get(e.deviceId)??`#${e.deviceId}`,n=p(e.metrics.phase);return I(`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:[V(v,{phase:e.metrics.phase,className:`h-2.5 w-2.5`}),V(`span`,{className:`font-medium text-foreground/90 max-w-[220px] truncate`,children:t}),V(`span`,{className:`font-mono tabular-nums`,children:e.metrics.actualFps.toFixed(1)}),V(`span`,{className:`opacity-60`,children:`fps`})]},e.deviceId)})})]})}F();var Bt=[`pipeline-orchestrator`],Vt=[`decoder`],Ht=!1;function Ut({nodeId:e,refreshToken:t}){let n=o(),[r,i]=B(null),[a,s]=B(null),c=(g(void 0).data??[]).find(t=>t.id===e),l=c?.name??e,u=c?.isOnline??!1,d=oe({onSuccess:e=>{s(e.effectiveModelId===null?`Reset done — model config cleared (node offline: effective model resolves on reconnect)`:`Reset done — effective detection model: ${e.effectiveModelId} (Auto)`)}}),f=async()=>{await n({title:`Reset ${l} to hardware-aware defaults?`,message:`This clears every per-device model default on this node (back to the format default) and every per-camera step override scoped to it. Existing per-camera customisations on this node are lost.`,confirmLabel:`Reset`,variant:`danger`})&&(s(null),d.mutate({agentNodeId:e}))};return I(`div`,{className:`relative h-full w-full space-y-3`,children:[I(`div`,{className:`flex items-center justify-end gap-2 text-xs`,children:[a&&V(`span`,{className:`text-emerald-400`,children:a}),d.isError&&V(`span`,{className:`text-red-400`,children:d.error instanceof Error?d.error.message:`Reset failed`}),V(`button`,{type:`button`,onClick:()=>{f()},disabled:d.isPending,className:`rounded border border-amber-500/40 bg-surface px-2 py-0.5 text-amber-300 hover:bg-surface-hover disabled:opacity-50`,title:`Clear this node's per-device model defaults + per-camera overrides scoped to this node`,children:d.isPending?`Resetting…`:`Reset to default`})]}),V(zt,{nodeId:e}),V(Ye,{nodeId:e,addonIds:Bt,level:`global`,sectionIds:Vt}),Ht,Ht,I(`div`,{children:[V(`h3`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Inference devices — default model per accelerator`}),V(ye,{nodeId:e,nodeName:l,isOnline:u})]})]})}var Wt=[`detection-pipeline`,`audio-analyzer`,`pipeline-runner`],Gt=`decoder-nodeav`;function Kt({nodeId:e,refreshToken:t}){let{data:n}=g(void 0),r=n?.find(t=>t.id===e)?.addons.find(e=>e.capabilities.includes(`decoder`))?.id??Gt,i=[...Wt,r];return I(`div`,{className:`flex flex-col h-full`,children:[V(st,{nodeId:e,refreshToken:t}),V(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-6`,children:V(Ye,{nodeId:e,addonIds:i,level:`global`,extraTabs:[{id:`assignments`,label:`Assignments`,order:-10,content:V(Ct,{nodeId:e,refreshToken:t})},{id:`tree`,label:`Pipeline`,order:39,content:V(Ut,{nodeId:e,refreshToken:t})},{id:`engines`,label:`Warm instances`,order:180,content:V(Tt,{nodeId:e,refreshToken:t})},{id:`models`,label:`Models`,order:200,content:V(Ft,{nodeId:e,refreshToken:t})},{id:`logs`,label:`Logs`,order:300,content:V(Rt,{nodeId:e})}]})})]})}var qt=`pipeline-orchestrator`,Jt=`recorder`,Yt=`recordingNodeId`,Xt=[`ingestNode`,`recordingNode`,`audioNode`,`motionNode`],Zt=[{key:`detect`,label:`Detect`,hint:`Runs the detection pipeline (decode + inference) for assigned cameras`}];function Qt(e,t){for(let n of e?.sections??[])for(let e of n.fields??[])if(e.key===t)return e.value}function $t(e,t){for(let[n,r]of Object.entries(e??{}))if(n===t)return r}function J(e,t,n){let r=Qt(e,t);return typeof r==`string`&&r.length>0?r:n}function en(e,t,n){let r=Qt(e,t);return typeof r==`number`&&Number.isFinite(r)?r:n}function tn(e,t){let n=$t(e,t);return typeof n==`number`&&Number.isFinite(n)?n:null}function nn(e,t){let n=$t(e,t);return typeof n==`string`&&n.length>0?n:null}function rn(e){return e===`ingestNode`?`Ingest`:e===`recordingNode`?`Recording`:e===`audioNode`?`Audio`:`Motion Node`}function an(e){return e===`ingestNode`?`Node that terminates default camera ingest`:e===`recordingNode`?`Node that owns the recorder (recording-node)`:e===`audioNode`?`Node that runs singleton audio work`:`Runs software (analyzer) motion-watch. Onboard cameras are unaffected.`}function on(e,t){switch(t){case`detect`:return e.pipeline}}function sn(e){return e instanceof Error?e.message:`Failed to save`}function cn(e){e.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`listAgentSettings`]]}),e.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAgentSettings`]]}),e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}function ln({capability:e,label:t,hint:n,nodeId:r,active:i,pending:a,layout:o,onToggle:s}){let c=i?`border-success/30 bg-success/15 text-success hover:bg-success/25`:`border-border bg-surface-hover text-foreground-subtle hover:bg-surface hover:text-foreground`,l=o===`card`?`w-full justify-center px-3 py-2 text-xs`:`px-2.5 py-1 text-[11px]`,u=i?Ie:ve;return I(`button`,{type:`button`,role:`switch`,"aria-checked":i,"aria-label":`${t} capability for ${r}`,title:`${t} — ${n}`,disabled:a,onClick:()=>s(e,!i),className:`inline-flex items-center gap-1.5 rounded-full border font-medium transition-colors disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 ${c} ${l}`,children:[V(u,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}),V(`span`,{children:t})]})}function un({node:e,emphasis:t=!1}){let n=e.isHub?Ae:W;return I(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[V(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${e.isOnline?`bg-success`:`bg-danger`}`,"aria-hidden":`true`}),V(n,{className:`h-4 w-4 shrink-0 text-foreground-subtle`,"aria-hidden":`true`}),I(`div`,{className:`min-w-0`,children:[I(`div`,{className:`flex items-center gap-1.5 ${t?`text-sm`:`text-xs`} font-semibold text-foreground`,children:[V(`span`,{className:`truncate`,children:e.name}),e.isHub&&V(ce,{variant:`info`,className:`px-1.5 py-0 text-[9px] uppercase tracking-wider`,children:`hub`}),!e.isOnline&&V(ce,{variant:`danger`,className:`px-1.5 py-0 text-[9px] uppercase tracking-wider`,children:`offline`})]}),V(`div`,{className:`font-mono text-[10px] text-foreground-subtle truncate`,children:e.id})]})]})}F();function dn({nodeId:e,value:t,detectedHosts:n,status:r,errorMessage:i,onCommit:a}){let[o,s]=B(t??``);H(()=>{s(t??``)},[t]);let c=n[0],l=c===void 0?`auto-detect`:`auto: ${c}`,u=r===`pending`,d=o.trim(),f=d!==(t??``),p=f&&!u,m=()=>{p&&a(e,d.length>0?d:null)};return I(`div`,{className:`flex items-center gap-1.5`,children:[V(`input`,{"aria-label":`Reachable host for ${e}`,type:`text`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,placeholder:l,value:o,disabled:u,onChange:e=>s(e.target.value),onBlur:m,onKeyDown:e=>{e.key===`Enter`&&m(),e.key===`Escape`&&s(t??``)},className:`w-40 rounded-md border border-border bg-background px-2.5 py-1.5 text-sm text-foreground placeholder:text-foreground-subtle focus:border-primary focus:outline-none disabled:opacity-50`}),I(`button`,{type:`button`,onClick:m,disabled:!p,"aria-label":`Save reachable host for ${e}`,title:`Save reachable host`,className:`inline-flex shrink-0 items-center gap-1 rounded-md px-2 py-1.5 text-[11px] font-medium bg-primary text-white hover:bg-primary/90 disabled:opacity-40 disabled:cursor-not-allowed`,children:[u?V(U,{className:`h-3 w-3 animate-spin`,"aria-hidden":`true`}):V(Ie,{className:`h-3 w-3`,"aria-hidden":`true`}),`Save`]}),!f&&!u&&r===`success`&&V(Ie,{className:`h-3.5 w-3.5 shrink-0 text-emerald-400`,"aria-label":`Saved`,role:`img`}),r===`error`&&V(`span`,{title:i??`Failed to save reachable host`,children:V(Re,{className:`h-3.5 w-3.5 shrink-0 text-red-400`,"aria-label":i??`Failed to save reachable host`,role:`img`})})]})}function fn({label:e,children:t}){return I(`div`,{className:`flex items-center justify-between gap-3`,children:[V(`span`,{className:`text-[11px] font-medium uppercase tracking-wide text-foreground-subtle`,children:e}),t]})}function pn({node:e,actions:t}){return I(`div`,{className:`rounded-xl border border-border bg-background p-4 space-y-4 ${e.isOnline?``:`opacity-60`}`,children:[V(un,{node:e,emphasis:!0}),V(`div`,{className:`grid grid-cols-2 gap-2`,children:Zt.map(n=>V(ln,{capability:n.key,label:n.label,hint:n.hint,nodeId:e.id,active:on(e.effective,n.key),pending:t.capabilityPending,layout:`card`,onToggle:(n,r)=>t.onToggleCapability(e.id,n,r)},n.key))}),V(`div`,{className:`space-y-3 border-t border-border pt-3`,children:V(fn,{label:`Reachable host`,children:V(dn,{nodeId:e.id,value:e.reachableHost,detectedHosts:e.detectedHosts,status:t.reachableHostStatus(e.id),errorMessage:t.reachableHostErrorMessage(e.id),onCommit:t.onCommitReachableHost})})})]})}function mn(){return I(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[10px] text-foreground-subtle`,children:[I(`span`,{className:`inline-flex items-center gap-1.5`,children:[V(`span`,{className:`h-2.5 w-2.5 rounded-full border border-success/30 bg-success/15`}),`Active capability`]}),I(`span`,{className:`inline-flex items-center gap-1.5`,children:[V(`span`,{className:`h-2.5 w-2.5 rounded-full border border-border bg-surface-hover`}),`Idle`]}),I(`span`,{className:`inline-flex items-center gap-1.5`,children:[V(`span`,{className:`h-2 w-2 rounded-full bg-success`}),`Node online`]}),I(`span`,{className:`inline-flex items-center gap-1.5`,children:[V(`span`,{className:`h-2 w-2 rounded-full bg-danger`}),`Node offline`]})]})}function hn({nodes:e,actions:t}){return V(`div`,{className:`overflow-x-auto rounded-lg border border-border`,children:I(`table`,{className:`w-full min-w-[720px] border-collapse text-sm`,children:[V(`thead`,{children:I(`tr`,{className:`border-b border-border bg-background text-[10px] uppercase tracking-wider text-foreground-subtle`,children:[V(`th`,{className:`px-4 py-3 text-left font-semibold`,children:`Node`}),Zt.map(e=>V(`th`,{className:`px-3 py-3 text-center font-semibold`,children:e.label},e.key)),V(`th`,{className:`px-4 py-3 text-left font-semibold`,children:`Reachable host`})]})}),V(`tbody`,{children:e.map(e=>I(`tr`,{className:`border-b border-border last:border-b-0 transition-colors hover:bg-surface-hover/40 ${e.isOnline?``:`opacity-60`}`,children:[V(`td`,{className:`px-4 py-3 align-middle`,children:V(un,{node:e})}),Zt.map(n=>V(`td`,{className:`px-3 py-3 text-center align-middle`,children:V(ln,{capability:n.key,label:n.label,hint:n.hint,nodeId:e.id,active:on(e.effective,n.key),pending:t.capabilityPending,layout:`cell`,onToggle:(n,r)=>t.onToggleCapability(e.id,n,r)})},n.key)),V(`td`,{className:`px-4 py-3 align-middle`,children:V(dn,{nodeId:e.id,value:e.reachableHost,detectedHosts:e.detectedHosts,status:t.reachableHostStatus(e.id),errorMessage:t.reachableHostErrorMessage(e.id),onCommit:t.onCommitReachableHost})})]},e.id))})]})})}function gn({role:e,value:t,options:n,pending:r,onChange:i}){return I(`label`,{className:`flex flex-col gap-1.5 rounded-lg border border-border bg-background p-3`,children:[V(`span`,{className:`text-xs font-semibold text-foreground`,children:rn(e)}),V(`select`,{value:t,disabled:r,onChange:t=>i(e,t.target.value),className:`rounded-md border border-border bg-surface px-2.5 py-1.5 text-sm text-foreground focus:border-primary focus:outline-none disabled:opacity-50`,children:n.map(e=>V(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),V(`span`,{className:`text-[10px] leading-tight text-foreground-subtle`,children:an(e)})]})}function _n({roleValues:e,options:t,pending:n,lowFpsEnabled:r,fpsMinThreshold:i,onRoleChange:a,onLowFpsToggle:o}){return I(`div`,{className:`grid gap-3 @lg/clustertab:grid-cols-2 @3xl/clustertab:grid-cols-4`,children:[Xt.map(r=>V(gn,{role:r,value:e[r],options:t,pending:n,onChange:a},r)),I(`label`,{className:`flex items-start gap-2.5 rounded-lg border border-border bg-background p-3 text-sm text-foreground`,children:[V(`input`,{type:`checkbox`,checked:r,disabled:n,onChange:e=>o(e.target.checked),className:`mt-0.5 h-4 w-4 shrink-0 accent-primary`}),I(`span`,{className:`flex flex-col gap-0.5`,children:[V(`span`,{className:`text-xs font-semibold`,children:`Low-fps relocate/shed`}),I(`span`,{className:`text-[10px] leading-tight text-foreground-subtle`,children:[`fpsMinThreshold `,r?`${i} fps`:`disabled`]})]})]})]})}F();function vn(){let e=z(),{nodes:r}=h(),i=ie(void 0),a=P({addonId:qt}),o=P({addonId:Jt}),s=()=>cn(e),c=t({onSuccess:s}),l=ae(),u=n({onSuccess:s}),d=T({onSuccess:s}),[f,p]=B(!1),m=L(()=>{let e=new Map;for(let t of i.data??[])e.set(t.nodeId,t.settings);return e},[i.data]),g=L(()=>r.map(e=>{let t=m.get(e.id),n=it(t,e.isHub),r=tn(t,`detectWeight`);return{id:e.id,name:e.name,isHub:e.isHub,isOnline:e.isOnline,settings:t,effective:n,weight:r??1,maxCameras:tn(t,`maxCameras`),reachableHost:nn(t,`reachableHost`),detectedHosts:e.localIps}}),[r,m]),_=g.filter(e=>e.effective.pipeline),v={ingestNode:J(a.data,`ingestNode`,`hub`),recordingNode:J(o.data,Yt,`hub`),audioNode:J(a.data,`audioNode`,`hub`),motionNode:J(a.data,`motionNode`,`hub`)},y=L(()=>{let e=r.filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,...Xt.map(e=>v[e]),...e])].filter(e=>e.length>0)},[r,v]),b=en(a.data,`fpsMinThreshold`,0),x=b>0,S=i.isLoading||a.isLoading||o.isLoading,C=(e,t,n)=>{c.mutate({agentNodeId:e,[t]:n})},w=(e,t)=>{if(e===`recordingNode`){d.mutate({addonId:Jt,patch:{[Yt]:t}});return}d.mutate({addonId:qt,patch:{[e]:t}})},E=e=>{d.mutate({addonId:qt,patch:{fpsMinThreshold:e?Math.max(1,b):0}})},D=e=>u.variables?.agentNodeId===e?u.isPending?`pending`:u.isError?`error`:u.isSuccess?`success`:`idle`:`idle`,O=e=>D(e)===`error`?sn(u.error):null,k=async e=>{p(!0);try{for(let t of e)await l.mutateAsync({agentNodeId:t.nodeId,detectWeight:t.weight})}finally{p(!1),s()}},A={capabilityPending:c.isPending,onToggleCapability:C,onCommitReachableHost:(e,t)=>u.mutate({agentNodeId:e,reachableHost:t}),reachableHostStatus:D,reachableHostErrorMessage:O};return I(`section`,{className:`rounded-xl border border-border bg-surface p-5 @3xl/clustertab:p-6 space-y-6`,children:[I(`header`,{className:`flex items-start justify-between gap-4`,children:[I(`div`,{className:`space-y-1`,children:[V(`h3`,{className:`text-base font-semibold text-foreground`,children:`Pipeline placement`}),V(`p`,{className:`max-w-prose text-xs leading-relaxed text-foreground-subtle`,children:`Toggle which node runs each pipeline capability, distribute detection weight across detect-capable nodes, and choose the singleton cluster roles.`})]}),S&&V(U,{className:`h-5 w-5 shrink-0 animate-spin text-foreground-subtle`,"aria-label":`Loading`})]}),I(`div`,{className:`space-y-3`,children:[V(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Singleton cluster roles`}),V(_n,{roleValues:v,options:y,pending:d.isPending,lowFpsEnabled:x,fpsMinThreshold:b,onRoleChange:w,onLowFpsToggle:E})]}),I(`div`,{className:`space-y-3`,children:[I(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[V(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Per-node capabilities`}),V(mn,{})]}),g.length===0?V(`p`,{className:`rounded-lg border border-dashed border-border bg-background px-4 py-6 text-center text-xs text-foreground-subtle`,children:`No cluster nodes reporting yet.`}):I(R,{children:[V(`div`,{className:`grid gap-4 @xl/clustertab:grid-cols-2 @3xl/clustertab:hidden`,children:g.map(e=>V(pn,{node:e,actions:A},e.id))}),V(`div`,{className:`hidden @3xl/clustertab:block`,children:V(hn,{nodes:g,actions:A})})]})]}),I(`div`,{className:`space-y-3`,children:[V(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Detection weight`}),V(_e,{nodes:_,pending:f,onCommitWeights:e=>void k(e)})]}),I(`div`,{className:`space-y-3`,children:[V(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Inference devices`}),_.length===0?V(`p`,{className:`rounded-lg border border-dashed border-border bg-background px-4 py-6 text-center text-xs text-foreground-subtle`,children:`No detect-capable nodes — enable detection on a node above to configure its accelerators.`}):V(`div`,{className:`space-y-2`,children:_.map(e=>V(ye,{nodeId:e.id,nodeName:e.name,isOnline:e.isOnline},e.id))})]})]})}F();var yn=!1;function bn({refreshToken:e}){let t=z(),{data:n}=g(void 0);L(()=>qe(n??[]),[n]);let r=x({onSuccess:()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]})}});return I(`div`,{className:`space-y-6`,children:[V(zt,{title:`Cluster cameras`}),V(ct,{refreshToken:e}),V(vn,{}),yn,I(`div`,{className:`flex flex-col gap-3 @md/clustertab:flex-row @md/clustertab:items-center @md/clustertab:justify-between`,children:[I(`div`,{className:`min-w-0`,children:[V(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Placement matrix`}),V(`p`,{className:`text-[11px] text-foreground-subtle`,children:`Pipeline · audio assignments per camera (decode always runs co-located with the pipeline). Click the kebab to pin / unpin / move a role; expand the chevron for the per-camera broker drill-down.`})]}),I(`button`,{type:`button`,onClick:()=>r.mutate(void 0),disabled:r.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:[V(we,{className:`h-3.5 w-3.5`}),r.isPending?`Rebalancing…`:`Rebalance pipelines`]})]}),V(pt,{mode:`cluster`})]})}var xn=[`pipeline-orchestrator`];function Sn({refreshToken:e}){return V(`div`,{className:`space-y-4 max-w-3xl`,children:V(Ye,{nodeId:`hub`,addonIds:xn,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.`})})}F();function Cn({refreshToken:e}){let t=z(),{data:n,isLoading:r}=se(),[i,a]=B(null),[o,s]=B(``),[c,u]=B(``),d=()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`listTemplates`]]})},f=l({onSuccess:()=>{a(null),d()}}),p=ne({onSuccess:d}),m=e=>{a(e.id),s(e.name),u(e.description??``)},h=()=>{a(null),s(``),u(``)},g=()=>{if(!i)return;let e=c.trim();f.mutate({id:i,name:o.trim()||`Untitled`,...e?{description:e}:{}})};if(r)return V(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading templates…`});let _=[...n??[]].toSorted((e,t)=>e.name.localeCompare(t.name));return V(`div`,{className:`space-y-6 max-w-4xl`,children:I(`section`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[I(`div`,{className:`border-b border-border px-4 py-3 flex items-center justify-between`,children:[I(`div`,{children:[V(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Templates`}),V(`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.`})]}),I(`div`,{className:`text-[11px] text-foreground-subtle`,children:[_.length,` template`,_.length===1?``:`s`]})]}),_.length===0?I(`div`,{className:`px-4 py-8 text-xs text-foreground-subtle flex flex-col items-center gap-2`,children:[V(Ee,{className:`h-6 w-6 opacity-40`}),V(`div`,{children:`No templates yet. Create one from a device Pipeline tab ("Save as template").`})]}):V(`ul`,{className:`divide-y divide-border`,children:_.map(e=>{let t=i===e.id;return V(`li`,{className:`px-4 py-3 text-xs`,children:I(`div`,{className:`flex items-start gap-3`,children:[V(`div`,{className:`flex-1 min-w-0`,children:t?I(`div`,{className:`space-y-2`,children:[V(`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}),V(`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=>u(e.target.value),placeholder:`Description (optional)`})]}):I(R,{children:[V(`div`,{className:`font-medium text-foreground`,children:e.name}),e.description&&V(`div`,{className:`text-foreground-subtle mt-0.5`,children:e.description}),I(`div`,{className:`mt-1 font-mono text-[10px] text-foreground-subtle`,children:[e.config.steps.length,` step(s)`,e.config.audio?.enabled?` · audio`:``,I(`span`,{className:`ml-2`,children:[`updated `,new Date(e.updatedAt).toLocaleString()]})]})]})}),V(`div`,{className:`flex items-center gap-1 shrink-0`,children:t?I(R,{children:[I(`button`,{type:`button`,onClick:g,disabled:f.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:[V(Ie,{className:`h-3 w-3`}),`Save`]}),I(`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:[V(He,{className:`h-3 w-3`}),`Cancel`]})]}):I(R,{children:[V(`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:V(Te,{className:`h-3 w-3`})}),V(`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:V(We,{className:`h-3 w-3`})})]})})]})},e.id)})})]})})}F();var wn=`pipeline-analytics`;function Tn(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 En(){let e=z(),{data:t}=g(void 0),{data:n,isLoading:r}=P({addonId:wn}),i=Tn(n),a=T({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),o=L(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,i,...e])].filter(Boolean)},[t,i]);return I(`div`,{className:`flex flex-col gap-6`,children:[I(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[V(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Post-processing node`}),V(`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.`}),I(`div`,{className:`mt-3 flex items-center gap-2`,children:[r?V(U,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):V(`select`,{value:i,onChange:e=>{e.target.value!==i&&a.mutate({addonId:wn,patch:{postProcessingNodeId:e.target.value}})},disabled:a.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:o.map(e=>V(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),a.isPending&&V(U,{className:`h-4 w-4 animate-spin text-primary`})]})]}),I(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[V(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Events folder`}),V(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where event crops / full frames are stored. A single folder — no collection / equal-splitting.`}),V(Xe,{types:[`eventMedia`]})]})]})}var Dn=`pipeline-orchestrator`,On=200;function kn(){return I(`div`,{className:`flex flex-col gap-3`,children:[I(`div`,{children:[V(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Orchestrator logs`}),V(`p`,{className:`text-[11px] text-foreground-subtle`,children:`Dispatch decisions, balancer moves and failover events from the pipeline orchestrator. Streaming live; the device chip on a line tells which camera it refers to.`})]}),V(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:V(E,{addonId:Dn,limit:On,maxHeight:`max-h-[calc(100vh-360px)]`,showScope:!0,showDeviceChip:!0,showFilters:!1})})]})}F();var An=[{id:`assignments`,label:`Assignments`},{id:`events`,label:`Events`},{id:`recording`,label:`Recording`},{id:`settings`,label:`Settings`},{id:`templates`,label:`Templates`},{id:`logs`,label:`Logs`}];function jn({refreshToken:e}){let[t,n]=B(`assignments`);return I(`div`,{className:`flex flex-col h-full`,children:[I(`div`,{className:`px-4 sm:px-6 py-4 border-b border-border`,children:[V(`h2`,{className:`text-base font-semibold text-foreground`,children:`Cluster Orchestration`}),V(`div`,{className:`text-[11px] text-foreground-subtle mt-1`,children:`Assignments with live load, cluster-wide settings, pipeline template library, per-camera pipeline overrides.`})]}),V(`div`,{className:`flex items-center gap-1 px-4 sm:px-6 border-b border-border overflow-x-auto`,children:An.map(e=>V(`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))}),I(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4 sm:p-6 @container/clustertab`,children:[t===`assignments`&&V(bn,{refreshToken:e}),t===`events`&&V(En,{}),t===`recording`&&V(Ze,{}),t===`settings`&&V(Sn,{refreshToken:e}),t===`templates`&&V(Cn,{refreshToken:e}),t===`logs`&&V(kn,{})]})]})}function Mn(e){let t=[],n=[],{assignment:r,detection:i,decoder:a,broker:o}=e;i!==null&&i.provisioning.state===`failed`&&t.push({code:`provisioning-failed`,severity:`error`,message:i.provisioning.error!==void 0&&i.provisioning.error.length>0?`Engine provisioning failed: ${i.provisioning.error}`:`Engine provisioning failed on the detection node`}),i!==null&&i.phase===`active`&&i.actualFps===0&&t.push({code:`detection-black-hole`,severity:`error`,message:`Detection phase is ACTIVE but 0 fps are being processed — frames are not reaching the detector (cross-node black-hole signature)`}),i!==null&&i.phase===`active`&&a!==null&&a.shm.framesWritten===0&&t.push({code:`decoder-black-hole`,severity:`error`,message:`Decoder on ${a.nodeId} has written 0 frames to the shared-memory plane while detection is active — the decode path is stalled`}),r.detectionNodeId===null&&i===null&&n.push({code:`unassigned`,severity:`warning`,message:`Not placed on any detection node — no pipeline is running for this camera`});for(let e of o?.profiles??[])e.status===`streaming`&&e.inFps===0&&n.push({code:`broker-stalled`,severity:`warning`,message:`Broker profile "${e.profile}" reports streaming but 0 in-fps — the source pull may be stalled`});return[...t,...n]}function Nn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Y(e){return typeof e==`string`&&e.length>0?e:null}function Pn(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Fn(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function In(e,t){return e==null?!1:JSON.stringify(e)!==JSON.stringify(t??null)}var Ln={detectionMode:null,detectionStreamProfile:null,detectionFps:null,motionSources:[],motionFps:null,motionCooldownMs:null,motionStreamProfile:null,audioMode:null,pipelineNodeId:null,decoderNodeId:null,audioNodeId:null,overriddenKeys:new Set};function Rn(e){if(!Nn(e)||!Array.isArray(e.sections))return Ln;let t=fe(e),n=e=>{let n=t.get(e);if(n!==void 0)return n.value??n.default},r=new Set;for(let[e,n]of t)In(n.value,n.default)&&r.add(e);return{detectionMode:Y(n(`detectionMode`)),detectionStreamProfile:Y(n(`detectionStreamProfile`)),detectionFps:Pn(n(`detectionFps`)),motionSources:Fn(n(`motionSources`)),motionFps:Pn(n(`motionFps`)),motionCooldownMs:Pn(n(`motionCooldownMs`)),motionStreamProfile:Y(n(`motionStreamProfile`)),audioMode:Y(n(`audioMode`)),pipelineNodeId:Y(n(`pipelineNodeId`)),decoderNodeId:Y(n(`decoderNodeId`)),audioNodeId:Y(n(`audioNodeId`)),overriddenKeys:r}}function zn(e,t=0){let n=[];for(let r of e)n.push({addonId:r.addonId,modelId:r.modelId??null,enabled:r.enabled,depth:t}),r.children!==void 0&&r.children.length>0&&n.push(...zn(r.children,t+1));return n}function Bn(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`}function X({title:e,children:t}){return I(`div`,{className:`bg-background px-3.5 py-3 min-w-0`,children:[V(`div`,{className:`text-[9px] font-semibold uppercase tracking-[0.14em] text-foreground-subtle mb-2`,children:e}),V(`div`,{className:`flex flex-col gap-1 min-w-0`,children:t})]})}function Z({label:e,children:t,overridden:n=!1}){return I(`div`,{className:`flex items-baseline gap-2 text-[11px] leading-snug min-w-0`,children:[V(`span`,{className:`text-foreground-subtle shrink-0 w-24 truncate`,title:e,children:e}),V(`span`,{className:`font-mono tabular-nums text-foreground min-w-0 truncate flex-1`,children:t}),n&&V(Vn,{})]})}function Vn(){return V(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-warning shrink-0 self-center`,title:`Device-level override active`,"aria-label":`Device-level override active`,role:`img`})}var Hn={neutral:`border-border text-foreground-muted`,success:`border-success/40 text-success`,warning:`border-warning/40 text-warning`,danger:`border-danger/40 text-danger`,info:`border-info/40 text-info`};function Q({tone:e=`neutral`,children:t,title:n}){return V(`span`,{title:n,className:`inline-flex items-center gap-1 rounded border px-1.5 py-px text-[10px] font-medium leading-tight whitespace-nowrap ${Hn[e]}`,children:t})}function $({children:e}){return V(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:e})}function Un({icon:e,label:t,nodeId:n,pinned:r,reason:i,overridden:a}){return I(`div`,{className:`flex items-center gap-2 text-[11px] leading-snug min-w-0`,children:[V(e,{className:`h-3 w-3 text-foreground-subtle shrink-0`}),V(`span`,{className:`text-foreground-subtle w-[4.5rem] shrink-0`,children:t}),n===null?V(`span`,{className:`text-foreground-subtle italic`,children:`unassigned`}):I(R,{children:[V(`span`,{className:`font-mono text-foreground truncate`,title:n,children:n}),r?I(`span`,{className:`inline-flex items-center gap-0.5 text-[10px] text-warning shrink-0`,title:`Manually pinned`,children:[V(et,{className:`h-2.5 w-2.5`}),` manual`]}):I(`span`,{className:`text-[10px] text-foreground-subtle shrink-0 truncate`,children:[`auto · `,i!==void 0&&i.length>0?i:`capacity`]}),a&&V(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-warning shrink-0`,title:`Persisted settings pin for this role`})]})]})}function Wn({assignment:e,settings:t,onlineNodes:n,pinPending:r,onDetectionPinChange:i}){let a=e.pinned.detection&&e.detectionNodeId!==null?e.detectionNodeId:`auto`,o=[...new Set([...e.detectionNodeId===null?[]:[e.detectionNodeId],...n.map(e=>e.id)])];return I(X,{title:`Where it runs`,children:[V(Un,{icon:W,label:`Detection`,nodeId:e.detectionNodeId,pinned:e.pinned.detection,reason:e.reasons.detection,overridden:t.overriddenKeys.has(`pipelineNodeId`)}),V(Un,{icon:Ne,label:`Decoder`,nodeId:e.decoderNodeId,pinned:e.pinned.decoder,reason:e.reasons.decoder,overridden:t.overriddenKeys.has(`decoderNodeId`)}),V(Un,{icon:Ce,label:`Audio`,nodeId:e.audioNodeId,pinned:e.pinned.audio,reason:e.reasons.audio,overridden:t.overriddenKeys.has(`audioNodeId`)}),V(Un,{icon:De,label:`Source`,nodeId:e.sourceNodeId,pinned:!1,reason:`ingest owner`,overridden:!1}),V(`div`,{className:`mt-1.5`,children:I(`select`,{value:a,disabled:r,"aria-label":`Detection placement pin`,onChange:e=>i(e.target.value),className:`w-full min-w-0 rounded-md border border-border bg-background px-2 py-1 text-[11px] text-foreground disabled:opacity-50`,children:[V(`option`,{value:`auto`,children:`Auto (load balanced)`}),o.map(e=>I(`option`,{value:e,children:[`Pin detection → `,n.find(t=>t.id===e)?.name??e]},e))]})})]})}function Gn(e){return`${e.width}×${e.height} ${e.codec} @${e.fps}fps`}function Kn(e,t){if(!(t===null||e===void 0))return e.find(e=>e.profile===t)}function qn(e){return e===null?`default`:e===0?`native (no throttle)`:`${e} fps`}function Jn({streams:e,brokerProfiles:t,settings:n,motionEnabled:r,motionFpsLive:i}){let a=Kn(t,n.detectionStreamProfile),o=Kn(t,n.motionStreamProfile),s=n.motionSources.includes(`analyzer`);return I(X,{title:`Streams & motion`,children:[I(Z,{label:`Detect stream`,overridden:n.overriddenKeys.has(`detectionStreamProfile`),children:[n.detectionStreamProfile??`—`,a!==void 0&&` · ${a.width}×${a.height} ${a.codec}`]}),V(Z,{label:`Detect FPS`,overridden:n.overriddenKeys.has(`detectionFps`),children:qn(n.detectionFps)}),I(Z,{label:`Motion src`,overridden:n.overriddenKeys.has(`motionSources`),children:[n.motionSources.length>0?n.motionSources.join(` + `):`none`,r===!1&&` · inactive`]}),s&&I(R,{children:[I(Z,{label:`Motion stream`,overridden:n.overriddenKeys.has(`motionStreamProfile`),children:[n.motionStreamProfile??`—`,o!==void 0&&` · ${o.width}×${o.height} ${o.codec}`]}),I(Z,{label:`Motion FPS`,overridden:n.overriddenKeys.has(`motionFps`),children:[qn(n.motionFps),i!==null&&` · live ${i.toFixed(1)}`]})]}),V(Z,{label:`Cooldown`,overridden:n.overriddenKeys.has(`motionCooldownMs`),children:n.motionCooldownMs===null?`default`:`${n.motionCooldownMs/1e3}s`}),V(`div`,{className:`mt-1.5 flex flex-col gap-0.5`,children:e.length===0?V($,{children:`No streams registered`}):e.map(e=>I(`div`,{className:`text-[10px] font-mono text-foreground-subtle truncate`,title:e.camStreamId,children:[V(`span`,{className:`text-foreground-muted`,children:e.kind}),` `,Gn(e)]},e.camStreamId))})]})}function Yn({steps:e,audioModelId:t,audioEnabled:n,audioMode:r}){return I(X,{title:`Pipeline steps`,children:[e===void 0?V($,{children:`Resolving…`}):e.length===0?V($,{children:`No steps configured`}):V(`div`,{className:`flex flex-wrap gap-1`,children:e.map((e,t)=>V(Q,{tone:e.enabled&&e.depth===0?`info`:`neutral`,title:e.modelId??e.addonId,children:I(`span`,{className:e.enabled?``:`line-through opacity-60`,children:[e.depth>0&&V(`span`,{className:`opacity-50`,children:`↳ `}),e.addonId,e.modelId!==null&&I(`span`,{className:`font-mono opacity-75`,children:[` · `,e.modelId]})]})},`${e.addonId}-${t}`))}),V(`div`,{className:`mt-1`,children:I(Z,{label:`Audio class.`,children:[r??`—`,n!==null&&(n?` · running`:` · off`),t!==null&&` · ${t}`]})})]})}var Xn={ready:`success`,installing:`info`,verifying:`info`,idle:`neutral`,failed:`danger`};function Zn({detection:e,live:t,detectionMode:n,modeOverridden:r}){if(e===null)return I(X,{title:`Detection runtime`,children:[V(Z,{label:`Mode`,overridden:r,children:n??`—`}),V($,{children:`Detection stage inactive or unreachable`})]});let i=t?.phase??e.phase,a=t?.actualFps??e.actualFps,o=t?.configuredFps??e.configuredFps,s=t?.avgInferenceTimeMs??e.avgInferenceMs,c=t?.queueDepth??e.queueDepth,l=p(i),u=i===`active`&&a===0;return I(X,{title:`Detection runtime`,children:[I(`div`,{className:`flex items-center gap-1.5 mb-0.5`,children:[I(`span`,{className:`inline-flex items-center gap-1 rounded border px-1.5 py-px text-[10px] font-semibold uppercase tracking-wider ${l.badgeClass}`,children:[V(v,{phase:i,className:`h-2.5 w-2.5`}),l.label]}),t!==void 0&&V(`span`,{className:`text-[9px] text-foreground-subtle uppercase tracking-wider`,children:`live`})]}),V(Z,{label:`Mode`,overridden:r,children:n??`—`}),I(Z,{label:`FPS`,children:[V(`span`,{className:u?`text-danger font-semibold`:``,children:a.toFixed(1)}),I(`span`,{className:`text-foreground-subtle`,children:[` / `,o.toFixed(0),` configured`]})]}),I(Z,{label:`Inference`,children:[s.toFixed(0),` ms`,c>0&&I(`span`,{className:`text-warning`,children:[` · queue `,c]}),t!==void 0&&t.droppedFrames>0&&I(`span`,{className:`text-warning`,children:[` · drops `,t.droppedFrames]})]}),I(Z,{label:`Engine`,children:[e.engine.backend,` · `,e.engine.device]}),I(Z,{label:`Provisioning`,children:[V(Q,{tone:Xn[e.provisioning.state]??`neutral`,children:e.provisioning.state}),e.provisioning.error!==void 0&&I(`span`,{className:`text-danger text-[10px]`,children:[` `,e.provisioning.error]})]})]})}function Qn({broker:e}){return e===null?V(X,{title:`Stream broker`,children:V($,{children:`Broker stage inactive or unreachable`})}):I(X,{title:`Stream broker`,children:[e.profiles.length===0?V($,{children:`No broker profiles`}):V(`div`,{className:`flex flex-col gap-1`,children:e.profiles.map(e=>{let t=e.status===`streaming`,n=t&&e.inFps===0;return I(`div`,{className:`flex items-center gap-2 text-[11px] font-mono tabular-nums min-w-0`,children:[V(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full shrink-0 ${n?`bg-danger`:t?`bg-success animate-pulse`:`bg-border`}`,title:e.status}),V(`span`,{className:`text-foreground w-10 shrink-0 truncate`,title:e.profile,children:e.profile}),I(`span`,{className:`text-foreground-subtle truncate`,children:[e.width,`×`,e.height,` `,e.codec]}),I(`span`,{className:`ml-auto shrink-0 ${n?`text-danger`:`text-foreground`}`,children:[e.inFps.toFixed(0),`→`,e.outFps.toFixed(0),`fps`]}),I(`span`,{className:`text-foreground-subtle shrink-0`,title:`Subscribers`,children:[`×`,e.subscribers]})]},e.profile)})}),I(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:[I(Q,{tone:e.webrtcSessions>0?`info`:`neutral`,children:[`WebRTC `,e.webrtcSessions]}),I(Q,{tone:e.rtspRestream?`success`:`neutral`,children:[`restream `,e.rtspRestream?`on`:`off`]})]})]})}function $n({decoder:e,detectionActive:t}){if(e===null)return V(X,{title:`Decoder`,children:V($,{children:`Decoder stage inactive or unreachable`})});let n=t&&e.shm.framesWritten===0;return I(X,{title:`Decoder`,children:[V(Z,{label:`Node`,children:e.nodeId}),V(Z,{label:`Sessions`,children:e.sessionCount}),I(Z,{label:`SHM frames`,children:[V(`span`,{className:n?`text-danger font-semibold`:``,children:e.shm.framesWritten}),V(`span`,{className:`text-foreground-subtle`,children:` written`})]}),I(Z,{label:`SHM reads`,children:[e.shm.getFrameHits,` hits`,e.shm.getFrameMisses>0&&I(`span`,{className:`text-warning`,children:[` · `,e.shm.getFrameMisses,` misses`]})]}),I(Z,{label:`SHM budget`,children:[e.shm.budgetMb,` MB`]}),e.formats.length>0&&V(Z,{label:`Formats`,children:e.formats.join(`, `)})]})}F();var er=`pipeline-orchestrator`,tr={healthy:`bg-success`,idle:`bg-warning`,error:`bg-danger`},nr={healthy:`Healthy`,idle:`Idle`,error:`Error`};function rr({problems:e}){return V(`div`,{role:`alert`,className:`flex flex-col border-b border-border`,children:e.map(e=>I(`div`,{className:`flex items-start gap-2 px-4 py-1.5 text-[11px] font-medium ${e.severity===`error`?`bg-danger/10 text-danger`:`bg-warning/10 text-warning`}`,children:[V(Ue,{className:`h-3.5 w-3.5 shrink-0 mt-px`}),V(`span`,{className:`min-w-0`,children:e.message})]},e.code))})}function ir({deviceId:e,name:t,online:n,status:r,live:i,onlineNodes:a}){let o=z(),{data:s}=j({addonId:er,deviceId:e,nodeId:`hub`},{staleTime:3e4}),{data:l}=d({deviceId:e},{staleTime:3e4}),u=L(()=>Rn(s),[s]),f=L(()=>l===void 0?void 0:zn(l.steps),[l]),p=L(()=>r===void 0?[]:Mn(r),[r]),m=()=>{o.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getCameraStatuses`]]}),o.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]})},h=ee({onSuccess:m}),g=c({onSuccess:m}),_=t=>{t===`auto`?g.mutate({deviceId:e}):h.mutate({deviceId:e,agentNodeId:t})},v=r===void 0?`idle`:Bn(r),y=p.some(e=>e.severity===`error`),b=p.length>0,x=y?`border-danger/50`:b?`border-warning/40`:`border-border`;return I(`article`,{"aria-label":`${t} pipeline status`,className:`rounded-lg border ${x} bg-background overflow-hidden`,children:[I(`header`,{className:`flex items-center gap-2.5 px-4 py-2.5 border-b border-border bg-surface/50 min-w-0`,children:[V(`span`,{className:`inline-block h-2 w-2 rounded-full shrink-0 ${y?`bg-danger`:tr[v]}`,title:y?`Error`:nr[v],"aria-label":y?`Error`:nr[v],role:`img`}),V(`h3`,{className:`text-[13px] font-semibold text-foreground truncate`,title:t,children:t}),I(`span`,{className:`text-[10px] text-foreground-subtle shrink-0`,children:[`#`,e]}),!n&&V(Q,{tone:`danger`,children:`offline`}),I(`span`,{className:`ml-auto flex items-center gap-1.5 shrink-0`,children:[u.detectionMode!==null&&V(Q,{tone:u.detectionMode===`disabled`?`warning`:u.detectionMode===`always-on`?`info`:`neutral`,title:`Object detection mode`,children:u.detectionMode===`disabled`?`detection off`:u.detectionMode}),r?.recording!=null&&(r.recording.active?I(Q,{tone:`danger`,title:`Recording (${r.recording.mode})`,children:[V(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full bg-danger animate-pulse`}),`REC`]}):r.recording.mode!==`off`&&I(Q,{tone:`neutral`,title:`Recording mode`,children:[`rec `,r.recording.mode]}))]})]}),p.length>0&&V(rr,{problems:p}),r===void 0?V(`div`,{className:`px-4 py-5 text-[11px] text-foreground-subtle italic`,children:`No pipeline status yet — the orchestrator has not composed a snapshot for this camera.`}):I(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-px bg-border`,children:[V(Wn,{assignment:r.assignment,settings:u,onlineNodes:a,pinPending:h.isPending||g.isPending,onDetectionPinChange:_}),V(Zn,{detection:r.detection,live:i,detectionMode:u.detectionMode,modeOverridden:u.overriddenKeys.has(`detectionMode`)}),V(Yn,{steps:f,audioModelId:l?.audio?.modelId??null,audioEnabled:r.audio?.enabled??l?.audio?.enabled??null,audioMode:u.audioMode}),V(Jn,{streams:r.source.streams,brokerProfiles:r.broker?.profiles,settings:u,motionEnabled:r.motion?.enabled??null,motionFpsLive:r.motion?.fps??null}),V(Qn,{broker:r.broker}),V($n,{decoder:r.decoder,detectionActive:r.detection?.phase===`active`})]})]})}F();var ar=5e3,or=1e4,sr=5e3;function cr(e){let t=z(),{data:n,isLoading:r}=ge(),{data:i,isLoading:a}=C({},{refetchInterval:ar}),{nodes:o}=h();H(()=>{e!==0&&t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getCameraStatuses`]]})},[e,t]);let[s,c]=B(new Map);_(pe.PipelineCameraMetricsSnapshot,e=>{let t=e.data;typeof t.deviceId==`number`&&c(e=>{let n=new Map(e);return n.set(t.deviceId,{phase:t.metrics.phase,configuredFps:t.metrics.configuredFps,actualFps:t.metrics.actualFps,queueDepth:t.metrics.queueDepth,avgInferenceTimeMs:t.metrics.avgInferenceTimeMs,droppedFrames:t.metrics.droppedFrames,timestamp:t.timestamp}),n})}),H(()=>{if(s.size===0)return;let e=setInterval(()=>{c(e=>{let t=Date.now()-or,n=!1,r=new Map(e);for(let[i,a]of e)a.timestamp<t&&(r.delete(i),n=!0);return n?r:e})},sr);return()=>clearInterval(e)},[s.size]);let l=L(()=>{let e=new Map;for(let t of i??[])e.set(t.deviceId,t);return e},[i]);return{rows:L(()=>(n??[]).filter(e=>e.isCamera).map(e=>({deviceId:e.id,name:e.name,online:e.online,status:l.get(e.id)})).sort((e,t)=>e.name.localeCompare(t.name)),[n,l]),liveMetrics:s,onlineNodes:L(()=>(o??[]).filter(e=>e.isOnline).map(e=>({id:e.id,name:e.name})),[o]),isLoading:r||a}}F();function lr({refreshToken:e}){let{rows:t,liveMetrics:n,onlineNodes:r,isLoading:i}=cr(e),a=L(()=>[...t.map(e=>{let t=e.status===void 0?[]:Mn(e.status);return{row:e,errorCount:t.filter(e=>e.severity===`error`).length,warningCount:t.filter(e=>e.severity===`warning`).length}})].sort((e,t)=>e.errorCount===t.errorCount?e.warningCount===t.warningCount?0:t.warningCount-e.warningCount:t.errorCount-e.errorCount),[t]),o=L(()=>{let e=0,t=0;for(let r of a)(r.errorCount>0||r.warningCount>0)&&(t+=1),(n.get(r.row.deviceId)?.phase??r.row.status?.detection?.phase)===`active`&&(e+=1);return{total:a.length,active:e,issues:t}},[a,n]);return i&&t.length===0?V(`div`,{className:`flex items-center justify-center h-full text-sm text-foreground-subtle`,children:`Loading camera pipelines…`}):t.length===0?V(`div`,{className:`flex items-center justify-center h-full text-sm text-foreground-subtle`,children:`No cameras found`}):V(`div`,{className:`h-full overflow-y-auto`,children:I(`div`,{className:`max-w-6xl mx-auto flex flex-col gap-3 px-4 py-4`,children:[I(`div`,{className:`flex items-center gap-4 text-[11px] text-foreground-subtle px-1`,children:[I(`span`,{children:[V(`span`,{className:`font-semibold text-foreground`,children:o.total}),` cameras`]}),I(`span`,{children:[V(`span`,{className:`font-semibold text-success`,children:o.active}),` actively inferring`]}),I(`span`,{children:[V(`span`,{className:`font-semibold ${o.issues>0?`text-danger`:`text-foreground`}`,children:o.issues}),` `,`with issues`]}),V(`span`,{className:`ml-auto hidden sm:inline text-[10px]`,children:`polled every 5 s · detection metrics live at 1 Hz`})]}),a.map(({row:e})=>V(ir,{deviceId:e.deviceId,name:e.name,online:e.online,status:e.status,live:n.get(e.deviceId),onlineNodes:r},e.deviceId))]})})}F();var ur=`__cluster__`;function dr(e){return e===`cameras`?`cameras`:`nodes`}function fr(){let[e,t]=Fe(),n=dr(e.get(`view`)),r=e.get(`node`)??`__cluster__`,[i,a]=B(0),[o,s]=B(!1);return H(()=>{n===`nodes`&&!e.get(`node`)&&t({view:`nodes`,node:ur},{replace:!0})},[n,e,t]),I(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[I(`div`,{className:`flex items-center justify-between gap-4 px-4 py-3 border-b border-border shrink-0`,children:[I(`div`,{className:`flex items-center gap-1 rounded-lg border border-border p-0.5 bg-surface`,children:[V(`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`}),V(`button`,{type:`button`,onClick:()=>{t({view:`cameras`},{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`})]}),I(`button`,{type:`button`,onClick:()=>a(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:[V(Oe,{className:`h-3.5 w-3.5`}),`Refresh`]})]}),n===`nodes`&&I(`button`,{type:`button`,onClick:()=>s(e=>!e),"aria-expanded":o,className:`md:hidden flex items-center justify-between gap-2 px-4 py-2 border-b border-border shrink-0 text-[11px] font-medium text-foreground-subtle hover:text-foreground transition-colors`,children:[I(`span`,{children:[o?`Hide`:`Show`,` node list`]}),V(Pe,{className:[`h-4 w-4 transition-transform`,o?`rotate-180`:``].join(` `)})]}),V(`div`,{className:`flex-1 flex flex-col md:flex-row overflow-hidden min-h-0`,children:n===`nodes`?I(R,{children:[V(`aside`,{className:[o?`block`:`hidden`,`md:block w-full md:w-72 shrink-0 border-b md:border-b-0 md:border-r border-border`,`max-h-[60vh] md:max-h-none overflow-y-auto`].join(` `),children:V(ot,{selectedNodeId:r,onSelect:e=>{t({view:`nodes`,node:e},{replace:!0}),s(!1)},refreshToken:i})}),V(`section`,{className:`flex-1 min-h-0 overflow-hidden`,children:r===`__cluster__`?V(jn,{refreshToken:i}):V(Kt,{nodeId:r,refreshToken:i})})]}):V(`section`,{className:`flex-1 min-h-0 overflow-hidden`,children:V(lr,{refreshToken:i})})})]})}export{fr as PipelinePage};
@@ -1 +0,0 @@
1
- import{W as e}from"./index-Cjto-EXm.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{W as e}from"./index-Cjto-EXm.js";var t=e(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]);export{t};
@@ -1 +0,0 @@
1
- import{W as e}from"./index-Cjto-EXm.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_-zgU2Aw4J.js";export{t as get,e as init};
@@ -1 +0,0 @@
1
- import{W as e}from"./index-Cjto-EXm.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{W as e}from"./index-Cjto-EXm.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{W as e}from"./index-Cjto-EXm.js";var t=e(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]);export{t};