@camstack/addon-admin-ui 1.1.36 → 1.1.38

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 (71) hide show
  1. package/dist/assets/{AddLocationWizard-fU39g28j.js → AddLocationWizard-6UQCTSu4.js} +1 -1
  2. package/dist/assets/{AddonCollectionPage-2R4sBcnH.js → AddonCollectionPage-C7y1Xqv4.js} +1 -1
  3. package/dist/assets/{Addons-OPXB9gcH.js → Addons-BMHA1UvX.js} +1 -1
  4. package/dist/assets/{AdminTabs-DZ8fjA_E.js → AdminTabs-Bn5jDw8C.js} +1 -1
  5. package/dist/assets/{BrokerForm-DxBh4Ab_.js → BrokerForm-E7__Uhl9.js} +1 -1
  6. package/dist/assets/{Capabilities-BowvKc7g.js → Capabilities-DWu3W2I3.js} +1 -1
  7. package/dist/assets/{CapabilityBadges-Cb2taM1G.js → CapabilityBadges-D4uPGt_S.js} +1 -1
  8. package/dist/assets/{Cluster-Dvu3Qmr3.js → Cluster-dHKbt5S3.js} +1 -1
  9. package/dist/assets/{Dashboard-DwJvs0Hh.js → Dashboard-DRARX0g8.js} +1 -1
  10. package/dist/assets/{Data-zUHS7p4f.js → Data-Cgi4uVIl.js} +1 -1
  11. package/dist/assets/{DetectionIntelligence-BneZGPL8.js → DetectionIntelligence-B-VvnmfI.js} +1 -1
  12. package/dist/assets/DeviceDetail-DiuVtjgW.js +2 -0
  13. package/dist/assets/{Devices-BPv3cLJV.js → Devices-BFoz2HIh.js} +1 -1
  14. package/dist/assets/{EmbedPlayerPage-B-sPclrx.js → EmbedPlayerPage-BY9eFyyg.js} +1 -1
  15. package/dist/assets/{FormBuilder-BHrYFTqO.js → FormBuilder-CJrUV3p4.js} +1 -1
  16. package/dist/assets/{Identity-4N-nfSAK.js → Identity-B0ygozcS.js} +1 -1
  17. package/dist/assets/{IntegrationDetail-CASAMzWi.js → IntegrationDetail-Brj01VUG.js} +1 -1
  18. package/dist/assets/{Integrations-BK8yyBnE.js → Integrations-Bj35Jpxj.js} +1 -1
  19. package/dist/assets/{Integrations-CFNCpTGQ.js → Integrations-DpfC2qld.js} +1 -1
  20. package/dist/assets/{Logs-B1uh5BYK.js → Logs-B2WAadmI.js} +1 -1
  21. package/dist/assets/{MyAccess-Brl1MiDm.js → MyAccess-DXmHi-4Y.js} +1 -1
  22. package/dist/assets/{Network-CcZYSjnr.js → Network-CaKLSIvm.js} +1 -1
  23. package/dist/assets/{NodeAddonsSettingsPanel-DTTq6Ljf.js → NodeAddonsSettingsPanel-DTzycFzS.js} +1 -1
  24. package/dist/assets/{NotificationTargets-Bji4H-RC.js → NotificationTargets-C3VSwqNL.js} +1 -1
  25. package/dist/assets/Pipeline-Cp7B8YFG.js +1 -0
  26. package/dist/assets/{PrivacyMaskSettings-CKAT3JFX.js → PrivacyMaskSettings-temQSWYL.js} +1 -1
  27. package/dist/assets/{ProviderIcon-KQShdlru.js → ProviderIcon-DwFpv01K.js} +1 -1
  28. package/dist/assets/{ScanNetworkModal-mQF_it2k.js → ScanNetworkModal-C6OLnfky.js} +1 -1
  29. package/dist/assets/{Settings-Bq1sSX7Z.js → Settings-BmZ2YcWY.js} +1 -1
  30. package/dist/assets/{Showroom-inuhv53W.js → Showroom-CHFvHOSL.js} +1 -1
  31. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BAi3eQvB.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-xXz7MEuT.js} +1 -1
  32. package/dist/assets/{build-cluster-graph-DlOB4sV_.js → build-cluster-graph-DIgt00ch.js} +1 -1
  33. package/dist/assets/circle-check-big-wzEehng2.js +1 -0
  34. package/dist/assets/{copy-C3o1fFh1.js → copy-CpT57v81.js} +1 -1
  35. package/dist/assets/{download-D2Hdt3_T.js → download-fsWmKUMh.js} +1 -1
  36. package/dist/assets/{hostInit-BKnQjzgs.js → hostInit-sp7Rf71V.js} +1 -1
  37. package/dist/assets/index-CY52lvbZ.js +4 -0
  38. package/dist/assets/{index-DO0772OA.css → index-_8k1nh07.css} +1 -1
  39. package/dist/assets/{key-round-Jz1W_Dm_.js → key-round-0X280kmV.js} +1 -1
  40. package/dist/assets/{mf-entry-bootstrap-0-b853eab9.js → mf-entry-bootstrap-0-2b967ba8.js} +2 -2
  41. package/dist/assets/{pencil-CFG04wDY.js → pencil-BlQGw-pI.js} +1 -1
  42. package/dist/assets/plus-DSiRMRVx.js +1 -0
  43. package/dist/assets/{radio-Bvao3n8m.js → radio-DO0Dq2MF.js} +1 -1
  44. package/dist/assets/{refresh-cw-B3eKxMWT.js → refresh-cw-CMRlnF-M.js} +1 -1
  45. package/dist/assets/remoteEntry-BTav0B7H.js +1 -0
  46. package/dist/assets/{rotate-ccw-g29vnwke.js → rotate-ccw-CaH5zDeG.js} +1 -1
  47. package/dist/assets/rotate-cw-CCcZjC0U.js +1 -0
  48. package/dist/assets/search-CN_ccU_h.js +1 -0
  49. package/dist/assets/{server-BrIBBG6H.js → server-CaW_paWO.js} +1 -1
  50. package/dist/assets/{sparkles-ARuuvyj1.js → sparkles-D1oHkgOm.js} +1 -1
  51. package/dist/assets/square-DWukmPnU.js +1 -0
  52. package/dist/assets/{square-check-big-piMyzaVk.js → square-check-big-D7lGfpqc.js} +1 -1
  53. package/dist/assets/{src-Dp6qXTLR.js → src-BZ1dd5LI.js} +4 -4
  54. package/dist/assets/{upload-CZGhOSU5.js → upload-7zSY3rlx.js} +1 -1
  55. package/dist/assets/{useDevice-D09Wge-X.js → useDevice-BwzYPnLK.js} +1 -1
  56. package/dist/assets/{useEventInvalidation-NEk-4cPL.js → useEventInvalidation-CETyyXeZ.js} +1 -1
  57. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-rJ2O9jZ3.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DkH43QoX.js} +2 -2
  58. package/dist/assets/{wifi-CyY3elJf.js → wifi-BeF9XXWL.js} +1 -1
  59. package/dist/assets/{zap-l_Zh2jBY.js → zap-abOrEOMQ.js} +1 -1
  60. package/dist/index.html +4 -4
  61. package/dist/server/addon.js +1 -1
  62. package/package.json +1 -1
  63. package/dist/assets/DeviceDetail-D55afT28.js +0 -2
  64. package/dist/assets/Pipeline-Bj4liIat.js +0 -1
  65. package/dist/assets/circle-check-big-Bcoiv1yk.js +0 -1
  66. package/dist/assets/index-CpCNvkGK.js +0 -4
  67. package/dist/assets/plus-Bc_u_j_c.js +0 -1
  68. package/dist/assets/remoteEntry-xYIBqMy5.js +0 -1
  69. package/dist/assets/rotate-cw-B3yeEqVR.js +0 -1
  70. package/dist/assets/search-ChyM3D_C.js +0 -1
  71. package/dist/assets/square-BM303wp_.js +0 -1
@@ -1 +1 @@
1
- import{$i as e,Aa as t,Da as n,Ea as r,S as i,Sa as a,Ta as o,ja as s,ka as c,wa as l,xa as u}from"./src-Dp6qXTLR.js";import{Q as d,S as f,W as p,a as m,q as h,t as g,x as _}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{p as v}from"./player-overlays-CpsGl45o.js";import{t as y}from"./circle-check-big-Bcoiv1yk.js";import{t as b}from"./pencil-CFG04wDY.js";import{t as x}from"./plus-Bc_u_j_c.js";import{t as S}from"./search-ChyM3D_C.js";import{R as C,V as w,j as T,s as E,x as D}from"./index-CpCNvkGK.js";import{t as O}from"./AdminPage-BwmGKnRf.js";var k=w(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]);d();var A=e=>typeof e==`string`&&e.length>0;function j(e){return{levels:e.levels,formats:e.format,bodyMaxLen:e.bodyMaxLen,attachmentSlots:e.attachments.mediaTypes,attachmentMode:e.attachments.mode,attachmentMax:e.attachments.max,attachmentMaxBytes:e.attachments.maxBytes,maxActions:e.actions,showActions:e.actions>0,showClickUrl:e.clickUrl,showSound:e.sound,showTtl:e.ttl,showTag:!0}}function M(e,t){return e.format.includes(t)?t:e.format[0]??`text`}function N(e,t){let n=[];for(let r of e.attachments.mediaTypes){if(n.length>=e.attachments.max)break;let i=t[r];A(i)&&n.push({mediaType:r,url:i})}return n}function P(e,t){if(e.actions<=0)return[];let n=[];for(let r of t){if(n.length>=e.actions)break;let t=A(r.label),i=A(r.url);!t&&!i||n.push({id:`test-${n.length+1}`,label:t?r.label:`Action ${n.length+1}`,...i?{url:r.url}:{}})}return n}function F(e,t){let n=e.levels.some(e=>e.id===t.level)?t.level:void 0,r=N(e,t.attachmentUrls),i=P(e,t.actions),a=e.ttl&&A(t.ttl)?Number(t.ttl):void 0;return{body:t.body,format:M(e,t.format),priority:I(t.priority),...A(t.title)?{title:t.title}:{},...n?{level:n}:{},...r.length>0?{attachments:r}:{},...i.length>0?{actions:i}:{},...e.clickUrl&&A(t.clickUrl)?{clickUrl:t.clickUrl}:{},...e.sound&&A(t.sound)?{sound:t.sound}:{},...a!==void 0&&Number.isFinite(a)?{ttl:a}:{},...A(t.tag)?{tag:t.tag}:{}}}function I(e){return Number.isFinite(e)?Math.min(5,Math.max(1,Math.round(e))):3}function L(e){return e.levels.find(e=>e.flags?.critical===!0)||e.levels.filter(e=>typeof e.ordinal==`number`).sort((e,t)=>t.ordinal-e.ordinal)[0]}function R(e){return{level:``,priority:3,format:e.format[0]??`text`,title:``,body:``,attachmentUrls:{},actions:[],clickUrl:``,sound:``,ttl:``,tag:``}}var z={image:`https://example.com/sample.jpg`,video:`https://example.com/sample.mp4`,gif:`https://example.com/sample.gif`,audio:`https://example.com/sample.mp3`,icon:`https://example.com/icon.png`};function B(e,t){let n=R(e);switch(t){case`minimal`:return{...n,body:`Test notification`};case`overflow`:return{...n,body:`X`.repeat(e.bodyMaxLen+50)};case`critical`:{let t=L(e);return{...n,body:`Critical test notification`,priority:5,level:t?.id??``}}case`everything`:{let t={},n=0;for(let r of e.attachments.mediaTypes){if(n>=e.attachments.max)break;t[r]=z[r],n+=1}let r=Array.from({length:e.actions},(e,t)=>({label:`Action ${t+1}`,url:`https://example.com/action/${t+1}`}));return{level:``,priority:4,format:e.format.includes(`markdown`)?`markdown`:e.format.includes(`html`)?`html`:e.format[0]??`text`,title:`Everything the kind supports`,body:`This sample fills every control the kind advertises.`,attachmentUrls:t,actions:r,clickUrl:e.clickUrl?`https://example.com/open`:``,sound:e.sound?`default`:``,ttl:e.ttl?`3600`:``,tag:`camstack-test`}}}}var V=[{id:`minimal`,label:`Minimal (body only)`},{id:`everything`,label:`Everything supported`},{id:`overflow`,label:`Overflow`},{id:`critical`,label:`Critical`}],H=`w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none`,U=`block text-[11px] font-medium text-foreground mb-1`;function W({target:e,kind:n,open:i,onClose:c}){let d=v(),m=p(()=>j(n.caps),[n.caps]),[y,b]=h(()=>R(n.caps)),[x,S]=h(null),C=p(()=>F(n.caps,y),[n.caps,y]),w=y.body.length,T=w>m.bodyMaxLen,E=e=>b(t=>({...t,...e})),O=g({mutationFn:()=>d.trpcClient.notificationOutput.testTarget.mutate({addonId:e.addonId,targetId:e.id,sample:F(n.caps,y)}),onMutate:()=>S(null),onSuccess:e=>S(e),onError:e=>S({success:!1,error:e instanceof Error?e.message:`Test failed`})}),A=e=>{b(B(n.caps,e)),S(null)},M=(e,t,n)=>{let r=y.actions.length>0?[...y.actions]:[];for(;r.length<=e;)r.push({label:``,url:``});r[e]={...r[e],[t]:n},E({actions:r})};return _(u,{open:i,onOpenChange:e=>!e&&c(),children:f(a,{width:`lg`,className:`!max-w-2xl`,children:[_(o,{children:f(r,{children:[`Test "`,e.name,`" (`,n.label,`)`]})}),f(`div`,{className:`space-y-4 max-h-[60vh] overflow-y-auto pr-1`,children:[_(`div`,{className:`flex flex-wrap gap-1.5`,children:V.map(e=>_(s,{size:`sm`,variant:`outline`,type:`button`,onClick:()=>A(e.id),children:e.label},e.id))}),f(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[m.levels.length>0&&f(`div`,{children:[_(`label`,{className:U,children:`Level`}),f(`select`,{className:H,value:y.level,onChange:e=>E({level:e.target.value}),children:[_(`option`,{value:``,children:`— derive from priority —`}),m.levels.map(e=>f(`option`,{value:e.id,children:[e.label,e.ordinal===null?` (qualitative)`:` (p${e.ordinal})`]},e.id))]}),(()=>{let e=m.levels.find(e=>e.id===y.level);return e?f(`div`,{className:`mt-1 space-y-1`,children:[e.description&&_(`p`,{className:`text-[10px] text-foreground-subtle`,children:e.description}),f(`div`,{className:`flex flex-wrap gap-1`,children:[e.flags?.critical&&_(t,{variant:`danger`,"data-testid":`flag-critical`,children:`critical`}),e.flags?.silent&&_(t,{variant:`info`,children:`silent`}),e.flags?.noPush&&_(t,{variant:`warning`,children:`no-push`})]}),e.requires&&e.requires.length>0&&f(`p`,{className:`text-[10px] text-warning`,children:[`Requires target config: `,e.requires.join(`, `)]})]}):null})()]}),f(`div`,{children:[f(`label`,{className:U,children:[`Priority (ordinal): `,y.priority]}),_(`input`,{type:`range`,min:1,max:5,step:1,value:y.priority,onChange:e=>E({priority:Number(e.target.value)}),className:`w-full accent-primary`,"aria-label":`priority`})]})]}),m.formats.length>0&&f(`div`,{children:[_(`label`,{className:U,children:`Format`}),_(`div`,{className:`flex flex-wrap gap-2`,children:m.formats.map(e=>f(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer`,children:[_(`input`,{type:`radio`,name:`format`,className:`accent-primary`,checked:y.format===e,onChange:()=>E({format:e})}),e]},e))})]}),f(`div`,{children:[_(`label`,{className:U,children:`Title`}),_(`input`,{className:H,value:y.title,onChange:e=>E({title:e.target.value})})]}),f(`div`,{children:[f(`label`,{className:U,children:[`Body`,` `,f(`span`,{className:T?`text-danger`:`text-foreground-subtle`,children:[`(`,w,`/`,m.bodyMaxLen,T?` — overflow`:``,`)`]})]}),_(`textarea`,{className:`${H} min-h-[80px] resize-y`,value:y.body,onChange:e=>E({body:e.target.value})})]}),m.attachmentSlots.length>0&&f(`div`,{children:[f(`label`,{className:U,children:[`Attachments`,` `,f(`span`,{className:`text-foreground-subtle`,children:[`(mode: `,m.attachmentMode,`, max `,m.attachmentMax,m.attachmentMaxBytes?`, ≤${Math.round(m.attachmentMaxBytes/1024/1024)}MB`:``,`)`]})]}),_(`div`,{className:`space-y-1.5`,children:m.attachmentSlots.map(e=>f(`div`,{className:`flex items-center gap-2`,children:[_(`span`,{className:`text-[10px] w-12 shrink-0 text-foreground-subtle`,children:e}),_(`input`,{className:H,placeholder:`${e} URL`,value:y.attachmentUrls[e]??``,onChange:t=>E({attachmentUrls:{...y.attachmentUrls,[e]:t.target.value}})})]},e))})]}),m.showActions&&f(`div`,{children:[f(`label`,{className:U,children:[`Actions (up to `,m.maxActions,`)`]}),_(`div`,{className:`space-y-1.5`,children:Array.from({length:Math.min(m.maxActions,3)},(e,t)=>f(`div`,{className:`flex items-center gap-2`,children:[_(`input`,{className:H,placeholder:`label`,value:y.actions[t]?.label??``,onChange:e=>M(t,`label`,e.target.value)}),_(`input`,{className:H,placeholder:`url`,value:y.actions[t]?.url??``,onChange:e=>M(t,`url`,e.target.value)})]},t))})]}),f(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[m.showClickUrl&&f(`div`,{children:[_(`label`,{className:U,children:`Click URL`}),_(`input`,{className:H,value:y.clickUrl,onChange:e=>E({clickUrl:e.target.value})})]}),m.showSound&&f(`div`,{children:[_(`label`,{className:U,children:`Sound`}),_(`input`,{className:H,value:y.sound,onChange:e=>E({sound:e.target.value})})]}),m.showTtl&&f(`div`,{children:[_(`label`,{className:U,children:`TTL (seconds)`}),_(`input`,{className:H,type:`number`,value:y.ttl,onChange:e=>E({ttl:e.target.value})})]}),m.showTag&&f(`div`,{children:[_(`label`,{className:U,children:`Tag`}),_(`input`,{className:H,value:y.tag,onChange:e=>E({tag:e.target.value})})]})]}),x&&_(G,{result:x}),f(`details`,{className:`text-[10px]`,children:[_(`summary`,{className:`cursor-pointer text-foreground-subtle`,children:`Payload preview`}),_(`pre`,{className:`mt-1 overflow-x-auto rounded bg-surface p-2 text-foreground-subtle`,children:JSON.stringify(C,null,2)})]})]}),f(l,{children:[_(s,{variant:`secondary`,size:`sm`,type:`button`,onClick:c,children:`Close`}),f(s,{size:`sm`,type:`button`,disabled:O.isPending||y.body.length===0,onClick:()=>O.mutate(),children:[O.isPending?_(D,{className:`h-3.5 w-3.5 animate-spin`}):_(k,{className:`h-3.5 w-3.5`}),`Send test`]})]})]})})}function G({result:e}){let t=e.renderedAs;return f(`div`,{className:`rounded-md border px-3 py-2 text-xs ${e.success?`border-success/40 bg-success/10`:`border-danger/40 bg-danger/10`}`,"data-testid":`test-result`,children:[f(`div`,{className:`flex items-center gap-2 font-medium`,children:[e.success?_(y,{className:`h-3.5 w-3.5 text-success`}):_(T,{className:`h-3.5 w-3.5 text-danger`}),_(`span`,{children:e.success?`Delivered`:`Failed`})]}),e.error&&_(`p`,{className:`mt-1 text-danger`,children:e.error}),t&&f(`dl`,{className:`mt-2 grid grid-cols-2 gap-x-3 gap-y-0.5 text-[11px] text-foreground-subtle`,children:[_(`dt`,{children:`Resolved level`}),_(`dd`,{className:`text-foreground`,children:t.level}),_(`dt`,{children:`Format sent`}),_(`dd`,{className:`text-foreground`,children:t.format}),_(`dt`,{children:`Attachments sent`}),_(`dd`,{className:`text-foreground`,children:t.attachmentsSent}),_(`dt`,{children:`Actions sent`}),_(`dd`,{className:`text-foreground`,children:t.actionsSent}),_(`dt`,{children:`Truncated`}),_(`dd`,{className:`text-foreground`,children:t.truncated?`yes`:`no`}),_(`dt`,{children:`Dropped`}),_(`dd`,{className:`text-foreground`,children:t.dropped.length>0?t.dropped.join(`, `):`—`})]})]})}function K(e){let t=[],n=new Map;for(let r of e){let e=n.get(r.addonId);e?e.push(r):(n.set(r.addonId,[r]),t.push(r.addonId))}return t.map(e=>({addonId:e,kinds:n.get(e)??[]}))}function q(e){let t=[],n=e=>{for(let r of e){if(r.type===`password`){t.push(r.key);continue}if(r.type===`group`){n(r.fields);continue}if(r.type===`sub-tabs`)for(let e of r.tabs)n(e.fields)}};for(let t of e.sections)n(t.fields);return t}function J(e,t,n){let r=new Set(n),i={};for(let[n,a]of Object.entries(e)){if(!r.has(n)){i[n]=a;continue}a==null||a===``||a!==t[n]&&(i[n]=a)}return i}function Y(e,t){let n=new Set(t),r={};for(let[t,i]of Object.entries(e))r[t]=n.has(t)?``:i;return r}d();var X=[`notificationOutput`,`listTargets`],Z=[`notificationOutput`,`listTargetKinds`];function Q(){let r=v(),[i,a]=h({mode:`closed`}),[o,l]=h(null),u=m({queryKey:X,queryFn:()=>r.trpcClient.notificationOutput.listTargets.query({})}),d=m({queryKey:Z,queryFn:async()=>(await r.trpcClient.notificationOutput.listTargetKinds.query({})).map(e=>({...e,configSchema:e.configSchema}))}),y=p(()=>d.data??[],[d.data]),S=p(()=>{let e=new Map;for(let t of y)e.set(t.kind,t);return e},[y]),w=g({mutationFn:e=>r.trpcClient.notificationOutput.setTargetEnabled.mutate({addonId:e.target.addonId,targetId:e.target.id,enabled:e.enabled}),onSuccess:()=>void u.refetch()}),T=g({mutationFn:e=>r.trpcClient.notificationOutput.deleteTarget.mutate({addonId:e.addonId,targetId:e.id}),onSuccess:()=>void u.refetch()}),A=o?S.get(o.kind):void 0;return f(O,{icon:C,title:`Notification Targets`,subtitle:`Deliver notifications to ntfy, Pushover, Telegram, Home Assistant and more. Each target's kind declares its capabilities; the test panel shows exactly what a message degrades to.`,actions:f(s,{size:`sm`,type:`button`,onClick:()=>a({mode:`pick-kind`}),children:[_(x,{className:`h-3.5 w-3.5`}),`Add target`]}),children:[u.isLoading&&_(`div`,{className:`flex items-center justify-center py-16`,children:_(D,{className:`h-6 w-6 animate-spin text-primary`})}),u.isError&&!u.isLoading&&_(e,{title:`Failed to load targets`,message:u.error instanceof Error?u.error.message:`Unknown error`,onRetry:()=>void u.refetch()}),!u.isLoading&&!u.isError&&(u.data??[]).length===0&&_(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:`No notification targets yet. Click "Add target" to configure one.`}),(u.data??[]).length>0&&_(c,{children:_(`ul`,{className:`divide-y divide-border`,children:(u.data??[]).map(e=>{let r=S.get(e.kind);return f(`li`,{className:`flex items-center gap-3 px-4 py-2.5`,children:[_(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface text-xs`,title:r?.label??e.kind,children:r?.icon??`🔔`}),f(`div`,{className:`min-w-0 flex-1`,children:[_(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.name}),_(`div`,{className:`text-[11px] text-foreground-subtle`,children:r?.label??e.kind})]}),!e.enabled&&_(t,{variant:`warning`,children:`disabled`}),_(n,{checked:e.enabled,onCheckedChange:t=>w.mutate({target:e,enabled:t}),"aria-label":`toggle ${e.name}`}),_(s,{size:`sm`,variant:`ghost`,type:`button`,disabled:!r,onClick:()=>l(e),title:`Test`,children:_(k,{className:`h-3.5 w-3.5`})}),_(s,{size:`sm`,variant:`ghost`,type:`button`,disabled:!r,onClick:()=>r&&a({mode:`form`,kind:r,target:e}),title:`Edit`,children:_(b,{className:`h-3.5 w-3.5`})}),_(s,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>T.mutate(e),title:`Delete`,children:_(E,{className:`h-3.5 w-3.5 text-danger`})})]},e.id)})})}),i.mode===`pick-kind`&&_($,{kinds:y,onCancel:()=>a({mode:`closed`}),onPick:e=>a({mode:`form`,kind:e,target:null})}),i.mode===`form`&&_(ee,{kind:i.kind,target:i.target,onCancel:()=>a({mode:`closed`}),onSaved:()=>{a({mode:`closed`}),u.refetch()}}),o&&A&&_(W,{target:o,kind:A,open:!0,onClose:()=>l(null)})]})}function $({kinds:e,onPick:n,onCancel:r}){let i=p(()=>K(e),[e]);return f(c,{className:`p-4 space-y-4`,children:[f(`div`,{className:`flex items-center justify-between`,children:[_(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Choose a notification kind`}),_(s,{size:`sm`,variant:`ghost`,type:`button`,onClick:r,children:`Cancel`})]}),i.length===0&&_(`p`,{className:`text-xs text-foreground-subtle`,children:`No notification providers are installed. Install the notifiers addon (or connect Home Assistant) to add targets.`}),i.map(e=>f(`div`,{children:[_(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-foreground-subtle mb-1.5`,children:e.addonId}),_(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-2`,children:e.kinds.map(r=>f(`button`,{type:`button`,onClick:()=>n(r),className:`flex flex-col items-center gap-1.5 rounded-lg border border-border bg-surface px-3 py-3 text-xs hover:border-primary/50 hover:bg-surface-hover transition-colors`,children:[_(`span`,{className:`text-lg`,children:r.icon}),_(`span`,{className:`font-medium text-foreground`,children:r.label}),r.supportsDiscovery&&_(t,{variant:`info`,style:`outline`,children:`discover`})]},`${e.addonId}:${r.kind}`))})]},e.addonId))]})}function ee({kind:e,target:t,onSaved:n,onCancel:r}){let a=v(),o=p(()=>q(e.configSchema),[e.configSchema]),l=p(()=>t?.config??{},[t]),[u,d]=h(t?.name??e.label),[m,y]=h(()=>t?Y(t.config,o):{}),[b,x]=h(null),[C,w]=h(null),T=g({mutationFn:()=>a.trpcClient.notificationOutput.discoverTargets.query({addonId:e.addonId,kind:e.kind,config:m}),onSuccess:e=>x(e),onError:e=>w(e instanceof Error?e.message:`Discovery failed`)}),E=g({mutationFn:()=>{let n=J(m,l,o),r={id:t?.id??`${e.kind}-${Date.now()}`,name:u,kind:e.kind,addonId:e.addonId,enabled:t?.enabled??!0,config:n};return a.trpcClient.notificationOutput.upsertTarget.mutate({addonId:e.addonId,target:r})},onSuccess:n,onError:e=>w(e instanceof Error?e.message:`Save failed`)}),O=e=>{d(e.suggestedName),y(t=>({...t,...e.config})),x(null)};return f(c,{className:`p-4 space-y-4`,children:[f(`div`,{className:`flex items-center justify-between`,children:[f(`h3`,{className:`text-sm font-semibold text-foreground flex items-center gap-2`,children:[_(`span`,{className:`text-lg`,children:e.icon}),t?`Edit ${t.name}`:`Add ${e.label} target`]}),_(s,{size:`sm`,variant:`ghost`,type:`button`,onClick:r,children:`Cancel`})]}),C&&_(`div`,{className:`rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger`,children:C}),f(`div`,{children:[_(`label`,{className:`block text-[11px] font-medium text-foreground mb-1`,children:`Name`}),_(`input`,{className:`w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none`,value:u,onChange:e=>d(e.target.value)})]}),e.supportsDiscovery&&f(`div`,{className:`space-y-2`,children:[f(s,{size:`sm`,variant:`outline`,type:`button`,disabled:T.isPending,onClick:()=>{w(null),T.mutate()},children:[T.isPending?_(D,{className:`h-3.5 w-3.5 animate-spin`}):_(S,{className:`h-3.5 w-3.5`}),`Discover`]}),b&&b.length===0&&_(`p`,{className:`text-[11px] text-foreground-subtle`,children:`No candidates discovered.`}),b&&b.length>0&&_(`div`,{className:`rounded-md border border-border divide-y divide-border`,children:b.map((e,t)=>f(`button`,{type:`button`,onClick:()=>O(e),className:`flex w-full items-center justify-between px-3 py-1.5 text-xs hover:bg-surface-hover`,children:[_(`span`,{className:`text-foreground`,children:e.suggestedName}),_(`span`,{className:`text-[10px] text-primary`,children:`use`})]},`${e.suggestedName}-${t}`))})]}),o.length>0&&t&&_(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Secret fields are hidden. Leave them blank to keep the stored value; type a new value to replace it.`}),_(i,{schema:e.configSchema,values:m,onChange:y}),f(`div`,{className:`flex justify-end gap-2`,children:[_(s,{variant:`secondary`,size:`sm`,type:`button`,onClick:r,children:`Cancel`}),f(s,{size:`sm`,type:`button`,disabled:E.isPending||u.trim().length===0,onClick:()=>{w(null),E.mutate()},children:[E.isPending&&_(D,{className:`h-3.5 w-3.5 animate-spin`}),t?`Save changes`:`Create target`]})]})]})}export{Q as NotificationTargetsPage,Q as default};
1
+ import{$i as e,Aa as t,Da as n,Ea as r,S as i,Sa as a,Ta as o,ja as s,ka as c,wa as l,xa as u}from"./src-BZ1dd5LI.js";import{Q as d,S as f,W as p,a as m,q as h,t as g,x as _}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{p as v}from"./player-overlays-CpsGl45o.js";import{t as y}from"./circle-check-big-wzEehng2.js";import{t as b}from"./pencil-BlQGw-pI.js";import{t as x}from"./plus-DSiRMRVx.js";import{t as S}from"./search-CN_ccU_h.js";import{R as C,V as w,j as T,s as E,x as D}from"./index-CY52lvbZ.js";import{t as O}from"./AdminPage-BwmGKnRf.js";var k=w(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]);d();var A=e=>typeof e==`string`&&e.length>0;function j(e){return{levels:e.levels,formats:e.format,bodyMaxLen:e.bodyMaxLen,attachmentSlots:e.attachments.mediaTypes,attachmentMode:e.attachments.mode,attachmentMax:e.attachments.max,attachmentMaxBytes:e.attachments.maxBytes,maxActions:e.actions,showActions:e.actions>0,showClickUrl:e.clickUrl,showSound:e.sound,showTtl:e.ttl,showTag:!0}}function M(e,t){return e.format.includes(t)?t:e.format[0]??`text`}function N(e,t){let n=[];for(let r of e.attachments.mediaTypes){if(n.length>=e.attachments.max)break;let i=t[r];A(i)&&n.push({mediaType:r,url:i})}return n}function P(e,t){if(e.actions<=0)return[];let n=[];for(let r of t){if(n.length>=e.actions)break;let t=A(r.label),i=A(r.url);!t&&!i||n.push({id:`test-${n.length+1}`,label:t?r.label:`Action ${n.length+1}`,...i?{url:r.url}:{}})}return n}function F(e,t){let n=e.levels.some(e=>e.id===t.level)?t.level:void 0,r=N(e,t.attachmentUrls),i=P(e,t.actions),a=e.ttl&&A(t.ttl)?Number(t.ttl):void 0;return{body:t.body,format:M(e,t.format),priority:I(t.priority),...A(t.title)?{title:t.title}:{},...n?{level:n}:{},...r.length>0?{attachments:r}:{},...i.length>0?{actions:i}:{},...e.clickUrl&&A(t.clickUrl)?{clickUrl:t.clickUrl}:{},...e.sound&&A(t.sound)?{sound:t.sound}:{},...a!==void 0&&Number.isFinite(a)?{ttl:a}:{},...A(t.tag)?{tag:t.tag}:{}}}function I(e){return Number.isFinite(e)?Math.min(5,Math.max(1,Math.round(e))):3}function L(e){return e.levels.find(e=>e.flags?.critical===!0)||e.levels.filter(e=>typeof e.ordinal==`number`).sort((e,t)=>t.ordinal-e.ordinal)[0]}function R(e){return{level:``,priority:3,format:e.format[0]??`text`,title:``,body:``,attachmentUrls:{},actions:[],clickUrl:``,sound:``,ttl:``,tag:``}}var z={image:`https://example.com/sample.jpg`,video:`https://example.com/sample.mp4`,gif:`https://example.com/sample.gif`,audio:`https://example.com/sample.mp3`,icon:`https://example.com/icon.png`};function B(e,t){let n=R(e);switch(t){case`minimal`:return{...n,body:`Test notification`};case`overflow`:return{...n,body:`X`.repeat(e.bodyMaxLen+50)};case`critical`:{let t=L(e);return{...n,body:`Critical test notification`,priority:5,level:t?.id??``}}case`everything`:{let t={},n=0;for(let r of e.attachments.mediaTypes){if(n>=e.attachments.max)break;t[r]=z[r],n+=1}let r=Array.from({length:e.actions},(e,t)=>({label:`Action ${t+1}`,url:`https://example.com/action/${t+1}`}));return{level:``,priority:4,format:e.format.includes(`markdown`)?`markdown`:e.format.includes(`html`)?`html`:e.format[0]??`text`,title:`Everything the kind supports`,body:`This sample fills every control the kind advertises.`,attachmentUrls:t,actions:r,clickUrl:e.clickUrl?`https://example.com/open`:``,sound:e.sound?`default`:``,ttl:e.ttl?`3600`:``,tag:`camstack-test`}}}}var V=[{id:`minimal`,label:`Minimal (body only)`},{id:`everything`,label:`Everything supported`},{id:`overflow`,label:`Overflow`},{id:`critical`,label:`Critical`}],H=`w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none`,U=`block text-[11px] font-medium text-foreground mb-1`;function W({target:e,kind:n,open:i,onClose:c}){let d=v(),m=p(()=>j(n.caps),[n.caps]),[y,b]=h(()=>R(n.caps)),[x,S]=h(null),C=p(()=>F(n.caps,y),[n.caps,y]),w=y.body.length,T=w>m.bodyMaxLen,E=e=>b(t=>({...t,...e})),O=g({mutationFn:()=>d.trpcClient.notificationOutput.testTarget.mutate({addonId:e.addonId,targetId:e.id,sample:F(n.caps,y)}),onMutate:()=>S(null),onSuccess:e=>S(e),onError:e=>S({success:!1,error:e instanceof Error?e.message:`Test failed`})}),A=e=>{b(B(n.caps,e)),S(null)},M=(e,t,n)=>{let r=y.actions.length>0?[...y.actions]:[];for(;r.length<=e;)r.push({label:``,url:``});r[e]={...r[e],[t]:n},E({actions:r})};return _(u,{open:i,onOpenChange:e=>!e&&c(),children:f(a,{width:`lg`,className:`!max-w-2xl`,children:[_(o,{children:f(r,{children:[`Test "`,e.name,`" (`,n.label,`)`]})}),f(`div`,{className:`space-y-4 max-h-[60vh] overflow-y-auto pr-1`,children:[_(`div`,{className:`flex flex-wrap gap-1.5`,children:V.map(e=>_(s,{size:`sm`,variant:`outline`,type:`button`,onClick:()=>A(e.id),children:e.label},e.id))}),f(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[m.levels.length>0&&f(`div`,{children:[_(`label`,{className:U,children:`Level`}),f(`select`,{className:H,value:y.level,onChange:e=>E({level:e.target.value}),children:[_(`option`,{value:``,children:`— derive from priority —`}),m.levels.map(e=>f(`option`,{value:e.id,children:[e.label,e.ordinal===null?` (qualitative)`:` (p${e.ordinal})`]},e.id))]}),(()=>{let e=m.levels.find(e=>e.id===y.level);return e?f(`div`,{className:`mt-1 space-y-1`,children:[e.description&&_(`p`,{className:`text-[10px] text-foreground-subtle`,children:e.description}),f(`div`,{className:`flex flex-wrap gap-1`,children:[e.flags?.critical&&_(t,{variant:`danger`,"data-testid":`flag-critical`,children:`critical`}),e.flags?.silent&&_(t,{variant:`info`,children:`silent`}),e.flags?.noPush&&_(t,{variant:`warning`,children:`no-push`})]}),e.requires&&e.requires.length>0&&f(`p`,{className:`text-[10px] text-warning`,children:[`Requires target config: `,e.requires.join(`, `)]})]}):null})()]}),f(`div`,{children:[f(`label`,{className:U,children:[`Priority (ordinal): `,y.priority]}),_(`input`,{type:`range`,min:1,max:5,step:1,value:y.priority,onChange:e=>E({priority:Number(e.target.value)}),className:`w-full accent-primary`,"aria-label":`priority`})]})]}),m.formats.length>0&&f(`div`,{children:[_(`label`,{className:U,children:`Format`}),_(`div`,{className:`flex flex-wrap gap-2`,children:m.formats.map(e=>f(`label`,{className:`flex items-center gap-1.5 text-xs cursor-pointer`,children:[_(`input`,{type:`radio`,name:`format`,className:`accent-primary`,checked:y.format===e,onChange:()=>E({format:e})}),e]},e))})]}),f(`div`,{children:[_(`label`,{className:U,children:`Title`}),_(`input`,{className:H,value:y.title,onChange:e=>E({title:e.target.value})})]}),f(`div`,{children:[f(`label`,{className:U,children:[`Body`,` `,f(`span`,{className:T?`text-danger`:`text-foreground-subtle`,children:[`(`,w,`/`,m.bodyMaxLen,T?` — overflow`:``,`)`]})]}),_(`textarea`,{className:`${H} min-h-[80px] resize-y`,value:y.body,onChange:e=>E({body:e.target.value})})]}),m.attachmentSlots.length>0&&f(`div`,{children:[f(`label`,{className:U,children:[`Attachments`,` `,f(`span`,{className:`text-foreground-subtle`,children:[`(mode: `,m.attachmentMode,`, max `,m.attachmentMax,m.attachmentMaxBytes?`, ≤${Math.round(m.attachmentMaxBytes/1024/1024)}MB`:``,`)`]})]}),_(`div`,{className:`space-y-1.5`,children:m.attachmentSlots.map(e=>f(`div`,{className:`flex items-center gap-2`,children:[_(`span`,{className:`text-[10px] w-12 shrink-0 text-foreground-subtle`,children:e}),_(`input`,{className:H,placeholder:`${e} URL`,value:y.attachmentUrls[e]??``,onChange:t=>E({attachmentUrls:{...y.attachmentUrls,[e]:t.target.value}})})]},e))})]}),m.showActions&&f(`div`,{children:[f(`label`,{className:U,children:[`Actions (up to `,m.maxActions,`)`]}),_(`div`,{className:`space-y-1.5`,children:Array.from({length:Math.min(m.maxActions,3)},(e,t)=>f(`div`,{className:`flex items-center gap-2`,children:[_(`input`,{className:H,placeholder:`label`,value:y.actions[t]?.label??``,onChange:e=>M(t,`label`,e.target.value)}),_(`input`,{className:H,placeholder:`url`,value:y.actions[t]?.url??``,onChange:e=>M(t,`url`,e.target.value)})]},t))})]}),f(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[m.showClickUrl&&f(`div`,{children:[_(`label`,{className:U,children:`Click URL`}),_(`input`,{className:H,value:y.clickUrl,onChange:e=>E({clickUrl:e.target.value})})]}),m.showSound&&f(`div`,{children:[_(`label`,{className:U,children:`Sound`}),_(`input`,{className:H,value:y.sound,onChange:e=>E({sound:e.target.value})})]}),m.showTtl&&f(`div`,{children:[_(`label`,{className:U,children:`TTL (seconds)`}),_(`input`,{className:H,type:`number`,value:y.ttl,onChange:e=>E({ttl:e.target.value})})]}),m.showTag&&f(`div`,{children:[_(`label`,{className:U,children:`Tag`}),_(`input`,{className:H,value:y.tag,onChange:e=>E({tag:e.target.value})})]})]}),x&&_(G,{result:x}),f(`details`,{className:`text-[10px]`,children:[_(`summary`,{className:`cursor-pointer text-foreground-subtle`,children:`Payload preview`}),_(`pre`,{className:`mt-1 overflow-x-auto rounded bg-surface p-2 text-foreground-subtle`,children:JSON.stringify(C,null,2)})]})]}),f(l,{children:[_(s,{variant:`secondary`,size:`sm`,type:`button`,onClick:c,children:`Close`}),f(s,{size:`sm`,type:`button`,disabled:O.isPending||y.body.length===0,onClick:()=>O.mutate(),children:[O.isPending?_(D,{className:`h-3.5 w-3.5 animate-spin`}):_(k,{className:`h-3.5 w-3.5`}),`Send test`]})]})]})})}function G({result:e}){let t=e.renderedAs;return f(`div`,{className:`rounded-md border px-3 py-2 text-xs ${e.success?`border-success/40 bg-success/10`:`border-danger/40 bg-danger/10`}`,"data-testid":`test-result`,children:[f(`div`,{className:`flex items-center gap-2 font-medium`,children:[e.success?_(y,{className:`h-3.5 w-3.5 text-success`}):_(T,{className:`h-3.5 w-3.5 text-danger`}),_(`span`,{children:e.success?`Delivered`:`Failed`})]}),e.error&&_(`p`,{className:`mt-1 text-danger`,children:e.error}),t&&f(`dl`,{className:`mt-2 grid grid-cols-2 gap-x-3 gap-y-0.5 text-[11px] text-foreground-subtle`,children:[_(`dt`,{children:`Resolved level`}),_(`dd`,{className:`text-foreground`,children:t.level}),_(`dt`,{children:`Format sent`}),_(`dd`,{className:`text-foreground`,children:t.format}),_(`dt`,{children:`Attachments sent`}),_(`dd`,{className:`text-foreground`,children:t.attachmentsSent}),_(`dt`,{children:`Actions sent`}),_(`dd`,{className:`text-foreground`,children:t.actionsSent}),_(`dt`,{children:`Truncated`}),_(`dd`,{className:`text-foreground`,children:t.truncated?`yes`:`no`}),_(`dt`,{children:`Dropped`}),_(`dd`,{className:`text-foreground`,children:t.dropped.length>0?t.dropped.join(`, `):`—`})]})]})}function K(e){let t=[],n=new Map;for(let r of e){let e=n.get(r.addonId);e?e.push(r):(n.set(r.addonId,[r]),t.push(r.addonId))}return t.map(e=>({addonId:e,kinds:n.get(e)??[]}))}function q(e){let t=[],n=e=>{for(let r of e){if(r.type===`password`){t.push(r.key);continue}if(r.type===`group`){n(r.fields);continue}if(r.type===`sub-tabs`)for(let e of r.tabs)n(e.fields)}};for(let t of e.sections)n(t.fields);return t}function J(e,t,n){let r=new Set(n),i={};for(let[n,a]of Object.entries(e)){if(!r.has(n)){i[n]=a;continue}a==null||a===``||a!==t[n]&&(i[n]=a)}return i}function Y(e,t){let n=new Set(t),r={};for(let[t,i]of Object.entries(e))r[t]=n.has(t)?``:i;return r}d();var X=[`notificationOutput`,`listTargets`],Z=[`notificationOutput`,`listTargetKinds`];function Q(){let r=v(),[i,a]=h({mode:`closed`}),[o,l]=h(null),u=m({queryKey:X,queryFn:()=>r.trpcClient.notificationOutput.listTargets.query({})}),d=m({queryKey:Z,queryFn:async()=>(await r.trpcClient.notificationOutput.listTargetKinds.query({})).map(e=>({...e,configSchema:e.configSchema}))}),y=p(()=>d.data??[],[d.data]),S=p(()=>{let e=new Map;for(let t of y)e.set(t.kind,t);return e},[y]),w=g({mutationFn:e=>r.trpcClient.notificationOutput.setTargetEnabled.mutate({addonId:e.target.addonId,targetId:e.target.id,enabled:e.enabled}),onSuccess:()=>void u.refetch()}),T=g({mutationFn:e=>r.trpcClient.notificationOutput.deleteTarget.mutate({addonId:e.addonId,targetId:e.id}),onSuccess:()=>void u.refetch()}),A=o?S.get(o.kind):void 0;return f(O,{icon:C,title:`Notification Targets`,subtitle:`Deliver notifications to ntfy, Pushover, Telegram, Home Assistant and more. Each target's kind declares its capabilities; the test panel shows exactly what a message degrades to.`,actions:f(s,{size:`sm`,type:`button`,onClick:()=>a({mode:`pick-kind`}),children:[_(x,{className:`h-3.5 w-3.5`}),`Add target`]}),children:[u.isLoading&&_(`div`,{className:`flex items-center justify-center py-16`,children:_(D,{className:`h-6 w-6 animate-spin text-primary`})}),u.isError&&!u.isLoading&&_(e,{title:`Failed to load targets`,message:u.error instanceof Error?u.error.message:`Unknown error`,onRetry:()=>void u.refetch()}),!u.isLoading&&!u.isError&&(u.data??[]).length===0&&_(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:`No notification targets yet. Click "Add target" to configure one.`}),(u.data??[]).length>0&&_(c,{children:_(`ul`,{className:`divide-y divide-border`,children:(u.data??[]).map(e=>{let r=S.get(e.kind);return f(`li`,{className:`flex items-center gap-3 px-4 py-2.5`,children:[_(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-surface text-xs`,title:r?.label??e.kind,children:r?.icon??`🔔`}),f(`div`,{className:`min-w-0 flex-1`,children:[_(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.name}),_(`div`,{className:`text-[11px] text-foreground-subtle`,children:r?.label??e.kind})]}),!e.enabled&&_(t,{variant:`warning`,children:`disabled`}),_(n,{checked:e.enabled,onCheckedChange:t=>w.mutate({target:e,enabled:t}),"aria-label":`toggle ${e.name}`}),_(s,{size:`sm`,variant:`ghost`,type:`button`,disabled:!r,onClick:()=>l(e),title:`Test`,children:_(k,{className:`h-3.5 w-3.5`})}),_(s,{size:`sm`,variant:`ghost`,type:`button`,disabled:!r,onClick:()=>r&&a({mode:`form`,kind:r,target:e}),title:`Edit`,children:_(b,{className:`h-3.5 w-3.5`})}),_(s,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>T.mutate(e),title:`Delete`,children:_(E,{className:`h-3.5 w-3.5 text-danger`})})]},e.id)})})}),i.mode===`pick-kind`&&_($,{kinds:y,onCancel:()=>a({mode:`closed`}),onPick:e=>a({mode:`form`,kind:e,target:null})}),i.mode===`form`&&_(ee,{kind:i.kind,target:i.target,onCancel:()=>a({mode:`closed`}),onSaved:()=>{a({mode:`closed`}),u.refetch()}}),o&&A&&_(W,{target:o,kind:A,open:!0,onClose:()=>l(null)})]})}function $({kinds:e,onPick:n,onCancel:r}){let i=p(()=>K(e),[e]);return f(c,{className:`p-4 space-y-4`,children:[f(`div`,{className:`flex items-center justify-between`,children:[_(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Choose a notification kind`}),_(s,{size:`sm`,variant:`ghost`,type:`button`,onClick:r,children:`Cancel`})]}),i.length===0&&_(`p`,{className:`text-xs text-foreground-subtle`,children:`No notification providers are installed. Install the notifiers addon (or connect Home Assistant) to add targets.`}),i.map(e=>f(`div`,{children:[_(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-foreground-subtle mb-1.5`,children:e.addonId}),_(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-2`,children:e.kinds.map(r=>f(`button`,{type:`button`,onClick:()=>n(r),className:`flex flex-col items-center gap-1.5 rounded-lg border border-border bg-surface px-3 py-3 text-xs hover:border-primary/50 hover:bg-surface-hover transition-colors`,children:[_(`span`,{className:`text-lg`,children:r.icon}),_(`span`,{className:`font-medium text-foreground`,children:r.label}),r.supportsDiscovery&&_(t,{variant:`info`,style:`outline`,children:`discover`})]},`${e.addonId}:${r.kind}`))})]},e.addonId))]})}function ee({kind:e,target:t,onSaved:n,onCancel:r}){let a=v(),o=p(()=>q(e.configSchema),[e.configSchema]),l=p(()=>t?.config??{},[t]),[u,d]=h(t?.name??e.label),[m,y]=h(()=>t?Y(t.config,o):{}),[b,x]=h(null),[C,w]=h(null),T=g({mutationFn:()=>a.trpcClient.notificationOutput.discoverTargets.query({addonId:e.addonId,kind:e.kind,config:m}),onSuccess:e=>x(e),onError:e=>w(e instanceof Error?e.message:`Discovery failed`)}),E=g({mutationFn:()=>{let n=J(m,l,o),r={id:t?.id??`${e.kind}-${Date.now()}`,name:u,kind:e.kind,addonId:e.addonId,enabled:t?.enabled??!0,config:n};return a.trpcClient.notificationOutput.upsertTarget.mutate({addonId:e.addonId,target:r})},onSuccess:n,onError:e=>w(e instanceof Error?e.message:`Save failed`)}),O=e=>{d(e.suggestedName),y(t=>({...t,...e.config})),x(null)};return f(c,{className:`p-4 space-y-4`,children:[f(`div`,{className:`flex items-center justify-between`,children:[f(`h3`,{className:`text-sm font-semibold text-foreground flex items-center gap-2`,children:[_(`span`,{className:`text-lg`,children:e.icon}),t?`Edit ${t.name}`:`Add ${e.label} target`]}),_(s,{size:`sm`,variant:`ghost`,type:`button`,onClick:r,children:`Cancel`})]}),C&&_(`div`,{className:`rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger`,children:C}),f(`div`,{children:[_(`label`,{className:`block text-[11px] font-medium text-foreground mb-1`,children:`Name`}),_(`input`,{className:`w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none`,value:u,onChange:e=>d(e.target.value)})]}),e.supportsDiscovery&&f(`div`,{className:`space-y-2`,children:[f(s,{size:`sm`,variant:`outline`,type:`button`,disabled:T.isPending,onClick:()=>{w(null),T.mutate()},children:[T.isPending?_(D,{className:`h-3.5 w-3.5 animate-spin`}):_(S,{className:`h-3.5 w-3.5`}),`Discover`]}),b&&b.length===0&&_(`p`,{className:`text-[11px] text-foreground-subtle`,children:`No candidates discovered.`}),b&&b.length>0&&_(`div`,{className:`rounded-md border border-border divide-y divide-border`,children:b.map((e,t)=>f(`button`,{type:`button`,onClick:()=>O(e),className:`flex w-full items-center justify-between px-3 py-1.5 text-xs hover:bg-surface-hover`,children:[_(`span`,{className:`text-foreground`,children:e.suggestedName}),_(`span`,{className:`text-[10px] text-primary`,children:`use`})]},`${e.suggestedName}-${t}`))})]}),o.length>0&&t&&_(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Secret fields are hidden. Leave them blank to keep the stored value; type a new value to replace it.`}),_(i,{schema:e.configSchema,values:m,onChange:y}),f(`div`,{className:`flex justify-end gap-2`,children:[_(s,{variant:`secondary`,size:`sm`,type:`button`,onClick:r,children:`Cancel`}),f(s,{size:`sm`,type:`button`,disabled:E.isPending||u.trim().length===0,onClick:()=>{w(null),E.mutate()},children:[E.isPending&&_(D,{className:`h-3.5 w-3.5 animate-spin`}),t?`Save changes`:`Create target`]})]})]})}export{Q as NotificationTargetsPage,Q as default};
@@ -0,0 +1 @@
1
+ import{Aa as e,Br as t,Ci as n,Di as r,Ei as i,Fr as a,Gr as o,Hr as s,Ia as c,Jr as l,Kr as u,Lr as d,Qi as f,Qr as p,Ra as m,Rr as h,T as g,Ti as _,Ur as v,Vr as y,Xr as b,Yr as x,Zr as S,_ as C,aa as w,ai as T,bi as E,ca as D,ci as O,da as k,di as A,ei as j,fi as M,ia as N,it as P,ki as F,na as I,oi as L,ot as ee,pi as te,qr as ne,ra as re,ri as ie,sa as ae,si as oe,ti as se,ua as ce,ui as le,vi as ue,xi as de,yi as fe,zr as pe}from"./src-BZ1dd5LI.js";import{I as me,K as he,Q as R,S as z,T as ge,W as B,a as _e,b as V,o as H,q as U,x as W,z as G}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{L as K,V as ve}from"./src-BXL7z3gT.js";import{p as ye}from"./player-overlays-CpsGl45o.js";import{t as be}from"./download-fsWmKUMh.js";import{i as xe,n as Se,r as Ce,t as we}from"./AddLocationWizard-6UQCTSu4.js";import{n as Te,r as Ee,t as De}from"./zap-abOrEOMQ.js";import{i as Oe,r as ke}from"./useDevice-BwzYPnLK.js";import{t as Ae}from"./pencil-BlQGw-pI.js";import{t as je}from"./plus-DSiRMRVx.js";import{t as Me}from"./refresh-cw-CMRlnF-M.js";import{t as Ne}from"./search-CN_ccU_h.js";import{t as Pe}from"./server-CaW_paWO.js";import{t as Fe}from"./square-check-big-D7lGfpqc.js";import{t as Ie}from"./square-DWukmPnU.js";import{A as Le,F as Re,G as ze,M as Be,P as Ve,V as He,b as Ue,i as We,j as Ge,k as q,o as Ke,s as qe,w as Je,x as J}from"./index-CY52lvbZ.js";import{t as Ye}from"./AdminPage-BwmGKnRf.js";import{t as Xe}from"./useEventInvalidation-CETyyXeZ.js";import{a as Ze,c as Y,i as Qe,l as $e,o as X,r as et,s as tt,t as nt}from"./build-cluster-graph-DIgt00ch.js";import{n as rt}from"./format-size-CO9d3C3-.js";import{t as it}from"./NodeAddonsSettingsPanel-DTzycFzS.js";var at=He(`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`}]]),ot=He(`film`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]),st=He(`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`}]]),ct=He(`lock-open`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]]),lt=He(`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`}]]);R();function ut(e){return e}function dt(e,t){for(let[n,r]of Object.entries(e??{}))if(n===t)return r}function ft(e,t){return typeof e==`boolean`?e:ut(t)}function pt(e,t){return{decode:ft(dt(e,`decode`),t),pipeline:ft(dt(e,`detect`),t),audio:ft(dt(e,`audio`),t),ingest:ft(dt(e,`ingest`),t)}}function mt(e,t,n){let r=e?.find(e=>e.nodeId===t);return pt(r?.settings,n)}function ht({selectedNodeId:t,onSelect:n,refreshToken:r}){let{data:i}=a(void 0),{data:o}=T(void 0),{data:s}=L(void 0),c=new Map;for(let e of o??[])c.set(e.agentNodeId,(c.get(e.agentNodeId)??0)+1);let l=i??[],u=l.filter(e=>e.isOnline).length,d=l.filter(e=>!e.isOnline).length;return z(`div`,{className:`flex flex-col h-full`,children:[z(`button`,{type:`button`,onClick:()=>n(Lr),className:`flex items-center gap-3 px-4 py-3 border-b border-border text-left transition-colors ${t===`__cluster__`?`bg-primary/10 text-primary`:`text-foreground hover:bg-surface-hover`}`,children:[W(Je,{className:`h-4 w-4 flex-shrink-0`}),z(`div`,{className:`min-w-0 flex-1`,children:[W(`div`,{className:`text-xs font-semibold truncate`,children:`Cluster`}),W(`div`,{className:`text-[10px] text-foreground-subtle`,children:`Balancer + failover + assignments`})]})]}),W(`div`,{className:`flex-1 overflow-y-auto`,children:l.map(r=>{let i=t===r.id,a=c.get(r.id)??0,o=r.isHub?Pe:q,l=mt(s,r.id,r.isHub),u=r.isOnline?null:m($e(r.lastSeen));return z(`button`,{type:`button`,onClick:()=>n(r.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`}${r.isOnline?``:` opacity-60`}`,children:[W(o,{className:`h-4 w-4 flex-shrink-0`}),z(`div`,{className:`min-w-0 flex-1`,children:[z(`div`,{className:`flex items-center gap-2`,children:[W(`span`,{className:`text-xs font-semibold truncate`,children:r.name}),r.isHub&&W(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`}),!r.isOnline&&W(`span`,{className:`h-1.5 w-1.5 rounded-full bg-destructive flex-shrink-0`}),r.isOnline&&W(`span`,{className:`h-1.5 w-1.5 rounded-full bg-success flex-shrink-0`})]}),z(`div`,{className:`text-[10px] text-foreground-subtle flex items-center gap-2 mt-0.5`,children:[z(`span`,{children:[r.cpuCores,` cores`]}),W(`span`,{children:`•`}),z(`span`,{children:[Math.round(r.memoryMB/1024),` GB`]}),a>0&&z(V,{children:[W(`span`,{children:`•`}),z(`span`,{className:`inline-flex items-center gap-0.5 text-foreground`,children:[W(Te,{className:`h-2.5 w-2.5`}),a]})]}),!r.isOnline&&z(V,{children:[W(`span`,{children:`•`}),z(`span`,{className:`text-destructive`,children:[`offline`,u===null?``:` · ${u}`]})]})]}),z(`div`,{className:`mt-0.5 flex items-center gap-1`,children:[W(e,{variant:l.decode?`success`:`danger`,className:`px-1 py-0 text-[9px] leading-3`,title:l.decode?`Decode: enabled`:`Decode: not enabled (agent capability)`,children:`Dec`}),W(e,{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`}),W(e,{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`})]})]})]},r.id)})}),z(`div`,{className:`px-4 py-2 border-t border-border text-[10px] text-foreground-subtle flex items-center justify-between`,children:[z(`span`,{children:[u,` online`]}),d>0&&z(`span`,{className:`text-destructive`,children:[d,` offline`]})]})]})}function gt({nodeId:e,refreshToken:t}){let{data:n}=a(void 0),r=n?.find(t=>t.id===e),i=re(`pipeline.runner-load-snapshot`,t=>t.nodeId===e)?.load??null;return r?z(`div`,{className:`px-6 py-4 border-b border-border`,children:[z(`div`,{className:`flex items-center gap-2 mb-1`,children:[W(`h2`,{className:`text-base font-semibold text-foreground`,children:r.name}),r.isOnline?W(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-success/10 text-success`,children:`online`}):W(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full bg-destructive/10 text-destructive`,children:`offline`}),r.isHub&&W(`span`,{className:`text-[9px] uppercase tracking-wider text-foreground-subtle border border-border rounded px-1 py-0.5`,children:`hub`})]}),z(`div`,{className:`text-[11px] text-foreground-subtle flex items-center gap-2 flex-wrap`,children:[W(`span`,{children:r.cpuModel??`CPU`}),W(`span`,{children:`•`}),z(`span`,{children:[r.cpuCores,` cores`]}),W(`span`,{children:`•`}),z(`span`,{children:[Math.round(r.memoryMB/1024),` GB`]}),i&&z(V,{children:[W(`span`,{children:`•`}),z(`span`,{children:[i.attachedCameras,` cameras (`,i.activeCameras,` active)`]}),W(`span`,{children:`•`}),z(`span`,{children:[i.avgInferenceTimeMs.toFixed(0),`ms avg inference`]}),W(`span`,{children:`•`}),z(`span`,{children:[`queue `,i.queueDepthTotal]}),i.hardware.hasGpu&&z(V,{children:[W(`span`,{children:`•`}),W(`span`,{className:`text-success`,children:`GPU`})]})]})]})]}):W(`div`,{className:`px-6 py-4 border-b border-border`,children:z(`div`,{className:`text-xs text-foreground-subtle`,children:[`Node not found: `,e]})})}function _t({refreshToken:e,nodeId:t}){let[n,r]=U(new Map),{nodes:i}=I();w(`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}=p(void 0),o=B(()=>{let e=new Map;for(let t of a??[])e.set(t.nodeId,t.deviceCount);return e},[a]),s=B(()=>{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=B(()=>{let e=new Map;for(let t of i)e.set(t.id,t.shortName);return e},[i]),l=B(()=>{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 z(`div`,{className:`@container/liveload`,children:[W(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),z(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 mb-3`,children:[W(Z,{label:`FPS`,value:e?e.totalFps.toFixed(1):`—`}),W(Z,{label:`Active / Attached`,value:e?`${e.activeCameras}/${e.attachedCameras}`:`—`}),W(Z,{label:`Avg infer ms`,value:e&&e.attachedCameras>0?(e.totalInferenceWeighted/e.attachedCameras).toFixed(0):`—`}),W(Z,{label:`Queue`,value:e?String(e.queueDepth):`—`}),W(Z,{label:`Audio`,value:String(o.get(t)??`—`)})]})]})}let u=[...s.entries()].toSorted(([e],[t])=>e===`hub`?-1:t===`hub`?1:e.localeCompare(t));return z(`div`,{className:`@container/liveload`,children:[W(`h3`,{className:`text-sm font-semibold text-foreground mb-2`,children:`Live load`}),z(`div`,{className:`grid grid-cols-2 @md/liveload:grid-cols-3 @3xl/liveload:grid-cols-5 gap-2 sm:gap-3 mb-3`,children:[W(Z,{label:`Total agents`,value:`${l.onlineAgents}/${l.totalAgents}`}),W(Z,{label:`Active / Attached`,value:`${l.activeCameras}/${l.attachedCameras}`}),W(Z,{label:`Total FPS`,value:l.totalFps.toFixed(1)}),W(Z,{label:`Avg inference ms`,value:l.avgInferenceTimeMs.toFixed(0)}),W(Z,{label:`Queue depth`,value:String(l.queueDepth)})]}),W(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:z(`table`,{className:`w-full text-xs min-w-[480px]`,children:[W(`thead`,{className:`bg-surface`,children:z(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[W(`th`,{className:`text-left px-3 py-2`,children:`Agent`}),W(`th`,{className:`text-right px-3 py-2`,children:`FPS`}),W(`th`,{className:`text-right px-3 py-2`,children:`Cameras`}),W(`th`,{className:`text-right px-3 py-2`,children:`Inference ms`}),W(`th`,{className:`text-right px-3 py-2`,children:`Queue`}),W(`th`,{className:`text-right px-3 py-2`,children:`Audio`})]})}),z(`tbody`,{children:[u.map(([e,t])=>z(`tr`,{className:`border-t border-border`,children:[W(`td`,{className:`px-3 py-2 text-foreground font-medium`,children:c.get(e)??e}),W(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.totalFps.toFixed(1)}),W(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras}),W(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.attachedCameras>0?(t.totalInferenceWeighted/t.attachedCameras).toFixed(0):`—`}),W(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t.queueDepth}),W(`td`,{className:`px-3 py-2 text-right text-foreground`,children:o.get(e)??`—`})]},e)),u.length===0&&W(`tr`,{children:W(`td`,{colSpan:6,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`No camera metrics received yet`})})]})]})})]})}function Z({label:e,value:t}){return z(`div`,{className:`rounded-lg border border-border bg-surface/60 p-3`,children:[W(`div`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle mb-1`,children:e}),W(`div`,{className:`text-lg font-semibold text-foreground`,children:t})]})}R();var vt={active:!1,pinned:!1,nodeId:null,reason:``},yt=[`pipeline.camera-assigned`,`pipeline.camera-unassigned`,`pipeline.camera-updated`,`agent.online`,`agent.offline`],bt={pipeline:q,decoder:ot,audio:Ee},xt={pipeline:`Pipeline`,decoder:`Decoder`,audio:`Audio`};function St({mode:e,nodeId:t,compact:n=!1}){if(e===`agent`&&!t)throw Error(`CameraAssignmentsTable: nodeId is required when mode === "agent"`);let r=H(),[i,a]=U(null),[o,s]=U(null),[c,d]=U(new Map);Xe([`pipelineOrchestrator`,`getPipelineAssignments`],yt),Xe([`pipelineOrchestrator`,`getDecoderAssignments`],yt),Xe([`pipelineOrchestrator`,`getAudioAssignments`],yt);let{data:f}=T(void 0),{data:p}=ie(void 0),{data:m}=S(void 0),{nodes:h}=I(),{data:_}=ke();w(`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})}),G(()=>{if(c.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)},[c.size]);let v=B(()=>{let e=new Map;for(let t of _??[])e.set(t.id,t.name);return e},[_]),y=B(()=>{let n=new Map,r=e=>{let t=n.get(e);if(t)return t;let r={deviceId:e,deviceName:v.get(e)??`Device ${e}`,pipeline:vt,decoder:vt,audio:vt};return n.set(e,r),r};for(let i of f??[]){let a=r(i.deviceId);n.set(i.deviceId,{...a,pipeline:{active:e===`cluster`?!0:i.agentNodeId===t,pinned:i.pinned,nodeId:i.agentNodeId,reason:i.reason??``}})}for(let i of p??[]){let a=r(i.deviceId);n.set(i.deviceId,{...a,decoder:{active:e===`cluster`?!0:i.decoderNodeId===t,pinned:i.pinned,nodeId:i.decoderNodeId,reason:i.reason??``}})}for(let i of m??[]){let a=r(i.deviceId);n.set(i.deviceId,{...a,audio:{active:e===`cluster`?!0:i.nodeId===t,pinned:i.pinned,nodeId:i.nodeId,reason:`capacity`}})}let i=[...n.values()];return e===`agent`&&(i=i.filter(e=>e.pipeline.active||e.decoder.active||e.audio.active)),i.sort((e,t)=>e.deviceId-t.deviceId),i},[f,p,m,v,e,t]),b=B(()=>(h??[]).filter(e=>e.isOnline).map(e=>({id:e.id,name:e.name})),[h]),x=()=>{r.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),r.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getDecoderAssignments`]]}),r.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]})},C=l({onSuccess:x}),D=E({onSuccess:x}),O=ne({onSuccess:x}),k=fe({onSuccess:x}),A=u({onSuccess:x}),j=ue({onSuccess:x}),M=(e,t,n)=>{t===`pipeline`?C.mutate({deviceId:e,agentNodeId:n}):t===`decoder`?O.mutate({deviceId:e,nodeId:n}):A.mutate({deviceId:e,nodeId:n}),a(null)},N=(e,t)=>{t===`pipeline`?D.mutate({deviceId:e}):t===`decoder`?k.mutate({deviceId:e}):j.mutate({deviceId:e}),a(null)};return W(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:z(`table`,{className:`w-full text-xs min-w-[760px] table-fixed`,children:[W(`thead`,{className:`bg-surface`,children:z(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[!n&&W(`th`,{className:`w-10`}),W(`th`,{className:`min-w-[200px] text-left px-3 py-2 align-middle`,children:`Camera`}),e===`cluster`?z(V,{children:[W(`th`,{className:`w-[168px] text-left px-3 py-2 align-middle`,children:`Auto | Pin`}),W(`th`,{className:`w-[188px] text-left px-3 py-2 align-middle`,children:`Resolved placement`})]}):z(V,{children:[W(`th`,{className:`w-[120px] text-left px-3 py-2 align-middle`,children:`Pipeline`}),W(`th`,{className:`w-[120px] text-left px-3 py-2 align-middle`,children:`Decoder`}),W(`th`,{className:`w-[120px] text-left px-3 py-2 align-middle`,children:`Audio`})]}),W(`th`,{className:`w-[132px] text-left px-3 py-2 align-middle`,children:`Status`})]})}),z(`tbody`,{children:[y.map(t=>{let r=c.get(t.deviceId),l=o===t.deviceId;return z(ge.Fragment,{children:[z(`tr`,{className:`border-t border-border align-middle relative`,children:[!n&&W(`td`,{className:`px-2 py-2 align-middle`,children:W(`button`,{type:`button`,onClick:()=>s(l?null:t.deviceId),className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle`,"aria-label":l?`Collapse broker details`:`Expand broker details`,children:W(l?Ve:Be,{className:`h-3.5 w-3.5`})})}),z(`td`,{className:`px-3 py-2 align-middle min-w-0`,children:[W(`div`,{className:`text-foreground font-medium leading-tight line-clamp-2 break-words`,title:t.deviceName,children:t.deviceName}),z(`div`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[`#`,t.deviceId]})]}),e===`cluster`?z(V,{children:[W(`td`,{className:`px-3 py-2 align-middle`,children:W(Ct,{state:t.pipeline,onlineNodes:b,pending:C.isPending||D.isPending,onChange:e=>{e===`auto`?N(t.deviceId,`pipeline`):M(t.deviceId,`pipeline`,e)}})}),W(`td`,{className:`px-3 py-2 align-middle`,children:W(wt,{state:t.pipeline})})]}):z(V,{children:[W(Tt,{role:`pipeline`,state:t.pipeline,mode:e,deviceId:t.deviceId,onlineNodes:b,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`)}),W(Tt,{role:`decoder`,state:t.decoder,mode:e,deviceId:t.deviceId,onlineNodes:b,isMenuOpen:i?.deviceId===t.deviceId&&i.role===`decoder`,onToggleMenu:()=>a(i?.deviceId===t.deviceId&&i.role===`decoder`?null:{deviceId:t.deviceId,role:`decoder`}),onCloseMenu:()=>a(null),onMove:e=>M(t.deviceId,`decoder`,e),onUnpin:()=>N(t.deviceId,`decoder`)}),W(Tt,{role:`audio`,state:t.audio,mode:e,deviceId:t.deviceId,onlineNodes:b,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`)})]}),W(`td`,{className:`px-3 py-2 align-middle`,children:W(kt,{snap:r})})]}),l&&!n&&z(`tr`,{className:`bg-surface/50`,children:[W(`td`,{}),W(`td`,{colSpan:e===`cluster`?4:5,className:`px-3 py-2`,children:W(g,{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)}),y.length===0&&W(`tr`,{children:W(`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 Ct({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 z(`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:[W(`option`,{value:`auto`,children:`Auto`}),a.map(e=>z(`option`,{value:e,children:[`Pin → `,t.find(t=>t.id===e)?.name??e]},e))]})}function wt({state:e}){if(!e.active||!e.nodeId)return W(`span`,{className:`text-[10px] text-foreground-subtle italic`,children:`—`});let t=e.pinned?`pinned · manual`:`auto · ${e.reason||`capacity`}`;return z(`div`,{className:`flex flex-col leading-tight min-w-0`,children:[W(`span`,{className:`font-mono text-[11px] text-foreground truncate`,title:e.nodeId,children:e.nodeId}),W(`span`,{className:`truncate ${e.pinned?`text-amber-400 text-[10px]`:`text-foreground-subtle text-[10px]`}`,title:t,children:t})]})}function Tt({role:e,state:t,mode:n,onlineNodes:r,isMenuOpen:i,onToggleMenu:a,onCloseMenu:o,onMove:s,onUnpin:c}){let l=bt[e],u=r.filter(e=>e.id!==(t.nodeId??``)),d=(t.active||n===`cluster`)&&(u.length>0||t.pinned);return z(`td`,{className:`px-3 py-2 align-middle relative min-w-0`,children:[z(`div`,{className:`flex items-center gap-2 min-w-0`,children:[W(n===`agent`?Et:Dt,{state:t,Icon:l}),W(`div`,{className:`ml-auto shrink-0`,children:d&&W(`button`,{type:`button`,onClick:a,className:`p-1 rounded hover:bg-surface-hover`,"aria-label":`${xt[e]} actions`,children:W(at,{className:`h-3 w-3 text-foreground-subtle`})})})]}),i&&d&&W(At,{title:xt[e],targets:u,pinned:t.pinned,onMove:s,onUnpin:c,onClose:o})]})}function Et({state:e,Icon:t}){return z(`div`,{className:`flex items-center gap-1.5`,children:[W(e.active?Fe:Ie,{className:`h-3.5 w-3.5 ${e.active?`text-success`:`text-foreground-subtle/50`}`}),W(t,{className:`h-3 w-3 ${e.active?`text-foreground-subtle`:`text-foreground-subtle/40`}`}),e.pinned&&W(lt,{className:`h-2.5 w-2.5 text-amber-400`})]})}function Dt({state:e,Icon:t}){return!e.active||!e.nodeId?z(`div`,{className:`flex items-center gap-1.5 text-foreground-subtle/60`,children:[W(t,{className:`h-3 w-3`}),W(`span`,{className:`text-[10px] italic`,children:`—`})]}):z(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[W(t,{className:`h-3 w-3 text-foreground-subtle shrink-0`}),z(`div`,{className:`flex flex-col leading-tight min-w-0`,children:[W(`span`,{className:`font-mono text-[11px] text-foreground truncate`,children:e.nodeId}),W(`span`,{className:`flex items-center gap-1 text-[10px]`,children:e.pinned?z(`span`,{className:`inline-flex items-center gap-0.5 text-amber-400`,children:[W(lt,{className:`h-2.5 w-2.5`}),` manual`]}):z(`span`,{className:`text-foreground-subtle truncate`,children:[`auto · `,e.reason||`capacity`]})})]})]})}var Ot=`min-h-[3.25rem]`;function kt({snap:e}){if(!e)return W(`div`,{className:`flex items-center ${Ot}`,children:W(`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=c(t);return z(`div`,{className:`flex flex-col justify-center gap-0.5 font-mono text-[10px] tabular-nums leading-tight min-w-0 ${Ot}`,children:[z(`span`,{className:`inline-flex items-center gap-1 min-w-0 ${s.textColor}`,children:[W(C,{phase:t,className:`h-2.5 w-2.5 shrink-0`}),W(`span`,{className:`font-semibold uppercase tracking-wider truncate`,children:s.label})]}),z(`span`,{className:`text-foreground-subtle whitespace-nowrap truncate`,children:[W(`span`,{className:`text-foreground`,children:n.toFixed(1)}),z(`span`,{children:[`/`,a.toFixed(0),` fps`]})]}),z(`span`,{className:`text-foreground-subtle whitespace-nowrap truncate`,children:[W(`span`,{className:`text-foreground`,children:r.toFixed(0)}),W(`span`,{children:` ms`}),i>0&&z(`span`,{className:`text-warning ml-1`,children:[`q`,i]})]}),z(`span`,{className:`whitespace-nowrap truncate ${o>0?`text-warning`:`text-foreground-subtle`}`,children:[`drops `,W(`span`,{className:`text-foreground`,children:o})]})]})}function At({title:e,targets:t,pinned:n,onMove:r,onUnpin:i,onClose:a}){let o=he(null);return G(()=>{let e=e=>{o.current?.contains(e.target)||a()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[a]),z(`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:[W(`div`,{className:`px-3 py-1 text-[9px] uppercase tracking-wider text-foreground-subtle border-b border-border`,children:e}),t.length>0&&W(`div`,{className:`py-1`,children:t.map(e=>z(`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&&z(`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&&W(`div`,{className:`px-3 py-1.5 text-[10px] text-foreground-subtle italic`,children:`Already auto · no other nodes online`})]})}function jt({nodeId:e,refreshToken:t}){return z(`div`,{className:`space-y-6`,children:[W(_t,{refreshToken:t,nodeId:e}),z(`div`,{children:[W(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Cameras on this node`}),z(`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.`]})]}),W(St,{mode:`agent`,nodeId:e,compact:!0})]})}R();function Mt(e,t){let n=Math.max(0,t-e);return`${Math.floor(e/1e3)}s idle · ${Math.floor(n/1e3)}s left`}function Nt({nodeId:e,refreshToken:t}){let r=H(),i=s({onSettled:()=>{r.invalidateQueries({queryKey:[`pipelineExecutor`,`listLoadedEngines`]})}}),{data:a}=v({nodeId:e}),o=re(`pipeline.engine-metrics-snapshot`,t=>t.nodeId===e)?.engines??a??null,c=o===null;Xe([`pipelineRunner`,`getLocalCameras`],[`pipeline.camera-assigned`,`pipeline.camera-unassigned`]);let{data:l}=n({nodeId:e}),{values:u}=N(`pipeline.camera-metrics-snapshot`,e=>e.deviceId,t=>t.nodeId===e),d=B(()=>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?`)||i.mutate({nodeId:e,engine:t,force:n.length>0})};return z(`div`,{className:`space-y-6`,children:[z(`div`,{children:[W(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Inference engines on this node`}),z(`p`,{className:`text-[11px] text-foreground-subtle`,children:[(o??[]).length,` engine(s) resident in RAM. `,(l??[]).length,` `,`camera(s) attached, `,d,` actively dispatching frames. Refreshes every 5s.`]})]}),W(`div`,{className:`rounded-lg border border-border overflow-x-auto`,children:z(`table`,{className:`w-full text-xs min-w-[640px]`,children:[W(`thead`,{className:`bg-surface`,children:z(`tr`,{className:`text-foreground-subtle text-[10px] uppercase tracking-wider`,children:[W(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Kind`}),W(`th`,{className:`text-left px-3 py-2 whitespace-nowrap`,children:`Runtime / Backend / Device`}),W(`th`,{className:`text-left px-3 py-2`,children:`Models`}),W(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Pool PID`}),W(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`Auto-kill`}),W(`th`,{className:`text-right px-3 py-2 whitespace-nowrap`,children:`In use`}),W(`th`,{className:`w-20`})]})}),z(`tbody`,{children:[c&&W(`tr`,{children:W(`td`,{colSpan:7,className:`px-3 py-4 text-center text-foreground-subtle text-[11px]`,children:`Loading…`})}),!c&&(o??[]).map(e=>{let t=e.kind===`warm-override`;return z(`tr`,{className:`border-t border-border ${t?`bg-amber-500/5`:``}`,children:[W(`td`,{className:`px-3 py-2`,children:z(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-medium ${t?`bg-amber-500/15 text-amber-400`:`bg-success/15 text-success`}`,children:[W(t?st:q,{className:`h-3 w-3`}),t?`warm`:`runtime`]})}),W(`td`,{className:`px-3 py-2`,children:z(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-sky-400`,children:[W(De,{className:`h-3 w-3`}),e.engine.runtime,`/`,e.engine.backend,e.engine.device?`/${e.engine.device}`:``,e.engine.format?` · ${e.engine.format}`:``]})}),W(`td`,{className:`px-3 py-2`,children:e.modelsLoaded.length===0?W(`span`,{className:`text-foreground-subtle text-[11px]`,children:`—`}):W(`div`,{className:`flex flex-wrap gap-1`,children:e.modelsLoaded.map(e=>W(`span`,{className:`inline-block rounded bg-surface px-1.5 py-0.5 text-[10px] font-mono text-foreground-subtle`,children:e},e))})}),W(`td`,{className:`px-3 py-2 text-right font-mono text-foreground`,children:e.poolPid??`—`}),W(`td`,{className:`px-3 py-2 text-right text-[11px]`,children:e.idleMs!==null&&e.idleTtlMs!==null?W(`span`,{className:`text-foreground-subtle`,children:Mt(e.idleMs,e.idleTtlMs)}):W(`span`,{className:`text-foreground-subtle/50`,children:`never`})}),W(`td`,{className:`px-3 py-2 text-right text-foreground`,children:t?`—`:(l??[]).length}),W(`td`,{className:`px-3 py-2 text-right`,children:z(`button`,{type:`button`,disabled:i.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:[W(qe,{className:`h-3 w-3`}),`Kill`]})})]},e.engineKey)}),!c&&(o??[]).length===0&&W(`tr`,{children:W(`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.`})})]})]})}),z(`div`,{className:`text-[10px] text-foreground-subtle leading-relaxed`,children:[W(`strong`,{className:`text-foreground`,children:`runtime`}),`: main camera-serving engine; never auto-killed while cameras attached. `,W(`strong`,{className:`text-foreground`,children:`warm`}),`: benchmark/test override held in cache for fast re-use; auto-disposed after the idle TTL.`]}),i.isError&&z(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-[11px] text-destructive`,children:[`Kill failed:`,` `,i.error instanceof Error?i.error.message:`unknown`]})]})}R();var Pt=new Set(ve);function Ft(e){return Pt.has(e)}function It(e,t,n){return`${e}/${t}/${n}`}function Lt(e){return{coreml:`CoreML`,openvino:`OpenVINO`,onnx:`ONNX`}[e.format]??e.format.toUpperCase()}function Rt(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 zt(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 Bt({addonId:e,model:t,format:n,isActive:r,progress:i,errorMsg:a,onDownload:o,onDelete:s}){let c=t.formats[n];return c?z(`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:[W(`div`,{className:`h-2 w-2 rounded-full shrink-0 ${c.downloaded?`bg-success`:`bg-foreground-subtle/30`}`}),z(`div`,{className:`flex-1 min-w-0`,children:[z(`div`,{className:`flex items-center gap-2`,children:[W(`span`,{className:`text-sm font-medium text-foreground`,children:t.name}),z(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:[`(`,t.id,`)`]})]}),i&&i.progress>=0&&i.progress<100&&z(`div`,{className:`mt-1.5 flex items-center gap-2 max-w-xs`,children:[W(`div`,{className:`flex-1 h-1 bg-surface-hover rounded-full overflow-hidden`,children:W(`div`,{className:`bg-primary h-full rounded-full transition-all duration-300`,style:{width:`${i.progress}%`}})}),z(`span`,{className:`text-[9px] text-primary font-mono tabular-nums shrink-0`,children:[Math.round(i.progress),`%`]})]})]}),W(`span`,{className:`text-xs text-foreground-subtle tabular-nums shrink-0`,children:rt(c.sizeMB)}),a&&z(`span`,{className:`flex items-center gap-1 text-[10px] text-danger max-w-[160px] truncate shrink-0`,title:a,children:[W(Ge,{className:`h-3 w-3 shrink-0`}),a]}),c.downloaded?z(`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?W(J,{className:`h-3 w-3 animate-spin`}):W(qe,{className:`h-3 w-3`}),r?`Deleting...`:`Delete`]}):z(`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?W(J,{className:`h-3 w-3 animate-spin`}):W(be,{className:`h-3 w-3`}),r?`Downloading...`:`Download`]})]}):null}function Vt({engines:e,activeEngine:t,viewEngine:n,onSelect:r}){let[i,a]=U(!1);return z(`div`,{className:`relative`,children:[z(`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:[W(q,{className:`h-4 w-4 text-primary shrink-0`}),z(`div`,{className:`flex-1 min-w-0`,children:[z(`div`,{className:`flex items-center gap-2`,children:[W(`span`,{className:`text-sm font-medium text-foreground`,children:Lt(n)}),Q(n)===Q(t)&&W(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),W(`div`,{className:`text-[10px] text-foreground-subtle`,children:Rt(n)})]}),W(Ve,{className:`h-4 w-4 text-foreground-subtle transition-transform ${i?`rotate-180`:``}`})]}),i&&W(`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 z(`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:[W(q,{className:`h-4 w-4 shrink-0 ${i?`text-primary`:`text-foreground-subtle`}`}),z(`div`,{className:`flex-1`,children:[z(`div`,{className:`flex items-center gap-2`,children:[W(`span`,{className:`text-sm font-medium ${i?`text-primary`:`text-foreground`}`,children:Lt(e)}),o&&W(`span`,{className:`text-[9px] px-1.5 py-0.5 rounded-full bg-success/10 text-success font-medium`,children:`Active`})]}),W(`div`,{className:`text-[10px] text-foreground-subtle`,children:Rt(e)})]}),i&&W(Le,{className:`h-4 w-4 text-primary shrink-0`})]},Q(e))})})]})}function Ht({embedded:e=!1,nodeId:n}={}){let r=H(),i=n??`hub`,[a,o]=U(null),[s,c]=U(new Set),[l,u]=U(new Map),[f,p]=U(new Map),[m,g]=U(``),{data:_=[]}=pe({nodeId:i}),v=_.filter((e,t,n)=>n.findIndex(t=>t.format===e.format)===t),{data:b}=y({nodeId:i}),x=b,{data:S,isLoading:C}=t({nodeId:i}),T=h(),E=d();w(`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||(u(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 D=x??{runtime:`node`,backend:`cpu`,format:`onnx`},O=v.find(e=>e.format===a)??D,k=O.format,A=S?.slots??[],j=A.map(e=>({...e,addons:e.addons.map(e=>({...e,models:e.models.filter(e=>e.formats[k]!==void 0)})).filter(e=>e.models.length>0)})).filter(e=>e.addons.length>0),M=zt(j,k),N=me(async(e,t,n)=>{if(!Ft(n))return;let a=It(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:`Download failed`]]))}finally{c(e=>{let t=new Set(e);return t.delete(a),t})}},[T,r,i]),P=me(async(e,t,n)=>{if(!Ft(n))return;let a=It(e,t,n);c(e=>new Set([...e,a])),p(e=>{let t=new Map(e);return t.delete(a),t});try{await E.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})}},[E,r,i]),F=me(e=>{o(e.format)},[]),I=m.trim()?j.map(e=>({...e,addons:e.addons.map(e=>({...e,models:e.models.filter(t=>t.name.toLowerCase().includes(m.toLowerCase())||t.id.toLowerCase().includes(m.toLowerCase())||e.name.toLowerCase().includes(m.toLowerCase()))})).filter(e=>e.models.length>0)})).filter(e=>e.addons.length>0):j,L=z(V,{children:[C&&W(`div`,{className:`flex items-center justify-center py-16`,children:W(J,{className:`h-5 w-5 animate-spin text-foreground-subtle`})}),!C&&A.length===0&&z(`div`,{className:`flex flex-col items-center justify-center py-16 text-foreground-subtle`,children:[W(xe,{className:`h-8 w-8 mb-3 opacity-30`}),W(`span`,{className:`text-sm`,children:`No pipeline steps available`}),W(`span`,{className:`text-xs mt-1`,children:`Configure the detection pipeline to see available models.`})]}),!C&&A.length>0&&z(V,{children:[W(Vt,{engines:v,activeEngine:D,viewEngine:O,onSelect:F}),z(`div`,{className:`flex items-center gap-4 text-xs text-foreground-subtle`,children:[z(`span`,{children:[W(`span`,{className:`font-semibold text-foreground tabular-nums`,children:M.total}),W(`span`,{className:`ml-1`,children:`compatible models`})]}),W(`span`,{className:`text-border`,children:`|`}),z(`span`,{children:[W(`span`,{className:`font-semibold text-success tabular-nums`,children:M.downloaded}),W(`span`,{className:`ml-1`,children:`downloaded`})]}),W(`span`,{className:`text-border`,children:`|`}),z(`span`,{className:`tabular-nums`,children:[rt(M.downloadedSizeMB),W(`span`,{className:`ml-1`,children:`on disk`})]})]}),M.total>5&&z(`div`,{className:`relative`,children:[W(Ne,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-foreground-subtle`}),W(`input`,{type:`text`,value:m,onChange:e=>g(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`})]}),I.map(e=>{let t=e.addons.reduce((e,t)=>e+t.models.length,0),n=e.addons.reduce((e,t)=>e+t.models.filter(e=>e.formats[k]?.downloaded).length,0);return z(`div`,{children:[z(`div`,{className:`flex items-center gap-2 mb-2`,children:[W(`h2`,{className:`text-sm font-semibold text-foreground`,children:e.label}),W(`div`,{className:`flex-1 h-px bg-border`}),z(`span`,{className:`text-[10px] text-foreground-subtle tabular-nums`,children:[n,`/`,t]})]}),W(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:e.addons.map(e=>e.models.map(t=>{let n=It(e.id,t.id,k);return W(Bt,{addonId:e.id,model:t,format:k,isActive:s.has(n),progress:l.get(t.id),errorMsg:f.get(n),onDownload:()=>N(e.id,t.id,k),onDelete:()=>P(e.id,t.id,k)},`${e.id}/${t.id}`)}))})]},e.id)}),I.length===0&&W(`div`,{className:`text-center py-8 text-sm text-foreground-subtle`,children:m.trim()?z(V,{children:[`No models matching “`,m,`”`]}):z(V,{children:[`No models available for `,Lt(O),` format`]})})]})]});return e?W(`div`,{className:`space-y-4`,children:L}):W(Ye,{children:L})}function Ut({nodeId:e,refreshToken:t}){return W(Ht,{embedded:!0,nodeId:e})}var Wt=[{concern:`pipeline`,label:`Pipeline`,advisory:!1},{concern:`audio`,label:`Audio`,advisory:!1},{concern:`decode`,label:`Decode`,advisory:!0,advisoryNote:`Advisory: decode currently runs co-located with the stream source (hub). Pins are stored and take effect with Phase-2 stream load-balancing.`}];function Gt(e,t){return e.filter(e=>e.currentNodeId!==t)}var Kt=`This node is not decoder-enabled (enabledDecoderNodes). Pinning detection here strands frames (0 fps) until frame-source-aware placement ships. Enable decode on this node first, or pick a decoder-enabled node.`;function qt(e,t,n){return t.includes(e)?{verdict:`ok`}:n?{verdict:`warn`,reason:Kt}:{verdict:`block`,reason:Kt}}R();var Jt=`pipeline-orchestrator`,Yt=`enabledDecoderNodes`;function Xt(e,t){if(!e||typeof e!=`object`)return;let n=e.sections;if(Array.isArray(n))for(let e of n){if(!e||typeof e!=`object`)continue;let n=e.fields;if(Array.isArray(n))for(let e of n){if(!e||typeof e!=`object`)continue;let n=e;if(n.key!==t)continue;let r=n.value;return Array.isArray(r)&&r.every(e=>typeof e==`string`)?r:void 0}}}function Zt({nodeId:e,nodeName:t,concern:n,open:r,onClose:i}){let a=H(),o=ke(),s=T(void 0),c=ie(void 0),d=S(void 0),f=P({addonId:Jt}),p=l(),m=ne(),h=u(),[g,_]=U(new Set),[v,y]=U(!1),[b,x]=U(null),[C,w]=U([]),[E,D]=U(null),O=Wt.find(e=>e.concern===n),k=B(()=>{let e=new Map;if(n===`pipeline`)for(let t of s.data??[])e.set(t.deviceId,t.agentNodeId);else if(n===`decode`)for(let t of c.data??[])e.set(t.deviceId,t.decoderNodeId);else for(let t of d.data??[])e.set(t.deviceId,t.nodeId);return e},[n,s.data,c.data,d.data]),A=B(()=>(o.data??[]).filter(e=>e.isCamera).map(e=>({deviceId:e.id,name:e.name,currentNodeId:k.get(e.id)??null})),[o.data,k]),j=B(()=>Gt(A,e),[A,e]),M=Xt(f.data,Yt),N=n===`pipeline`?qt(e,M??[],!1):{verdict:`ok`},[F,I]=U(!1);if(!r)return null;let L=N.verdict===`block`,ee=N.verdict===`warn`&&!F,te=g.size>0&&!v&&!L&&!ee,re=e=>{_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ae=j.length>0&&j.every(e=>g.has(e.deviceId)),oe=()=>{_(ae?new Set:new Set(j.map(e=>e.deviceId)))},se=async t=>{n===`pipeline`?await p.mutateAsync({deviceId:t,agentNodeId:e}):n===`decode`?await m.mutateAsync({deviceId:t,nodeId:e}):await h.mutateAsync({deviceId:t,nodeId:e})},ce=new Map(A.map(e=>[e.deviceId,e.name]));return z(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[W(`div`,{className:`absolute inset-0 bg-black/60`,onClick:i}),z(`div`,{className:`relative z-10 flex w-full max-w-2xl flex-col h-[80vh] rounded-xl border border-border bg-background shadow-2xl`,children:[z(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[z(`div`,{className:`min-w-0`,children:[z(`h2`,{className:`text-sm font-semibold text-foreground`,children:[`Batch assign `,O?.label??n,` → `,t]}),z(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:[`Pick the cameras whose `,O?.label.toLowerCase()??n,` should run on this node.`]})]}),W(`button`,{type:`button`,onClick:i,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover`,"aria-label":`Close`,children:W(We,{className:`h-4 w-4`})})]}),z(`div`,{className:`flex-1 min-h-0 px-5 py-3 flex flex-col gap-2 overflow-hidden`,children:[O?.advisory&&O.advisoryNote&&W(`div`,{className:`rounded-lg border border-warning/30 bg-warning/5 px-3 py-2 shrink-0`,children:z(`div`,{className:`flex items-start gap-2`,children:[W(Ke,{className:`h-3.5 w-3.5 text-warning mt-0.5 shrink-0`}),W(`p`,{className:`text-[11px] text-warning`,children:O.advisoryNote})]})}),N.verdict!==`ok`&&W(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 shrink-0`,children:z(`div`,{className:`flex items-start gap-2`,children:[W(Ke,{className:`h-3.5 w-3.5 text-destructive mt-0.5 shrink-0`}),z(`div`,{className:`min-w-0`,children:[W(`p`,{className:`text-[11px] text-destructive`,children:N.reason}),N.verdict===`warn`&&z(`label`,{className:`mt-1 flex items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[W(`input`,{type:`checkbox`,checked:F,onChange:e=>I(e.target.checked),className:`accent-primary`}),`I understand — assign anyway`]})]})]})}),j.length>0&&z(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle shrink-0`,children:[W(`input`,{type:`checkbox`,"aria-label":`Select all`,checked:ae,onChange:oe,className:`accent-primary`}),`Select all (`,j.length,`)`]}),W(`div`,{className:`flex-1 min-h-0 overflow-y-auto rounded-lg border border-border divide-y divide-border`,children:j.length===0?z(`div`,{className:`px-3 py-6 text-center text-[11px] text-foreground-subtle`,children:[`No eligible cameras — all cameras are already assigned to `,t,`.`]}):j.map(e=>z(`label`,{className:`flex items-center gap-2 px-3 py-2 text-xs text-foreground hover:bg-surface-hover cursor-pointer`,children:[W(`input`,{type:`checkbox`,"aria-label":`Select ${e.name}`,checked:g.has(e.deviceId),onChange:()=>re(e.deviceId),className:`accent-primary`}),W(`span`,{className:`truncate`,children:e.name}),e.currentNodeId&&z(`span`,{className:`ml-auto text-[10px] text-foreground-subtle shrink-0`,children:[`on `,e.currentNodeId]})]},e.deviceId))}),(E!==null||C.length>0)&&z(`div`,{className:`space-y-1 text-[10px] shrink-0`,children:[E!==null&&E>0&&z(`p`,{className:`text-success`,children:[`Assigned `,E,` camera(s) to `,t,`.`]}),C.map(e=>z(`p`,{className:`text-destructive`,children:[e.name,`: `,e.message]},e.deviceId))]})]}),z(`div`,{className:`flex items-center justify-between border-t border-border px-5 py-3 shrink-0`,children:[W(`span`,{className:`text-[10px] text-foreground-subtle`,children:v&&b?`${b.done} / ${b.total}…`:``}),z(`div`,{className:`flex items-center gap-2`,children:[W(`button`,{type:`button`,onClick:i,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground`,children:`Close`}),z(`button`,{type:`button`,onClick:async()=>{let e=[...g];if(e.length===0)return;y(!0),w([]),D(null),x({done:0,total:e.length});let t=[],n=0;for(let r=0;r<e.length;r+=1){let i=e[r];try{await se(i),n+=1}catch(e){t.push({deviceId:i,name:ce.get(i)??String(i),message:e instanceof Error?e.message:String(e)})}x({done:r+1,total:e.length})}y(!1),w(t),D(n),_(new Set),a.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),a.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getDecoderAssignments`]]}),a.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]})},disabled:!te,className:`inline-flex items-center gap-1.5 rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50 disabled:cursor-not-allowed`,children:[v&&W(J,{className:`h-3.5 w-3.5 animate-spin`}),`Assign `,g.size,` to `,t]})]})]})]})]})}R();function Qt({nodeId:e,title:t}){let{data:n}=ke(),{data:r}=T(void 0),i=B(()=>{let e=new Map;for(let t of n??[])e.set(t.id,t.name);return e},[n]),a=B(()=>{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]=U(new Map);w(`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}))}),G(()=>{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 l=B(()=>{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 l.length===0?z(`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`]}):z(`div`,{className:`rounded-md border border-border bg-surface px-3 py-2`,children:[z(`div`,{className:`flex items-center gap-2 mb-1.5`,children:[W(`span`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:t??`Cameras`}),W(`span`,{className:`text-[10px] text-foreground-subtle`,children:l.length})]}),W(`div`,{className:`flex flex-wrap gap-1.5`,children:l.map(e=>{let t=i.get(e.deviceId)??`#${e.deviceId}`,n=c(e.metrics.phase);return z(`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:[W(C,{phase:e.metrics.phase,className:`h-2.5 w-2.5`}),W(`span`,{className:`font-medium text-foreground/90 max-w-[220px] truncate`,children:t}),W(`span`,{className:`font-mono tabular-nums`,children:e.metrics.actualFps.toFixed(1)}),W(`span`,{className:`opacity-60`,children:`fps`})]},e.deviceId)})})]})}R();var $t=[`pipeline-orchestrator`],en=[`decoder`];function tn(e,t){if(!e)return null;for(let n of e.slots)for(let e of n.addons)if(e.id===t)return e;return null}function nn({nodeId:e,refreshToken:n}){let r=H(),[i,s]=U(null),[c,l]=U(null),[u,d]=U(null),[f,p]=U(null),m=(a(void 0).data??[]).find(t=>t.id===e)?.name??e,h=t({nodeId:e},{refetchOnMount:`always`}),g=b({agentNodeId:e},{refetchOnMount:`always`}),_=()=>{r.invalidateQueries({queryKey:[[`addonSettings`]]}),r.invalidateQueries({queryKey:[[`pipelineOrchestrator`]]}),r.invalidateQueries({queryKey:[[`pipelineExecutor`]]})},v=le({onSuccess:_}),y=o({onSuccess:e=>{_(),p(`Reset done — regenerated default model: ${e.regeneratedModelId}`)}}),x=()=>{window.confirm(`Reset ${m} to hardware-aware defaults?\n\nThis clears the node's global pipeline seed and every per-camera step override, then re-seeds from the hardware default. Existing per-camera customisations on this node are lost.`)&&(p(null),y.mutate({nodeId:e}))},S=h.data??null,C=g.data,w=S?.selectedEngine.format??`coreml`,T=B(()=>S?ce(S):[],[S]),E=B(()=>[{agentNodeId:e,engineLabel:w}],[e,w]),O=(e,t)=>{let n=C?.addonDefaults[e];return!tn(S,e)?.models.some(e=>!!e.formats[w])||!n?{kind:`na`}:n.enabled?{kind:`enabled`,modelId:n.modelId??`Auto`}:{kind:`disabled`}},A=i&&S?tn(S,i.addonId):null,j=t=>{let n=C?.addonDefaults[t]??null;s({addonId:t,agentNodeId:e}),l(n)},M=(t,n)=>{if(!C)return;let r=C.addonDefaults[t],i=tn(S,t);if(!r&&!i)return;let a={enabled:n,modelId:r?.modelId??i?.defaultModelId??``,settings:r?.settings??{}};v.mutate({agentNodeId:e,defaults:{...C.addonDefaults,[t]:a}})},N=()=>{s(null),l(null)},P=()=>{!c||!i||!C||v.mutate({agentNodeId:e,defaults:{...C.addonDefaults,[i.addonId]:c}},{onSuccess:N})};if(h.isLoading||g.isLoading)return W(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading pipeline…`});if(h.error)return z(`div`,{className:`text-xs text-red-400`,children:[`Failed to load catalog: `,String(h.error)]});if(!S)return W(`div`,{className:`text-xs text-foreground-subtle`,children:`Catalog unavailable for this node (runner offline?).`});let F=i!==null&&A!==null&&c!==null;return z(`div`,{className:`relative h-full w-full space-y-3`,children:[z(`div`,{className:`flex items-center justify-end gap-2 text-xs`,children:[f&&W(`span`,{className:`text-emerald-400`,children:f}),y.isError&&W(`span`,{className:`text-red-400`,children:y.error instanceof Error?y.error.message:`Reset failed`}),W(`button`,{type:`button`,onClick:x,disabled:y.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 global pipeline seed + per-camera overrides and re-seed from the hardware default`,children:y.isPending?`Resetting…`:`Reset to default`})]}),W(Qt,{nodeId:e}),W(it,{nodeId:e,addonIds:$t,level:`global`,sectionIds:en}),z(`div`,{className:`flex items-center gap-2 text-xs`,children:[W(`span`,{className:`font-medium text-muted-foreground`,children:`Batch assign:`}),W(`button`,{type:`button`,onClick:()=>d(`pipeline`),className:`rounded border border-border bg-surface px-2 py-0.5 text-xs hover:bg-surface-hover`,children:`Pipeline…`}),W(`button`,{type:`button`,onClick:()=>d(`audio`),className:`rounded border border-border bg-surface px-2 py-0.5 text-xs hover:bg-surface-hover`,children:`Audio…`}),W(`button`,{type:`button`,onClick:()=>d(`decode`),className:`rounded border border-border bg-surface px-2 py-0.5 text-xs text-foreground-subtle hover:bg-surface-hover`,children:`Decode… (advisory)`})]}),u&&W(Zt,{nodeId:e,nodeName:m,concern:u,open:u!==null,onClose:()=>d(null)}),W(`div`,{className:F?`pr-[360px]`:``,children:T.length>0?W(ae,{tree:T,agents:E,getCellState:O,onCellClick:j,selectedCell:i,onToggleEnabled:M}):W(`div`,{className:`text-xs text-foreground-subtle`,children:`Catalog empty.`})}),W(k,{open:F,onClose:N,title:A?.name??``,subtitle:i?`${i.agentNodeId} · ${w}`:``,footer:z(V,{children:[W(`button`,{type:`button`,className:`px-3 py-1 text-xs border border-border rounded bg-surface hover:bg-muted`,onClick:N,children:`Cancel`}),W(`button`,{type:`button`,disabled:!c||!i||v.isPending,className:`px-3 py-1 text-xs bg-primary text-primary-foreground rounded disabled:opacity-50`,onClick:P,children:v.isPending?`Saving…`:`Save`})]}),children:A&&c&&i&&W(D,{mode:`agent`,addon:A,agentDefault:c,agentNodeId:i.agentNodeId,engineFormat:w,onChangeAgentConfig:e=>l(e)})})]})}var rn=[`detection-pipeline`,`audio-analyzer`,`pipeline-runner`],an=`decoder-nodeav`;function on({nodeId:e,refreshToken:t}){let{data:n}=a(void 0),r=n?.find(t=>t.id===e)?.addons.find(e=>e.capabilities.includes(`decoder`))?.id??an,i=[...rn,r];return z(`div`,{className:`flex flex-col h-full`,children:[W(gt,{nodeId:e,refreshToken:t}),W(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-6`,children:W(it,{nodeId:e,addonIds:i,level:`global`,extraTabs:[{id:`assignments`,label:`Assignments`,order:-10,content:W(jt,{nodeId:e,refreshToken:t})},{id:`tree`,label:`Pipeline`,order:39,content:W(nn,{nodeId:e,refreshToken:t})},{id:`engines`,label:`Warm instances`,order:180,content:W(Nt,{nodeId:e,refreshToken:t})},{id:`models`,label:`Models`,order:200,content:W(Ut,{nodeId:e,refreshToken:t})}]})})]})}var sn=`pipeline-orchestrator`,cn=`recorder`,ln=`recordingNodeId`,un=[`ingestNode`,`recordingNode`,`audioNode`],dn=[{key:`detect`,label:`Detect`,hint:`Runs the detection pipeline for assigned cameras`},{key:`decode`,label:`Decode`,hint:`Decodes video frames locally (advisory placement)`}];function fn(e,t){for(let n of e?.sections??[])for(let e of n.fields??[])if(e.key===t)return e.value}function pn(e,t){for(let[n,r]of Object.entries(e??{}))if(n===t)return r}function mn(e,t,n){let r=fn(e,t);return typeof r==`string`&&r.length>0?r:n}function hn(e,t,n){let r=fn(e,t);return typeof r==`number`&&Number.isFinite(r)?r:n}function gn(e,t){let n=pn(e,t);return typeof n==`number`&&Number.isFinite(n)?n:null}function _n(e,t){let n=pn(e,t);return typeof n==`string`&&n.length>0?n:null}function vn(e){return e===`ingestNode`?`Ingest`:e===`recordingNode`?`Recording`:`Audio`}function yn(e){return e===`ingestNode`?`Node that terminates default camera ingest`:e===`recordingNode`?`Node that owns the recorder (recording-node)`:`Node that runs singleton audio work`}function bn(e,t){return t===`detect`?e.pipeline:e[t]}function xn(e){e.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`listAgentSettings`]]}),e.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAgentSettings`]]}),e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}function Sn({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?Re:Oe;return z(`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:[W(u,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}),W(`span`,{children:t})]})}function Cn({node:t,emphasis:n=!1}){let r=t.isHub?Pe:q;return z(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[W(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${t.isOnline?`bg-success`:`bg-danger`}`,"aria-hidden":`true`}),W(r,{className:`h-4 w-4 shrink-0 text-foreground-subtle`,"aria-hidden":`true`}),z(`div`,{className:`min-w-0`,children:[z(`div`,{className:`flex items-center gap-1.5 ${n?`text-sm`:`text-xs`} font-semibold text-foreground`,children:[W(`span`,{className:`truncate`,children:t.name}),t.isHub&&W(e,{variant:`info`,className:`px-1.5 py-0 text-[9px] uppercase tracking-wider`,children:`hub`}),!t.isOnline&&W(e,{variant:`danger`,className:`px-1.5 py-0 text-[9px] uppercase tracking-wider`,children:`offline`})]}),W(`div`,{className:`font-mono text-[10px] text-foreground-subtle truncate`,children:t.id})]})]})}R();function wn({nodeId:e,value:t,detectedHosts:n,pending:r,onCommit:i}){let[a,o]=U(t??``);G(()=>{o(t??``)},[t]);let s=n[0],c=s===void 0?`auto-detect`:`auto: ${s}`,l=()=>{let t=a.trim();i(e,t.length>0?t:null)};return W(`input`,{"aria-label":`Reachable host for ${e}`,type:`text`,inputMode:`url`,autoComplete:`off`,spellCheck:!1,placeholder:c,value:a,disabled:r,onChange:e=>o(e.target.value),onBlur:l,onKeyDown:e=>{e.key===`Enter`&&l()},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`})}function Tn({label:e,children:t}){return z(`div`,{className:`flex items-center justify-between gap-3`,children:[W(`span`,{className:`text-[11px] font-medium uppercase tracking-wide text-foreground-subtle`,children:e}),t]})}function En({node:e,actions:t}){return z(`div`,{className:`rounded-xl border border-border bg-background p-4 space-y-4 ${e.isOnline?``:`opacity-60`}`,children:[W(Cn,{node:e,emphasis:!0}),W(`div`,{className:`grid grid-cols-2 gap-2`,children:dn.map(n=>W(Sn,{capability:n.key,label:n.label,hint:n.hint,nodeId:e.id,active:bn(e.effective,n.key),pending:t.capabilityPending,layout:`card`,onToggle:(n,r)=>t.onToggleCapability(e.id,n,r)},n.key))}),W(`div`,{className:`space-y-3 border-t border-border pt-3`,children:W(Tn,{label:`Reachable host`,children:W(wn,{nodeId:e.id,value:e.reachableHost,detectedHosts:e.detectedHosts,pending:t.reachableHostPending,onCommit:t.onCommitReachableHost})})})]})}function Dn(){return z(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[10px] text-foreground-subtle`,children:[z(`span`,{className:`inline-flex items-center gap-1.5`,children:[W(`span`,{className:`h-2.5 w-2.5 rounded-full border border-success/30 bg-success/15`}),`Active capability`]}),z(`span`,{className:`inline-flex items-center gap-1.5`,children:[W(`span`,{className:`h-2.5 w-2.5 rounded-full border border-border bg-surface-hover`}),`Idle`]}),z(`span`,{className:`inline-flex items-center gap-1.5`,children:[W(`span`,{className:`h-2 w-2 rounded-full bg-success`}),`Node online`]}),z(`span`,{className:`inline-flex items-center gap-1.5`,children:[W(`span`,{className:`h-2 w-2 rounded-full bg-danger`}),`Node offline`]})]})}function On({nodes:e,actions:t}){return W(`div`,{className:`overflow-x-auto rounded-lg border border-border`,children:z(`table`,{className:`w-full min-w-[720px] border-collapse text-sm`,children:[W(`thead`,{children:z(`tr`,{className:`border-b border-border bg-background text-[10px] uppercase tracking-wider text-foreground-subtle`,children:[W(`th`,{className:`px-4 py-3 text-left font-semibold`,children:`Node`}),dn.map(e=>W(`th`,{className:`px-3 py-3 text-center font-semibold`,children:e.label},e.key)),W(`th`,{className:`px-4 py-3 text-left font-semibold`,children:`Reachable host`})]})}),W(`tbody`,{children:e.map(e=>z(`tr`,{className:`border-b border-border last:border-b-0 transition-colors hover:bg-surface-hover/40 ${e.isOnline?``:`opacity-60`}`,children:[W(`td`,{className:`px-4 py-3 align-middle`,children:W(Cn,{node:e})}),dn.map(n=>W(`td`,{className:`px-3 py-3 text-center align-middle`,children:W(Sn,{capability:n.key,label:n.label,hint:n.hint,nodeId:e.id,active:bn(e.effective,n.key),pending:t.capabilityPending,layout:`cell`,onToggle:(n,r)=>t.onToggleCapability(e.id,n,r)})},n.key)),W(`td`,{className:`px-4 py-3 align-middle`,children:W(wn,{nodeId:e.id,value:e.reachableHost,detectedHosts:e.detectedHosts,pending:t.reachableHostPending,onCommit:t.onCommitReachableHost})})]},e.id))})]})})}function kn({role:e,value:t,options:n,pending:r,onChange:i}){return z(`label`,{className:`flex flex-col gap-1.5 rounded-lg border border-border bg-background p-3`,children:[W(`span`,{className:`text-xs font-semibold text-foreground`,children:vn(e)}),W(`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=>W(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),W(`span`,{className:`text-[10px] leading-tight text-foreground-subtle`,children:yn(e)})]})}function An({roleValues:e,options:t,pending:n,lowFpsEnabled:r,fpsMinThreshold:i,onRoleChange:a,onLowFpsToggle:o}){return z(`div`,{className:`grid gap-3 @lg/clustertab:grid-cols-2 @3xl/clustertab:grid-cols-4`,children:[un.map(r=>W(kn,{role:r,value:e[r],options:t,pending:n,onChange:a},r)),z(`label`,{className:`flex items-start gap-2.5 rounded-lg border border-border bg-background p-3 text-sm text-foreground`,children:[W(`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`}),z(`span`,{className:`flex flex-col gap-0.5`,children:[W(`span`,{className:`text-xs font-semibold`,children:`Low-fps relocate/shed`}),z(`span`,{className:`text-[10px] leading-tight text-foreground-subtle`,children:[`fpsMinThreshold `,r?`${i} fps`:`disabled`]})]})]})]})}R();function jn(e,t,n){return Math.min(Math.max(e,t),n)}function Mn(e){let t=e.reduce((e,t)=>e+Math.max(t.weight,0),0);if(t<=0){let t=e.length>0?100/e.length:0;return Object.fromEntries(e.map(e=>[e.id,t]))}return Object.fromEntries(e.map(e=>[e.id,Math.max(e.weight,0)/t*100]))}function Nn(e,t,n,r,i){let a=i.filter(e=>e!==t&&r.has(e)).reduce((t,n)=>t+(e[n]??0),0),o=jn(n,0,Math.max(0,100-a)),s=i.filter(e=>e!==t&&!r.has(e)),c=Math.max(0,100-o-a),l=s.reduce((t,n)=>t+(e[n]??0),0),u={...e,[t]:o};if(s.length>0)if(l>0)for(let t of s)u[t]=c*((e[t]??0)/l);else{let e=c/s.length;for(let t of s)u[t]=e}return u}function Pn({nodes:e,pending:t,onCommitWeight:n}){let[r,i]=U(()=>Mn(e)),[a,o]=U(new Set);G(()=>{i(Mn(e)),o(t=>new Set([...t].filter(t=>e.some(e=>e.id===t))))},[e.map(e=>`${e.id}:${e.weight}`).join(`|`)]);let s=e.map(e=>e.id),c=e=>{o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},l=(e,t)=>{i(n=>Nn(n,e,t,a,s))},u=()=>{for(let t of e)n(t.id,Math.round(r[t.id]??0))};if(e.length===0)return W(`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-enabled nodes. Enable “Detect” on a node above to distribute detection weight.`});let d=e.length===1;return z(`div`,{className:`space-y-3`,children:[e.map(e=>{let n=r[e.id]??0,i=a.has(e.id);return z(`div`,{className:`flex items-center gap-3`,children:[W(`span`,{className:`w-28 shrink-0 truncate text-xs font-medium text-foreground`,title:e.name,children:e.name}),W(`input`,{"aria-label":`Detection weight for ${e.name}`,type:`range`,min:0,max:100,step:1,value:Math.round(n),disabled:t||i||d,onChange:t=>l(e.id,Number(t.target.value)),onPointerUp:u,onKeyUp:u,className:`h-1.5 flex-1 cursor-pointer accent-primary disabled:cursor-not-allowed disabled:opacity-50`}),z(`span`,{className:`w-10 shrink-0 text-right font-mono text-xs tabular-nums text-foreground`,children:[Math.round(n),`%`]}),W(`button`,{type:`button`,onClick:()=>c(e.id),disabled:t||d,"aria-pressed":i,title:i?`Unlock — allow rebalancing`:`Lock this share when others change`,className:`shrink-0 rounded p-1 hover:bg-surface-hover disabled:opacity-40 ${i?`text-amber-400`:`text-foreground-subtle`}`,children:W(i?Ue:ct,{className:`h-3.5 w-3.5`})})]},e.id)}),W(`p`,{className:`text-[10px] leading-tight text-foreground-subtle`,children:`Shares sum to 100%. Dragging one slider rebalances the unlocked nodes; lock a node to pin its share. Detection only distributes across nodes that can source a camera’s frames.`})]})}R();function Fn(){let e=H(),{nodes:t}=I(),n=L(void 0),r=P({addonId:sn}),i=P({addonId:cn}),a=()=>xn(e),o=A({onSuccess:a}),s=M({onSuccess:a}),c=te({onSuccess:a}),l=ee({onSuccess:a}),u=B(()=>{let e=new Map;for(let t of n.data??[])e.set(t.nodeId,t.settings);return e},[n.data]),d=B(()=>t.map(e=>{let t=u.get(e.id),n=pt(t,e.isHub),r=gn(t,`detectWeight`);return{id:e.id,name:e.name,isHub:e.isHub,isOnline:e.isOnline,settings:t,effective:n,weight:r??1,maxCameras:gn(t,`maxCameras`),reachableHost:_n(t,`reachableHost`),detectedHosts:e.localIps}}),[t,u]),f=d.filter(e=>e.effective.pipeline),p={ingestNode:mn(r.data,`ingestNode`,`hub`),recordingNode:mn(i.data,ln,`hub`),audioNode:mn(r.data,`audioNode`,`hub`)},m=B(()=>{let e=t.filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,...un.map(e=>p[e]),...e])].filter(e=>e.length>0)},[t,p]),h=hn(r.data,`fpsMinThreshold`,0),g=h>0,_=n.isLoading||r.isLoading||i.isLoading,v=(e,t,n)=>{o.mutate({agentNodeId:e,[t]:n})},y=(e,t)=>{if(e===`recordingNode`){l.mutate({addonId:cn,patch:{[ln]:t}});return}l.mutate({addonId:sn,patch:{[e]:t}})},b=e=>{l.mutate({addonId:sn,patch:{fpsMinThreshold:e?Math.max(1,h):0}})},x={capabilityPending:o.isPending,reachableHostPending:c.isPending,onToggleCapability:v,onCommitReachableHost:(e,t)=>c.mutate({agentNodeId:e,reachableHost:t})};return z(`section`,{className:`rounded-xl border border-border bg-surface p-5 @3xl/clustertab:p-6 space-y-6`,children:[z(`header`,{className:`flex items-start justify-between gap-4`,children:[z(`div`,{className:`space-y-1`,children:[W(`h3`,{className:`text-base font-semibold text-foreground`,children:`Pipeline placement`}),W(`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.`})]}),_&&W(J,{className:`h-5 w-5 shrink-0 animate-spin text-foreground-subtle`,"aria-label":`Loading`})]}),z(`div`,{className:`space-y-3`,children:[W(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Singleton cluster roles`}),W(An,{roleValues:p,options:m,pending:l.isPending,lowFpsEnabled:g,fpsMinThreshold:h,onRoleChange:y,onLowFpsToggle:b})]}),z(`div`,{className:`space-y-3`,children:[z(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[W(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Per-node capabilities`}),W(Dn,{})]}),d.length===0?W(`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.`}):z(V,{children:[W(`div`,{className:`grid gap-4 @xl/clustertab:grid-cols-2 @3xl/clustertab:hidden`,children:d.map(e=>W(En,{node:e,actions:x},e.id))}),W(`div`,{className:`hidden @3xl/clustertab:block`,children:W(On,{nodes:d,actions:x})})]})]}),z(`div`,{className:`space-y-3`,children:[W(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:`Detection weight`}),W(Pn,{nodes:f,pending:s.isPending,onCommitWeight:(e,t)=>s.mutate({agentNodeId:e,detectWeight:t})})]})]})}R();var In=!1;function Ln({refreshToken:e}){let t=H(),{data:n}=a(void 0);B(()=>nt(n??[]),[n]);let r=O({onSuccess:()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getPipelineAssignments`]]}),t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getDecoderAssignments`]]}),t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`getAudioAssignments`]]})}});return z(`div`,{className:`space-y-6`,children:[W(_t,{refreshToken:e}),W(Fn,{}),In,z(`div`,{className:`flex flex-col gap-3 @md/clustertab:flex-row @md/clustertab:items-center @md/clustertab:justify-between`,children:[z(`div`,{className:`min-w-0`,children:[W(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Placement matrix`}),W(`p`,{className:`text-[11px] text-foreground-subtle`,children:`Pipeline · decoder · audio assignments per camera. Click the kebab to pin / unpin / move any role; expand the chevron for the per-camera broker drill-down.`})]}),z(`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:[W(De,{className:`h-3.5 w-3.5`}),r.isPending?`Rebalancing…`:`Rebalance pipelines`]})]}),W(St,{mode:`cluster`})]})}var Rn=[`pipeline-orchestrator`];function zn({refreshToken:e}){return W(`div`,{className:`space-y-4 max-w-3xl`,children:W(it,{nodeId:`hub`,addonIds:Rn,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.`})})}R();function Bn({refreshToken:e}){let t=H(),{data:n,isLoading:r}=oe(),[i,a]=U(null),[o,s]=U(``),[c,l]=U(``),u=()=>{t.invalidateQueries({queryKey:[[`pipelineOrchestrator`,`listTemplates`]]})},d=de({onSuccess:()=>{a(null),u()}}),f=x({onSuccess:u}),p=e=>{a(e.id),s(e.name),l(e.description??``)},m=()=>{a(null),s(``),l(``)},h=()=>{if(!i)return;let e=c.trim();d.mutate({id:i,name:o.trim()||`Untitled`,...e?{description:e}:{}})};if(r)return W(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading templates…`});let g=[...n??[]].toSorted((e,t)=>e.name.localeCompare(t.name));return W(`div`,{className:`space-y-6 max-w-4xl`,children:z(`section`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[z(`div`,{className:`border-b border-border px-4 py-3 flex items-center justify-between`,children:[z(`div`,{children:[W(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Templates`}),W(`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.`})]}),z(`div`,{className:`text-[11px] text-foreground-subtle`,children:[g.length,` template`,g.length===1?``:`s`]})]}),g.length===0?z(`div`,{className:`px-4 py-8 text-xs text-foreground-subtle flex flex-col items-center gap-2`,children:[W(je,{className:`h-6 w-6 opacity-40`}),W(`div`,{children:`No templates yet. Create one from a device Pipeline tab ("Save as template").`})]}):W(`ul`,{className:`divide-y divide-border`,children:g.map(e=>{let t=i===e.id;return W(`li`,{className:`px-4 py-3 text-xs`,children:z(`div`,{className:`flex items-start gap-3`,children:[W(`div`,{className:`flex-1 min-w-0`,children:t?z(`div`,{className:`space-y-2`,children:[W(`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}),W(`input`,{className:`w-full rounded border border-border bg-surface-hover px-2 py-1 text-[11px] text-foreground focus:outline-none focus:border-primary`,value:c,onChange:e=>l(e.target.value),placeholder:`Description (optional)`})]}):z(V,{children:[W(`div`,{className:`font-medium text-foreground`,children:e.name}),e.description&&W(`div`,{className:`text-foreground-subtle mt-0.5`,children:e.description}),z(`div`,{className:`mt-1 font-mono text-[10px] text-foreground-subtle`,children:[e.config.steps.length,` step(s)`,e.config.audio?.enabled?` · audio`:``,z(`span`,{className:`ml-2`,children:[`updated `,new Date(e.updatedAt).toLocaleString()]})]})]})}),W(`div`,{className:`flex items-center gap-1 shrink-0`,children:t?z(V,{children:[z(`button`,{type:`button`,onClick:h,disabled:d.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] font-medium bg-primary text-white hover:bg-primary/90 disabled:opacity-50`,children:[W(Re,{className:`h-3 w-3`}),`Save`]}),z(`button`,{type:`button`,onClick:m,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover`,children:[W(We,{className:`h-3 w-3`}),`Cancel`]})]}):z(V,{children:[W(`button`,{type:`button`,onClick:()=>p(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:W(Ae,{className:`h-3 w-3`})}),W(`button`,{type:`button`,onClick:()=>{confirm(`Delete template "${e.name}"?`)&&f.mutate({id:e.id})},disabled:f.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:W(qe,{className:`h-3 w-3`})})]})})]})},e.id)})})]})})}R();function Vn(e,t){if(!e)return null;for(let n of e.slots)for(let e of n.addons)if(e.id===t)return e;return null}function Hn({nodeId:e,refreshToken:n}){let r=H(),i=ye().trpcClient,[o,s]=U(null),[c,l]=U(null),u=L(void 0,{refetchOnMount:`always`});Xe([`nodes`,`topology`],[`agent.online`,`agent.offline`,`agent.unregistered`,`addon.installed`,`addon.uninstalled`,`addon.updated`]);let d=a(void 0,{refetchOnMount:`always`}),f=B(()=>{let e=new Set;for(let t of d.data??[])t.isOnline&&e.add(t.id);return e},[d.data]),p=t({nodeId:e},{refetchOnMount:`always`}),m=B(()=>(u.data??[]).filter(e=>f.has(e.nodeId)).map(e=>e.nodeId),[u.data,f]),h=_e({enabled:m.length>0,queryKey:[[`pipelineExecutor`,`getSchema`],`schema-by-agent`,m.join(`,`),n],queryFn:async()=>{let e={};for(let t of m)try{e[t]=(await i.pipelineExecutor.getSchema.query({nodeId:t})).selectedEngine.format}catch{e[t]=`coreml`}return e}}),g=le({onSuccess:()=>{r.invalidateQueries({queryKey:[[`pipelineOrchestrator`]]}),r.invalidateQueries({queryKey:[[`pipelineExecutor`]]}),r.invalidateQueries({queryKey:[[`addonSettings`]]})}}),_=B(()=>p.data?ce(p.data):[],[p.data]),v=B(()=>{let e=u.data??[],t=f;return(t.size===0?[]:e.filter(e=>t.has(e.nodeId))).map(e=>{let t=h.data?.[e.nodeId];return{agentNodeId:e.nodeId,engineLabel:t??`(engine unknown)`}})},[u.data,h.data,f]),y=(e,t)=>{let n=(u.data?.find(e=>e.nodeId===t))?.settings.addonDefaults[e],r=h.data?.[t];return!Vn(p.data??null,e)?.models.some(e=>r!==void 0&&!!e.formats[r])||!n?{kind:`na`}:n.enabled?{kind:`enabled`,modelId:n.modelId??`Auto`}:{kind:`disabled`}},b=o?u.data?.find(e=>e.nodeId===o.agentNodeId)??null:null,x=o&&p.data?Vn(p.data,o.addonId):null,S=o?h.data?.[o.agentNodeId]??`coreml`:`coreml`,C=()=>{s(null),l(null)},w=(e,t)=>{let n=(u.data?.find(e=>e.nodeId===t))?.settings.addonDefaults[e]??null;s({addonId:e,agentNodeId:t}),l(n)},T=()=>{!c||!o||!b||g.mutate({agentNodeId:o.agentNodeId,defaults:{...b.settings.addonDefaults,[o.addonId]:c}},{onSuccess:C})};if(u.isLoading||p.isLoading)return W(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading agents…`});if(!p.data)return z(`div`,{className:`text-xs text-foreground-subtle`,children:[`Catalog unavailable for `,e,`.`]});let E=o!==null&&x!==null&&c!==null;return z(`div`,{className:`relative h-full w-full space-y-3`,children:[W(Qt,{title:`Cluster cameras`}),W(`div`,{className:E?`pr-[360px]`:``,children:_.length>0&&v.length>0?W(ae,{tree:_,agents:v,getCellState:y,onCellClick:w,selectedCell:o}):W(`div`,{className:`text-xs text-foreground-subtle`,children:`No agents or catalog empty.`})}),W(k,{open:E,onClose:C,title:x?.name??``,subtitle:o?`${o.agentNodeId} · ${S}`:``,footer:z(V,{children:[W(`button`,{type:`button`,className:`px-3 py-1 text-xs border border-border rounded bg-surface hover:bg-muted`,onClick:C,children:`Cancel`}),W(`button`,{type:`button`,disabled:!c||!o||g.isPending,className:`px-3 py-1 text-xs bg-primary text-primary-foreground rounded disabled:opacity-50`,onClick:T,children:g.isPending?`Saving…`:`Save`})]}),children:x&&c&&o&&W(D,{mode:`agent`,addon:x,agentDefault:c,agentNodeId:o.agentNodeId,engineFormat:S,onChangeAgentConfig:e=>l(e)})})]})}R();function Un({types:e}){let t=H(),n=f(),{data:a}=r({}),o=i(),s=B(()=>o.data??[],[o.data]),[c,l]=U(null),[u,d]=U(null),p=()=>{t.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})},m=F({onSuccess:p}),h=_({onSuccess:p}),g=B(()=>{let e=new Map;for(let t of a??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[a]),v=e=>{e.isDefault||m.mutate({id:e.id,type:e.type,providerId:e.providerId,displayName:e.displayName,config:e.config,isDefault:!0})},y=async e=>{if(e.isDefault){await n({title:`Cannot delete default location`,message:`"${e.displayName}" is the default for type "${e.type}". Mark another as default first.`,confirmLabel:`OK`,variant:`warning`});return}await n({title:`Delete location "${e.displayName}"?`,message:`Removes the record; files on disk are untouched.`,confirmLabel:`Delete`,variant:`danger`})&&h.mutate({id:e.id})},b=e.map(e=>s.find(t=>t.id===e)).filter(e=>e!==void 0);return z(`div`,{className:`space-y-3`,children:[b.length===0?W(`p`,{className:`text-[11px] text-foreground-subtle italic`,children:`No storage locations declared for this purpose.`}):b.map(e=>W(Ce,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:g.get(e.id)??[],onAdd:e=>l(e),onEdit:e=>d(e),onDelete:e=>{y(e)},onSetDefault:e=>v(e)},e.id)),c!==null&&W(we,{initialType:c,onClose:()=>l(null),onCreated:()=>{p(),l(null)}}),u!==null&&W(Se,{location:u,onClose:()=>d(null),onSaved:()=>{p(),d(null)}})]})}R();var Wn=`pipeline-analytics`;function Gn(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 Kn(){let e=H(),{data:t}=a(void 0),{data:n,isLoading:r}=P({addonId:Wn}),i=Gn(n),o=ee({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),s=B(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,i,...e])].filter(Boolean)},[t,i]);return z(`div`,{className:`flex flex-col gap-6`,children:[z(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[W(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Post-processing node`}),W(`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.`}),z(`div`,{className:`mt-3 flex items-center gap-2`,children:[r?W(J,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):W(`select`,{value:i,onChange:e=>{e.target.value!==i&&o.mutate({addonId:Wn,patch:{postProcessingNodeId:e.target.value}})},disabled:o.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:s.map(e=>W(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),o.isPending&&W(J,{className:`h-4 w-4 animate-spin text-primary`})]})]}),z(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[W(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Events folder`}),W(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where event crops / full frames are stored. A single folder — no collection / equal-splitting.`}),W(Un,{types:[`eventMedia`]})]})]})}R();var qn=`recorder`;function Jn(e,t,n){for(let n of e?.sections??[])for(let e of n.fields??[])if(e.key===t&&typeof e.value==`string`)return e.value;return n}function Yn(){let e=H(),{data:t}=a(void 0),{data:n,isLoading:r}=P({addonId:qn}),i=Jn(n,`recordingNodeId`,`hub`),o=ee({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),s=B(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,i,...e])].filter(Boolean)},[t,i]);return z(`div`,{className:`flex flex-col gap-6`,children:[z(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[W(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Recording node`}),W(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that records (continuous & events) and serves playback. Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`}),z(`div`,{className:`mt-3 flex items-center gap-2`,children:[r?W(J,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):W(`select`,{value:i,onChange:e=>{e.target.value!==i&&o.mutate({addonId:qn,patch:{recordingNodeId:e.target.value}})},disabled:o.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:s.map(e=>W(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),o.isPending&&W(J,{className:`h-4 w-4 animate-spin text-primary`})]}),i!==`hub`&&z(`p`,{className:`mt-2 text-[11px] text-amber-500`,children:[`The stream-broker is hub-only — an agent recorder pulls streams from the hub over the network. The hub's RTSP restream port must be reachable from`,` `,W(`span`,{className:`font-medium`,children:i}),`. If the auto-derived host doesn't work, set the recorder's`,W(`span`,{className:`font-medium`,children:` recordingHubHostname`}),` global setting.`]})]}),z(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[W(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Recordings folders`}),W(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where recordings are stored. Multi-location collections — segments are split across the locations of a type. Add a location to grow capacity; mark one default per type.`}),W(Un,{types:[`recordings`,`recordingsLow`]})]})]})}R();var Xn=[{id:`assignments`,label:`Assignments`},{id:`pipeline`,label:`Pipeline`},{id:`events`,label:`Events`},{id:`recording`,label:`Recording`},{id:`settings`,label:`Settings`},{id:`templates`,label:`Templates`}];function Zn({refreshToken:e}){let[t,n]=U(`assignments`),{data:r}=a(void 0),i=r?.find(e=>e.isHub&&e.isOnline)?.id??r?.find(e=>e.isOnline)?.id??null;return z(`div`,{className:`flex flex-col h-full`,children:[z(`div`,{className:`px-4 sm:px-6 py-4 border-b border-border`,children:[W(`h2`,{className:`text-base font-semibold text-foreground`,children:`Cluster Orchestration`}),W(`div`,{className:`text-[11px] text-foreground-subtle mt-1`,children:`Assignments with live load, cluster-wide settings, pipeline template library, per-camera pipeline overrides.`})]}),W(`div`,{className:`flex items-center gap-1 px-4 sm:px-6 border-b border-border overflow-x-auto`,children:Xn.map(e=>W(`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))}),z(`div`,{className:`flex-1 min-h-0 overflow-y-auto p-4 sm:p-6 @container/clustertab`,children:[t===`assignments`&&W(Ln,{refreshToken:e}),t===`pipeline`&&(i?W(Hn,{nodeId:i,refreshToken:e}):W(`div`,{className:`text-xs text-foreground-subtle`,children:`No online node available — schema unreachable.`})),t===`events`&&W(Kn,{}),t===`recording`&&W(Yn,{}),t===`settings`&&W(zn,{refreshToken:e}),t===`templates`&&W(Bn,{refreshToken:e})]})]})}function Qn(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`}R();var $n={healthy:`bg-green-500`,idle:`bg-yellow-400`,error:`bg-red-500`},er={healthy:`Healthy`,idle:`Idle`,error:`Error`};function tr({health:e}){return W(`span`,{className:`inline-block h-2 w-2 rounded-full shrink-0 ${$n[e]}`,title:er[e],"aria-label":er[e],role:`img`})}function nr({selectedDeviceId:e,onSelect:t}){let{data:n}=ke(),{data:r}=se({}),i=B(()=>{let e=new Map;for(let t of r??[])e.set(t.deviceId,t);return e},[r]),a=B(()=>(n??[]).filter(e=>e.isCamera).map(e=>{let t=i.get(e.id);return{deviceId:e.id,name:e.name,health:t===void 0?`idle`:Qn(t)}}),[n,i]);return a.length===0?W(`div`,{className:`px-4 py-6 text-center text-[11px] text-foreground-subtle italic`,children:`No cameras found`}):W(`ul`,{className:`divide-y divide-border`,children:a.map(n=>{let r=n.deviceId===e;return W(`li`,{children:z(`button`,{type:`button`,onClick:()=>t(n.deviceId),className:[`w-full flex items-center gap-2.5 px-4 py-3 text-left transition-colors`,r?`bg-surface-active text-foreground`:`hover:bg-surface-hover text-foreground-subtle hover:text-foreground`].join(` `),"aria-pressed":r,children:[W(tr,{health:n.health}),z(`span`,{className:`flex-1 min-w-0`,children:[W(`span`,{className:`block truncate text-[12px] font-medium leading-tight`,children:n.name}),z(`span`,{className:`block text-[10px] text-foreground-subtle leading-tight mt-0.5`,children:[`#`,n.deviceId]})]})]})},n.deviceId)})})}var rr=300,ir=158,ar={camera:0,source:1,broker:2,decoder:3,motion:4,detection:4,audio:4,recorder:4};function $(e){return ar[e]*rr}function or(e,t){return e===null||t===null?!1:e!==t}function sr(e){let t=e.profiles.reduce((e,t)=>e+t.subscribers,0),n=e.profiles.reduce((e,t)=>e+t.inFps,0),r=e.profiles.reduce((e,t)=>e+t.outFps,0);return`${t} subs · ${n.toFixed(1)}→${r.toFixed(1)} fps`}function cr(e){return`${e.actualFps.toFixed(1)} fps · q${e.queueDepth} · ${e.avgInferenceMs.toFixed(1)}ms`}function lr(e){return`shm ${e.shm.getFrameHits+e.shm.getFrameMisses>0?Math.round(e.shm.getFrameHits/(e.shm.getFrameHits+e.shm.getFrameMisses)*100):0}% hit`}function ur(e){let t=[],n=[],r=e.decoder===null?0:[e.motion,e.detection,e.audio,e.recording].filter(e=>e!==null).length,i=r>1?(r-1)/2*ir:0,a={id:`camera`,kind:`camera`,nodeId:null,data:{deviceId:e.deviceId},position:{x:$(`camera`),y:i}};t.push(a);let o={id:`source`,kind:`source`,nodeId:null,data:{streams:e.source.streams},position:{x:$(`source`),y:i}};t.push(o),n.push({id:`camera->source`,source:`camera`,target:`source`,crossNode:!1});let s=e.broker;if(s!==null){let e={id:`broker`,kind:`broker`,nodeId:null,data:{profiles:s.profiles,webrtcSessions:s.webrtcSessions,rtspRestream:s.rtspRestream},position:{x:$(`broker`),y:i}};t.push(e),n.push({id:`source->broker`,source:`source`,target:`broker`,crossNode:!1})}let c=e.decoder;if(c!==null){let r={id:`decoder`,kind:`decoder`,nodeId:c.nodeId,data:{nodeId:c.nodeId,formats:c.formats,sessionCount:c.sessionCount,shm:c.shm},position:{x:$(`decoder`),y:i}};t.push(r);let a=s===null?`source`:`broker`,o=s===null?void 0:sr(s),l=s===null?lr(c):o;n.push({id:`${a}->decoder`,source:a,target:`decoder`,crossNode:or(null,c.nodeId),...l===void 0?{}:{label:l}});let u=0,d=e.motion;if(d!==null){let e={id:`motion`,kind:`motion`,nodeId:null,data:{enabled:d.enabled,fps:d.fps},position:{x:$(`motion`),y:u*ir}};t.push(e),n.push({id:`decoder->motion`,source:`decoder`,target:`motion`,crossNode:!1}),u++}let f=e.detection;if(f!==null){let e={id:`detection`,kind:`detection`,nodeId:f.nodeId,data:{nodeId:f.nodeId,engine:f.engine,phase:f.phase,configuredFps:f.configuredFps,actualFps:f.actualFps,queueDepth:f.queueDepth,avgInferenceMs:f.avgInferenceMs,provisioning:f.provisioning},position:{x:$(`detection`),y:u*ir}};t.push(e),n.push({id:`decoder->detection`,source:`decoder`,target:`detection`,crossNode:or(c.nodeId,f.nodeId),label:cr(f)}),u++}let p=e.audio;if(p!==null){let e={id:`audio`,kind:`audio`,nodeId:p.nodeId,data:{nodeId:p.nodeId,enabled:p.enabled},position:{x:$(`audio`),y:u*ir}};t.push(e),n.push({id:`decoder->audio`,source:`decoder`,target:`audio`,crossNode:or(c.nodeId,p.nodeId)}),u++}let m=e.recording;if(m!==null){let e={id:`recorder`,kind:`recorder`,nodeId:null,data:{mode:m.mode,active:m.active,storageBytes:m.storageBytes},position:{x:$(`recorder`),y:u*ir}};t.push(e),n.push({id:`decoder->recorder`,source:`decoder`,target:`recorder`,crossNode:!1})}}return{nodes:t,edges:n}}R();function dr(e){let{data:t,isLoading:n}=j({deviceId:e}),[r,i]=U(void 0);return G(()=>{t!==void 0&&i(t)},[t]),w(K.PipelineCameraMetricsSnapshot,t=>{let n=t.data;n.deviceId===e&&i(e=>e===void 0||e.detection===null?e:{...e,detection:{...e.detection,phase:n.metrics.phase,actualFps:n.metrics.actualFps,queueDepth:n.metrics.queueDepth,avgInferenceMs:n.metrics.avgInferenceTimeMs}})}),w(K.PipelineEngineProvisioning,e=>{let t=e.data;i(n=>{if(n===void 0||n.detection===null)return n;let r=n.detection.nodeId??n.assignment?.detectionNodeId??null;return r===null||e.source.type!==`node`||e.source.id!==r?n:{...n,detection:{...n.detection,provisioning:{state:t.state,error:t.error}}}})}),w(K.MotionAnalysis,t=>{t.source.type!==`device`||t.source.id!==e||i(e=>e===void 0||e.motion===null?e:{...e,motion:{...e.motion,enabled:!0}})}),w(K.StreamBrokerMetricsSnapshot,t=>{let n=t.data;n.deviceId===e&&i(e=>e===void 0||e.broker===null?e:{...e,broker:{...e.broker,profiles:e.broker.profiles.map(e=>e.profile===n.profile?{...e,subscribers:n.stats.encodedSubscribers+n.stats.decodedSubscribers,inFps:n.stats.inputFps,outFps:n.stats.decodeFps}:e)}})}),w(K.PipelineAudioInferenceResult,t=>{t.data.deviceId===e&&i(e=>e===void 0||e.audio===null?e:{...e,audio:{...e.audio,enabled:!0}})}),w(K.RecordingStarted,t=>{t.data.deviceId===e&&i(e=>e===void 0||e.recording===null?e:{...e,recording:{...e.recording,active:!0}})}),w(K.RecordingStopped,t=>{t.data.deviceId===e&&i(e=>e===void 0||e.recording===null?e:{...e,recording:{...e.recording,active:!1}})}),{status:r,isLoading:n}}function fr({data:e}){return z(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[W(X,{type:`source`,position:Y.Right}),z(`div`,{className:`flex items-center gap-2`,children:[W(`span`,{className:`h-2 w-2 rounded-full bg-green-500 shrink-0`,"aria-label":`healthy`}),z(`span`,{className:`text-sm font-semibold truncate`,children:[`Camera #`,e.deviceId]})]}),W(`div`,{className:`text-xs text-muted-foreground mt-1`,children:`source`})]})}function pr(e){return e>0?`bg-green-500`:`bg-yellow-500`}function mr({data:e}){let t=e.streams[0],n=e.streams.length;return z(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[W(X,{type:`target`,position:Y.Left}),W(X,{type:`source`,position:Y.Right}),z(`div`,{className:`flex items-center gap-2`,children:[W(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${pr(n)}`,"aria-label":n>0?`healthy`:`idle`}),W(`span`,{className:`text-sm font-semibold`,children:`Source`}),z(`span`,{className:`text-xs text-muted-foreground`,children:[n,` streams`]})]}),t!==void 0&&z(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[t.codec,` `,t.width,`×`,t.height,` `,t.fps,`fps`]})]})}function hr(e){return e>0?`bg-green-500`:`bg-yellow-500`}function gr({data:e}){let t=e.profiles.reduce((e,t)=>e+t.subscribers,0),n=e.profiles.length;return z(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[W(X,{type:`target`,position:Y.Left}),W(X,{type:`source`,position:Y.Right}),z(`div`,{className:`flex items-center gap-2`,children:[W(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${hr(t)}`,"aria-label":t>0?`healthy`:`idle`}),W(`span`,{className:`text-sm font-semibold`,children:`Broker`}),z(`span`,{className:`text-xs text-muted-foreground`,children:[n,` profiles`]})]}),z(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[t,` subs · WebRTC `,e.webrtcSessions,e.rtspRestream&&` · RTSP`]})]})}function _r(e){return e>0?`bg-green-500`:`bg-yellow-500`}function vr(e,t){let n=e+t;return n>0?Math.round(e/n*100):0}function yr({data:e}){let t=vr(e.shm.getFrameHits,e.shm.getFrameMisses),n=e.offline===!0;return z(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2${n?` opacity-50`:``}`,children:[W(X,{type:`target`,position:Y.Left}),W(X,{type:`source`,position:Y.Right}),z(`div`,{className:`flex items-center gap-2`,children:[W(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${_r(e.sessionCount)}`,"aria-label":e.sessionCount>0?`healthy`:`idle`}),W(`span`,{className:`text-sm font-semibold`,children:`Decoder`}),z(`span`,{className:`text-xs text-muted-foreground`,children:[`@`,e.nodeId]}),n&&W(`span`,{className:`text-[9px] font-semibold px-1 py-0.5 rounded bg-destructive/10 text-destructive`,"aria-label":`offline`,children:`offline`})]}),z(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.formats.join(`, `),` · `,e.sessionCount,` sessions`]}),z(`div`,{className:`text-xs text-muted-foreground`,children:[`shm `,t,`% hit`]})]})}function br(e){return e?`bg-green-500`:`bg-yellow-500`}function xr({data:e}){return z(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[W(X,{type:`target`,position:Y.Left}),z(`div`,{className:`flex items-center gap-2`,children:[W(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${br(e.enabled)}`,"aria-label":e.enabled?`enabled`:`disabled`}),W(`span`,{className:`text-sm font-semibold`,children:`Motion`})]}),z(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.enabled?`enabled`:`disabled`,` · `,e.fps,` fps`]})]})}function Sr(e){return e.provisioning.state===`failed`?`bg-red-500`:e.phase===`active`?`bg-green-500`:(e.phase,`bg-yellow-500`)}function Cr(e){return e===`ready`?`bg-green-500 text-white`:e===`failed`?`bg-red-500 text-white`:`bg-yellow-500 text-white`}function wr({data:e}){let t=e.offline===!0;return z(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[180px] px-3 py-2${t?` opacity-50`:``}`,children:[W(X,{type:`target`,position:Y.Left}),z(`div`,{className:`flex items-center gap-2`,children:[W(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${Sr(e)}`,"aria-label":e.phase}),W(`span`,{className:`text-sm font-semibold`,children:`Detection`}),z(`span`,{className:`text-xs text-muted-foreground`,children:[`@`,e.nodeId]}),t&&W(`span`,{className:`text-[9px] font-semibold px-1 py-0.5 rounded bg-destructive/10 text-destructive`,"aria-label":`offline`,children:`offline`})]}),z(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.engine.backend,`·`,e.engine.device,` · `,e.phase]}),z(`div`,{className:`text-xs text-muted-foreground`,children:[e.actualFps.toFixed(1),`/`,e.configuredFps,` fps · q`,e.queueDepth,` ·`,` `,e.avgInferenceMs.toFixed(1),`ms`]}),z(`div`,{className:`flex items-center gap-1 mt-1`,children:[W(`span`,{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded ${Cr(e.provisioning.state)}`,"aria-label":`provisioning ${e.provisioning.state}`,children:e.provisioning.state}),e.provisioning.state===`failed`&&e.provisioning.error!==void 0&&W(`span`,{className:`text-[10px] text-red-500 truncate`,children:e.provisioning.error})]})]})}function Tr(e){return e?`bg-green-500`:`bg-yellow-500`}function Er({data:e}){let t=e.offline===!0;return z(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2${t?` opacity-50`:``}`,children:[W(X,{type:`target`,position:Y.Left}),z(`div`,{className:`flex items-center gap-2`,children:[W(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${Tr(e.enabled)}`,"aria-label":e.enabled?`enabled`:`disabled`}),W(`span`,{className:`text-sm font-semibold`,children:`Audio`}),z(`span`,{className:`text-xs text-muted-foreground`,children:[`@`,e.nodeId]}),t&&W(`span`,{className:`text-[9px] font-semibold px-1 py-0.5 rounded bg-destructive/10 text-destructive`,"aria-label":`offline`,children:`offline`})]}),W(`div`,{className:`text-xs text-muted-foreground mt-1`,children:e.enabled?`enabled`:`disabled`})]})}function Dr(e){return e.mode===`off`?`bg-red-500`:e.active?`bg-green-500`:`bg-yellow-500`}function Or(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GB`:`${(e/1048576).toFixed(1)} MB`}function kr({data:e}){return z(`div`,{className:`border border-border rounded-lg bg-background shadow-sm min-w-[160px] px-3 py-2`,children:[W(X,{type:`target`,position:Y.Left}),z(`div`,{className:`flex items-center gap-2`,children:[W(`span`,{className:`h-2 w-2 rounded-full shrink-0 ${Dr(e)}`,"aria-label":e.active?`active`:e.mode===`off`?`off`:`inactive`}),W(`span`,{className:`text-sm font-semibold`,children:`Recorder`}),W(`span`,{className:`text-xs text-muted-foreground`,children:e.mode})]}),z(`div`,{className:`text-xs text-muted-foreground mt-1`,children:[e.active?`active`:`inactive`,` · `,Or(e.storageBytes)]})]})}R();var Ar={camera:fr,source:mr,broker:gr,decoder:yr,motion:xr,detection:wr,audio:Er,recorder:kr},jr={stroke:`#f59e0b`,strokeWidth:2},Mr={strokeWidth:1.5},Nr=`camstack-pipeline-flow-layout`,Pr=`Camera → Source → Broker → Decoder → Motion · Detection · Audio · Recorder`,Fr={padding:.2};function Ir({deviceId:e}){let{status:t,isLoading:n}=dr(e),{data:r}=a(void 0),i=B(()=>{let e=new Set;for(let t of r??[])t.isOnline||e.add(t.id);return e},[r]),{computedNodes:o,rfEdges:s}=B(()=>{if(t===void 0)return{computedNodes:[],rfEdges:[]};let e=ur(t);return{computedNodes:e.nodes.map(e=>({id:e.id,type:e.kind,position:{x:e.position.x,y:e.position.y},data:{...e.data,offline:e.nodeId!==null&&i.has(e.nodeId)}})),rfEdges:e.edges.map(e=>({id:e.id,source:e.source,target:e.target,animated:e.crossNode,style:e.crossNode?jr:Mr,label:e.label}))}},[t,i]),{nodes:c,onNodesChange:l,resetLayout:u}=et(`${Nr}:${e}`,o);return n?W(`div`,{className:`flex items-center justify-center h-full text-sm text-muted-foreground`,children:`Loading…`}):t===void 0?W(`div`,{className:`flex items-center justify-center h-full text-sm text-muted-foreground`,children:`No pipeline data`}):z(`div`,{className:`w-full h-full relative overflow-hidden`,children:[z(`div`,{className:`absolute top-2 left-2 z-10 max-w-[calc(100%-7rem)] rounded border border-border bg-background/90 px-2 py-1 backdrop-blur-sm`,children:[W(`div`,{className:`text-xs font-semibold text-foreground`,children:`Pipeline flow`}),W(`div`,{className:`text-[10px] text-muted-foreground truncate`,children:Pr})]}),W(`button`,{type:`button`,onClick:u,className:`absolute top-2 right-2 z-10 text-xs px-2 py-1 rounded border border-border bg-background hover:bg-muted`,title:`Restore the automatic layout, discarding dragged positions`,children:`Reset layout`}),z(tt,{nodes:c,edges:s,onNodesChange:l,nodesDraggable:!0,nodeTypes:Ar,fitView:!0,fitViewOptions:Fr,minZoom:.2,proOptions:{hideAttribution:!0},children:[W(Qe,{gap:20,size:1}),W(Ze,{showInteractive:!1})]})]})}R();var Lr=`__cluster__`;function Rr(e){return e===`cameras`?`cameras`:`nodes`}function zr(){let[e,t]=ze(),n=Rr(e.get(`view`)),r=e.get(`node`)??`__cluster__`,i=e.get(`camera`),a=i===null?null:parseInt(i,10),[o,s]=U(0),[c,l]=U(!1);return G(()=>{n===`nodes`&&!e.get(`node`)&&t({view:`nodes`,node:Lr},{replace:!0})},[n,e,t]),z(`div`,{className:`flex flex-col h-full overflow-hidden`,children:[z(`div`,{className:`flex items-center justify-between gap-4 px-4 py-3 border-b border-border shrink-0`,children:[z(`div`,{className:`flex items-center gap-1 rounded-lg border border-border p-0.5 bg-surface`,children:[W(`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`}),W(`button`,{type:`button`,onClick:()=>{let e={view:`cameras`};a!==null&&(e.camera=String(a)),t(e,{replace:!0})},className:[`px-3 py-1 rounded-md text-[11px] font-medium transition-colors`,n===`cameras`?`bg-background text-foreground shadow-sm`:`text-foreground-subtle hover:text-foreground`].join(` `),children:`Cameras`})]}),z(`button`,{type:`button`,onClick:()=>s(e=>e+1),title:`Refresh`,className:`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:[W(Me,{className:`h-3.5 w-3.5`}),`Refresh`]})]}),z(`button`,{type:`button`,onClick:()=>l(e=>!e),"aria-expanded":c,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:[z(`span`,{children:[c?`Hide`:`Show`,` `,n===`nodes`?`node list`:`camera list`]}),W(Ve,{className:[`h-4 w-4 transition-transform`,c?`rotate-180`:``].join(` `)})]}),W(`div`,{className:`flex-1 flex flex-col md:flex-row overflow-hidden min-h-0`,children:n===`nodes`?z(V,{children:[W(`aside`,{className:[c?`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:W(ht,{selectedNodeId:r,onSelect:e=>{t({view:`nodes`,node:e},{replace:!0}),l(!1)},refreshToken:o})}),W(`section`,{className:`flex-1 min-h-0 overflow-hidden`,children:r===`__cluster__`?W(Zn,{refreshToken:o}):W(on,{nodeId:r,refreshToken:o})})]}):z(V,{children:[W(`aside`,{className:[c?`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:W(nr,{selectedDeviceId:a,onSelect:e=>{t({view:`cameras`,camera:String(e)},{replace:!0}),l(!1)}})}),W(`section`,{className:`flex-1 min-h-0 overflow-hidden`,children:a!==null&&Number.isFinite(a)&&!Number.isNaN(a)?W(Ir,{deviceId:a}):W(`div`,{className:`flex items-center justify-center h-full text-sm text-foreground-subtle`,children:`Select a camera to view its pipeline flow`})})]})})]})}export{zr as PipelinePage};
@@ -1 +1 @@
1
- import{Ma as e,Na as t,Pa as n}from"./src-Dp6qXTLR.js";import{I as r,K as i,Q as a,S as o,W as s,b as c,q as l,x as u,z as d}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{L as f,V as p,c as ee,g as m,n as h,p as g,s as te}from"./player-overlays-CpsGl45o.js";import{MaskShapeCanvas as _}from"./MaskShapeCanvas-pGn6MKOi.js";var ne=m(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]);a();var v=120,y=`privacy-mask`,b=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,x=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`;function S(e){return e.kind===`rect`||e.kind===`polygon`?e:null}function re(e){let t=new Set(e.map(e=>e.id)),n=0;for(;t.has(n);)n+=1;return n}function C(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(JSON.stringify(e[n])!==JSON.stringify(t[n]))return!1;return!0}function w({deviceId:a}){let m=ee(g().trpcClient,a),[w,T]=l(null),[E,D]=l(!1),[O,k]=l(null),[A,j]=l(null),[M,N]=l(!1),[P,F]=l(!1),[I,L]=l(null),[R,z]=l(null),B=i(!1);d(()=>{if(!m)return;let e=!1;return B.current=!1,T(null),D(!1),k(null),j(null),F(!1),L(null),z(null),(async()=>{try{let t=await m.privacyMask?.getOptions({});if(e)return;if(!t)throw Error(`device proxy not ready`);if(T(t),B.current)return;let n=await m.privacyMask?.getStatus({});if(e)return;if(!n)throw Error(`device proxy not ready`);B.current=!0;let r={enabled:n.enabled,regions:n.regions};j(r),k(r)}catch(t){if(e)return;p(t)?D(!0):console.error(`Privacy Mask load failed`,t)}})(),()=>{e=!0}},[m]);let V=s(()=>O!==null&&A!==null&&(O.enabled!==A.enabled||!C(O.regions,A.regions)),[O,A]),H=O?O.regions.length:0,U=w?w.maxRegions:0,W=i(0);d(()=>{W.current=U},[U]);let G=U>0&&H>=U,K=r(()=>{k(e=>e&&{...e,enabled:!e.enabled})},[]),q=r(e=>{L(typeof e==`number`?e:null)},[]),J=s(()=>O?O.regions.map(e=>({id:e.id,shape:e.shape,enabled:e.enabled,label:`Zone ${String(e.id)}`})):[],[O]),Y=r((e,t)=>{let n=S(t);n&&k(t=>t&&{...t,regions:t.regions.map(t=>t.id===e?{...t,shape:n}:t)})},[]),X=r(e=>{let t=S(e);t&&(z(null),k(e=>{if(!e)return e;let n=W.current;if(n>0&&e.regions.length>=n)return e;let r=re(e.regions),i={id:r,enabled:!0,shape:t};return L(r),{...e,regions:[...e.regions,i]}}))},[]),Z=r(e=>{F(!0),L(null),z(e)},[]),ie=r(e=>{F(!0),z(null),L(e)},[]),ae=r(e=>{L(t=>t===e?null:t),k(t=>t&&{...t,regions:t.regions.filter(t=>t.id!==e)})},[]),oe=r(()=>{z(null),L(null),A&&k({enabled:A.enabled,regions:A.regions})},[A]),se=r(async()=>{if(!(!m||!O)){N(!0);try{await m.privacyMask?.setMask({patch:{enabled:O.enabled,regions:[...O.regions]}});let e=await m.privacyMask?.getStatus({});if(e){let t={enabled:e.enabled,regions:e.regions};j(t),k(t)}}catch(e){console.error(`Privacy Mask save failed`,e)}finally{N(!1)}}},[m,O]),ce=r(()=>{F(e=>(e&&(z(null),L(null)),!e))},[]),Q=w?.supportedShapes??[];h(s(()=>P&&!E&&w&&O?{id:y,order:v,node:u(_,{transparent:!0,items:J,supportedShapes:Q,polygonVertices:w.polygonVertices,selectedId:I,onSelect:q,onShapeChange:Y,onDrawComplete:X,drawingKind:R})}:null,[P,E,w,O,J,Q,I,q,Y,X,R]));let le=w?.supportedShapes.includes(`rect`)??!1,ue=w?.supportedShapes.includes(`polygon`)??!1,$=w!==null&&(w.maxRegions<=0||w.supportedShapes.length===0);return m?u(te,{title:`Privacy Mask`,icon:u(n,{className:`h-3.5 w-3.5 text-foreground-subtle`}),children:u(`div`,{className:`flex flex-col gap-3`,children:E||$?u(`p`,{className:`${f} leading-relaxed`,children:`This camera doesn't support an on-board privacy mask.`}):!E&&!$&&w!==null&&O!==null?o(c,{children:[o(`p`,{className:`${f} leading-relaxed`,children:[`Toggle `,u(`strong`,{className:`text-foreground`,children:`Edit mask`}),` to draw blanked-out zones on the live frame, then `,u(`strong`,{className:`text-foreground`,children:`Save`}),` to push them to the camera. Drag a rectangle to move, its corner to resize; drag polygon vertices, click an edge midpoint to add one, or right-click a vertex to remove it.`]}),o(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[u(`button`,{type:`button`,onClick:ce,disabled:M,"aria-pressed":P,className:P?x:b,children:P?`Done editing`:`Edit mask`}),u(`button`,{type:`button`,onClick:K,disabled:M,"aria-pressed":O.enabled,className:O.enabled?x:b,children:O.enabled?`Mask on`:`Mask off`}),le&&u(`button`,{type:`button`,onClick:()=>Z(`rect`),disabled:M||G,"aria-pressed":R===`rect`,className:R===`rect`?x:b,title:G?`Maximum zones reached`:`Add a rectangle zone`,children:`+ Rect`}),ue&&u(`button`,{type:`button`,onClick:()=>Z(`polygon`),disabled:M||G,"aria-pressed":R===`polygon`,className:R===`polygon`?x:b,title:G?`Maximum zones reached`:`Add a polygon zone`,children:`+ Polygon`}),o(`span`,{className:`${f} ml-1 tabular-nums`,children:[H,` / `,U,` zones`]}),u(`span`,{className:`flex-1`}),u(`button`,{type:`button`,onClick:oe,disabled:M||!V,className:`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,children:`Revert`}),u(`button`,{type:`button`,onClick:()=>void se(),disabled:M||!V,className:x,children:M?`Saving…`:`Save`})]}),H>0?u(`div`,{className:`flex flex-col gap-1`,children:O.regions.map(n=>{let r=I===n.id,i=n.shape.kind===`polygon`?ne:t;return o(`div`,{className:`flex items-center gap-2 rounded-md border px-2 py-1 transition-colors ${r?`border-primary/50 bg-primary/10`:`border-border bg-surface`}`,children:[o(`button`,{type:`button`,onClick:()=>ie(n.id),disabled:M,className:`flex flex-1 items-center gap-2 text-left text-[11px] font-medium text-foreground-subtle hover:text-foreground disabled:opacity-40 transition-colors`,children:[u(i,{className:`h-3.5 w-3.5 shrink-0`}),o(`span`,{children:[`Zone `,n.id]}),u(`span`,{className:`text-foreground-faint capitalize`,children:n.shape.kind})]}),u(`button`,{type:`button`,onClick:()=>ae(n.id),disabled:M,"aria-label":`Delete zone ${String(n.id)}`,title:`Delete zone`,className:`inline-flex h-6 w-6 items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:border-red-400/40 hover:bg-red-500/10 hover:text-red-400 disabled:opacity-40 transition-colors`,children:u(e,{className:`h-3.5 w-3.5`})})]},n.id)})}):null]}):u(`p`,{className:`${f} leading-relaxed`,children:`Loading the camera's privacy mask…`})})}):null}export{w as PrivacyMaskSettings};
1
+ import{Ma as e,Na as t,Pa as n}from"./src-BZ1dd5LI.js";import{I as r,K as i,Q as a,S as o,W as s,b as c,q as l,x as u,z as d}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{L as f,V as p,c as ee,g as m,n as h,p as g,s as te}from"./player-overlays-CpsGl45o.js";import{MaskShapeCanvas as _}from"./MaskShapeCanvas-pGn6MKOi.js";var ne=m(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]);a();var v=120,y=`privacy-mask`,b=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,x=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`;function S(e){return e.kind===`rect`||e.kind===`polygon`?e:null}function re(e){let t=new Set(e.map(e=>e.id)),n=0;for(;t.has(n);)n+=1;return n}function C(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(JSON.stringify(e[n])!==JSON.stringify(t[n]))return!1;return!0}function w({deviceId:a}){let m=ee(g().trpcClient,a),[w,T]=l(null),[E,D]=l(!1),[O,k]=l(null),[A,j]=l(null),[M,N]=l(!1),[P,F]=l(!1),[I,L]=l(null),[R,z]=l(null),B=i(!1);d(()=>{if(!m)return;let e=!1;return B.current=!1,T(null),D(!1),k(null),j(null),F(!1),L(null),z(null),(async()=>{try{let t=await m.privacyMask?.getOptions({});if(e)return;if(!t)throw Error(`device proxy not ready`);if(T(t),B.current)return;let n=await m.privacyMask?.getStatus({});if(e)return;if(!n)throw Error(`device proxy not ready`);B.current=!0;let r={enabled:n.enabled,regions:n.regions};j(r),k(r)}catch(t){if(e)return;p(t)?D(!0):console.error(`Privacy Mask load failed`,t)}})(),()=>{e=!0}},[m]);let V=s(()=>O!==null&&A!==null&&(O.enabled!==A.enabled||!C(O.regions,A.regions)),[O,A]),H=O?O.regions.length:0,U=w?w.maxRegions:0,W=i(0);d(()=>{W.current=U},[U]);let G=U>0&&H>=U,K=r(()=>{k(e=>e&&{...e,enabled:!e.enabled})},[]),q=r(e=>{L(typeof e==`number`?e:null)},[]),J=s(()=>O?O.regions.map(e=>({id:e.id,shape:e.shape,enabled:e.enabled,label:`Zone ${String(e.id)}`})):[],[O]),Y=r((e,t)=>{let n=S(t);n&&k(t=>t&&{...t,regions:t.regions.map(t=>t.id===e?{...t,shape:n}:t)})},[]),X=r(e=>{let t=S(e);t&&(z(null),k(e=>{if(!e)return e;let n=W.current;if(n>0&&e.regions.length>=n)return e;let r=re(e.regions),i={id:r,enabled:!0,shape:t};return L(r),{...e,regions:[...e.regions,i]}}))},[]),Z=r(e=>{F(!0),L(null),z(e)},[]),ie=r(e=>{F(!0),z(null),L(e)},[]),ae=r(e=>{L(t=>t===e?null:t),k(t=>t&&{...t,regions:t.regions.filter(t=>t.id!==e)})},[]),oe=r(()=>{z(null),L(null),A&&k({enabled:A.enabled,regions:A.regions})},[A]),se=r(async()=>{if(!(!m||!O)){N(!0);try{await m.privacyMask?.setMask({patch:{enabled:O.enabled,regions:[...O.regions]}});let e=await m.privacyMask?.getStatus({});if(e){let t={enabled:e.enabled,regions:e.regions};j(t),k(t)}}catch(e){console.error(`Privacy Mask save failed`,e)}finally{N(!1)}}},[m,O]),ce=r(()=>{F(e=>(e&&(z(null),L(null)),!e))},[]),Q=w?.supportedShapes??[];h(s(()=>P&&!E&&w&&O?{id:y,order:v,node:u(_,{transparent:!0,items:J,supportedShapes:Q,polygonVertices:w.polygonVertices,selectedId:I,onSelect:q,onShapeChange:Y,onDrawComplete:X,drawingKind:R})}:null,[P,E,w,O,J,Q,I,q,Y,X,R]));let le=w?.supportedShapes.includes(`rect`)??!1,ue=w?.supportedShapes.includes(`polygon`)??!1,$=w!==null&&(w.maxRegions<=0||w.supportedShapes.length===0);return m?u(te,{title:`Privacy Mask`,icon:u(n,{className:`h-3.5 w-3.5 text-foreground-subtle`}),children:u(`div`,{className:`flex flex-col gap-3`,children:E||$?u(`p`,{className:`${f} leading-relaxed`,children:`This camera doesn't support an on-board privacy mask.`}):!E&&!$&&w!==null&&O!==null?o(c,{children:[o(`p`,{className:`${f} leading-relaxed`,children:[`Toggle `,u(`strong`,{className:`text-foreground`,children:`Edit mask`}),` to draw blanked-out zones on the live frame, then `,u(`strong`,{className:`text-foreground`,children:`Save`}),` to push them to the camera. Drag a rectangle to move, its corner to resize; drag polygon vertices, click an edge midpoint to add one, or right-click a vertex to remove it.`]}),o(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[u(`button`,{type:`button`,onClick:ce,disabled:M,"aria-pressed":P,className:P?x:b,children:P?`Done editing`:`Edit mask`}),u(`button`,{type:`button`,onClick:K,disabled:M,"aria-pressed":O.enabled,className:O.enabled?x:b,children:O.enabled?`Mask on`:`Mask off`}),le&&u(`button`,{type:`button`,onClick:()=>Z(`rect`),disabled:M||G,"aria-pressed":R===`rect`,className:R===`rect`?x:b,title:G?`Maximum zones reached`:`Add a rectangle zone`,children:`+ Rect`}),ue&&u(`button`,{type:`button`,onClick:()=>Z(`polygon`),disabled:M||G,"aria-pressed":R===`polygon`,className:R===`polygon`?x:b,title:G?`Maximum zones reached`:`Add a polygon zone`,children:`+ Polygon`}),o(`span`,{className:`${f} ml-1 tabular-nums`,children:[H,` / `,U,` zones`]}),u(`span`,{className:`flex-1`}),u(`button`,{type:`button`,onClick:oe,disabled:M||!V,className:`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,children:`Revert`}),u(`button`,{type:`button`,onClick:()=>void se(),disabled:M||!V,className:x,children:M?`Saving…`:`Save`})]}),H>0?u(`div`,{className:`flex flex-col gap-1`,children:O.regions.map(n=>{let r=I===n.id,i=n.shape.kind===`polygon`?ne:t;return o(`div`,{className:`flex items-center gap-2 rounded-md border px-2 py-1 transition-colors ${r?`border-primary/50 bg-primary/10`:`border-border bg-surface`}`,children:[o(`button`,{type:`button`,onClick:()=>ie(n.id),disabled:M,className:`flex flex-1 items-center gap-2 text-left text-[11px] font-medium text-foreground-subtle hover:text-foreground disabled:opacity-40 transition-colors`,children:[u(i,{className:`h-3.5 w-3.5 shrink-0`}),o(`span`,{children:[`Zone `,n.id]}),u(`span`,{className:`text-foreground-faint capitalize`,children:n.shape.kind})]}),u(`button`,{type:`button`,onClick:()=>ae(n.id),disabled:M,"aria-label":`Delete zone ${String(n.id)}`,title:`Delete zone`,className:`inline-flex h-6 w-6 items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:border-red-400/40 hover:bg-red-500/10 hover:text-red-400 disabled:opacity-40 transition-colors`,children:u(e,{className:`h-3.5 w-3.5`})})]},n.id)})}):null]}):u(`p`,{className:`${f} leading-relaxed`,children:`Loading the camera's privacy mask…`})})}):null}export{w as PrivacyMaskSettings};
@@ -1 +1 @@
1
- import{Q as e,S as t,q as n,x as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{t as i}from"./radio-Bvao3n8m.js";import{t as a}from"./server-BrIBBG6H.js";import{t as o}from"./wifi-CyY3elJf.js";import{V as s}from"./index-CpCNvkGK.js";var c=s(`cctv`,[[`path`,{d:`M16.75 12h3.632a1 1 0 0 1 .894 1.447l-2.034 4.069a1 1 0 0 1-1.708.134l-2.124-2.97`,key:`ir91b5`}],[`path`,{d:`M17.106 9.053a1 1 0 0 1 .447 1.341l-3.106 6.211a1 1 0 0 1-1.342.447L3.61 12.3a2.92 2.92 0 0 1-1.3-3.91L3.69 5.6a2.92 2.92 0 0 1 3.92-1.3z`,key:`jlp8i1`}],[`path`,{d:`M2 19h3.76a2 2 0 0 0 1.8-1.1L9 15`,key:`19bib8`}],[`path`,{d:`M2 21v-4`,key:`l40lih`}],[`path`,{d:`M7 9h.01`,key:`19b3jx`}]]),l=s(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]);e();var u={frigate:{icon:c,color:`#3b82f6`,label:`Frigate`},scrypted:{icon:a,color:`#a855f7`,label:`Scrypted`},reolink:{icon:i,color:`#06b6d4`,label:`Reolink`},homeassistant:{icon:l,color:`#22d3ee`,label:`Home Assistant`},rtsp:{icon:o,color:`#78716c`,label:`RTSP`},onvif:{icon:o,color:`#78716c`,label:`ONVIF`}},d={sm:`h-4 w-4`,md:`h-5 w-5`,lg:`h-6 w-6`},f={sm:`h-7 w-7`,md:`h-8 w-8`,lg:`h-10 w-10`};function p(e){let t=e.toLowerCase();return t.startsWith(`provider-`)?t.slice(9):t}function m(e){return u[p(e)]??{icon:c,color:`#78716c`,label:e}}function h(e){let t=p(e);return`/api/addon-assets/${e.toLowerCase().startsWith(`provider-`)?e:`provider-${t}`}/assets/icon.svg`}function g({type:e,size:i=`md`,showLabel:a}){let o=m(e),s=o.icon,[c,l]=n(!1),u=h(e);return t(`div`,{className:`flex items-center gap-2`,children:[r(`div`,{className:`flex items-center justify-center rounded-lg ${f[i]}`,style:{backgroundColor:`${o.color}15`},children:c?r(s,{className:d[i],style:{color:o.color}}):r(`img`,{src:u,alt:o.label,className:d[i],onError:()=>l(!0)})}),a&&r(`span`,{className:`text-xs font-medium text-foreground-subtle`,children:o.label})]})}export{g as t};
1
+ import{Q as e,S as t,q as n,x as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{t as i}from"./radio-DO0Dq2MF.js";import{t as a}from"./server-CaW_paWO.js";import{t as o}from"./wifi-BeF9XXWL.js";import{V as s}from"./index-CY52lvbZ.js";var c=s(`cctv`,[[`path`,{d:`M16.75 12h3.632a1 1 0 0 1 .894 1.447l-2.034 4.069a1 1 0 0 1-1.708.134l-2.124-2.97`,key:`ir91b5`}],[`path`,{d:`M17.106 9.053a1 1 0 0 1 .447 1.341l-3.106 6.211a1 1 0 0 1-1.342.447L3.61 12.3a2.92 2.92 0 0 1-1.3-3.91L3.69 5.6a2.92 2.92 0 0 1 3.92-1.3z`,key:`jlp8i1`}],[`path`,{d:`M2 19h3.76a2 2 0 0 0 1.8-1.1L9 15`,key:`19bib8`}],[`path`,{d:`M2 21v-4`,key:`l40lih`}],[`path`,{d:`M7 9h.01`,key:`19b3jx`}]]),l=s(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]);e();var u={frigate:{icon:c,color:`#3b82f6`,label:`Frigate`},scrypted:{icon:a,color:`#a855f7`,label:`Scrypted`},reolink:{icon:i,color:`#06b6d4`,label:`Reolink`},homeassistant:{icon:l,color:`#22d3ee`,label:`Home Assistant`},rtsp:{icon:o,color:`#78716c`,label:`RTSP`},onvif:{icon:o,color:`#78716c`,label:`ONVIF`}},d={sm:`h-4 w-4`,md:`h-5 w-5`,lg:`h-6 w-6`},f={sm:`h-7 w-7`,md:`h-8 w-8`,lg:`h-10 w-10`};function p(e){let t=e.toLowerCase();return t.startsWith(`provider-`)?t.slice(9):t}function m(e){return u[p(e)]??{icon:c,color:`#78716c`,label:e}}function h(e){let t=p(e);return`/api/addon-assets/${e.toLowerCase().startsWith(`provider-`)?e:`provider-${t}`}/assets/icon.svg`}function g({type:e,size:i=`md`,showLabel:a}){let o=m(e),s=o.icon,[c,l]=n(!1),u=h(e);return t(`div`,{className:`flex items-center gap-2`,children:[r(`div`,{className:`flex items-center justify-center rounded-lg ${f[i]}`,style:{backgroundColor:`${o.color}15`},children:c?r(s,{className:d[i],style:{color:o.color}}):r(`img`,{src:u,alt:o.label,className:d[i],onError:()=>l(!0)})}),a&&r(`span`,{className:`text-xs font-medium text-foreground-subtle`,children:o.label})]})}export{g as t};
@@ -1 +1 @@
1
- import{An as e,En as t,Kt as n,Xt as r,Zt as i,gn as a,mn as o,on as s}from"./src-Dp6qXTLR.js";import{I as c,K as l,Q as u,S as d,W as f,b as p,q as m,x as h,z as g}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{t as _}from"./download-D2Hdt3_T.js";import{t as v}from"./refresh-cw-B3eKxMWT.js";import{D as y,F as b,N as x,V as S,i as C,o as w,x as T}from"./index-CpCNvkGK.js";import{t as E}from"./FormBuilder-BHrYFTqO.js";import{t as D}from"./BrokerForm-DxBh4Ab_.js";var O=S(`radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]);u();var k=[`amazon.com`,`amazon.it`,`amazon.de`,`amazon.co.uk`,`amazon.fr`,`amazon.es`,`amazon.ca`,`amazon.com.au`,`amazon.co.jp`,`amazon.in`,`amazon.com.br`,`amazon.com.mx`],A=`/addon/import-alexa`,j=2e3;function M(e){return typeof e==`object`&&!!e&&typeof e.sessionId==`string`&&typeof e.loginUrl==`string`}function N(e){return typeof e==`object`&&!!e&&typeof e.phase==`string`&&typeof e.sessionId==`string`}function P(e){return typeof e==`object`&&!!e&&typeof e.brokerId==`string`}function F(e){return{"Content-Type":`application/json`,Authorization:`Bearer ${localStorage.getItem(`camstack_admin_token`)??``}`,...e}}async function I(e,t,n){let r=await fetch(`${A}${e}`,{method:`POST`,headers:F(),body:JSON.stringify(t)}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!n(i))throw Error(`Unexpected response from server`);return i}async function L(e){let t=new URLSearchParams({sessionId:e}),n=localStorage.getItem(`camstack_admin_token`)??``,r=await fetch(`${A}/login/status?${t.toString()}`,{headers:{Authorization:`Bearer ${n}`}}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!N(i))throw Error(`Unexpected status response from server`);return i}async function R(e){try{await fetch(`${A}/login/cancel`,{method:`POST`,headers:F(),body:JSON.stringify({sessionId:e})})}catch{}}function z({brokerId:e,onResolved:t,onCancel:n}){let[r,i]=m(`amazon.it`),[a,o]=m(`Alexa account`),[s,u]=m({kind:`idle`}),f=l(!0);g(()=>(f.current=!0,()=>{f.current=!1}),[]);let p=l(null),_=l(null),b=c(()=>{_.current!==null&&(clearInterval(_.current),_.current=null)},[]),x=c(async n=>{b(),f.current&&u({kind:`committing`,sessionId:n});try{let r=await I(`/login/commit`,{sessionId:n,name:a.trim().length>0?a.trim():`Alexa account`,...e===void 0?{}:{brokerId:e}},P);p.current=null,t(r.brokerId)}catch(e){let t=e instanceof Error?e.message:String(e);f.current&&u({kind:`error`,message:t,sessionId:n})}},[e,a,t,b]),S=c((e,t)=>{b();let n=async()=>{try{let n=await L(e);if(n.phase===`captured`){b(),x(e);return}if(n.phase===`error`){b(),f.current&&u({kind:`error`,message:n.error??`Login proxy returned an error`,sessionId:e});return}if(n.phase===`cancelled`){b(),f.current&&u({kind:`idle`});return}f.current&&u({kind:`polling`,sessionId:e,loginUrl:n.loginUrl||t,phase:n.phase})}catch(e){let t=e instanceof Error?e.message:String(e);f.current&&u(e=>e.kind===`polling`?{...e}:{kind:`error`,message:t,sessionId:null})}};_.current=setInterval(()=>{n()},j)},[b,x]);g(()=>()=>{b(),p.current!==null&&R(p.current)},[b]);let C=async()=>{b(),p.current!==null&&(R(p.current),p.current=null),u({kind:`starting`});try{let e=await I(`/login/start`,{amazonDomain:r},M);p.current=e.sessionId,u({kind:`polling`,sessionId:e.sessionId,loginUrl:e.loginUrl,phase:`starting`}),S(e.sessionId,e.loginUrl)}catch(e){u({kind:`error`,message:e instanceof Error?e.message:String(e),sessionId:null})}},E=()=>{b(),p.current!==null&&(R(p.current),p.current=null),u({kind:`idle`})},D=()=>{E()},O=s.kind===`idle`,A=s.kind===`starting`,N=s.kind===`polling`,F=s.kind===`committing`,z=s.kind===`error`,B=A||N||F,V=s.kind===`polling`?s.phase:null,H=s.kind===`polling`?s.loginUrl:null,U=N&&V===`awaiting-login`,W=N&&(V===`starting`||V===null);return d(`div`,{className:`space-y-4`,children:[(O||z)&&d(`div`,{className:`space-y-3`,children:[e===void 0&&d(`div`,{className:`space-y-1`,children:[h(`label`,{htmlFor:`alexa-account-name`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Account name`}),h(`input`,{id:`alexa-account-name`,type:`text`,value:a,onChange:e=>o(e.target.value),placeholder:`Alexa account`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),d(`div`,{className:`space-y-1`,children:[h(`label`,{htmlFor:`alexa-amazon-region`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Amazon region`}),h(`select`,{id:`alexa-amazon-region`,value:r,onChange:e=>i(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,children:k.map(e=>h(`option`,{value:e,children:e},e))})]})]}),z&&d(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px] flex items-start gap-2`,children:[h(w,{className:`h-3.5 w-3.5 mt-0.5 flex-shrink-0`}),h(`span`,{children:s.message})]}),A&&d(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[h(T,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Starting login proxy…`]}),W&&d(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[h(T,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Waiting for proxy to be ready…`]}),F&&d(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[h(T,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Saving credentials…`]}),U&&H!==null&&d(`div`,{className:`space-y-3`,children:[d(`div`,{className:`rounded-lg border border-border bg-surface p-3 space-y-2`,children:[h(`p`,{className:`text-xs font-semibold text-foreground`,children:`Open the link below to log in to your Amazon account`}),h(`p`,{className:`text-[10px] text-foreground-subtle`,children:`After completing the login and any 2FA steps, this wizard will continue automatically.`}),d(`a`,{href:H,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:[h(y,{className:`h-3.5 w-3.5`}),`Login to Amazon`]})]}),d(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[10px] text-amber-700 dark:text-amber-300`,children:[h(`strong`,{children:`Note:`}),` The login proxy runs directly on the hub. If the link does not open or the page does not load, make sure the hub's proxy host and port are reachable from your browser. You can configure `,h(`code`,{className:`font-mono`,children:`proxyHost`}),` in the Alexa addon settings and ensure the proxy port is published (Docker port mapping).`]}),d(`div`,{className:`flex items-center gap-2 text-[10px] text-foreground-subtle`,children:[h(T,{className:`h-3 w-3 animate-spin`}),`Waiting for Amazon login to complete…`]})]}),d(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[h(`button`,{type:`button`,onClick:B?E:n,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:B?`Cancel login`:`Back`}),d(`div`,{className:`flex items-center gap-2`,children:[z&&d(`button`,{type:`button`,onClick:D,className:`inline-flex items-center gap-1.5 rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10`,children:[h(v,{className:`h-3.5 w-3.5`}),`Retry`]}),O&&h(`button`,{type:`button`,onClick:()=>{C()},disabled:e===void 0&&a.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Start login`})]})]})]})}u();var B=`alexa`;function V(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function H(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.addonId==`string`&&Array.isArray(e.kinds)):[]}var U={connected:`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`,connecting:`bg-amber-500/15 text-amber-700 dark:text-amber-300`,disconnected:`bg-foreground-subtle/15 text-foreground-subtle`,"auth-failed":`bg-danger/15 text-danger`,unreachable:`bg-danger/15 text-danger`,error:`bg-danger/15 text-danger`};function W({kind:e,onResolved:t,onBack:a}){let[o,s]=m(e===B?`alexa-login`:`existing`),c=r({kind:e}),l=f(()=>V(c.data).filter(t=>t.kind===e),[c.data,e]),u=i(),p=f(()=>{for(let t of H(u.data))if(t.kinds.some(t=>t.kind===e))return t.addonId},[u.data,e]),[g,_]=m(null),[v,y]=m(``),b=n({}),S=()=>{g&&t(g)},C=async n=>{v.trim().length!==0&&t((await b.mutateAsync({kind:e,name:v.trim(),settings:n,...p===void 0?{}:{addonId:p}})).id)},w=e=>{e===`new`?_(null):b.reset(),s(e)};return d(`div`,{className:`space-y-4`,children:[d(`button`,{type:`button`,onClick:a,className:`inline-flex items-center gap-1 text-[11px] text-foreground-subtle hover:text-foreground`,children:[h(x,{className:`h-3.5 w-3.5`}),` Back`]}),d(`div`,{className:`inline-flex rounded-lg border border-border p-0.5 flex-wrap gap-0.5`,children:[e===B&&h(`button`,{type:`button`,onClick:()=>w(`alexa-login`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${o===`alexa-login`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Login interactively`}),h(`button`,{type:`button`,onClick:()=>w(`existing`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${o===`existing`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Use existing`}),h(`button`,{type:`button`,onClick:()=>w(`new`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${o===`new`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:e===B?`Paste cookie`:`Create new`})]}),o===`alexa-login`&&h(z,{onResolved:t,onCancel:a}),o===`existing`&&d(`div`,{className:`space-y-3`,children:[c.isLoading&&d(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[h(T,{className:`h-3.5 w-3.5 animate-spin`}),` Loading brokers…`]}),c.isError&&d(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:[`Failed to load brokers:`,` `,c.error instanceof Error?c.error.message:`Unknown error`]}),!c.isLoading&&!c.isError&&l.length===0&&d(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-6 text-center text-xs text-foreground-subtle`,children:[`No brokers of this kind yet. Switch to`,` `,h(`span`,{className:`font-medium text-foreground`,children:e===B?`Login interactively`:`Create new`}),` `,`to register one.`]}),h(`div`,{className:`space-y-2`,children:l.map(e=>d(`button`,{type:`button`,onClick:()=>_(e.id),className:`flex w-full items-center justify-between gap-3 rounded-lg border bg-surface p-3 text-left transition-colors ${g===e.id?`border-primary ring-1 ring-primary`:`border-border hover:border-foreground-subtle/30`}`,children:[h(`span`,{className:`text-xs font-semibold text-foreground`,children:e.name}),h(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${U[e.status]}`,children:e.status})]},e.id))}),l.length>0&&h(`div`,{className:`flex justify-end pt-1`,children:h(`button`,{type:`button`,onClick:S,disabled:!g,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Use this broker`})})]}),o===`new`&&d(`div`,{className:`space-y-3`,children:[d(`div`,{className:`space-y-1`,children:[h(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Name`}),h(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`My Home Assistant`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),b.isError&&h(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:b.error instanceof Error?b.error.message:String(b.error)}),h(D,{kind:e,...p===void 0?{}:{addonId:p},onSubmit:e=>{C(e).catch(()=>{})},onCancel:a,submitLabel:b.isPending?`Creating…`:`Create broker`,disabled:b.isPending||v.trim().length===0}),v.trim().length===0&&h(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Enter a name before creating.`})]})]})}u();function G({open:e,onClose:n,scope:r}){let i=s(),[a,o]=m(new Set),[l,u]=m(new Set),{data:p}=t({}),g=f(()=>new Set((p??[]).map(e=>e.stableId)),[p]),v=c(async(e,t)=>{u(e=>new Set(e).add(t.stableId));try{await i.mutateAsync({addonId:e,candidate:t}),o(e=>new Set(e).add(t.stableId))}catch{}finally{u(e=>{let n=new Set(e);return n.delete(t.stableId),n})}},[i]),y=c((e,t)=>{let n=typeof t.prefilledConfig.host==`string`?t.prefilledConfig.host:null,r=g.has(t.stableId),i=a.has(t.stableId)||r,o=l.has(t.stableId);return d(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-surface px-3 py-2`,children:[d(`div`,{className:`min-w-0`,children:[h(`p`,{className:`truncate text-xs font-medium text-foreground`,children:t.suggestedName}),n&&h(`p`,{className:`truncate text-[10px] font-mono text-foreground-subtle`,children:n})]}),i?d(`span`,{className:`flex items-center gap-1 text-[11px] text-foreground-subtle`,children:[h(b,{className:`h-3.5 w-3.5`}),` `,r?`Already added`:`Added`]}):d(`button`,{type:`button`,onClick:()=>void v(e,t),disabled:o,className:`flex items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-50`,children:[o?h(T,{className:`h-3.5 w-3.5 animate-spin`}):h(_,{className:`h-3.5 w-3.5`}),`Add`]})]},t.stableId)},[a,l,g,v]);if(!e)return null;let x=r?`Scan network — ${r.label}`:`Scan network for devices`;return d(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[h(`div`,{className:`absolute inset-0 bg-black/60`,onClick:n}),d(`div`,{className:`relative z-10 flex w-full max-w-2xl flex-col max-h-[90vh] rounded-xl border border-border bg-background shadow-2xl`,children:[d(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[d(`div`,{className:`flex items-center gap-2`,children:[h(O,{className:`h-4 w-4 text-primary`}),h(`h2`,{className:`text-sm font-semibold text-foreground`,children:x})]}),h(`button`,{onClick:n,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:h(C,{className:`h-4 w-4`})})]}),r?h(q,{scope:r,onAdopt:y,onReset:()=>o(new Set)}):h(K,{onAdopt:y,onReset:()=>o(new Set)})]})]})}function K({onAdopt:e,onReset:t}){let n=o(),r=c(()=>{t(),n.mutate({})},[n,t]);g(()=>{!n.isPending&&!n.data&&r()},[]);let i=f(()=>(n.data?.groups??[]).filter(e=>e.candidates.length>0),[n.data]),a=f(()=>i.reduce((e,t)=>e+t.candidates.length,0),[i]);return d(p,{children:[h(`div`,{className:`flex items-center justify-end gap-2 border-b border-border px-5 py-2 shrink-0`,children:d(`button`,{onClick:r,disabled:n.isPending,className:`flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[h(v,{className:`h-3.5 w-3.5 ${n.isPending?`animate-spin`:``}`}),`Re-scan`]})}),d(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[n.isPending&&h(J,{label:`Scanning the local network…`}),!n.isPending&&n.isError&&h(Y,{}),!n.isPending&&n.data&&i.length===0&&h(`p`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!n.isPending&&i.length>0&&d(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,a,` device`,a===1?``:`s`,` on the network.`]}),!n.isPending&&i.map(t=>d(`div`,{className:`space-y-1.5`,children:[d(`div`,{className:`flex items-center gap-2`,children:[h(`span`,{className:`text-[11px] font-semibold text-foreground`,children:t.label}),d(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`(`,t.candidates.length,`)`]})]}),t.candidates.map(n=>e(t.addonId,n))]},t.addonId))]})]})}function q({scope:t,onAdopt:n,onReset:r}){let i=e({addonId:t.addonId}).data??null,[o,s]=m({}),l=a(),u=c(()=>{r(),l.mutate({addonId:t.addonId,params:o})},[l,t.addonId,o,r]),f=l.data?.candidates??[];return h(p,{children:d(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[i&&h(E,{schema:i,values:o,onChange:s}),d(`button`,{onClick:u,disabled:l.isPending,className:`flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:[l.isPending?h(T,{className:`h-3.5 w-3.5 animate-spin`}):h(O,{className:`h-3.5 w-3.5`}),l.isPending?`Scanning…`:`Scan`]}),l.isError&&h(Y,{}),!l.isPending&&l.data&&f.length===0&&h(`p`,{className:`py-6 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!l.isPending&&f.length>0&&d(`div`,{className:`space-y-1.5`,children:[d(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,f.length,` device`,f.length===1?``:`s`,`.`]}),f.map(e=>n(t.addonId,e))]})]})})}function J({label:e}){return d(`div`,{className:`flex flex-col items-center py-12`,children:[h(T,{className:`h-6 w-6 animate-spin text-primary`}),h(`p`,{className:`mt-3 text-xs text-foreground-subtle`,children:e})]})}function Y(){return d(`div`,{className:`flex items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3`,children:[h(w,{className:`h-4 w-4 text-destructive mt-0.5 shrink-0`}),h(`p`,{className:`text-xs text-destructive`,children:`The scan failed. Try again.`})]})}export{W as n,O as r,G as t};
1
+ import{An as e,En as t,Kt as n,Xt as r,Zt as i,gn as a,mn as o,on as s}from"./src-BZ1dd5LI.js";import{I as c,K as l,Q as u,S as d,W as f,b as p,q as m,x as h,z as g}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{t as _}from"./download-fsWmKUMh.js";import{t as v}from"./refresh-cw-CMRlnF-M.js";import{D as y,F as b,N as x,V as S,i as C,o as w,x as T}from"./index-CY52lvbZ.js";import{t as E}from"./FormBuilder-CJrUV3p4.js";import{t as D}from"./BrokerForm-E7__Uhl9.js";var O=S(`radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]);u();var k=[`amazon.com`,`amazon.it`,`amazon.de`,`amazon.co.uk`,`amazon.fr`,`amazon.es`,`amazon.ca`,`amazon.com.au`,`amazon.co.jp`,`amazon.in`,`amazon.com.br`,`amazon.com.mx`],A=`/addon/import-alexa`,j=2e3;function M(e){return typeof e==`object`&&!!e&&typeof e.sessionId==`string`&&typeof e.loginUrl==`string`}function N(e){return typeof e==`object`&&!!e&&typeof e.phase==`string`&&typeof e.sessionId==`string`}function P(e){return typeof e==`object`&&!!e&&typeof e.brokerId==`string`}function F(e){return{"Content-Type":`application/json`,Authorization:`Bearer ${localStorage.getItem(`camstack_admin_token`)??``}`,...e}}async function I(e,t,n){let r=await fetch(`${A}${e}`,{method:`POST`,headers:F(),body:JSON.stringify(t)}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!n(i))throw Error(`Unexpected response from server`);return i}async function L(e){let t=new URLSearchParams({sessionId:e}),n=localStorage.getItem(`camstack_admin_token`)??``,r=await fetch(`${A}/login/status?${t.toString()}`,{headers:{Authorization:`Bearer ${n}`}}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!N(i))throw Error(`Unexpected status response from server`);return i}async function R(e){try{await fetch(`${A}/login/cancel`,{method:`POST`,headers:F(),body:JSON.stringify({sessionId:e})})}catch{}}function z({brokerId:e,onResolved:t,onCancel:n}){let[r,i]=m(`amazon.it`),[a,o]=m(`Alexa account`),[s,u]=m({kind:`idle`}),f=l(!0);g(()=>(f.current=!0,()=>{f.current=!1}),[]);let p=l(null),_=l(null),b=c(()=>{_.current!==null&&(clearInterval(_.current),_.current=null)},[]),x=c(async n=>{b(),f.current&&u({kind:`committing`,sessionId:n});try{let r=await I(`/login/commit`,{sessionId:n,name:a.trim().length>0?a.trim():`Alexa account`,...e===void 0?{}:{brokerId:e}},P);p.current=null,t(r.brokerId)}catch(e){let t=e instanceof Error?e.message:String(e);f.current&&u({kind:`error`,message:t,sessionId:n})}},[e,a,t,b]),S=c((e,t)=>{b();let n=async()=>{try{let n=await L(e);if(n.phase===`captured`){b(),x(e);return}if(n.phase===`error`){b(),f.current&&u({kind:`error`,message:n.error??`Login proxy returned an error`,sessionId:e});return}if(n.phase===`cancelled`){b(),f.current&&u({kind:`idle`});return}f.current&&u({kind:`polling`,sessionId:e,loginUrl:n.loginUrl||t,phase:n.phase})}catch(e){let t=e instanceof Error?e.message:String(e);f.current&&u(e=>e.kind===`polling`?{...e}:{kind:`error`,message:t,sessionId:null})}};_.current=setInterval(()=>{n()},j)},[b,x]);g(()=>()=>{b(),p.current!==null&&R(p.current)},[b]);let C=async()=>{b(),p.current!==null&&(R(p.current),p.current=null),u({kind:`starting`});try{let e=await I(`/login/start`,{amazonDomain:r},M);p.current=e.sessionId,u({kind:`polling`,sessionId:e.sessionId,loginUrl:e.loginUrl,phase:`starting`}),S(e.sessionId,e.loginUrl)}catch(e){u({kind:`error`,message:e instanceof Error?e.message:String(e),sessionId:null})}},E=()=>{b(),p.current!==null&&(R(p.current),p.current=null),u({kind:`idle`})},D=()=>{E()},O=s.kind===`idle`,A=s.kind===`starting`,N=s.kind===`polling`,F=s.kind===`committing`,z=s.kind===`error`,B=A||N||F,V=s.kind===`polling`?s.phase:null,H=s.kind===`polling`?s.loginUrl:null,U=N&&V===`awaiting-login`,W=N&&(V===`starting`||V===null);return d(`div`,{className:`space-y-4`,children:[(O||z)&&d(`div`,{className:`space-y-3`,children:[e===void 0&&d(`div`,{className:`space-y-1`,children:[h(`label`,{htmlFor:`alexa-account-name`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Account name`}),h(`input`,{id:`alexa-account-name`,type:`text`,value:a,onChange:e=>o(e.target.value),placeholder:`Alexa account`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),d(`div`,{className:`space-y-1`,children:[h(`label`,{htmlFor:`alexa-amazon-region`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Amazon region`}),h(`select`,{id:`alexa-amazon-region`,value:r,onChange:e=>i(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,children:k.map(e=>h(`option`,{value:e,children:e},e))})]})]}),z&&d(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px] flex items-start gap-2`,children:[h(w,{className:`h-3.5 w-3.5 mt-0.5 flex-shrink-0`}),h(`span`,{children:s.message})]}),A&&d(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[h(T,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Starting login proxy…`]}),W&&d(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[h(T,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Waiting for proxy to be ready…`]}),F&&d(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[h(T,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Saving credentials…`]}),U&&H!==null&&d(`div`,{className:`space-y-3`,children:[d(`div`,{className:`rounded-lg border border-border bg-surface p-3 space-y-2`,children:[h(`p`,{className:`text-xs font-semibold text-foreground`,children:`Open the link below to log in to your Amazon account`}),h(`p`,{className:`text-[10px] text-foreground-subtle`,children:`After completing the login and any 2FA steps, this wizard will continue automatically.`}),d(`a`,{href:H,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:[h(y,{className:`h-3.5 w-3.5`}),`Login to Amazon`]})]}),d(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[10px] text-amber-700 dark:text-amber-300`,children:[h(`strong`,{children:`Note:`}),` The login proxy runs directly on the hub. If the link does not open or the page does not load, make sure the hub's proxy host and port are reachable from your browser. You can configure `,h(`code`,{className:`font-mono`,children:`proxyHost`}),` in the Alexa addon settings and ensure the proxy port is published (Docker port mapping).`]}),d(`div`,{className:`flex items-center gap-2 text-[10px] text-foreground-subtle`,children:[h(T,{className:`h-3 w-3 animate-spin`}),`Waiting for Amazon login to complete…`]})]}),d(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[h(`button`,{type:`button`,onClick:B?E:n,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:B?`Cancel login`:`Back`}),d(`div`,{className:`flex items-center gap-2`,children:[z&&d(`button`,{type:`button`,onClick:D,className:`inline-flex items-center gap-1.5 rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10`,children:[h(v,{className:`h-3.5 w-3.5`}),`Retry`]}),O&&h(`button`,{type:`button`,onClick:()=>{C()},disabled:e===void 0&&a.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Start login`})]})]})]})}u();var B=`alexa`;function V(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function H(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.addonId==`string`&&Array.isArray(e.kinds)):[]}var U={connected:`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`,connecting:`bg-amber-500/15 text-amber-700 dark:text-amber-300`,disconnected:`bg-foreground-subtle/15 text-foreground-subtle`,"auth-failed":`bg-danger/15 text-danger`,unreachable:`bg-danger/15 text-danger`,error:`bg-danger/15 text-danger`};function W({kind:e,onResolved:t,onBack:a}){let[o,s]=m(e===B?`alexa-login`:`existing`),c=r({kind:e}),l=f(()=>V(c.data).filter(t=>t.kind===e),[c.data,e]),u=i(),p=f(()=>{for(let t of H(u.data))if(t.kinds.some(t=>t.kind===e))return t.addonId},[u.data,e]),[g,_]=m(null),[v,y]=m(``),b=n({}),S=()=>{g&&t(g)},C=async n=>{v.trim().length!==0&&t((await b.mutateAsync({kind:e,name:v.trim(),settings:n,...p===void 0?{}:{addonId:p}})).id)},w=e=>{e===`new`?_(null):b.reset(),s(e)};return d(`div`,{className:`space-y-4`,children:[d(`button`,{type:`button`,onClick:a,className:`inline-flex items-center gap-1 text-[11px] text-foreground-subtle hover:text-foreground`,children:[h(x,{className:`h-3.5 w-3.5`}),` Back`]}),d(`div`,{className:`inline-flex rounded-lg border border-border p-0.5 flex-wrap gap-0.5`,children:[e===B&&h(`button`,{type:`button`,onClick:()=>w(`alexa-login`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${o===`alexa-login`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Login interactively`}),h(`button`,{type:`button`,onClick:()=>w(`existing`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${o===`existing`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Use existing`}),h(`button`,{type:`button`,onClick:()=>w(`new`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${o===`new`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:e===B?`Paste cookie`:`Create new`})]}),o===`alexa-login`&&h(z,{onResolved:t,onCancel:a}),o===`existing`&&d(`div`,{className:`space-y-3`,children:[c.isLoading&&d(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[h(T,{className:`h-3.5 w-3.5 animate-spin`}),` Loading brokers…`]}),c.isError&&d(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:[`Failed to load brokers:`,` `,c.error instanceof Error?c.error.message:`Unknown error`]}),!c.isLoading&&!c.isError&&l.length===0&&d(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-6 text-center text-xs text-foreground-subtle`,children:[`No brokers of this kind yet. Switch to`,` `,h(`span`,{className:`font-medium text-foreground`,children:e===B?`Login interactively`:`Create new`}),` `,`to register one.`]}),h(`div`,{className:`space-y-2`,children:l.map(e=>d(`button`,{type:`button`,onClick:()=>_(e.id),className:`flex w-full items-center justify-between gap-3 rounded-lg border bg-surface p-3 text-left transition-colors ${g===e.id?`border-primary ring-1 ring-primary`:`border-border hover:border-foreground-subtle/30`}`,children:[h(`span`,{className:`text-xs font-semibold text-foreground`,children:e.name}),h(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${U[e.status]}`,children:e.status})]},e.id))}),l.length>0&&h(`div`,{className:`flex justify-end pt-1`,children:h(`button`,{type:`button`,onClick:S,disabled:!g,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Use this broker`})})]}),o===`new`&&d(`div`,{className:`space-y-3`,children:[d(`div`,{className:`space-y-1`,children:[h(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Name`}),h(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`My Home Assistant`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),b.isError&&h(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:b.error instanceof Error?b.error.message:String(b.error)}),h(D,{kind:e,...p===void 0?{}:{addonId:p},onSubmit:e=>{C(e).catch(()=>{})},onCancel:a,submitLabel:b.isPending?`Creating…`:`Create broker`,disabled:b.isPending||v.trim().length===0}),v.trim().length===0&&h(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Enter a name before creating.`})]})]})}u();function G({open:e,onClose:n,scope:r}){let i=s(),[a,o]=m(new Set),[l,u]=m(new Set),{data:p}=t({}),g=f(()=>new Set((p??[]).map(e=>e.stableId)),[p]),v=c(async(e,t)=>{u(e=>new Set(e).add(t.stableId));try{await i.mutateAsync({addonId:e,candidate:t}),o(e=>new Set(e).add(t.stableId))}catch{}finally{u(e=>{let n=new Set(e);return n.delete(t.stableId),n})}},[i]),y=c((e,t)=>{let n=typeof t.prefilledConfig.host==`string`?t.prefilledConfig.host:null,r=g.has(t.stableId),i=a.has(t.stableId)||r,o=l.has(t.stableId);return d(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-surface px-3 py-2`,children:[d(`div`,{className:`min-w-0`,children:[h(`p`,{className:`truncate text-xs font-medium text-foreground`,children:t.suggestedName}),n&&h(`p`,{className:`truncate text-[10px] font-mono text-foreground-subtle`,children:n})]}),i?d(`span`,{className:`flex items-center gap-1 text-[11px] text-foreground-subtle`,children:[h(b,{className:`h-3.5 w-3.5`}),` `,r?`Already added`:`Added`]}):d(`button`,{type:`button`,onClick:()=>void v(e,t),disabled:o,className:`flex items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-50`,children:[o?h(T,{className:`h-3.5 w-3.5 animate-spin`}):h(_,{className:`h-3.5 w-3.5`}),`Add`]})]},t.stableId)},[a,l,g,v]);if(!e)return null;let x=r?`Scan network — ${r.label}`:`Scan network for devices`;return d(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[h(`div`,{className:`absolute inset-0 bg-black/60`,onClick:n}),d(`div`,{className:`relative z-10 flex w-full max-w-2xl flex-col max-h-[90vh] rounded-xl border border-border bg-background shadow-2xl`,children:[d(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[d(`div`,{className:`flex items-center gap-2`,children:[h(O,{className:`h-4 w-4 text-primary`}),h(`h2`,{className:`text-sm font-semibold text-foreground`,children:x})]}),h(`button`,{onClick:n,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:h(C,{className:`h-4 w-4`})})]}),r?h(q,{scope:r,onAdopt:y,onReset:()=>o(new Set)}):h(K,{onAdopt:y,onReset:()=>o(new Set)})]})]})}function K({onAdopt:e,onReset:t}){let n=o(),r=c(()=>{t(),n.mutate({})},[n,t]);g(()=>{!n.isPending&&!n.data&&r()},[]);let i=f(()=>(n.data?.groups??[]).filter(e=>e.candidates.length>0),[n.data]),a=f(()=>i.reduce((e,t)=>e+t.candidates.length,0),[i]);return d(p,{children:[h(`div`,{className:`flex items-center justify-end gap-2 border-b border-border px-5 py-2 shrink-0`,children:d(`button`,{onClick:r,disabled:n.isPending,className:`flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[h(v,{className:`h-3.5 w-3.5 ${n.isPending?`animate-spin`:``}`}),`Re-scan`]})}),d(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[n.isPending&&h(J,{label:`Scanning the local network…`}),!n.isPending&&n.isError&&h(Y,{}),!n.isPending&&n.data&&i.length===0&&h(`p`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!n.isPending&&i.length>0&&d(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,a,` device`,a===1?``:`s`,` on the network.`]}),!n.isPending&&i.map(t=>d(`div`,{className:`space-y-1.5`,children:[d(`div`,{className:`flex items-center gap-2`,children:[h(`span`,{className:`text-[11px] font-semibold text-foreground`,children:t.label}),d(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`(`,t.candidates.length,`)`]})]}),t.candidates.map(n=>e(t.addonId,n))]},t.addonId))]})]})}function q({scope:t,onAdopt:n,onReset:r}){let i=e({addonId:t.addonId}).data??null,[o,s]=m({}),l=a(),u=c(()=>{r(),l.mutate({addonId:t.addonId,params:o})},[l,t.addonId,o,r]),f=l.data?.candidates??[];return h(p,{children:d(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[i&&h(E,{schema:i,values:o,onChange:s}),d(`button`,{onClick:u,disabled:l.isPending,className:`flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:[l.isPending?h(T,{className:`h-3.5 w-3.5 animate-spin`}):h(O,{className:`h-3.5 w-3.5`}),l.isPending?`Scanning…`:`Scan`]}),l.isError&&h(Y,{}),!l.isPending&&l.data&&f.length===0&&h(`p`,{className:`py-6 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!l.isPending&&f.length>0&&d(`div`,{className:`space-y-1.5`,children:[d(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,f.length,` device`,f.length===1?``:`s`,`.`]}),f.map(e=>n(t.addonId,e))]})]})})}function J({label:e}){return d(`div`,{className:`flex flex-col items-center py-12`,children:[h(T,{className:`h-6 w-6 animate-spin text-primary`}),h(`p`,{className:`mt-3 text-xs text-foreground-subtle`,children:e})]})}function Y(){return d(`div`,{className:`flex items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3`,children:[h(w,{className:`h-4 w-4 text-destructive mt-0.5 shrink-0`}),h(`p`,{className:`text-xs text-destructive`,children:`The scan failed. Try again.`})]})}export{W as n,O as r,G as t};
@@ -1 +1 @@
1
- import{Fr as e}from"./src-Dp6qXTLR.js";import{S as t,x as n}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{f as r}from"./index-CpCNvkGK.js";import{t as i}from"./AdminPage-BwmGKnRf.js";import{t as a}from"./NodeAddonsSettingsPanel-DTTq6Ljf.js";function o(){let{data:o,isLoading:s}=e(void 0),c=(o??[]).find(e=>e.isHub&&e.isOnline),l=c?.addons.map(e=>e.id)??[];return n(i,{children:s?n(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`Loading hub topology…`}):c?l.length===0?n(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`No addons installed on the hub yet.`}):n(a,{nodeId:c.id,addonIds:l,level:`global`}):t(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground text-sm gap-2 py-12`,children:[n(r,{className:`h-8 w-8 opacity-30`}),n(`p`,{children:`No online hub node found.`}),n(`p`,{className:`text-xs`,children:`Settings will appear once the hub is reachable.`})]})})}export{o as SettingsPage};
1
+ import{Fr as e}from"./src-BZ1dd5LI.js";import{S as t,x as n}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{f as r}from"./index-CY52lvbZ.js";import{t as i}from"./AdminPage-BwmGKnRf.js";import{t as a}from"./NodeAddonsSettingsPanel-DTzycFzS.js";function o(){let{data:o,isLoading:s}=e(void 0),c=(o??[]).find(e=>e.isHub&&e.isOnline),l=c?.addons.map(e=>e.id)??[];return n(i,{children:s?n(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`Loading hub topology…`}):c?l.length===0?n(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`No addons installed on the hub yet.`}):n(a,{nodeId:c.id,addonIds:l,level:`global`}):t(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground text-sm gap-2 py-12`,children:[n(r,{className:`h-8 w-8 opacity-30`}),n(`p`,{children:`No online hub node found.`}),n(`p`,{className:`text-xs`,children:`Settings will appear once the hub is reachable.`})]})})}export{o as SettingsPage};
@@ -1 +1 @@
1
- import{Q as e,S as t,q as n,x as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{t as i}from"./CapabilityBadges-Cb2taM1G.js";import{t as a}from"./ProviderIcon-KQShdlru.js";import{t as o}from"./StatusBadge-Dcr2bw58.js";import{t as s}from"./FormBuilder-BHrYFTqO.js";e();function c({title:e,children:n}){return t(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[r(`div`,{className:`border-b border-border px-4 py-2.5`,children:r(`h2`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider`,children:e})}),r(`div`,{className:`p-4`,children:n})]})}function l({name:e,cssVar:n,hex:i}){return t(`div`,{className:`flex flex-col items-center gap-1.5`,children:[r(`div`,{className:`h-10 w-10 rounded-lg border border-border shadow-inner`,style:{backgroundColor:n?`var(${n})`:i}}),r(`span`,{className:`text-[10px] text-foreground-subtle text-center leading-tight`,children:e})]})}var u={sections:[{id:`demo`,title:`Demo Fields`,columns:2,fields:[{key:`name`,type:`text`,label:`Name`,placeholder:`Enter name`},{key:`count`,type:`number`,label:`Count`,min:0,max:100,unit:`items`},{key:`enabled`,type:`boolean`,label:`Enabled`},{key:`mode`,type:`select`,label:`Mode`,options:[{value:`a`,label:`Alpha`},{value:`b`,label:`Beta`}]},{key:`tags`,type:`tags`,label:`Tags`,span:2,suggestions:[`camera`,`zone`,`alert`]},{key:`confidence`,type:`slider`,label:`Confidence`,min:0,max:100,step:5,unit:`%`,span:2},{key:`info`,type:`info`,label:`Note`,content:`This is an informational message for the user.`,variant:`info`}]}]};function d(){let[e,d]=n({name:`Example`,count:10,enabled:!0,mode:`a`,tags:[`camera`],confidence:60});return t(`div`,{className:`p-6 space-y-6 max-w-5xl mx-auto`,children:[t(`div`,{className:`mb-6`,children:[r(`h1`,{className:`text-xl font-bold text-foreground`,children:`Component Showroom`}),r(`p`,{className:`text-sm text-foreground-subtle mt-1`,children:`All UI components at a glance`})]}),r(c,{title:`Typography`,children:t(`div`,{className:`space-y-3`,children:[r(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Heading 1 — Display title`}),r(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Heading 2 — Section title`}),r(`h3`,{className:`text-base font-semibold text-foreground`,children:`Heading 3 — Card title`}),r(`h4`,{className:`text-sm font-semibold text-foreground`,children:`Heading 4 — Sub-section`}),r(`p`,{className:`text-sm text-foreground`,children:`Body text — Regular paragraph content goes here. It uses the foreground color.`}),r(`p`,{className:`text-sm text-foreground-subtle`,children:`Subtle text — Secondary/descriptive text with reduced emphasis.`}),r(`p`,{className:`text-xs text-foreground-subtle uppercase tracking-wider font-semibold`,children:`Label / Caption`}),r(`p`,{className:`text-xs text-foreground-disabled`,children:`Disabled / placeholder text`})]})}),r(c,{title:`Colors`,children:t(`div`,{className:`flex flex-wrap gap-4`,children:[r(l,{name:`primary`,cssVar:`--color-primary`}),r(l,{name:`background`,cssVar:`--color-background`}),r(l,{name:`surface`,cssVar:`--color-surface`}),r(l,{name:`foreground`,cssVar:`--color-foreground`}),r(l,{name:`success`,cssVar:`--color-success`}),r(l,{name:`warning`,cssVar:`--color-warning`}),r(l,{name:`danger`,cssVar:`--color-danger`}),r(l,{name:`info`,cssVar:`--color-info`}),r(l,{name:`border`,cssVar:`--color-border`}),r(`div`,{className:`w-px`}),r(l,{name:`frigate`,hex:`#3b82f6`}),r(l,{name:`scrypted`,hex:`#a855f7`}),r(l,{name:`reolink`,hex:`#06b6d4`}),r(l,{name:`ha`,hex:`#22d3ee`}),r(l,{name:`rtsp`,hex:`#78716c`})]})}),r(c,{title:`Buttons`,children:t(`div`,{className:`flex flex-wrap gap-3`,children:[r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90 transition-opacity`,children:`Primary`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-surface px-4 py-2 text-sm font-medium text-foreground hover:bg-surface-hover transition-colors`,children:`Secondary`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-danger/40 bg-danger/10 px-4 py-2 text-sm font-medium text-danger hover:bg-danger/20 transition-colors`,children:`Danger`}),r(`button`,{disabled:!0,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white opacity-40 cursor-not-allowed`,children:`Disabled`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-4 py-2 text-sm font-medium text-warning hover:bg-warning/20 transition-colors`,children:`Warning`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-success/40 bg-success/10 px-4 py-2 text-sm font-medium text-success hover:bg-success/20 transition-colors`,children:`Success`})]})}),r(c,{title:`Inputs`,children:t(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Text input`}),r(`input`,{type:`text`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`Type something...`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Number input`}),r(`input`,{type:`number`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`0`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Password input`}),r(`input`,{type:`password`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`••••••••`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Select`}),t(`select`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,children:[r(`option`,{children:`Option A`}),r(`option`,{children:`Option B`}),r(`option`,{children:`Option C`})]})]}),t(`div`,{className:`md:col-span-2`,children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Textarea`}),r(`textarea`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30 resize-y min-h-[60px]`,placeholder:`Enter multi-line text...`,rows:3})]}),r(`div`,{children:t(`label`,{className:`flex items-center gap-2 cursor-pointer select-none`,children:[r(`input`,{type:`checkbox`,className:`h-3.5 w-3.5 rounded border-border accent-primary`,defaultChecked:!0}),r(`span`,{className:`text-xs font-medium text-foreground`,children:`Checkbox (checked)`})]})}),r(`div`,{children:t(`div`,{className:`flex items-center justify-between`,children:[r(`span`,{className:`text-xs font-medium text-foreground`,children:`Toggle switch`}),r(f,{})]})}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Slider`}),r(`input`,{type:`range`,className:`w-full h-1 accent-primary cursor-pointer`,min:0,max:100,defaultValue:60})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Tags example`}),r(`div`,{className:`flex flex-wrap gap-1.5 rounded-md border border-border bg-background px-2 py-1.5 min-h-[38px]`,children:[`camera`,`zone`,`alert`].map(e=>r(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-xs text-primary`,children:e},e))})]})]})}),r(c,{title:`Badges`,children:t(`div`,{className:`space-y-3`,children:[t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`StatusBadge`}),r(`div`,{className:`flex flex-wrap gap-2`,children:[`running`,`stopped`,`error`,`online`,`offline`,`idle`].map(e=>r(o,{status:e},e))})]}),t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),r(i,{capabilities:[`streaming`,`detection`,`recording`,`audio`]})]})]})}),r(c,{title:`Cards`,children:t(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[t(`div`,{className:`rounded-lg bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Surface card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-surface`. Default card background."})]}),t(`div`,{className:`rounded-lg border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Bordered card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `border border-border bg-surface`."})]}),t(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-primary mb-1`,children:`Accent card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:`Highlighted with primary color.`})]}),t(`div`,{className:`rounded-lg bg-background p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Background card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-background`. Inset card."})]})]})}),r(c,{title:`Provider Icons`,children:r(`div`,{className:`flex flex-wrap gap-4`,children:[`frigate`,`scrypted`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>r(a,{type:e,size:`lg`,showLabel:!0},e))})}),t(c,{title:`Form Builder Demo`,children:[r(s,{schema:u,values:e,onChange:d}),t(`details`,{className:`mt-3`,children:[r(`summary`,{className:`text-[10px] text-foreground-subtle cursor-pointer hover:text-foreground`,children:`View current values`}),r(`pre`,{className:`mt-2 rounded-md bg-background p-3 text-[10px] text-foreground-subtle overflow-auto`,children:JSON.stringify(e,null,2)})]})]}),r(c,{title:`Info Boxes`,children:r(`div`,{className:`space-y-2`,children:[{variant:`info`,label:`Info`,content:`This is an informational message. Use it for tips and hints.`},{variant:`warning`,label:`Warning`,content:`This action may have side effects. Proceed with caution.`},{variant:`success`,label:`Success`,content:`Operation completed successfully. All systems are green.`},{variant:`danger`,label:`Danger`,content:`This operation is irreversible. Data will be permanently deleted.`}].map(({variant:e,label:n,content:i})=>{let a={info:{border:`border-info`,bg:`bg-info/5`,text:`text-info`},warning:{border:`border-warning`,bg:`bg-warning/5`,text:`text-warning`},success:{border:`border-success`,bg:`bg-success/5`,text:`text-success`},danger:{border:`border-danger`,bg:`bg-danger/5`,text:`text-danger`}}[e];return t(`div`,{className:`rounded-md border-l-4 px-3 py-2.5 ${a.border} ${a.bg}`,children:[r(`p`,{className:`text-xs font-semibold mb-0.5 ${a.text}`,children:n}),r(`p`,{className:`text-xs text-foreground-subtle leading-relaxed`,children:i})]},e)})})})]})}function f(){let[e,t]=n(!0);return r(`button`,{type:`button`,role:`switch`,"aria-checked":e,onClick:()=>t(e=>!e),className:[`relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150 cursor-pointer`,e?`bg-primary`:`bg-foreground-subtle/30`].join(` `),children:r(`span`,{className:[`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform duration-150`,e?`translate-x-4`:`translate-x-0.5`].join(` `)})})}export{d as ShowroomPage};
1
+ import{Q as e,S as t,q as n,x as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{t as i}from"./CapabilityBadges-D4uPGt_S.js";import{t as a}from"./ProviderIcon-DwFpv01K.js";import{t as o}from"./StatusBadge-Dcr2bw58.js";import{t as s}from"./FormBuilder-CJrUV3p4.js";e();function c({title:e,children:n}){return t(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[r(`div`,{className:`border-b border-border px-4 py-2.5`,children:r(`h2`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider`,children:e})}),r(`div`,{className:`p-4`,children:n})]})}function l({name:e,cssVar:n,hex:i}){return t(`div`,{className:`flex flex-col items-center gap-1.5`,children:[r(`div`,{className:`h-10 w-10 rounded-lg border border-border shadow-inner`,style:{backgroundColor:n?`var(${n})`:i}}),r(`span`,{className:`text-[10px] text-foreground-subtle text-center leading-tight`,children:e})]})}var u={sections:[{id:`demo`,title:`Demo Fields`,columns:2,fields:[{key:`name`,type:`text`,label:`Name`,placeholder:`Enter name`},{key:`count`,type:`number`,label:`Count`,min:0,max:100,unit:`items`},{key:`enabled`,type:`boolean`,label:`Enabled`},{key:`mode`,type:`select`,label:`Mode`,options:[{value:`a`,label:`Alpha`},{value:`b`,label:`Beta`}]},{key:`tags`,type:`tags`,label:`Tags`,span:2,suggestions:[`camera`,`zone`,`alert`]},{key:`confidence`,type:`slider`,label:`Confidence`,min:0,max:100,step:5,unit:`%`,span:2},{key:`info`,type:`info`,label:`Note`,content:`This is an informational message for the user.`,variant:`info`}]}]};function d(){let[e,d]=n({name:`Example`,count:10,enabled:!0,mode:`a`,tags:[`camera`],confidence:60});return t(`div`,{className:`p-6 space-y-6 max-w-5xl mx-auto`,children:[t(`div`,{className:`mb-6`,children:[r(`h1`,{className:`text-xl font-bold text-foreground`,children:`Component Showroom`}),r(`p`,{className:`text-sm text-foreground-subtle mt-1`,children:`All UI components at a glance`})]}),r(c,{title:`Typography`,children:t(`div`,{className:`space-y-3`,children:[r(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Heading 1 — Display title`}),r(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Heading 2 — Section title`}),r(`h3`,{className:`text-base font-semibold text-foreground`,children:`Heading 3 — Card title`}),r(`h4`,{className:`text-sm font-semibold text-foreground`,children:`Heading 4 — Sub-section`}),r(`p`,{className:`text-sm text-foreground`,children:`Body text — Regular paragraph content goes here. It uses the foreground color.`}),r(`p`,{className:`text-sm text-foreground-subtle`,children:`Subtle text — Secondary/descriptive text with reduced emphasis.`}),r(`p`,{className:`text-xs text-foreground-subtle uppercase tracking-wider font-semibold`,children:`Label / Caption`}),r(`p`,{className:`text-xs text-foreground-disabled`,children:`Disabled / placeholder text`})]})}),r(c,{title:`Colors`,children:t(`div`,{className:`flex flex-wrap gap-4`,children:[r(l,{name:`primary`,cssVar:`--color-primary`}),r(l,{name:`background`,cssVar:`--color-background`}),r(l,{name:`surface`,cssVar:`--color-surface`}),r(l,{name:`foreground`,cssVar:`--color-foreground`}),r(l,{name:`success`,cssVar:`--color-success`}),r(l,{name:`warning`,cssVar:`--color-warning`}),r(l,{name:`danger`,cssVar:`--color-danger`}),r(l,{name:`info`,cssVar:`--color-info`}),r(l,{name:`border`,cssVar:`--color-border`}),r(`div`,{className:`w-px`}),r(l,{name:`frigate`,hex:`#3b82f6`}),r(l,{name:`scrypted`,hex:`#a855f7`}),r(l,{name:`reolink`,hex:`#06b6d4`}),r(l,{name:`ha`,hex:`#22d3ee`}),r(l,{name:`rtsp`,hex:`#78716c`})]})}),r(c,{title:`Buttons`,children:t(`div`,{className:`flex flex-wrap gap-3`,children:[r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90 transition-opacity`,children:`Primary`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-surface px-4 py-2 text-sm font-medium text-foreground hover:bg-surface-hover transition-colors`,children:`Secondary`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-danger/40 bg-danger/10 px-4 py-2 text-sm font-medium text-danger hover:bg-danger/20 transition-colors`,children:`Danger`}),r(`button`,{disabled:!0,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white opacity-40 cursor-not-allowed`,children:`Disabled`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-4 py-2 text-sm font-medium text-warning hover:bg-warning/20 transition-colors`,children:`Warning`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-success/40 bg-success/10 px-4 py-2 text-sm font-medium text-success hover:bg-success/20 transition-colors`,children:`Success`})]})}),r(c,{title:`Inputs`,children:t(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Text input`}),r(`input`,{type:`text`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`Type something...`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Number input`}),r(`input`,{type:`number`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`0`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Password input`}),r(`input`,{type:`password`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`••••••••`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Select`}),t(`select`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,children:[r(`option`,{children:`Option A`}),r(`option`,{children:`Option B`}),r(`option`,{children:`Option C`})]})]}),t(`div`,{className:`md:col-span-2`,children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Textarea`}),r(`textarea`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30 resize-y min-h-[60px]`,placeholder:`Enter multi-line text...`,rows:3})]}),r(`div`,{children:t(`label`,{className:`flex items-center gap-2 cursor-pointer select-none`,children:[r(`input`,{type:`checkbox`,className:`h-3.5 w-3.5 rounded border-border accent-primary`,defaultChecked:!0}),r(`span`,{className:`text-xs font-medium text-foreground`,children:`Checkbox (checked)`})]})}),r(`div`,{children:t(`div`,{className:`flex items-center justify-between`,children:[r(`span`,{className:`text-xs font-medium text-foreground`,children:`Toggle switch`}),r(f,{})]})}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Slider`}),r(`input`,{type:`range`,className:`w-full h-1 accent-primary cursor-pointer`,min:0,max:100,defaultValue:60})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Tags example`}),r(`div`,{className:`flex flex-wrap gap-1.5 rounded-md border border-border bg-background px-2 py-1.5 min-h-[38px]`,children:[`camera`,`zone`,`alert`].map(e=>r(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-xs text-primary`,children:e},e))})]})]})}),r(c,{title:`Badges`,children:t(`div`,{className:`space-y-3`,children:[t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`StatusBadge`}),r(`div`,{className:`flex flex-wrap gap-2`,children:[`running`,`stopped`,`error`,`online`,`offline`,`idle`].map(e=>r(o,{status:e},e))})]}),t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),r(i,{capabilities:[`streaming`,`detection`,`recording`,`audio`]})]})]})}),r(c,{title:`Cards`,children:t(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[t(`div`,{className:`rounded-lg bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Surface card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-surface`. Default card background."})]}),t(`div`,{className:`rounded-lg border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Bordered card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `border border-border bg-surface`."})]}),t(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-primary mb-1`,children:`Accent card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:`Highlighted with primary color.`})]}),t(`div`,{className:`rounded-lg bg-background p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Background card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-background`. Inset card."})]})]})}),r(c,{title:`Provider Icons`,children:r(`div`,{className:`flex flex-wrap gap-4`,children:[`frigate`,`scrypted`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>r(a,{type:e,size:`lg`,showLabel:!0},e))})}),t(c,{title:`Form Builder Demo`,children:[r(s,{schema:u,values:e,onChange:d}),t(`details`,{className:`mt-3`,children:[r(`summary`,{className:`text-[10px] text-foreground-subtle cursor-pointer hover:text-foreground`,children:`View current values`}),r(`pre`,{className:`mt-2 rounded-md bg-background p-3 text-[10px] text-foreground-subtle overflow-auto`,children:JSON.stringify(e,null,2)})]})]}),r(c,{title:`Info Boxes`,children:r(`div`,{className:`space-y-2`,children:[{variant:`info`,label:`Info`,content:`This is an informational message. Use it for tips and hints.`},{variant:`warning`,label:`Warning`,content:`This action may have side effects. Proceed with caution.`},{variant:`success`,label:`Success`,content:`Operation completed successfully. All systems are green.`},{variant:`danger`,label:`Danger`,content:`This operation is irreversible. Data will be permanently deleted.`}].map(({variant:e,label:n,content:i})=>{let a={info:{border:`border-info`,bg:`bg-info/5`,text:`text-info`},warning:{border:`border-warning`,bg:`bg-warning/5`,text:`text-warning`},success:{border:`border-success`,bg:`bg-success/5`,text:`text-success`},danger:{border:`border-danger`,bg:`bg-danger/5`,text:`text-danger`}}[e];return t(`div`,{className:`rounded-md border-l-4 px-3 py-2.5 ${a.border} ${a.bg}`,children:[r(`p`,{className:`text-xs font-semibold mb-0.5 ${a.text}`,children:n}),r(`p`,{className:`text-xs text-foreground-subtle leading-relaxed`,children:i})]},e)})})})]})}function f(){let[e,t]=n(!0);return r(`button`,{type:`button`,role:`switch`,"aria-checked":e,onClick:()=>t(e=>!e),className:[`relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150 cursor-pointer`,e?`bg-primary`:`bg-foreground-subtle/30`].join(` `),children:r(`span`,{className:[`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform duration-150`,e?`translate-x-4`:`translate-x-0.5`].join(` `)})})}export{d as ShowroomPage};
@@ -1 +1 @@
1
- import"./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-rJ2O9jZ3.js";import{t as e}from"./vite-preload-helper-zJ_50EbN.js";var t={"@camstack/sdk":async()=>await e(()=>import(`./dist-B8dNOlY9.js`),[]),"@camstack/types":async()=>await e(()=>import(`./dist-DRenWL4F.js`),[]),"@camstack/ui-library":async()=>await e(()=>import(`./src-Dp6qXTLR.js`).then(e=>e.t),[]),"@tanstack/react-query":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js`).then(e=>e.y),[]),"@trpc/client":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-CSJxMxg6.js`).then(e=>e.A),[]),"@trpc/react-query":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DkcC9IVF.js`).then(e=>e.r),[]),konva:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__konva__loadShare__.js-B7XYY0cV.js`).then(e=>e.n),[]),react:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js`).then(e=>(e.et(),e.$)),[]),"react-dom":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-D9-wIasd.js`).then(e=>(e.a(),e.i)),[]),"react-dom/client":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DstpX0yz.js`).then(e=>e.r),[]),"react-konva":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-BBBrLLEa.js`).then(e=>e.u),[]),"react/jsx-runtime":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js`).then(e=>e.w),[])},n={"@camstack/sdk":{name:`@camstack/sdk`,version:`1.1.19`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@camstack/sdk`].loaded=!0;let{"@camstack/sdk":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^1.1.19`}},"@camstack/types":{name:`@camstack/types`,version:`1.1.34`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@camstack/types`].loaded=!0;let{"@camstack/types":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^1.1.34`}},"@camstack/ui-library":{name:`@camstack/ui-library`,version:`1.1.29`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@camstack/ui-library`].loaded=!0;let{"@camstack/ui-library":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^1.1.29`}},"@tanstack/react-query":{name:`@tanstack/react-query`,version:`5.101.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@tanstack/react-query`].loaded=!0;let{"@tanstack/react-query":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^5.101.0`}},"@trpc/client":{name:`@trpc/client`,version:`11.18.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@trpc/client`].loaded=!0;let{"@trpc/client":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^11.18.0`}},"@trpc/react-query":{name:`@trpc/react-query`,version:`11.18.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@trpc/react-query`].loaded=!0;let{"@trpc/react-query":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^11.18.0`}},konva:{name:`konva`,version:`10.3.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n.konva.loaded=!0;let{konva:e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^10.3.0`}},react:{name:`react`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n.react.loaded=!0;let{react:e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}},"react-dom":{name:`react-dom`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react-dom`].loaded=!0;let{"react-dom":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}},"react-dom/client":{name:`react-dom/client`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react-dom/client`].loaded=!0;let{"react-dom/client":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}},"react-konva":{name:`react-konva`,version:`19.2.5`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react-konva`].loaded=!0;let{"react-konva":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.5`}},"react/jsx-runtime":{name:`react/jsx-runtime`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react/jsx-runtime`].loaded=!0;let{"react/jsx-runtime":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}}},r=[];export{r as usedRemotes,n as usedShared};
1
+ import"./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DkH43QoX.js";import{t as e}from"./vite-preload-helper-zJ_50EbN.js";var t={"@camstack/sdk":async()=>await e(()=>import(`./dist-B8dNOlY9.js`),[]),"@camstack/types":async()=>await e(()=>import(`./dist-DRenWL4F.js`),[]),"@camstack/ui-library":async()=>await e(()=>import(`./src-BZ1dd5LI.js`).then(e=>e.t),[]),"@tanstack/react-query":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js`).then(e=>e.y),[]),"@trpc/client":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-CSJxMxg6.js`).then(e=>e.A),[]),"@trpc/react-query":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DkcC9IVF.js`).then(e=>e.r),[]),konva:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__konva__loadShare__.js-B7XYY0cV.js`).then(e=>e.n),[]),react:async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js`).then(e=>(e.et(),e.$)),[]),"react-dom":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-D9-wIasd.js`).then(e=>(e.a(),e.i)),[]),"react-dom/client":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-DstpX0yz.js`).then(e=>e.r),[]),"react-konva":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_konva__loadShare__.js-BBBrLLEa.js`).then(e=>e.u),[]),"react/jsx-runtime":async()=>await e(()=>import(`./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js`).then(e=>e.w),[])},n={"@camstack/sdk":{name:`@camstack/sdk`,version:`1.1.19`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@camstack/sdk`].loaded=!0;let{"@camstack/sdk":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^1.1.19`}},"@camstack/types":{name:`@camstack/types`,version:`1.1.34`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@camstack/types`].loaded=!0;let{"@camstack/types":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^1.1.34`}},"@camstack/ui-library":{name:`@camstack/ui-library`,version:`1.1.29`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@camstack/ui-library`].loaded=!0;let{"@camstack/ui-library":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^1.1.29`}},"@tanstack/react-query":{name:`@tanstack/react-query`,version:`5.101.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@tanstack/react-query`].loaded=!0;let{"@tanstack/react-query":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^5.101.0`}},"@trpc/client":{name:`@trpc/client`,version:`11.18.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@trpc/client`].loaded=!0;let{"@trpc/client":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^11.18.0`}},"@trpc/react-query":{name:`@trpc/react-query`,version:`11.18.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`@trpc/react-query`].loaded=!0;let{"@trpc/react-query":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^11.18.0`}},konva:{name:`konva`,version:`10.3.0`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n.konva.loaded=!0;let{konva:e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^10.3.0`}},react:{name:`react`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n.react.loaded=!0;let{react:e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}},"react-dom":{name:`react-dom`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react-dom`].loaded=!0;let{"react-dom":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}},"react-dom/client":{name:`react-dom/client`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react-dom/client`].loaded=!0;let{"react-dom/client":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}},"react-konva":{name:`react-konva`,version:`19.2.5`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react-konva`].loaded=!0;let{"react-konva":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.5`}},"react/jsx-runtime":{name:`react/jsx-runtime`,version:`19.2.7`,scope:[`default`],loaded:!1,from:`admin_ui_host`,async get(){n[`react/jsx-runtime`].loaded=!0;let{"react/jsx-runtime":e}=t,r={...await e()};return Object.defineProperty(r,"__esModule",{value:!0,enumerable:!1}),function(){return r}},shareConfig:{singleton:!0,requiredVersion:`^19.2.7`}}},r=[];export{r as usedRemotes,n as usedShared};