@camstack/addon-admin-ui 1.2.320 → 1.2.325
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AddonCollectionPage-CxXDirJC.js +1 -0
- package/dist/assets/Addons-yUjR3ne-.js +1 -0
- package/dist/assets/AdminTabs-BAM_VEcr.js +1 -0
- package/dist/assets/AiProfiles-DFt8Msz0.js +3 -0
- package/dist/assets/BrokerForm-DJ3qfWi2.js +1 -0
- package/dist/assets/Build-WoqeOLcT.js +40 -0
- package/dist/assets/{Calendars-B1_mLIVE.js → Calendars-xVXTf8RZ.js} +1 -1
- package/dist/assets/{Capabilities-VNPaMHq7.js → Capabilities-navCtLqG.js} +1 -1
- package/dist/assets/Cluster-BY1QM5Z2.js +11 -0
- package/dist/assets/CompositionEditor-I994CTE1.js +1 -0
- package/dist/assets/CompositionEditorPage-Cvw-au86.js +1 -0
- package/dist/assets/Data-ZLMpTx54.js +1 -0
- package/dist/assets/DetectionIntelligence-k4KVX3Uf.js +1 -0
- package/dist/assets/DeviceDetail-CqO4P4tT.js +2 -0
- package/dist/assets/DeviceDoActionFields-Dpj5IfHA.js +1 -0
- package/dist/assets/Devices-Ch7ANkBl.js +1 -0
- package/dist/assets/{EmbedPlayerPage-BGgzYptJ.js → EmbedPlayerPage-71VuS-Bb.js} +1 -1
- package/dist/assets/Events-BKJoiU2D.js +1 -0
- package/dist/assets/Identity-CiNMp8j1.js +1 -0
- package/dist/assets/IntegrationDetail-D43nbJRT.js +1 -0
- package/dist/assets/Integrations-D_DZgBSS.js +1 -0
- package/dist/assets/{Integrations-AXOsTawD.js → Integrations-G7_JMVno.js} +1 -1
- package/dist/assets/Locations-DQ9JzyGW.js +3 -0
- package/dist/assets/Logs-zT3fieFH.js +1 -0
- package/dist/assets/ModelLicenses-gTKgSLAN.js +1 -0
- package/dist/assets/{MotionZonesSettings-Ld-j-FOf.js → MotionZonesSettings-KM6kSbLo.js} +1 -1
- package/dist/assets/{MyAccess-DkAeD0Ir.js → MyAccess-Rrl2hM65.js} +1 -1
- package/dist/assets/Network-CPjvZo6T.js +1 -0
- package/dist/assets/NodeAddonsSettingsPanel-CCwfGq_E.js +1 -0
- package/dist/assets/{NodeInferenceDevices-DPflIBwk.js → NodeInferenceDevices-DzgwYV4u.js} +1 -1
- package/dist/assets/Notifications-pUbzRZix.js +1 -0
- package/dist/assets/Pipeline-BNeb9r9-.js +1 -0
- package/dist/assets/Plates-4Amk2xfY.js +1 -0
- package/dist/assets/{PrivacyMaskSettings-BZrLQhuR.js → PrivacyMaskSettings-CuPF3MaA.js} +1 -1
- package/dist/assets/Recordings-CO2jBj0N.js +1 -0
- package/dist/assets/ScanNetworkModal-kJrj8OJb.js +1 -0
- package/dist/assets/{SceneMonitorEditor-DArl0gdm.js → SceneMonitorEditor-CpUHyGR_.js} +1 -1
- package/dist/assets/{Scenes-DKjp5Iid.js → Scenes-CvLBgWoy.js} +1 -1
- package/dist/assets/{Settings-DmbFUzbw.js → Settings-QZKVIFMF.js} +1 -1
- package/dist/assets/Showroom-DcYPKtQJ.js +1 -0
- package/dist/assets/{StorageLocationsPanel-BSZbgwvo.js → StorageLocationsPanel-X-MRft-g.js} +1 -1
- package/dist/assets/{Terminal-CQwcJHRr.js → Terminal-s6Zu_1EM.js} +5 -5
- package/dist/assets/Viewer-DAQPh3zV.js +1 -0
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-8eP7BPxU.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BUHP4cOg.js} +1 -1
- package/dist/assets/{archive-bhxXcFdH.js → archive-BdrfT8Tm.js} +1 -1
- package/dist/assets/{authed-media-DoAWMi2a.js → authed-media-CRNsxF0o.js} +1 -1
- package/dist/assets/{boxes-j_W4wNc5.js → boxes-Cn405C00.js} +1 -1
- package/dist/assets/circle-slash-C8P2Biab.js +1 -0
- package/dist/assets/{debounced-invalidate-i8fFRjDI.js → debounced-invalidate-Dez2UBjF.js} +1 -1
- package/dist/assets/device-integration-icon-B5QgUAfP.js +1 -0
- package/dist/assets/device-picker-model-C2sF6CIo.js +1 -0
- package/dist/assets/dist-Bar-bGVd.js +349 -0
- package/dist/assets/{dist-CuhmUcM3.js → dist-CV-syViC.js} +1 -1
- package/dist/assets/{face-bbox-6mKTh5h_.js → face-bbox-CQK8LoSC.js} +1 -1
- package/dist/assets/{hard-drive-download-CfRqYj8Y.js → hard-drive-download-BE7uIvf-.js} +1 -1
- package/dist/assets/{hostInit-DK6L4JlB.js → hostInit-CG02F6uF.js} +1 -1
- package/dist/assets/index-BRONX8do.css +2 -0
- package/dist/assets/index-DFWOuEL5.js +4 -0
- package/dist/assets/{layers-QOUNNTM5.js → layers-6dQVJNN5.js} +1 -1
- package/dist/assets/location-owned-usage-DbA3r5FN.js +1 -0
- package/dist/assets/{mf-entry-bootstrap-0-a0da9d1e.js → mf-entry-bootstrap-0-66979c19.js} +2 -2
- package/dist/assets/mount-C2sF6CIo.js +1 -0
- package/dist/assets/notification-schedule-field-BK0G8TgA.js +1 -0
- package/dist/assets/{player-overlays-BiMOywnH.js → player-overlays-aOXZvSE_.js} +1 -1
- package/dist/assets/remoteEntry-CQ1SACyJ.js +1 -0
- package/dist/assets/{send-BJx_S3it.js → send-wsqOcYXe.js} +1 -1
- package/dist/assets/{settings-2-sRY7papp.js → settings-2-CFEBspgz.js} +1 -1
- package/dist/assets/{square-check-big-DIDWLK6q.js → square-check-big-DWTXdL5u.js} +1 -1
- package/dist/assets/src-Cq9_wgDT.js +349 -0
- package/dist/assets/src-DP92R2_g.js +67 -0
- package/dist/assets/{use-scenes-feed-Cc_D9YMA.js → use-scenes-feed-CTIPfYEG.js} +1 -1
- package/dist/assets/{use-stationary-objects-BK-lZxz5.js → use-stationary-objects-Bok446Um.js} +1 -1
- package/dist/assets/useEventInvalidation-C2sF6CIo.js +1 -0
- package/dist/assets/{useNodeUrlSelection-DEofbZPd.js → useNodeUrlSelection-D912mZ5j.js} +1 -1
- package/dist/assets/useTranslation-Bc5yH9V9.js +1 -0
- package/dist/assets/user-round-BLAmXvb7.js +1 -0
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Bw8wYSqx.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_--fCbD2Tp.js} +2 -2
- package/dist/index.html +9 -6
- package/dist/server/addon.js +88 -5
- package/package.json +1 -1
- package/dist/assets/AddonCollectionPage-5nQd-fl7.js +0 -1
- package/dist/assets/Addons-nH13f52s.js +0 -1
- package/dist/assets/AdminTabs-ya1bCNSO.js +0 -1
- package/dist/assets/AiProfiles-BMleMmAA.js +0 -3
- package/dist/assets/BrokerForm-DHZ8hUlp.js +0 -1
- package/dist/assets/Build-CD7-IGea.js +0 -375
- package/dist/assets/CapabilityBadges-D54okPp4.js +0 -1
- package/dist/assets/Cluster-C9Odf0CH.js +0 -11
- package/dist/assets/CompositionEditor-LVv358x7.js +0 -1
- package/dist/assets/CompositionEditorPage-C1WliWGd.js +0 -1
- package/dist/assets/Data-hilVqnUh.js +0 -1
- package/dist/assets/DetectionIntelligence-yqs4-_p5.js +0 -1
- package/dist/assets/DeviceAggregateSection-WJZBDahv.js +0 -1
- package/dist/assets/DeviceDetail-BChiwD-w.js +0 -2
- package/dist/assets/DeviceDoActionFields-DzNdsRac.js +0 -1
- package/dist/assets/Devices-4YZ9Sf8I.js +0 -1
- package/dist/assets/Events-tVjjBxsP.js +0 -1
- package/dist/assets/FormBuilder-Mm2KUHj_.js +0 -1
- package/dist/assets/Identity-8eGv_R6C.js +0 -1
- package/dist/assets/IntegrationDetail-3Pyar-gL.js +0 -1
- package/dist/assets/Integrations-4v0L4iRd.js +0 -1
- package/dist/assets/Locations-BbGnTY6L.js +0 -3
- package/dist/assets/Logs-Bu8iqW5z.js +0 -1
- package/dist/assets/ModelLicenses-UdDC7tYP.js +0 -1
- package/dist/assets/Network-DrjDUX_p.js +0 -1
- package/dist/assets/NodeAddonsSettingsPanel-aN5DSImk.js +0 -1
- package/dist/assets/Notifications-DnWt27Kz.js +0 -1
- package/dist/assets/Pipeline-DRDZgfL-.js +0 -1
- package/dist/assets/Plates-ZWQhgQK-.js +0 -1
- package/dist/assets/ProviderIcon-ChyLY-K8.js +0 -1
- package/dist/assets/Recordings-ECXZUa6a.js +0 -1
- package/dist/assets/ScanNetworkModal-DaVszVsh.js +0 -1
- package/dist/assets/SchemaTabBar-Bvm8GY8a.js +0 -1
- package/dist/assets/Showroom-CfI9H0xt.js +0 -1
- package/dist/assets/StableTabPanel-Dc954AQl.js +0 -1
- package/dist/assets/Viewer-Cp1t9JAa.js +0 -1
- package/dist/assets/circle-slash-B992-uTX.js +0 -1
- package/dist/assets/device-integration-icon-C0LvIHA1.js +0 -1
- package/dist/assets/device-picker-model-Bx-MZkA4.js +0 -1
- package/dist/assets/dist-CKSjSzEl.js +0 -349
- package/dist/assets/index-BBheY5o3.css +0 -2
- package/dist/assets/index-j5fkiwRk.js +0 -4
- package/dist/assets/location-owned-usage-CTvGcaad.js +0 -1
- package/dist/assets/remoteEntry-BpoD5TCl.js +0 -1
- package/dist/assets/src-BMvSPnxA.js +0 -349
- package/dist/assets/src-D5VbJHEA.js +0 -67
- package/dist/assets/useDevice-UWeOTc-3.js +0 -1
- package/dist/assets/useEventInvalidation-Bx-MZkA4.js +0 -1
- package/dist/assets/user-round-CCoCiRZv.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{yt as e}from"./player-overlays-
|
|
1
|
+
import{yt as e}from"./player-overlays-aOXZvSE_.js";var t=e(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as e,Q as t,S as n,W as r,o as i,q as a,x as o,z as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{_t as c,at as l,gt as u,mt as d,st as f,yt as p}from"./player-overlays-aOXZvSE_.js";import{Ec as m,Mn as h,Mu as g,bu as _,er as v,gu as y,k as b,mc as x,vu as S,xl as C}from"./src-DP92R2_g.js";import{t as w}from"./archive-BdrfT8Tm.js";import{t as T}from"./hard-drive-download-BE7uIvf-.js";import{hr as E}from"./src-Cq9_wgDT.js";import{b as ee}from"./index-DFWOuEL5.js";import{t as D}from"./format-size-DIxKXxtj.js";var O=p(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]);t();function k(e){let t=e.trim().toLowerCase();return t.length===0?``:t.replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function te(e,t){let n=k(t);return`${e}:${n.length>0?n:`default`}`}var A=new Set([`proc`,`sys`,`dev`,`run`,`boot`,`lost+found`,`snap`,`bin`,`sbin`,`lib`,`lib32`,`lib64`,`libx32`,`usr`,`etc`,`var`,`opt`,`tmp`,`srv`,`root`,`System`,`Library`,`Applications`,`cores`,`private`]),j=[`recordings`,`data`,`mnt`,`media`,`Volumes`];function M(e){let t=j.findIndex(t=>t===`recordings`?e.startsWith(t):e===t);return t===-1?j.length:t}function N(e){return e.filter(e=>!e.name.startsWith(`.`)&&!A.has(e.name)).toSorted((e,t)=>{let n=M(e.name)-M(t.name);return n===0?e.name.localeCompare(t.name):n}).map(e=>e.path)}function ne({nodeId:t,value:r,onChange:i}){let c=l().trpcClient,[u,d]=a([]),[f,p]=a(r),[m,h]=a(null),[g,_]=a(null),[v,y]=a(``),b=e(async(e,n)=>{_(null);try{let r=await c.filesystemBrowse.browse.query({nodeId:t,path:e});h(r),p(r.path),n&&i(r.path)}catch(e){_(e instanceof Error?e.message:`browse failed`)}},[c,t,i]);s(()=>{p(r),(async()=>{let e=await c.filesystemBrowse.browse.query({nodeId:t,path:`/`}).then(e=>e).catch(()=>null);if(e){d(N(e.entries)),await b(r.startsWith(`/`)?r:`/`,!1);return}try{let e=await c.filesystemBrowse.listAllowedRoots.query({nodeId:t});d(e),await b(r&&e.some(e=>r.startsWith(e))?r:e[0]??``,!1)}catch(e){d([]),h(null),_(e instanceof Error&&/not available on node/i.test(e.message)?`This node can't be browsed remotely. Enter the path manually.`:e instanceof Error?e.message:`browse unavailable`)}})()},[t]);let x=async()=>{if(!(!v.trim()||!m)){_(null);try{let e=`${m.path.replace(/\/+$/,``)}/${v.trim()}`;await c.filesystemBrowse.createDir.mutate({nodeId:t,path:e}),y(``),await b(m.path,!0)}catch(e){_(e instanceof Error?e.message:`create failed`)}}},S=e=>`${(e/1e9).toFixed(1)} GB`;return n(`div`,{className:`space-y-2 rounded border border-border p-2`,children:[o(`div`,{className:`flex flex-wrap gap-1`,children:u.map(e=>o(`button`,{onClick:()=>void b(e,!0),className:`rounded border border-border px-2 py-0.5 text-[10px] font-mono hover:border-primary/40`,children:e},e))}),o(`input`,{value:f,onChange:e=>{p(e.target.value),i(e.target.value)},placeholder:`/absolute/path`,className:`w-full rounded border border-border bg-background px-2 py-1 text-[11px] font-mono`}),m&&n(`div`,{className:`text-[10px] text-foreground-subtle`,children:[S(m.freeBytes),` free / `,S(m.totalBytes)]}),o(`div`,{className:`max-h-40 space-y-0.5 overflow-y-auto`,children:m?.entries.map(e=>n(`button`,{onClick:()=>void b(e.path,!0),className:`block w-full truncate rounded px-2 py-1 text-left text-xs hover:bg-primary/5`,children:[`📁 `,e.name]},e.path))}),n(`div`,{className:`flex gap-1`,children:[o(`input`,{value:v,onChange:e=>y(e.target.value),placeholder:`new folder`,className:`flex-1 rounded border border-border bg-background px-2 py-1 text-xs`}),o(`button`,{onClick:()=>void x(),className:`rounded border border-border px-2 py-1 text-xs hover:border-primary/40`,children:`Create`})]}),g&&o(`div`,{className:`text-[10px] text-red-400`,children:g})]})}t();function P({initialType:e,onClose:t,onCreated:s}){let c=i(),d=l().trpcClient,[f,p]=a(`picker`),[h,_]=a(e),[v,y]=a(null),[S,w]=a({}),[T,E]=a(``),[D,O]=a(null),[k,A]=a(!1),[j,M]=a(`hub`),[N,P]=a(null),[F,I]=a(!1),L=e=>w(t=>({...t,basePath:e})),R=typeof S.basePath==`string`?S.basePath:``,z=x(),B=r(()=>{let e=z.data;return Array.isArray(e)?e:[]},[z.data]),V=z.isLoading,H=m({onSuccess:()=>{c.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),s()}}),U=r(()=>D!==null&&D.length>0?D:te(h,T),[h,T,D]),W=async()=>{if(v){I(!0),P(null);try{P(await(e=>d.storage.testConfig.query(e))({providerId:v.providerId,config:S}))}catch(e){P({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{I(!1)}}};return o(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:t,children:n(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[n(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[n(`div`,{className:`space-y-0.5`,children:[o(`h2`,{className:`text-sm font-semibold text-foreground`,children:{picker:`Add Location — Pick provider`,config:`Add Location — ${v?.displayName??``}`,naming:`Add Location — Name`}[f]}),n(`p`,{className:`text-xs text-foreground-subtle`,children:[`Type: `,o(`span`,{className:`font-mono`,children:h})]})]}),o(`button`,{onClick:t,className:`text-foreground-subtle hover:text-foreground`,children:o(C,{className:`h-4 w-4`})})]}),f===`picker`&&n(`div`,{className:`p-4 space-y-2`,children:[V&&o(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:`Loading providers…`}),!V&&B.length===0&&n(`div`,{className:`rounded border border-border bg-background px-3 py-4 text-center text-xs text-foreground-subtle`,children:[`No storage-provider supports type "`,h,`". Install a compatible addon (e.g.`,` `,o(`code`,{className:`font-mono`,children:`remote-storage`}),`) to enable it.`]}),B.map(e=>n(`button`,{onClick:()=>{y(e),p(`config`)},className:`flex w-full items-center gap-3 rounded-lg border border-border bg-background p-3 text-left hover:border-primary/40 hover:bg-primary/5 transition-colors`,children:[n(`div`,{className:`flex-1 min-w-0`,children:[o(`p`,{className:`text-xs font-semibold text-foreground`,children:e.displayName}),o(`p`,{className:`text-[10px] text-foreground-subtle font-mono mt-0.5 truncate`,children:e.providerId})]}),o(u,{className:`h-4 w-4 text-foreground-subtle flex-shrink-0`})]},e.providerId))]}),f===`config`&&v&&n(`div`,{className:`p-4 space-y-3 max-h-[60vh] overflow-y-auto`,children:[o(ee,{schema:v.configSchema,values:S,onChange:w}),v.nodeLocal&&n(`div`,{className:`space-y-2`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Node`}),o(b,{selectedNodeId:j,onSelect:M,alwaysShow:!0}),o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Path`}),o(ne,{nodeId:j,value:R,onChange:L})]}),N&&o(`div`,{className:`rounded border px-3 py-2 text-[11px] ${N.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:N.ok?`Connection OK.`:`Test failed: ${N.error??`unknown error`}`}),n(`div`,{className:`flex items-center justify-between pt-1`,children:[o(`button`,{onClick:()=>p(`picker`),className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Back`}),n(`div`,{className:`flex items-center gap-2`,children:[o(`button`,{onClick:()=>{W()},disabled:F,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10 disabled:opacity-50`,children:F?`Testing…`:`Test connection`}),o(`button`,{onClick:()=>p(`naming`),className:`rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:`Next`})]})]})]}),f===`naming`&&v&&n(`div`,{className:`p-4 space-y-3`,children:[n(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Display name`}),o(`input`,{type:`text`,value:T,onChange:e=>E(e.target.value),placeholder:`${h} on ${v.displayName}`,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`})]}),n(`div`,{className:`space-y-1`,children:[n(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:[`Id`,` `,o(`span`,{className:`lowercase tracking-normal text-foreground-subtle`,children:`— auto-derived; override if needed`})]}),o(`input`,{type:`text`,value:U,onChange:e=>O(e.target.value),placeholder:te(h,T),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground font-mono focus:outline-none focus:ring-1 focus:ring-primary`}),n(`p`,{className:`text-[10px] text-foreground-subtle`,children:[`Format: `,o(`code`,{className:`font-mono`,children:`<type>:<slug>`}),`. Lowercase letters, digits, and hyphens only.`]})]}),n(`label`,{className:`flex items-start gap-2 rounded border border-border bg-background px-3 py-2 cursor-pointer hover:bg-primary/5`,children:[o(`input`,{type:`checkbox`,checked:k,onChange:e=>A(e.target.checked),className:`accent-primary mt-0.5`}),n(`div`,{className:`space-y-0.5`,children:[o(`div`,{className:`text-xs font-medium text-foreground`,children:`Enable immediately`}),o(`div`,{className:`text-[10px] text-foreground-subtle`,children:`A disabled location receives no writes until enabled — reads and age-based retention still work, nothing new lands here. Leave this off to register the disk now and start using it later.`})]})]}),H.isError&&o(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:H.error instanceof Error?H.error.message:String(H.error)}),n(`div`,{className:`flex items-center justify-between pt-1`,children:[o(`button`,{onClick:()=>p(`config`),className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Back`}),n(`div`,{className:`flex items-center gap-2`,children:[o(`button`,{onClick:()=>{_(e),y(null),w({}),E(``),O(null),A(!1),P(null),p(`picker`)},className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Reset`}),n(`button`,{onClick:()=>{v&&H.mutate({id:U,type:h,displayName:T.trim(),providerId:v.providerId,config:S,enabled:k,nodeId:v.nodeLocal?j:void 0})},disabled:H.isPending||T.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[H.isPending?o(g,{className:`h-3.5 w-3.5 animate-spin`}):null,H.isPending?`Saving…`:`Save`]})]})]})]})]})})}function F(e){return E(e)}function I(e){return e===`active`}var L=[{mode:`active`,label:`Active`,consequence:`New data is written here, and the oldest is deleted when the disk fills up.`,requiresConfirmation:!1},{mode:`readonly`,label:`Read-only`,consequence:`Nothing new is written and nothing is ever deleted. A frozen archive that stays on the timeline.`,requiresConfirmation:!1},{mode:`drain`,label:`Drain`,consequence:`Nothing new is written. The oldest data here is deleted, a little at a time, until this location is empty.`,requiresConfirmation:!1},{mode:`disabled`,label:`Disabled`,consequence:`Nothing is written and nothing is read: the footage stored here disappears from the timeline until you turn it back on. Nothing is deleted.`,requiresConfirmation:!0}];function R(e){return L.find(t=>t.mode===e)??L[0]}function z(e){return R(e).requiresConfirmation}var B=`Blocked: this is the last location of its type still accepting writes — new data would have nowhere to go.`;function V(e,t,n){return I(n)||!I(F(e))||t.some(t=>t.id!==e.id&&I(F(t)))?{blocked:!1,reason:``}:{blocked:!0,reason:B}}function H(e,t){return{active:V(e,t,`active`).reason,readonly:V(e,t,`readonly`).reason,drain:V(e,t,`drain`).reason,disabled:V(e,t,`disabled`).reason}}function U(e,t,n){return!(n===`single`||t.length<=1||I(F(e))&&t.filter(e=>I(F(e))).length<=1)}function W(e){return e===`active`?{enabled:!0,readOnly:!1}:e===`readonly`?{enabled:!1,readOnly:!1}:{enabled:!1,readOnly:!0}}function re(e,t){let n={...t.config??e.config};t.mode!==void 0&&(W(t.mode).readOnly?n.readOnly=!0:delete n.readOnly);let r={id:e.id,type:e.type,displayName:t.displayName??e.displayName,providerId:e.providerId,config:n,isSystem:e.isSystem},i=t.nodeId??e.nodeId,a=i===void 0?r:{...r,nodeId:i};return t.mode===void 0?e.enabled===void 0?a:{...a,enabled:e.enabled}:{...a,mode:t.mode,enabled:W(t.mode).enabled}}var ie=1024**3;function G(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function ae(e){let t=G(e.minFreeGb);if(t!==null)return{unit:`gb`,value:t};let n=G(e.minFreePercent);return n===null?{unit:`percent`,value:null}:{unit:`percent`,value:n}}function oe(e,t){return G(e[t===`gb`?`minFreeGb`:`minFreePercent`])}function se(e,t){let n={...e};return delete n.minFreePercent,delete n.minFreeGb,t.value===null?n:t.unit===`gb`?{...n,minFreeGb:t.value}:{...n,minFreePercent:t.value}}function ce(e,t){let n=e.trim();if(n===``)return null;let r=Number(n);return Number.isFinite(r)?t===`percent`?Math.min(100,Math.max(0,r)):Math.max(0,r):null}function le(e,t,n=10){if(e.unit===`gb`&&e.value!==null)return e.value*ie;let r=e.value??n;return t===null||t<=0?null:t*Math.min(100,Math.max(0,r))/100}function ue(e){return e===`gb`?`GB to keep free`:`% of the volume to keep free`}function de(e,t=10){return`CamStack keeps ${e.value===null?`${String(t)}% of the volume (the default)`:e.unit===`gb`?`${String(e.value)} GB`:`${String(e.value)}% of the volume`} free on this disk. As it fills up, the OLDEST data stored here is deleted to hold that much free space; if it cannot be held any more, new data goes to another location of the same type instead of filling the disk. Leave the value empty for the default (${String(t)}%).`}function fe(e){return G(e.maxUsedGb)}function pe(e,t){let n=G(e.maxUsedGb);return n===null||n<0?null:{bytes:n*ie,reason:t===`drain`?`drain`:`legacy`}}t();function me({config:e,defaultPercent:t=10,onChange:r}){let[i,s]=a(()=>ae(e).unit),c=oe(e,i),l={unit:i,value:c},u=fe(e),d=t=>{s(t),r(se(e,{unit:t,value:null}))},f=t=>{r(se(e,{unit:i,value:ce(t,i)}))};return n(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Protected free space`}),n(`div`,{className:`flex items-center gap-2`,children:[n(`select`,{"aria-label":`Protection unit`,value:i,onChange:e=>{d(e.target.value===`gb`?`gb`:`percent`)},className:`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:[o(`option`,{value:`percent`,children:`% of the volume`}),o(`option`,{value:`gb`,children:`GB of free space`})]}),o(`input`,{type:`number`,"aria-label":ue(i),min:0,max:i===`percent`?100:void 0,value:c===null?``:c,placeholder:i===`percent`?String(t):`default`,onChange:e=>{f(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`})]}),o(`p`,{className:`text-[10px] text-foreground-subtle`,children:de(l,t)}),u!==null&&n(`p`,{className:`text-[10px] text-foreground-subtle italic`,children:[`This location also stores a maximum used size of `,u,` GB. That limit is managed by the system now and is no longer editable here; it is kept as it is.`]})]})}t();function he({location:e,onClose:t,onSaved:s}){let c=i(),u=l().trpcClient,[d,f]=a({...e.config}),[p,h]=a(e.displayName),[_,v]=a(null),[y,S]=a(!1),w=x(),T=r(()=>{let t=w.data;return Array.isArray(t)?t.find(t=>t.providerId===e.providerId)??null:null},[w.data,e.providerId]),E=m({onSuccess:()=>{c.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),s()}}),D=T?.shouldSaveDiskSpace===!0,O=T?.nodeLocal===!0,[k,te]=a(typeof e.nodeId==`string`?e.nodeId:`hub`),A=typeof d.basePath==`string`?d.basePath:``,j=e=>f(t=>({...t,basePath:e})),M=T?.minFreePercent??10,N=async()=>{S(!0),v(null);try{v(await(e=>u.storage.testConfig.query(e))({providerId:e.providerId,locationId:e.id,config:d}))}catch(e){v({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{S(!1)}};return o(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:t,children:n(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[n(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[n(`div`,{className:`space-y-0.5`,children:[n(`h2`,{className:`text-sm font-semibold text-foreground`,children:[`Edit `,e.displayName]}),n(`p`,{className:`text-xs text-foreground-subtle`,children:[o(`span`,{className:`font-mono`,children:e.id}),` ·`,` `,T?.displayName??e.providerId]})]}),o(`button`,{onClick:t,className:`text-foreground-subtle hover:text-foreground`,children:o(C,{className:`h-4 w-4`})})]}),n(`div`,{className:`p-4 space-y-3 max-h-[60vh] overflow-y-auto`,children:[n(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Display name`}),o(`input`,{type:`text`,value:p,onChange:e=>h(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`})]}),T&&o(ee,{schema:T.configSchema,values:d,onChange:f}),O&&n(`div`,{className:`space-y-2`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Node`}),o(b,{selectedNodeId:k,onSelect:te,alwaysShow:!0}),o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Path`}),o(ne,{nodeId:k,value:A,onChange:j})]}),D&&o(me,{config:d,defaultPercent:M,onChange:f}),!T&&!w.isLoading&&n(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-700 dark:text-amber-300`,children:[`Provider `,o(`code`,{className:`font-mono`,children:e.providerId}),` is no longer registered. Field schema unavailable; raw config is preserved on save.`]}),_&&o(`div`,{className:`rounded border px-3 py-2 text-[11px] ${_.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:_.ok?`Connection OK.`:`Test failed: ${_.error??`unknown error`}`}),E.isError&&o(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:E.error instanceof Error?E.error.message:String(E.error)})]}),n(`div`,{className:`flex items-center justify-between gap-2 border-t border-border px-4 py-3`,children:[o(`button`,{onClick:t,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Cancel`}),n(`div`,{className:`flex items-center gap-2`,children:[o(`button`,{onClick:()=>{N()},disabled:y||!T,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10 disabled:opacity-50`,children:y?`Testing…`:`Test connection`}),n(`button`,{onClick:()=>{E.mutate(re(e,{displayName:p.trim(),config:d,nodeId:O?k:e.nodeId}))},disabled:E.isPending||p.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[E.isPending?o(g,{className:`h-3.5 w-3.5 animate-spin`}):null,E.isPending?`Saving…`:`Save`]})]})]})]})})}function ge(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function _e(e){if(!ge(e))return null;let t=e.locationId;if(typeof t!=`string`||t.length===0)return null;let n=K(e.startedAtMs),r=K(e.startBytes),i=K(e.bytesRemaining);return n===null||r===null||i===null||typeof e.drained!=`boolean`?null:{locationId:t,startedAtMs:n,startBytes:r,bytesRemaining:i,drained:e.drained,estimatedEmptyAtMs:K(e.estimatedEmptyAtMs)}}function ve(e){let t=new Map;if(!Array.isArray(e))return t;for(let n of e){let e=_e(n);e!==null&&t.set(e.locationId,e)}return t}function ye(e){if(e.startBytes<=0||e.bytesRemaining>e.startBytes)return null;let t=e.startBytes-e.bytesRemaining;return Math.min(1,Math.max(0,t/e.startBytes))}function be(e,t){return e?t===void 0?{kind:`unreported`}:t.drained||t.bytesRemaining<=0?{kind:`drained`}:{kind:`draining`,bytesRemaining:t.bytesRemaining,drainedFraction:ye(t),estimatedEmptyAtMs:t.estimatedEmptyAtMs}:{kind:`idle`}}function xe(e){return e.mode===`drain`?!0:e.config.readOnly===!0}function Se(e){return`${(e/1024**3).toFixed(e>=100*1024**3?0:1)} GB`}function Ce(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function we({drain:e}){if(e.kind===`idle`)return null;if(e.kind===`unreported`)return o(`span`,{"data-testid":`drain-unreported`,className:`text-[10px] text-foreground-subtle`,title:`This location is draining. The hub has not reported how much is left yet — either the drain has just been set, or this hub predates the drain-progress report.`,children:`Draining · remaining not reported yet`});if(e.kind===`drained`)return o(`span`,{"data-testid":`drain-done`,className:`text-[10px] text-success`,title:`Everything that was here has been moved. The location is still in drain mode — it receives no new writes until you change that.`,children:`Drained · nothing left to move`});let t=e.drainedFraction===null?null:Math.round(e.drainedFraction*100);return n(`span`,{"data-testid":`drain-progress`,className:`flex items-center gap-1.5 text-[10px] text-foreground-subtle tabular-nums`,children:[t!==null&&o(`span`,{"data-testid":`drain-bar`,className:`inline-block h-1 w-10 rounded-full bg-border overflow-hidden`,role:`progressbar`,"aria-label":`Drain progress`,"aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":100,children:o(`span`,{className:`block h-full bg-warning`,style:{width:`${t}%`}})}),n(`span`,{children:[Se(e.bytesRemaining),` left`,t!==null&&` · ${t}% moved`]}),e.estimatedEmptyAtMs===null?o(`span`,{"data-testid":`drain-eta-absent`,title:`The drain is paced by how fast this class of data is still growing, and that has not been observed yet. There is no date to give.`,children:`· empty time not known yet`}):n(`span`,{"data-testid":`drain-eta`,children:[`· empty `,Ce(e.estimatedEmptyAtMs)]})]})}var Te=[`ok`,`warn`,`critical`];function Ee(e){return e>=.95?`critical`:e>=.85?`warn`:`ok`}function De(e){return Math.min(1,Math.max(0,e))}function q(e){let{availableBytes:t,totalBytes:n}=e;if(n===null||n<=0||t===null)return null;let r=De((n-t)/n);return{fraction:r,severity:Ee(r),recordingsFraction:De(e.usedBytes/n),freeBytes:t,totalBytes:n}}function Oe(e){if(e.length===0)return null;let t=0,n=0,r=0,i=0,a=null;for(let o of e){let e=q(o);if(e===null){n+=1;continue}t+=1,r+=e.totalBytes,i+=e.freeBytes,(a===null||Te.indexOf(e.severity)>Te.indexOf(a))&&(a=e.severity)}return{knownVolumes:t,unknownVolumes:n,totalBytes:r,freeBytes:i,severity:a}}var ke=`Capacity unknown — nothing measured this volume from here. A remote share, a location on another node, or a mount that did not answer.`;function J(e){return Math.min(1,Math.max(0,e))}function Y(e){return Math.round(J(e)*1e3)/10}function X(e){return`${String(Math.round(J(e)*100))}%`}function Ae(e,t,n={}){let{totalBytes:r,availableBytes:i}=e;if(r===null||r<=0||i===null){let e=n.ownedBytes===void 0||n.ownedBytes===null||!Number.isFinite(n.ownedBytes)||n.ownedBytes<0?null:D(n.ownedBytes);return{kind:`unknown`,owned:e,summary:e===null?ke:`${ke} CamStack holds ${e} here.`}}let a=Math.min(Math.max(i,0),r),o=r-a,s=t===null||t<=0?0:t,c=Math.min(s,a),l=s>a,u=a-c,d=n.ownedBytes,f=d==null||!Number.isFinite(d)||d<0?null:Math.min(d,o),p=o-(f??0),m=q({usedBytes:f??o,availableBytes:a,totalBytes:r}),h=m===null?J(o/r):m.fraction,g=m===null?Ee(h):m.severity,_=f===null?null:m===null?J(f/r):m.recordingsFraction,v=n.cap??null,y=v===null?null:J((c+v.bytes)/r),b=v!==null&&f!==null&&f>v.bytes,x={total:D(r),freeTotal:D(a),freeTotalPercent:X(a/r),used:D(p),usedPercent:X(p/r),free:D(u),freePercent:X(u/r),reserve:s===0?null:`${D(s)} kept free`,owned:f===null||_===null?null:`${D(f)} of recordings (${X(_)})`,cap:v===null?null:v.reason===`drain`?`${D(v.bytes)} drain target (managed by CamStack)`:`${D(v.bytes)} cap (managed by CamStack)`},S=[`${x.freeTotal} free of ${x.total} (${x.freeTotalPercent} free)`,x.owned===null?null:`CamStack holds ${x.owned}`,x.reserve===null?null:l?`${x.reserve} — less free than that right now, the oldest data here is being deleted`:x.reserve,x.cap===null?null:b?`${x.cap} — already below what is stored here, the oldest is being deleted`:x.cap].filter(e=>e!==null).join(` · `),C=[];return c>0&&C.push({segment:`reserve`,label:`Kept free`,value:D(s),alarming:l}),x.owned!==null&&C.push({segment:`owned`,label:`CamStack`,value:x.owned,alarming:!1}),C.push({segment:`used`,label:f===null?`Used`:`Other data`,value:`${x.used} (${x.usedPercent})`,alarming:g===`critical`}),C.push({segment:`free`,label:`Free`,value:`${x.free} (${x.freePercent})`,alarming:l}),v!==null&&C.push({segment:`cap`,label:v.reason===`drain`?`Drain target`:`Cap`,value:`${D(v.bytes)} · managed by CamStack`,alarming:b}),{kind:`known`,severity:g,legend:C,segments:{reservePercent:Y(c/r),ownedPercent:f===null?null:Y(f/r),usedPercent:Y(p/r),freePercent:Y(u/r),capPercent:y===null?null:Y(y)},labels:x,reserveExceedsFree:l,capBelowOwned:b,summary:S}}var je={ok:`bg-primary`,warn:`bg-amber-500`,critical:`bg-danger`},Z={reserve:`bg-danger/40`,owned:`bg-foreground/50`,free:`bg-border`,cap:`bg-foreground`};function Me(e,t){return e===`used`?je[t]:Z[e]}function Ne({location:e,ownedBytes:t}){let r=e.capacity??null,i=le(ae(e.config),r?.totalBytes??null),a=Ae({totalBytes:r?.totalBytes??null,availableBytes:r?.availableBytes??null},i,{ownedBytes:t??null,cap:pe(e.config,F(e))});return a.kind===`unknown`?o(`div`,{className:`text-[10px] text-foreground-subtle italic`,title:a.summary,children:a.owned===null?`Capacity unknown`:`Capacity unknown · CamStack holds ${a.owned}`}):n(`div`,{className:`mt-1 space-y-1`,title:a.summary,children:[n(`div`,{className:`relative flex h-2 w-full max-w-md overflow-hidden rounded-full bg-border`,children:[a.segments.reservePercent>0&&o(`div`,{className:Z.reserve,style:{width:`${String(a.segments.reservePercent)}%`}}),a.segments.ownedPercent!==null&&o(`div`,{className:Z.owned,style:{width:`${String(a.segments.ownedPercent)}%`}}),o(`div`,{className:je[a.severity],style:{width:`${String(a.segments.usedPercent)}%`}}),o(`div`,{className:Z.free,style:{width:`${String(a.segments.freePercent)}%`}}),a.segments.capPercent!==null&&o(`div`,{className:`absolute inset-y-0 w-px ${a.capBelowOwned?`bg-danger`:Z.cap}`,style:{left:`${String(a.segments.capPercent)}%`}})]}),o(`ul`,{className:`flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:a.legend.map(e=>n(`li`,{className:`flex items-center gap-1`,children:[o(`span`,{"aria-hidden":`true`,className:`inline-block h-2 w-2 shrink-0 rounded-sm ${Me(e.segment,a.severity)}`}),n(`span`,{className:`text-[10px] tabular-nums ${e.alarming?`text-danger`:`text-foreground-subtle`}`,children:[e.label,` `,e.value]})]},e.segment))})]})}var Pe={eventMedia:[`events`],recordingsLow:[`low`],recordings:[`high`,`mid`]},Fe={eventMedia:`pipeline-analytics`,recordingsLow:`recorder`,recordings:`recorder`},Ie=`storage.discardLocation`,Le=`storage.discardLocationStatus`,Re=`storage.discardLocationCancel`;function ze(e){return Pe[e]??null}function Be(e){return Fe[e]??null}function Ve(e){return!I(F(e))}function He(e,t){return ze(e.type)===null||!Ve(e)?!1:t.some(t=>t.id!==e.id&&I(F(t)))}var Ue=new Set([`idle`,`scanning`,`wiping-fs`,`wiping-db`,`cascading`,`complete`,`cancelled`,`error`]);function Q(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function $(e){return typeof e==`string`?e:null}function We(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.running!=`boolean`)return null;let n=t.phase;if(typeof n!=`string`||!Ue.has(n))return null;let r=Q(t.camerasTotal),i=Q(t.camerasDone),a=Q(t.foldersRemoved),o=Q(t.dbRowsDeleted),s=Q(t.ownersCascaded);return r===null||i===null||a===null||o===null||s===null?null:{running:t.running,locationId:$(t.locationId),jobId:$(t.jobId),phase:n,camerasTotal:r,camerasDone:i,foldersRemoved:a,dbRowsDeleted:o,ownersCascaded:s,detail:$(t.detail)??``,startedAtMs:Q(t.startedAtMs),finishedAtMs:Q(t.finishedAtMs),error:$(t.error)}}function Ge(e){if(e.phase===`complete`)return 100;if(e.phase===`cancelled`||e.phase===`error`||e.phase===`idle`)return e.camerasTotal>0?Math.min(99,Math.round(e.camerasDone/e.camerasTotal*100)):0;if(e.camerasTotal>0){let t=e.camerasDone/e.camerasTotal*85;return e.phase===`wiping-db`?Math.min(95,Math.round(t+8)):e.phase===`cascading`?Math.min(99,Math.round(t+12)):Math.min(85,Math.round(t))}return e.phase===`scanning`?2:5}t();var Ke=2e3;function qe({location:e,siblings:t}){return He(e,t)?o(Je,{location:e}):null}function Je({location:e}){let t=h(),r=v(),i=Be(e.type),[c,l]=a(null),[u,d]=a(null),[f,p]=a(!1);if(s(()=>{if(i===null)return;let e=!1,t=async()=>{try{let t=await r.mutateAsync({addonId:i,action:Le,input:{}});if(e)return;l(We(t))}catch{}};t();let n=setInterval(()=>void t(),Ke);return()=>{e=!0,clearInterval(n)}},[i,e.id]),i===null)return null;let m=c!==null&&c.locationId===e.id,_=m&&c.running,y=m&&c.phase!==`idle`,b=async()=>{if(await t({title:`Discard leftovers on "${e.displayName}"?`,message:`Permanently deletes leftover files and records on this location. Other locations are not affected. This cannot be undone and may take hours.`,confirmLabel:`Discard leftovers`,variant:`danger`})){d(null),p(!0);try{await r.mutateAsync({addonId:i,action:Ie,input:{locationId:e.id}}),l(We(await r.mutateAsync({addonId:i,action:Le,input:{}})))}catch(e){d(e instanceof Error?e.message:String(e))}finally{p(!1)}}},x=async()=>{try{await r.mutateAsync({addonId:i,action:Re,input:{}})}catch(e){d(e instanceof Error?e.message:String(e))}};return n(`div`,{className:`flex flex-col gap-1 min-w-[9rem] max-w-[16rem]`,children:[_?n(`button`,{type:`button`,onClick:()=>void x(),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger border border-danger/40 hover:bg-danger/10`,children:[o(C,{className:`h-3 w-3`}),`Cancel`]}):n(`button`,{type:`button`,onClick:()=>void b(),disabled:f,title:`Permanently delete leftover files on this location. Other locations are not affected.`,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger border border-danger/40 hover:bg-danger/10 disabled:opacity-50`,children:[f?o(g,{className:`h-3 w-3 animate-spin`}):o(O,{className:`h-3 w-3`}),`Discard leftovers`]}),y&&c!==null&&n(`div`,{className:`space-y-0.5`,children:[o(`div`,{className:`h-1 rounded bg-border overflow-hidden`,children:o(`div`,{className:`h-full bg-primary transition-[width] duration-300`,style:{width:`${Ge(c)}%`}})}),n(`p`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[c.phase,c.camerasTotal>0?` · ${c.camerasDone}/${c.camerasTotal} cam`:``,c.dbRowsDeleted>0?` · ${c.dbRowsDeleted} rows`:``,c.detail?` · ${c.detail}`:``]})]}),(u||m&&c?.error)&&o(`p`,{className:`text-[10px] text-danger leading-tight`,children:u??c?.error})]})}t();var Ye={active:y,readonly:w,drain:T,disabled:d},Xe={active:`border-success/30 text-success hover:bg-success/10`,readonly:`border-border text-foreground-subtle hover:text-foreground hover:bg-primary/10`,drain:`border-warning/40 text-warning hover:bg-warning/10`,disabled:`border-danger/40 text-danger hover:bg-danger/10`};function Ze({mode:e,open:t,onToggle:r}){let i=R(e),a=Ye[e];return n(`button`,{type:`button`,"aria-expanded":t,"aria-label":`Location state`,onClick:r,title:i.consequence,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium border ${Xe[e]}`,children:[o(a,{className:`h-3 w-3`}),i.label,o(c,{className:`h-3 w-3 ${t?`rotate-180`:``}`})]})}function Qe({mode:e,blockedReasons:t,onSelect:r,onDismiss:i}){return s(()=>{let e=e=>{e.key===`Escape`&&i()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[i]),n(`div`,{className:`w-full basis-full rounded-lg border border-border bg-background p-1`,role:`group`,"aria-label":`Location state choices`,children:[n(`div`,{className:`flex items-center justify-between px-2 py-1`,children:[o(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Location state`}),o(`button`,{type:`button`,"aria-label":`Close location state choices`,onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:o(C,{className:`h-3 w-3`})})]}),L.map(a=>{let s=t[a.mode],c=s!==``,l=Ye[a.mode],u=a.mode===e;return n(`button`,{type:`button`,role:`radio`,"aria-checked":u,"aria-label":a.label,disabled:c,onClick:()=>{c||(i(),u||r(a.mode))},className:`flex w-full flex-col items-start gap-0.5 rounded px-2 py-1.5 text-left ${c?`cursor-not-allowed opacity-60`:u?`bg-primary/10`:`hover:bg-primary/5`}`,children:[n(`span`,{className:`flex items-center gap-1.5 text-[11px] font-medium text-foreground`,children:[o(l,{className:`h-3 w-3`}),a.label,u&&o(`span`,{className:`text-[9px] uppercase text-primary`,children:`current`})]}),o(`span`,{className:`text-[10px] leading-snug text-foreground-subtle`,children:a.consequence}),c&&o(`span`,{className:`text-[10px] leading-snug text-warning`,children:s})]},a.mode)})]})}t();function $e(e){let t=e.basePath;if(typeof t==`string`&&t.length>0)return t;let n=Object.keys(e);return n.length===0?``:n.join(`, `)}function et({location:e,onEdit:t,onDelete:r,onSetMode:i,blockedReasons:s,canDelete:c,siblings:l=[],drain:u,ownedBytes:d}){let[p,m]=a(!1),h=$e(e.config),g=F(e);return n(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2 px-3 py-2 border-t border-border first:border-t-0 hover:bg-primary/5`,children:[n(`div`,{className:`flex items-start gap-2 min-w-0 flex-1 basis-72`,children:[o(`div`,{className:`shrink-0 sm:w-32`,"data-testid":`location-badge-slot`,children:o(`span`,{className:`inline-block text-[10px] uppercase tracking-wide text-foreground-subtle bg-background border border-border rounded px-1.5 py-0.5 font-mono`,children:e.providerId})}),n(`div`,{className:`min-w-0 flex-1`,children:[o(`div`,{className:`text-xs font-medium text-foreground truncate`,children:e.displayName}),h&&o(`div`,{className:`text-[10px] text-foreground-subtle truncate font-mono`,children:h}),o(Ne,{location:e,ownedBytes:d??null}),u!==void 0&&o(we,{drain:u})]})]}),n(`div`,{className:`flex flex-wrap items-center gap-1 shrink-0`,children:[o(qe,{location:e,siblings:l}),o(Ze,{mode:g,open:p,onToggle:()=>{m(e=>!e)}}),n(`button`,{onClick:()=>t(e),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle border border-border hover:text-foreground hover:bg-primary/10`,children:[o(_,{className:`h-3 w-3`}),`Edit`]}),c&&o(`button`,{onClick:()=>r(e),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,title:`Delete location`,children:o(f,{className:`h-3 w-3`})})]}),p&&o(Qe,{mode:g,blockedReasons:s,onSelect:t=>i(e,t),onDismiss:()=>{m(!1)}})]})}t();function tt({type:e,displayName:t,description:i,cardinality:a,locations:s,onAdd:c,onEdit:l,onDelete:u,onSetMode:d,ownedBytesById:f,drainById:p}){let m=r(()=>{let e=[...s];return e.sort((e,t)=>{let n=I(F(e));return n===I(F(t))?e.displayName.localeCompare(t.displayName):n?-1:1}),e},[s]);return n(`div`,{className:`rounded-lg border border-border bg-surface`,children:[n(`div`,{className:`flex items-start justify-between border-b border-border px-3 py-2`,children:[n(`div`,{className:`space-y-0.5`,children:[n(`div`,{className:`flex items-center gap-2`,children:[o(`span`,{className:`text-sm font-semibold text-foreground capitalize`,children:t}),o(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle bg-background border border-border rounded px-1.5 py-0.5 font-mono`,children:e})]}),i&&o(`p`,{className:`text-[11px] text-foreground-subtle`,children:i}),a===`single`&&o(`p`,{className:`text-[10px] text-foreground-subtle italic`,children:`Single — one location per type. Edit the existing entry; it can't be split.`})]}),a===`multi`&&n(`button`,{onClick:()=>c(e),className:`inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[11px] font-medium text-primary-foreground hover:bg-primary/90`,children:[o(S,{className:`h-3 w-3`}),`Add`]})]}),m.length===0?o(`div`,{className:`px-3 py-4 text-center text-[11px] text-foreground-subtle italic`,children:a===`multi`?`No location registered. Click "Add" to register one.`:`No location registered yet — should be auto-seeded at next boot.`}):o(`div`,{children:m.map(e=>o(et,{location:e,cardinality:a,canDelete:U(e,m,a),onEdit:l,onDelete:u,onSetMode:d,blockedReasons:H(e,m),ownedBytes:f?.get(e.id)??null,drain:be(xe(e),p?.get(e.id)),siblings:m},e.id))})]})}var nt=[`recordings`,`recordingsLow`];function rt(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function it(e,t){if(t===void 0||!nt.includes(e.type))return null;let n=t.find(t=>rt(t).includes(e.id));return n===void 0||!Number.isFinite(n.usedBytes)||n.usedBytes<0?null:n.usedBytes}function at(e,t){let n=new Map;for(let r of e){let e=it(r,t);e!==null&&n.set(r.id,e)}return n}export{ve as a,R as c,Oe as i,z as l,tt as n,he as o,q as r,re as s,at as t,P as u};
|
|
@@ -12,8 +12,8 @@ const __mfImport = (src) =>
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
(async () => {
|
|
15
|
-
const __mfHostInit = await __mfImport("./hostInit-
|
|
15
|
+
const __mfHostInit = await __mfImport("./hostInit-CG02F6uF.js");
|
|
16
16
|
await __mfHostInit.__tla;
|
|
17
17
|
const { initHost } = __mfHostInit;
|
|
18
18
|
await initHost();
|
|
19
|
-
})().then(() => __mfImport("./index-
|
|
19
|
+
})().then(() => __mfImport("./index-DFWOuEL5.js"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./src-DP92R2_g.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Q as e,S as t,W as n,b as r,i,q as a,x as o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{at as s,st as c}from"./player-overlays-aOXZvSE_.js";import{Bd as l,Ks as u,Rn as d,Ta as f,Ws as p,au as m,bn as h,en as g,f as ee,vu as te,xl as ne}from"./src-DP92R2_g.js";import{B as re,G as _,I as ie,J as ae,Jn as v,L as oe,O as se,Q as ce,R as le,U as y,W as b,Y as ue,Z as de,_ as fe,at as pe,ct as me,d as he,dt as ge,et as x,fn as _e,ft as ve,g as ye,h as be,it as xe,k as Se,lt as Ce,ot as S,pn as we,pt as Te,q as Ee,st as C,tt as De,ut as Oe,v as ke,x as Ae,y as je,z as w}from"./src-Cq9_wgDT.js";import{t as T}from"./useTranslation-Bc5yH9V9.js";e();function E(e){return t=>Object.prototype.hasOwnProperty.call(e,t)}var Me=E({devices:!0}),Ne=E({classes:!0,classesExclude:!0,labelEquals:!0,identities:!0,identitiesExclude:!0,eventTypeTokens:!0,sensorKinds:!0}),Pe=E({minConfidence:!0,minImportance:!0,minLabelConfidence:!0}),Fe=E({minDwellSeconds:!0}),Ie=E({source:!0}),Le=E({crossing:!0}),Re=E({packagePhase:!0}),ze=E({sensorTransition:!0}),Be=E({plates:!0}),Ve=E({occupancy:!0}),He=E({audio:!0}),Ue=E({systemEvent:!0}),We=E({deviceState:!0}),Ge=E({scene:!0});function Ke(e,t){let n=e[t];return Array.isArray(n)?n:[]}function qe(e,t){let n=e[t];return typeof n==`number`?n:void 0}function D(e,t){let r=s().trpcClient,a=i({queries:e.map(e=>({queryKey:[[`nc-pickers`,`zones`],{deviceId:e}],staleTime:3e4,queryFn:async()=>({deviceId:e,zones:(await r.zones.listZones.query({deviceId:e})).map(e=>({id:e.id,name:e.name}))})}))});return n(()=>{let e=[],n=new Set;for(let r of a){if(!r.data)continue;let i=t.find(e=>e.id===r.data.deviceId)?.name;for(let t of r.data.zones)n.has(t.id)||(n.add(t.id),e.push({value:t.id,label:t.name,...i===void 0?{}:{hint:i}}))}return{options:e,loading:a.some(e=>e.isLoading),failed:a.some(e=>e.isError)}},[a,t])}function Je(e){let t=s().trpcClient,r=i({queries:e.map(e=>({queryKey:[[`nc-pickers`,`event-kinds`],{deviceId:e}],staleTime:6e4,queryFn:async()=>(await t.pipelineAnalytics.listEventKinds.query({deviceId:e})).map(e=>({kind:e.kind,label:e.label}))}))});return n(()=>{let e=new Map;for(let t of r)for(let n of t.data??[])e.has(n.kind)||e.set(n.kind,n.label);let t=[...e.entries()].map(([e,t])=>({value:e,label:t}));return t.sort((e,t)=>e.label.localeCompare(t.label)),{options:t,loading:r.some(e=>e.isLoading)}},[r])}function Ye(){let e=f();return n(()=>({options:(e.data??[]).map(e=>({value:e.id,label:e.name})),loading:e.isLoading,failed:e.isError===!0}),[e.data,e.isLoading,e.isError])}function Xe(){let e=p({limit:200}),t=u();return n(()=>{let n=new Set;for(let e of t.data??[])e.name.trim().length>0&&n.add(e.name);let r=new Set;for(let t of e.data??[])t.text.trim().length>0&&r.add(t.text);return[...[...n].sort(),...[...r].sort()]},[e.data,t.data])}function O({options:e,value:r,onChange:i,loading:s,emptyHint:c,placeholder:l,noFreeText:u=!1}){let[d,f]=a(``),p=n(()=>new Set(e.map(e=>e.value)),[e]),m=n(()=>new Set(r),[r]),h=r.filter(e=>!p.has(e)),g=e=>{i(m.has(e)?r.filter(t=>t!==e):[...r,e])},ee=()=>{let e=d.trim();e.length===0||r.includes(e)||(i([...r,e]),f(``))};return t(`div`,{className:`mt-1 space-y-1.5`,children:[h.length>0&&o(`div`,{className:`flex flex-wrap gap-1`,children:h.map(e=>t(`button`,{type:`button`,onClick:()=>i(r.filter(t=>t!==e)),className:`inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground hover:bg-surface-hover`,title:`Custom value — click to remove`,children:[e,` ×`]},e))}),e.length>0?o(`div`,{className:`max-h-40 overflow-y-auto rounded-md border border-border divide-y divide-border`,children:e.map(e=>t(`label`,{className:`flex items-center gap-2.5 px-3 py-1.5 text-xs text-foreground cursor-pointer hover:bg-surface-hover`,children:[o(`input`,{type:`checkbox`,checked:m.has(e.value),onChange:()=>g(e.value),className:`accent-primary`}),o(`span`,{className:`flex-1 truncate`,children:e.label}),e.hint!==void 0&&o(`span`,{className:`text-[10px] text-foreground-subtle`,children:e.hint})]},e.value))}):o(`p`,{className:`text-[10px] text-foreground-subtle`,children:s===!0?`Loading…`:c}),!u&&o(`input`,{value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),ee())},placeholder:l,className:`w-full rounded-md border border-border bg-background px-2 py-1 text-xs text-foreground placeholder:text-foreground-subtle`})]})}var k=[{value:`immediate`,label:`Immediate`,hint:`Fires on the first matching detection of a track (lowest latency).`},{value:`track-end`,label:`Track end`,hint:`Evaluates the finalised track record when it closes.`},{value:`device-event`,label:`Device event`,hint:`Doorbell press, sensor state change, or an occupancy edge on a linked device.`},{value:`package-event`,label:`Package event`,hint:`A parcel delivery or pick-up.`},{value:`system-event`,label:`System event`,hint:`The installation itself: a camera or stream going offline, a node leaving the cluster, an addon or server update becoming available.`}],A=`Immediate, grouped`,Ze=k.flatMap(e=>e.value===`immediate`?[e,{value:`immediate-grouped`,label:A,hint:`Waits for subjects to be recognised, then sends one message with a mosaic, one picture per subject.`}]:[e]);function Qe(e){return e.groupingSec!==void 0&&y(e)?`immediate-grouped`:e.delivery}function $e(e){let t=(e.delivery===`immediate`||e.delivery===`track-end`)&&y({delivery:`immediate`,conditions:e.conditions});return Ze.filter(e=>e.value!==`immediate-grouped`||t)}function et(e){return Ze.find(t=>t.value===e)?.value}function tt(e,t=A){return Qe(e)===`immediate-grouped`?`${t} · ${String(e.groupingSec)} s`:rt(e.delivery)}function nt(e){if(e.trim().length===0)return;let t=Number(e);return Number.isFinite(t)&&t>=0?Math.trunc(t):void 0}function rt(e){return k.find(t=>t.value===e)?.label??e}function it(e){return k.some(t=>t.value===e)}var at=[{key:`all`,label:`All rules`,blurb:`Every event-driven notification rule. Summaries and Timelapses live in their own tabs on this same Rules page — pick the type under New rule when creating from here.`,newRuleLabel:`New rule`,emptyHint:`No event-driven rules yet. Click "New rule" and pick Rule, Summary or Timelapse.`,creatable:!0},{key:`detection`,label:`Detections`,blurb:`Rules driven by what the cameras SEE — detections, tracks and package events. Doorbell presses and other sensor changes have their own section now (operator ruling, 2026-10-01).`,newRuleLabel:`New detection rule`,emptyHint:`No detection rules yet. Click "New detection rule" to author one.`,creatable:!0},{key:`sensor`,label:`Sensors`,blurb:`Rules driven by a device or sensor CHANGING STATE — a doorbell press, a linked sensor opening or closing. The picture is one snapshot of the camera the sensor is attributed to; there is no media choice to make.`,newRuleLabel:`New sensor rule`,emptyHint:`No sensor rules yet. Click "New sensor rule" to be told when a doorbell is pressed or a linked sensor changes.`,creatable:!0},{key:`audio`,label:`Sound`,blurb:`Rules on what the cameras HEAR: a sustained window of sound loud enough, or classified as one of the sounds you name. A sound rule is an immediate rule carrying the sound condition — it fires only on a confirmed sampling window, never on a picture.`,newRuleLabel:`New sound rule`,emptyHint:`No sound rules yet. Click "New sound rule" — it opens on the sound condition already filled in with a level threshold, so you only have to name the sounds and the targets.`,creatable:!0},{key:`occupancy`,label:`Occupancy`,blurb:`Rules on how many objects are in a camera frame or a zone, and for how long: "the driveway became occupied", "the garden emptied". An occupancy rule is a device-event rule carrying the occupancy condition.`,newRuleLabel:`New occupancy rule`,emptyHint:`No occupancy rules yet. Click "New occupancy rule" — it opens on the occupancy condition; pick the camera on the Devices tab, then the zone and the count.`,creatable:!0},{key:`device-events`,label:`Device events`,blurb:`Rules about your devices: offline or back, switched off or on, a stream dropping, a battery or consumable running low, a camera detecting nothing. These carry no image.`,newRuleLabel:`New device-event rule`,emptyHint:`No device-event rules yet. Click "New device-event rule" to be told when a device drops, a battery runs low or a camera goes blind.`,creatable:!0},{key:`system`,label:`System events`,blurb:`Rules about the installation itself: a node leaving the cluster, an addon crash-looping, an update available or installed, a backup or export finishing. These carry no image and are not tied to a detection.`,newRuleLabel:`New system rule`,emptyHint:`No system rules yet. Click "New system rule" to be told when a node leaves, an update lands or a backup finishes.`,creatable:!0},{key:`alarm`,label:`Alarm`,blurb:`Rules about the alarm panel: arming, armed, triggered, disarmed, and the refusals in between.`,newRuleLabel:`New alarm rule`,emptyHint:`No alarm rules yet. Click "New alarm rule" to be told when the alarm arms, goes off or is disarmed.`,creatable:!0},{key:`mixed`,label:`To recreate`,blurb:`System rules authored before the three families existed. Each mixes families and keeps firing as it is, but it cannot be edited: recreate it as one rule per family (Device events, System events, Alarm). Open none of them: Delete each once its replacements exist.`,newRuleLabel:`New rule`,emptyHint:`Nothing to recreate.`,creatable:!1}];function ot(e){return _(b(e)).editable}function st(e){return re(ct(e))}function ct(e){switch(e){case`device-events`:case`system`:case`alarm`:case`mixed`:return e;default:return}}var lt=new Map([[0,`No cooldown`],[60,`1 minute`],[3600,`1 hour`]]),ut=86400;function dt(e){let t=lt.get(e);return t===void 0?e%3600==0?`${e/3600} hours`:e%60==0?`${e/60} minutes`:`${e} seconds`:t}function ft(e){if(e.trim().length===0)return;let t=Number(e);return Number.isFinite(t)&&t>=0?Math.trunc(t):void 0}var pt=[{value:`rule-device`,label:`Per device`},{value:`rule`,label:`Whole rule (one window for every device)`}];function mt(e){return pt.find(t=>t.value===e)?.value}var ht=[{value:`per-class`,label:`Separate windows per class (default)`},{value:`shared`,label:`Shared across classes`}];function gt(e){return ht.find(t=>t.value===e)?.value}var j=[{value:`best`,label:`Best available image`,description:`The best subject crop available when the notification is sent.`},{value:`best-matching`,label:`Best matching image`,description:`The image that explains why the rule fired — the face crop for an identity rule, the plate crop for a plate rule; falls back to the best image otherwise.`},{value:`keyFrame`,label:`Key frame`,description:`The clean full scene frame with no subject box.`},{value:`none`,label:`No attachment`,description:`Send the notification with no image.`}];function _t(e){return j.find(t=>t.value===e)?.value}var M=[{value:``,label:`Automatic`},{value:`cropped`,label:`Cropped on the subject`},{value:`full`,label:`Full frame`},{value:`boxed`,label:`Full frame with boxes`}];function vt(e){let t=M.find(t=>t.value===e)?.value;return t===``?void 0:t}var N=[{value:``,label:`Mosaic of every linked camera (default)`},{value:`mosaic`,label:`Mosaic of every linked camera`},{value:`each`,label:`One image per camera (first camera where only one is allowed)`}];function yt(e){let t=N.find(t=>t.value===e)?.value;return t===``?void 0:t}var P=[{value:``,label:`Lowest available`},{value:`low`,label:`Low`},{value:`mid`,label:`Medium`},{value:`high`,label:`High`}];function bt(e){let t=P.find(t=>t.value===e)?.value;return t===``?void 0:t}var xt=[{value:`any`,label:`Any source`},{value:`pipeline`,label:`Pipeline`},{value:`onboard`,label:`Onboard (camera)`},{value:`sensor`,label:`Sensor`}],St=[{value:`delivered`,label:`Delivered`},{value:`picked-up`,label:`Picked up`},{value:`both`,label:`Both`}],Ct=[{value:``,label:`It triggers and when it clears`},{value:`raised`,label:`Only when it triggers`},{value:`cleared`,label:`Only when it clears`}];function wt(e){return e===`raised`||e===`cleared`?e:void 0}function F(e,t){return e===`sensorTransition`?Se(t.sensorKinds):!0}var Tt=[{value:`enter`,label:`Entering`},{value:`exit`,label:`Leaving`},{value:`any`,label:`Entering or leaving`}],Et=`enter`;function I(e){return e===`exit`||e===`any`?e:void 0}var Dt=[{value:1,label:`1 — Min`},{value:2,label:`2 — Low`},{value:3,label:`3 — Default`},{value:4,label:`4 — High`},{value:5,label:`5 — Max`}];function Ot(e,t){return e.options&&e.options.length>0?e.options:t}var kt=[{value:``,label:`Default (2×)`},{value:`1`,label:`1× — real time`},{value:`2`,label:`2×`},{value:`3`,label:`3×`},{value:`4`,label:`4×`},{value:`6`,label:`6×`},{value:`8`,label:`8×`}];function At(e){if(e===``)return;let t=Number(e);return Number.isFinite(t)&&t>=1&&t<=8?t:void 0}var jt=new Map(Object.entries({"device-offline":`Device offline`,"device-online":`Device online`,"device-disabled":`Device switched off`,"device-enabled":`Device switched on`,"stream-offline":`Stream offline`,"stream-online":`Stream online`,"device-battery-low":`Battery low`,"device-battery-normal":`Battery back to normal`,"device-consumable-low":`Consumable low`,"device-consumable-normal":`Consumable back to normal`,"device-tank-low":`Tank low (water, detergent)`,"device-tank-full":`Tank full (dirty water, dust)`,"device-tank-normal":`Tank back to normal`,"detection-blind":`Camera detecting nothing`,"node-offline":`Node offline`,"node-online":`Node online`,"node-inference-unavailable":`Node has no usable inference device`,"addon-crash-loop":`Addon stopped after repeated crashes`,"addon-update-available":`Addon update available`,"addon-updated":`Addons updated`,"server-update-available":`Server update available`,"server-updated":`Server updated`,"wrapper-update-available":`Container / app update available`,"export-completed":`Export completed`,"backup-completed":`Backup completed`,"alarm-arm-refused":`Alarm arm refused (something is open)`,"alarm-check-failed":`Alarm check failed (armed anyway)`,"alarm-arming":`Alarm arming (exit delay)`,"alarm-armed":`Alarm armed`,"alarm-pending":`Alarm entry delay started`,"alarm-triggered":`Alarm triggered`,"alarm-rearmed":`Alarm re-armed after siren`,"alarm-sensor-bypass":`Alarm sensor bypass`,"alarm-disarmed":`Alarm disarmed`}));function Mt(e){return jt.get(e)}var Nt={"device-state":`A device the hub can no longer reach, or that came back. Switched off / on is a device an operator turned off or back on — not a fault, a choice.`,streams:`A stream that stopped or came back.`,battery:`A battery below the cluster threshold, and (optionally) its return to normal. Devices with a binary low-battery indicator are judged by the indicator, not by the percentage.`,consumables:`A consumable — filter, brush, bag — at or below this rule’s threshold, or that the device reports as due for replacement, and (optionally) its return to normal after a change. A device that only says "replace" is judged by that, not by a percentage.`,tanks:`A robot vacuum tank the device reports as running low (clean water, detergent) or full (dirty water, dust bin), and (optionally) its return to normal once refilled or emptied.`,"detection-blind":`A camera that is running and being analysed, but detects nothing — up, and producing no work.`,nodes:`An agent or worker node joining or leaving the cluster, or an online node whose inference devices all went away.`,addons:`An addon the hub has stopped restarting after repeated crashes, a newer version of an addon, or an addon update that just finished.`,updates:`A newer version of the server itself, or of the container / app the node runs inside, is available — or a server update just finished.`,"backups-exports":`A scheduled or manual backup of the hub finished, or a footage export finished rendering.`,alarm:`The alarm panel refusing to arm, arming, armed, counting down to a siren, going off, re-arming, excluding an open sensor, or being disarmed.`},L=ce.map(e=>({id:e.id,family:e.family,label:e.label,hint:Nt[e.id]??``,kinds:e.kinds.flatMap(e=>{let t=Mt(e);return t===void 0?[]:[{value:e,label:t}]})}));function R(e){return L.filter(t=>t.family===e)}function z(e){let t=Ee(e).conditions.systemEvent;return t===void 0?{kinds:(R(e)[0]?.kinds??[]).map(e=>e.value)}:{...t,kinds:[...t.kinds]}}var B=L.flatMap(e=>e.kinds);function V(e){return B.find(t=>t.value===e)?.label??e}function Pt(e){return{devices:x(e,`deviceIds`),deviceTypes:x(e,`deviceTypes`),nodes:x(e,`nodeIds`),packages:x(e,`packageNames`),consumableThreshold:x(e,`consumableLowPercent`)}}function H(e,t){let n=de[e],r=Pt(t);return{devices:n.includes(`deviceIds`)&&r.devices,excludeDevices:n.includes(`excludeDeviceIds`)&&r.devices,deviceTypes:n.includes(`deviceTypes`)&&r.deviceTypes,nodes:n.includes(`nodeIds`)&&r.nodes,packages:n.includes(`packageNames`)&&r.packages,consumableThreshold:n.includes(`consumableLowPercent`)&&r.consumableThreshold}}var Ft=Object.values(v).map(e=>({value:e,label:It(e)})).toSorted((e,t)=>e.label.localeCompare(t.label));function It(e){let t=e.replaceAll(`-`,` `);return t.charAt(0).toUpperCase()+t.slice(1)}function Lt(e,t,n){if(!R(n).some(e=>e.kinds.some(e=>e.value===t)))return e;let r=e?.kinds??[];return r.length===1&&r[0]===t?e:Bt(e,r.includes(t)?r.filter(e=>e!==t):B.filter(e=>e.value===t||r.includes(e.value)).map(e=>e.value),n)}function Rt(e,t){return t===void 0?void 0:Bt(t,t.kinds,e)}function zt(e,t){let n=e?.kinds??[];if(n.length===0)return;let r=U(t,`deviceIds`,e?.deviceIds),i=U(t,`excludeDeviceIds`,e?.excludeDeviceIds),a=U(t,`deviceTypes`,e?.deviceTypes),o=U(t,`nodeIds`,e?.nodeIds),s=U(t,`packageNames`,e?.packageNames),c=Object.prototype.hasOwnProperty.call(t,`consumableLowPercent`)?t.consumableLowPercent:e?.consumableLowPercent;return{kinds:[...n],...r===void 0?{}:{deviceIds:[...r]},...i===void 0?{}:{excludeDeviceIds:[...i]},...a===void 0?{}:{deviceTypes:[...a]},...o===void 0?{}:{nodeIds:[...o]},...s===void 0?{}:{packageNames:[...s]},...c===void 0?{}:{consumableLowPercent:c}}}function U(e,t,n){let r=Object.prototype.hasOwnProperty.call(e,t)?e[t]:n;return r!==void 0&&r.length===0?void 0:r}function Bt(e,t,n){let r=H(n,t),i=r.devices?e?.deviceIds:void 0,a=r.excludeDevices?e?.excludeDeviceIds:void 0,o=r.deviceTypes?e?.deviceTypes:void 0,s=r.nodes?e?.nodeIds:void 0,c=r.packages?e?.packageNames:void 0,l=r.consumableThreshold?e?.consumableLowPercent:void 0;return{kinds:[...t],...i&&i.length>0?{deviceIds:[...i]}:{},...a&&a.length>0?{excludeDeviceIds:[...a]}:{},...o&&o.length>0?{deviceTypes:[...o]}:{},...s&&s.length>0?{nodeIds:[...s]}:{},...c&&c.length>0?{packageNames:[...c]}:{},...l===void 0?{}:{consumableLowPercent:l}}}var Vt=95;function Ht(e){let t=e.trim();if(t===``)return{kind:`clear`};let n=Number(t);return Number.isInteger(n)&&n>=1&&n<=Vt?{kind:`set`,value:n}:{kind:`invalid`}}function Ut(e,t=2){if(e===void 0||e.length===0)return`No event selected`;let n=e.slice(0,t).map(V).join(`, `),r=e.length-Math.min(t,e.length);return r>0?`${n} +${r}`:n}function Wt(e){if(e===void 0)return`—`;let t=[],n=e.deviceIds?.length??0,r=e.deviceTypes?.length??0,i=e.nodeIds?.length??0,a=e.packageNames?.length??0,o=e.excludeDeviceIds?.length??0;r>0&&t.push(e.deviceTypes?.map(It).join(`, `)??``),n>0&&t.push(`${n} device${n===1?``:`s`}`),i>0&&t.push(`${i} node${i===1?``:`s`}`),a>0&&t.push(`${a} package${a===1?``:`s`}`);let s=o>0?`except ${o} device${o===1?``:`s`}`:null,c=e.consumableLowPercent===void 0?[]:[`consumables at ${e.consumableLowPercent}%`];return t.length===0?[s===null?`Everything`:`Everything ${s}`,...c].join(` · `):[...t,...s===null?[]:[s],...c].join(` · `)}function Gt(e){return e===void 0||(e.deviceTypes?.length??0)===0?!1:e.kinds.some(e=>_e.includes(e))}var Kt=[`all`,`only`,`except`];function qt(e,t){return(e??[]).length>0?`only`:(t??[]).length>0?`except`:`all`}function W(e,t){let n=[...e??[]],r=[...t??[]];return{mode:qt(n,r),include:n,exclude:r,legacyBoth:n.length>0&&r.length>0}}function Jt(e,t){return{...e,mode:t}}function Yt(e){switch(e.mode){case`only`:return e.include;case`except`:return e.exclude;case`all`:return[]}}function Xt(e,t){switch(e.mode){case`only`:return{...e,include:[...t]};case`except`:return{...e,exclude:[...t]};case`all`:return e}}function Zt(e){return e.mode===`only`&&e.legacyBoth?e.exclude:[]}function Qt(e){return{...e,exclude:[],legacyBoth:!1}}function G(e){switch(e.mode){case`all`:return{};case`except`:return e.exclude.length>0?{exclude:[...e.exclude]}:{};case`only`:{let t=Zt(e);return{...e.include.length>0?{include:[...e.include]}:{},...t.length>0?{exclude:[...t]}:{}}}}}function $t(e){let t=G(e),n=t.include??[],r=t.exclude??[];return[...e.include.filter(e=>!n.includes(e)),...e.exclude.filter(e=>!r.includes(e))]}var K=[`onActivation`,`onDeactivation`,`onTrigger`,`onTriggerOff`],q={onActivation:{title:`On activation`,hint:`Runs when the rule is turned on.`},onDeactivation:{title:`On deactivation`,hint:`Runs when the rule is turned off.`},onTrigger:{title:`On trigger`,hint:`Runs on a positive / raised match.`},onTriggerOff:{title:`On trigger off`,hint:`Runs on a clear / leave match. Delivery types without a clear edge never fire this.`}},en={onActivation:[],onDeactivation:[],onTrigger:[],onTriggerOff:[],buttons:[]};function tn(e){return e===void 0?en:{onActivation:[...e.onActivation??[]],onDeactivation:[...e.onDeactivation??[]],onTrigger:[...e.onTrigger??[]],onTriggerOff:[...e.onTriggerOff??[]],buttons:[...e.buttons??[]]}}function J(e){let t=e.buttons.filter(e=>e.id.trim()!==``&&e.label.trim()!==``&&e.sequenceId.trim()!==``),n={onActivation:e.onActivation,onDeactivation:e.onDeactivation,onTrigger:e.onTrigger,onTriggerOff:e.onTriggerOff};if(!(!K.some(e=>n[e].length>0)&&t.length===0))return{...n.onActivation.length>0?{onActivation:[...n.onActivation]}:{},...n.onDeactivation.length>0?{onDeactivation:[...n.onDeactivation]}:{},...n.onTrigger.length>0?{onTrigger:[...n.onTrigger]}:{},...n.onTriggerOff.length>0?{onTriggerOff:[...n.onTriggerOff]}:{},...t.length>0?{buttons:t}:{}}}function nn(e,t){let n=[];for(let r of K){let i=e[r];i.length>4&&n.push({kind:`too-many`,message:`${q[r].title} has more than 4 bindings.`});for(let e of i)e.kind===`sequence`&&!t.has(e.sequenceId)&&n.push({kind:`unknown-sequence`,message:`${q[r].title} points at a sequence that does not exist.`})}let r=new Set;for(let i of e.buttons){let e=i.id.trim();e!==``&&(r.has(e)&&n.push({kind:`duplicate-button`,message:`Two buttons share the id "${e}". The id is what the audit line names when one is tapped.`}),r.add(e),t.has(i.sequenceId.trim())||n.push({kind:`unknown-sequence`,message:`"${i.label||e}" points at a sequence that does not exist. It would never appear on a notification.`}))}return n}function rn(e,t){return{id:`action-${String(e+1)}`,label:`Action`,sequenceId:t}}function an(){return{kind:`do`,action:{kind:`wait`,seconds:5}}}function on(e){return{kind:`sequence`,sequenceId:e}}function sn(){return{kind:`wait`,seconds:5}}var cn=[{value:`acknowledge`,label:`Acknowledge`},{value:`dismiss`,label:`Dismiss`},{value:`silence`,label:`Silence`},{value:`snooze`,label:`Snooze`},{value:`view`,label:`View`},{value:`play`,label:`Play`},{value:`camera`,label:`Camera`},{value:`open`,label:`Open`},{value:`close`,label:`Close`},{value:`unlock`,label:`Unlock`},{value:`lock`,label:`Lock`},{value:`disarm`,label:`Disarm`},{value:`arm`,label:`Arm`},{value:`arm-home`,label:`Arm — home`},{value:`arm-away`,label:`Arm — away`},{value:`arm-night`,label:`Arm — night`},{value:`light`,label:`Light`},{value:`alert`,label:`Alert`}];function ln(e){let t=[],n=e.find(e=>e.type===v.AlarmPanel);n!==void 0&&t.push({id:`trigger-alarm`,label:`Trigger the alarm`,hint:`Presses ${n.name}. The panel's entry delay still runs, and a disarm during it cancels the alarm.`,build:()=>({name:`trigger the alarm`,actions:[{kind:`cap`,deviceId:n.id,cap:`alarm-panel`,method:`trigger`,args:{}}]})});for(let n of e.filter(e=>e.type===v.Siren))t.push({id:`siren-${String(n.id)}`,label:`Sound ${n.name}`,hint:`On, 30 seconds, off.`,build:()=>({name:`sound ${n.name}`.toLowerCase(),minDelaySec:60,actions:[{kind:`cap`,deviceId:n.id,cap:`switch`,method:`setState`,args:{on:!0}},{kind:`wait`,seconds:30},{kind:`cap`,deviceId:n.id,cap:`switch`,method:`setState`,args:{on:!1}}]})});return t}function un(e,t){return e.onTrigger.length>=4?e:{...e,onTrigger:[...e.onTrigger,{kind:`sequence`,sequenceId:t}]}}var dn=[10,30,60],fn=[5,10,15,30,60,120,240,480];function pn(e){return e>=60&&e%60==0?`${e/60} h`:`${e} min`}var mn=new Set([`alarm-arm-refused`,`alarm-check-failed`,`alarm-arming`,`alarm-armed`,`alarm-pending`,`alarm-triggered`,`alarm-rearmed`,`alarm-sensor-bypass`,`alarm-disarmed`]),hn=`alarm-panel`;function gn(e,t){for(let t of e.systemEvent?.kinds??[])if(mn.has(t))return!0;for(let e of t)if(e.kind===`cap`&&e.cap===hn)return!0;return!1}function _n(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[];for(let t of[`onActivation`,`onDeactivation`,`onTrigger`,`onTriggerOff`])for(let i of e[t])if(i.kind===`do`)r.push(i.action);else{let e=n.get(i.sequenceId);e!==void 0&&r.push(...e.actions)}for(let t of e.buttons){let e=n.get(t.sequenceId);e!==void 0&&r.push(...e.actions)}return r}function vn(e){let{devices:t,devicesExclude:n,classes:r,classesExclude:i,...a}=e;return{conditions:a,deviceScope:W(t,n),classScope:W(r,i)}}function yn(e){let t=G(e.deviceScope),n=G(e.classScope);return{...e.conditions,...t.include===void 0?{}:{devices:[...t.include]},...t.exclude===void 0?{}:{devicesExclude:[...t.exclude]},...n.include===void 0?{}:{classes:[...n.include]},...n.exclude===void 0?{}:{classesExclude:[...n.exclude]}}}function bn(e){return e.deviceScope.mode===`only`?e.deviceScope.include:[]}function xn(e,t,n){let r=b(n);return e.some(e=>e.id===t&&oe(e,n.delivery,r))}function Sn(e=`immediate`,t={}){return{name:``,enabled:!0,delivery:e,targetIds:[],targetUsers:[],targetParams:{},priority:3,mediaAttach:`best`,mediaZoneCrop:!1,mediaFrame:void 0,mediaGif:!1,mediaClip:!1,mediaProfile:void 0,mediaClipSpeed:void 0,mediaLinkedCameras:void 0,templateTitle:``,templateBody:``,...vn(t),schedule:void 0,systemEventDelivery:void 0,snoozeAllowGlobal:!1,groupingSec:void 0,snoozeOptions:void 0,actions:en,cooldownSec:30,cooldownScope:`rule-device`,cooldownGranularity:void 0}}function Cn(e){let t={};for(let n of e.targets)n.params&&Object.keys(n.params).length>0&&(t[n.targetId]=n.params);return{name:e.name,enabled:e.enabled,delivery:e.delivery,targetIds:e.targets.map(e=>e.targetId),targetUsers:e.targetUsers??[],targetParams:t,priority:e.priority,mediaAttach:e.media.attach,mediaZoneCrop:e.media.zoneCrop===!0,mediaFrame:e.media.frame,mediaGif:e.media.gif===!0,mediaClip:e.media.clip===!0,mediaProfile:e.media.profile,mediaClipSpeed:e.media.clipSpeed,mediaLinkedCameras:e.media.linkedCameras,templateTitle:e.template?.title??``,templateBody:e.template?.body??``,...vn(e.conditions),schedule:e.schedule,systemEventDelivery:e.systemEventDelivery,snoozeAllowGlobal:e.snoozeAllowGlobal===!0,groupingSec:e.groupingSec,snoozeOptions:e.snoozeOptions,actions:tn(e.actions),cooldownSec:e.throttle.cooldownSec,cooldownScope:e.throttle.scope,cooldownGranularity:e.throttle.granularity}}function wn(e,t){let n=[];if(An(e)){let r=e.groupingSec;r!==void 0&&(!Number.isInteger(r)||r<5||r>60)&&n.push(`The grouping window is a whole number of seconds between 5 and 60.`);let i=t?.confirm;i?.enabled===!0&&i.expect!==void 0&&!jn(i.expect)&&n.push(`This rule’s AI confirm expects more than one subject, but a grouped message judges one picture per subject, so it would never send. Remove the confirm expectation (viewer or API), or choose Immediate.`)}if(C(e.conditions.audio)&&n.push(`This sound rule names neither a sound nor a level threshold, so it can never fire — every sample would count as a hit and the engine refuses it rather than notifying on silence. Pick at least one sound, or add a level.`),(!Number.isInteger(e.cooldownSec)||e.cooldownSec<0||e.cooldownSec>86400)&&n.push(`The cooldown is a whole number of seconds between 0 and ${String(ut)} (24 hours). 0 means every match is delivered.`),Y(e))for(let t of je({delivery:e.delivery,conditions:e.conditions,...e.systemEventDelivery===void 0?{}:{systemEventDelivery:e.systemEventDelivery},...J(e.actions)===void 0?{}:{actions:J(e.actions)}}))n.push(be(t));return n}function Tn(e){let t=e.systemEventDelivery;if(t===void 0)return{};if(!w(e.delivery))return t.mode===`summary`?{systemEventDelivery:{mode:`instant`}}:{};if(t.mode===`summary`&&ke(t.schedule)===null){let e=fe(t.schedule);if(e!==null&&e.times.length>0)return{systemEventDelivery:{...t,schedule:ye(e.times,t.schedule.timezone)}}}return{systemEventDelivery:t}}function En(e){if(!Y(e))return null;if(!Ae(e.templateBody))return`This body names none of the summary ({{summaryText}} or a section variable) — the hub appends {{summaryText}} to it when it sends.`;let t=e.templateBody;return(e.systemEventDelivery?.mode===`summary`?e.systemEventDelivery.split:void 0)===`section`&&t.trim().length>0&&!/\{\{\s*summaryText\s*\}\}/.test(t)?`Sent one per category: this body names no {{summaryText}}, so on every other category’s notification the hub appends {{summaryText}} (that category’s lines).`:null}function Y(e){return w(e.delivery)&&e.systemEventDelivery?.mode===`summary`}function Dn(e,t,n=new Set){return wn(e,t).length===0&&it(e.delivery)&&(!w(e.delivery)||Fn(e)>0)&&b(e)!==`mixed`&&e.name.trim().length>0&&(e.targetIds.length>0||e.targetUsers.length>0)&&nn(e.actions,n).length===0}function On(e,t){let n=Nn(e.conditions,t);return w(t)&&(n.systemEvent?.kinds.length??0)===0?{...e,delivery:t,conditions:{...n,systemEvent:z(`device-events`)}}:{...e,delivery:t,conditions:n}}function kn(e,t){return t===`immediate-grouped`?{...On(e,`immediate`),groupingSec:e.groupingSec??20}:{...On(e,t),groupingSec:void 0}}function An(e){return e.groupingSec!==void 0&&y(e)}function jn(e){switch(e.op){case`>`:return 1>e.count;case`<=`:return 1<=e.count;case`<`:return 1<e.count;case`==`:return e.count===1;default:return 1>=e.count}}var Mn=new Set([`immediate`,`track-end`,`package-event`]);function Nn(e,t){if(e.source!==`pipeline`||Mn.has(t))return e;let{source:n,...r}=e;return r}function Pn(e,t){return ue(e.conditions.systemEvent)===t?e:{...e,conditions:{...e.conditions,systemEvent:z(t)}}}function Fn(e){return e.conditions.systemEvent?.kinds.length??0}function X(e,t){return e.appliesTo.includes(t)}var In={source:`any`};function Ln(e,t){if(t==null)return!0;if(Array.isArray(t))return t.length===0;if(typeof t==`string`)return t.length===0||In[e]===t;if(typeof t==`number`)return!Number.isFinite(t);if(typeof t==`object`){if(`ids`in t){let e=t.ids;return!Array.isArray(e)||e.length===0}if(`values`in t){let e=t.values;return!Array.isArray(e)||e.length===0}return!1}return!1}var Rn=we.filter(e=>e.id===`audio`);function zn(e){if(e.length===0)return e;let t=new Set(e.map(e=>e.id)),n=Rn.filter(e=>!t.has(e.id));return n.length===0?e:[...e,...n]}function Bn(e,t,n,r=b({delivery:t,conditions:e})){let i=n.length===0?null:new Set(n.filter(e=>e.id!==`schedule`&&oe(e,t,r)).map(e=>e.id)),a={};for(let[t,n]of Object.entries(e))i!==null&&!i.has(t)||F(t,e)&&(Ln(t,n)||(a[t]=n));return a}function Vn(e,t){if(e===void 0)return{};let n=Rt(e,t.systemEvent);return n===void 0?{}:{systemEvent:n}}function Hn(e){return e!==void 0&&e.windows.length>0}function Un(e){let t={...e.clipPreRollSec===void 0?{}:{clipPreRollSec:e.clipPreRollSec},...e.clipPostRollSec===void 0?{}:{clipPostRollSec:e.clipPostRollSec}};return Object.keys(t).length>0?t:void 0}function Wn(e){let t=Un(e.media);return{...e.confirm===void 0?{}:{confirm:e.confirm},...t===void 0?{}:{media:t}}}function Gn(e,t,n=[]){let r=e.templateTitle.trim(),i=e.templateBody.trim(),a=r.length>0||i.length>0?{...r.length>0?{title:r}:{},...i.length>0?{body:i}:{}}:void 0,o=J(e.actions),s=b(e),c=_(s),l=ae(s),u=n.length===0?!0:n.some(t=>t.id===`schedule`&&X(t,e.delivery)),d=!Y(e)&&u&&Hn(e.schedule)?e.schedule:void 0,f=n.length===0?!0:n.some(t=>t.id===`devices`&&X(t,e.delivery)),p=n.length===0?!0:n.some(t=>t.id===`devicesExclude`&&X(t,e.delivery)),{devices:m,devicesExclude:h,...g}=yn(e);return{name:e.name.trim(),enabled:e.enabled,delivery:e.delivery,conditions:{...Bn(g,e.delivery,n,s),...f&&m!==void 0?{devices:m}:{},...p&&h!==void 0?{devicesExclude:h}:{},...Vn(l,e.conditions)},...d?{schedule:d}:{},...Tn(e),targets:e.targetIds.map(t=>{let n=e.targetParams[t];return n&&Object.keys(n).length>0?{targetId:t,params:n}:{targetId:t}}),...e.targetUsers.length>0?{targetUsers:[...e.targetUsers]}:{},media:c.carriesMedia?{attach:e.mediaAttach,...c.carriesSubjectCrop&&e.mediaZoneCrop?{zoneCrop:!0}:{},...c.carriesSubjectCrop&&e.mediaFrame!==void 0?{frame:e.mediaFrame}:{},...e.mediaGif?{gif:!0}:{},...e.mediaClip?{clip:!0}:{},...e.mediaProfile===void 0?{}:{profile:e.mediaProfile},...e.mediaClipSpeed===void 0?{}:{clipSpeed:e.mediaClipSpeed},...s===`sensor`&&e.mediaAttach!==`none`&&e.mediaLinkedCameras!==void 0?{linkedCameras:e.mediaLinkedCameras}:{},...(e.mediaGif||e.mediaClip)&&t?.media?.clipPreRollSec!==void 0?{clipPreRollSec:t.media.clipPreRollSec}:{},...(e.mediaGif||e.mediaClip)&&t?.media?.clipPostRollSec!==void 0?{clipPostRollSec:t.media.clipPostRollSec}:{}}:{attach:`none`},throttle:{cooldownSec:e.cooldownSec,scope:e.cooldownScope,...e.cooldownGranularity===void 0?{}:{granularity:e.cooldownGranularity}},priority:e.priority,...a?{template:a}:{},...e.snoozeAllowGlobal?{snoozeAllowGlobal:!0}:{},...An(e)?{groupingSec:e.groupingSec}:{},...e.snoozeOptions===void 0?{}:{snoozeOptions:[...e.snoozeOptions]},...t?.confirm===void 0?{}:{confirm:t.confirm},...o===void 0?{}:{actions:o}}}function Kn(e,t){let n=Gn(e,void 0,t);return[`template`,`schedule`,`targetUsers`,`snoozeOptions`,`snoozeAllowGlobal`,`groupingSec`,`actions`].filter(e=>n[e]===void 0)}var qn=[{key:`rule`,label:`Rule`,fields:[`name`,`enabled`,`delivery`,`groupingSec`,`targetIds`,`targetUsers`,`targetParams`]},{key:`devices`,label:`Devices`,fields:[`deviceScope`]},{key:`conditions`,label:`Conditions`,fields:[`conditions`,`classScope`,`schedule`,`systemEventDelivery`]},{key:`notification`,label:`Notification`,fields:[`priority`,`mediaAttach`,`mediaFrame`,`mediaZoneCrop`,`mediaGif`,`mediaClip`,`mediaProfile`,`mediaClipSpeed`,`mediaLinkedCameras`,`templateTitle`,`templateBody`]},{key:`actions`,label:`Actions`,fields:[`actions`]},{key:`advanced`,label:`Advanced`,fields:[`snoozeAllowGlobal`,`snoozeOptions`,`cooldownSec`,`cooldownScope`,`cooldownGranularity`]}];function Jn(e,t={}){let n=b({delivery:e,conditions:t}),r=_(n),i=qn.map(e=>e.key===`conditions`?{...e,label:r.label}:e);return re(n)?i.filter(e=>e.key!==`devices`):i}function Yn(e){if(e.audio!==void 0)return`Sound`;if(e.occupancy!==void 0)return`Occupancy`}function Xn(e){let t=b(e),n=le(yn(e),t);return t===`sensor`&&e.conditions.sensorTransition!==void 0&&!F(`sensorTransition`,e.conditions)?[...n,{conditionId:`sensorTransition`,reason:se}]:n}var Zn=`rule`;function Qn(e){return qn.find(t=>t.key===e)?.key}function $n(e){return e?.toLowerCase().startsWith(`it`)===!0?`it`:`en`}function er(){let{i18n:e}=T(),t=$n(e.language);return e=>he(e,t)}e();var tr=`block text-[11px] font-medium text-foreground`,Z=`text-[10px] text-foreground-subtle mt-0.5`;function nr({cameras:e,fleet:t,value:n,onChange:r,emptyMeansAll:i=!1,savedHadDevices:a=!1}){return o(ee,{devices:e,listState:t.state,fleet:t,value:n,onChange:r,emptyMeansAll:i,savedHadDevices:a})}function rr({value:e,placeholder:n,onChange:r}){let[i,s]=a(``),c=()=>{let t=i.trim();if(t.length===0||e.includes(t)){s(``);return}r([...e,t]),s(``)},l=t=>r(e.filter(e=>e!==t));return t(`div`,{className:`mt-1 space-y-1.5`,children:[e.length>0&&o(`div`,{className:`flex flex-wrap gap-1`,children:e.map(e=>t(`span`,{className:`inline-flex items-center gap-1 rounded bg-surface-hover px-1.5 py-0.5 text-[11px] text-foreground`,children:[e,o(`button`,{type:`button`,onClick:()=>l(e),"aria-label":`remove ${e}`,className:`text-foreground-subtle hover:text-danger`,children:o(ne,{className:`h-3 w-3`})})]},e))}),o(g,{value:i,placeholder:n,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),c())},onBlur:c})]})}function ir({picker:e,value:r,onChange:i}){let a=n(()=>De(e),[e]),s=n(()=>new Set(r),[r]),c=r.filter(e=>!a.has(e)),l=e=>{i(s.has(e)?r.filter(t=>t!==e):[...r,e])};return t(`div`,{className:`space-y-2`,children:[c.length>0&&o(`div`,{className:`flex flex-wrap gap-1`,children:c.map(e=>t(`button`,{type:`button`,onClick:()=>i(r.filter(t=>t!==e)),className:`inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground hover:bg-surface-hover`,title:`Custom value — click to remove`,children:[e,` ×`]},e))}),e.groups.map(e=>t(`div`,{children:[o(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-muted mb-1`,children:e.fallbackLabel}),o(`div`,{className:`flex flex-wrap gap-1`,children:e.options.map(e=>{let t=s.has(e.value);return o(`button`,{type:`button`,"aria-pressed":t,onClick:()=>l(e.value),className:t?`rounded border border-primary bg-primary/15 px-1.5 py-0.5 text-[10px] text-foreground`:`rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground hover:bg-surface-hover`,children:e.label},e.value)})})]},e.key))]})}function ar({value:e,min:n,max:r,step:i,onChange:a}){return t(`div`,{className:`mt-1 flex items-center gap-2`,children:[o(g,{type:`number`,value:e??``,min:n,max:r,step:i,className:`max-w-[8rem]`,onChange:e=>{let t=e.target.value;if(t===``){a(void 0);return}let n=Number(t);a(Number.isFinite(n)?n:void 0)}}),e!==void 0&&r!==void 0&&o(`input`,{type:`range`,min:n,max:r,step:i,value:e,onChange:e=>a(Number(e.target.value)),className:`flex-1 accent-primary`,"aria-label":`value`})]})}function or({value:e,onChange:n,options:r}){let{t:i}=T(),a=sr(r??[]),s=a.length>0?a:Tt;return t(`div`,{className:`mt-1 space-y-1`,children:[o(h,{value:e??`enter`,options:s.map(e=>({value:e.value,label:i(`notificationRules.crossing.${e.value}`,e.label)})),onChange:e=>n(I(e.target.value))}),o(`p`,{className:Z,children:i(`notificationRules.crossing.hint`,`Which way the subject crosses the zone.`)})]})}function sr(e){let t=[];for(let n of e){let e=n.value===``||n.value===`enter`?Et:I(n.value);e===void 0||t.some(t=>t.value===e)||t.push({value:e,label:n.label})}return t}function cr({deviceIds:e,cameras:t,value:n,onChange:r}){let{options:i,loading:a}=D(e,t);return o(O,{options:i,value:n,onChange:r,loading:a,noFreeText:!0,emptyHint:e.length===0?`Select cameras first — a rule can only use zones those cameras actually have.`:`The selected cameras have no zones. Draw one in the camera’s zone editor first.`,placeholder:``})}function lr({deviceIds:e,value:t,onChange:n}){let{options:r,loading:i}=Je(e);return o(O,{options:r,value:t,onChange:n,loading:i,emptyHint:e.length===0?`Select cameras above to pick their event kinds — or type a token.`:`No event kinds reported for the selected cameras — type a token.`,placeholder:`Event token…`})}var ur=[{value:`became-occupied`,label:`Became occupied`},{value:`became-free`,label:`Became free`},{value:`>=`,label:`Count ≥`},{value:`<=`,label:`Count ≤`}];function dr(e,t){let n=e.map(e=>({value:e.value,label:e.label}));return t===void 0||t===``||n.some(e=>e.value===t)?n:[...n,{value:t,label:`${t} — sub-type, never counts (always 0)`}]}function fr({deviceIds:e,cameras:n,classOptions:r,value:i,onChange:a}){let{options:s,loading:c}=D(e,n),l=i??ie,u=e=>a({...l,...e}),d=l.op===`became-occupied`||l.op===`became-free`,f=dr(r,l.className);return t(`div`,{className:`mt-1 space-y-1.5`,children:[t(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[o(`div`,{className:`min-w-[10rem]`,children:o(h,{value:l.zoneId??``,options:[{value:``,label:c?`Loading zones…`:`— whole frame —`},...s.map(e=>({value:e.value,label:e.label}))],onChange:e=>u({zoneId:e.target.value===``?void 0:e.target.value})})}),o(`div`,{className:`min-w-[9rem]`,children:o(h,{value:l.className??``,options:[{value:``,label:`— any class —`},...f],onChange:e=>u({className:e.target.value===``?void 0:e.target.value})})}),o(`div`,{className:`min-w-[9rem]`,children:o(h,{value:l.op,options:ur.map(e=>({value:e.value,label:e.label})),onChange:e=>{let t=ur.find(t=>t.value===e.target.value);t&&u({op:t.value})}})})]}),t(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-foreground-subtle`,children:[t(`label`,{className:`flex items-center gap-1`,children:[d?`Threshold`:`Count`,o(g,{type:`number`,min:0,className:`w-16`,value:String(l.count),onChange:e=>u({count:Math.max(0,Number(e.target.value)||0)})})]}),t(`label`,{className:`flex items-center gap-1`,children:[`Hold for`,o(g,{type:`number`,min:0,max:3600,className:`w-16`,value:String(l.sustainSeconds),onChange:e=>u({sustainSeconds:Math.min(3600,Math.max(0,Number(e.target.value)||0))})}),`s`]}),i===void 0?null:o(`button`,{type:`button`,onClick:()=>a(void 0),className:`underline hover:text-foreground`,children:`Clear`})]}),e.length===0&&o(`p`,{className:`text-[11px] text-warning`,children:`No camera picked on the Devices tab: this watches EVERY camera's occupancy, and no zone can be offered until you choose one — a zone id belongs to a camera.`}),o(`p`,{className:`text-[11px] text-foreground-subtle`,children:`Counts confirmed tracked objects from zone analytics. The change must hold for the sustain window before it fires; with no snapshot for the camera or zone the rule never fires.`})]})}var pr=[{value:`label`,label:`Sounds — fires at once`,Icon:m},{value:`level`,label:`Volume — over a window`,Icon:l}];function mr({taxonomy:e,value:n,onChange:i}){let a=Oe(n),s=e=>i(ve(n,e)),{choices:c,unknownLabels:l}=me(e,a.labels),u=Ce(n)??`label`;return t(`div`,{className:`mt-1 space-y-2`,children:[t(`div`,{className:`flex flex-wrap items-center gap-1`,children:[pr.map(e=>o(`button`,{type:`button`,"aria-pressed":u===e.value,onClick:()=>s({mode:e.value}),className:`rounded border px-2 py-0.5 text-[11px] ${u===e.value?`border-primary bg-primary/15 text-foreground`:`border-border text-foreground-subtle hover:bg-surface-hover`}`,children:t(`span`,{className:`inline-flex items-center gap-1`,children:[o(e.Icon,{className:`h-3 w-3`}),e.label]})},e.value)),n===void 0?null:o(`button`,{type:`button`,onClick:()=>i(void 0),className:`ml-1 text-xs text-foreground-subtle underline hover:text-foreground`,children:`Clear`})]}),u===`label`?t(r,{children:[o(`div`,{className:`flex flex-wrap gap-1`,children:c.map(e=>{let n=ge(a.labels,e.value),r=e.unknown?`border-dashed border-warning text-warning`:n?`border-primary bg-primary/15 text-foreground`:`border-border text-foreground hover:bg-surface-hover`;return o(`button`,{type:`button`,"aria-pressed":n,title:e.unknown?`Stored by the rule — not offered by this hub`:void 0,onClick:()=>s({labels:Te(a.labels,e.value)}),className:`rounded border px-1.5 py-0.5 text-[10px] ${r}`,children:t(`span`,{className:`inline-flex items-center gap-1`,children:[o(d,{iconId:e.iconId,size:12}),e.label]})},e.value)})}),l.length>0&&t(`p`,{className:`text-[10px] text-warning`,children:[`Kept from the rule, unknown to this hub: `,l.join(`, `)]}),t(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-foreground-subtle`,children:[t(`label`,{className:`flex items-center gap-1`,children:[`Confirm after`,o(g,{type:`number`,min:1,max:20,step:1,className:`w-16`,value:String(a.confirmHits??2),onChange:e=>s({confirmHits:Number(e.target.value)})}),`frames`]}),t(`label`,{className:`flex items-center gap-1`,children:[`within`,o(g,{type:`number`,min:1,max:60,step:1,className:`w-16`,value:String(a.confirmWindowSec??5),onChange:e=>s({confirmWindowSec:Number(e.target.value)})}),`s`]})]}),t(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`Fires when that many labelled frames land inside the window (default`,` `,2,` in `,5,` s). A single-frame false positive never reaches 2; a real episode usually labels two or three frames. The rule's cooldown is the other throttle.`]})]}):t(r,{children:[o(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-foreground-subtle`,children:t(`label`,{className:`flex items-center gap-1`,children:[`Louder than`,o(g,{type:`number`,min:xe,max:0,step:3,className:`w-20`,value:String(a.dbThreshold??pe),onChange:e=>s({dbThreshold:Number(e.target.value)})}),`dBFS`]})}),t(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-foreground-subtle`,children:[t(`label`,{className:`flex items-center gap-1`,children:[`Hits`,o(g,{type:`number`,min:1,max:100,step:5,className:`w-16`,value:String(a.hitPercent),onChange:e=>s({hitPercent:Number(e.target.value)})}),`% (default `,S.hitPercent,`)`]}),t(`label`,{className:`flex items-center gap-1`,children:[`over`,o(g,{type:`number`,min:1,max:300,step:5,className:`w-16`,value:String(a.samplingSeconds),onChange:e=>s({samplingSeconds:Number(e.target.value)})}),`s (default `,S.samplingSeconds,`)`]})]}),t(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`dBFS is negative-going: 0 is full scale, `,xe,` is silence — so a HIGHER number is a narrower filter. Measured on this hub, a baby crying reads `,`−`,`55 to `,`−`,`26 dBFS, so a floor above `,`−`,`55 excludes most of it. The window must be FULL before it can match.`]})]}),C(n)?o(`p`,{className:`text-[11px] text-warning`,children:`With neither a sound nor a level threshold this can never match — every sample would be a hit, so the engine refuses it rather than notifying on silence.`}):null]})}function hr({value:e,onChange:n}){let r=e?.values??[],i=e?.maxDistance??1,a=e=>n(e.length>0?{values:e,maxDistance:i}:void 0),s=e=>n(r.length>0?{values:r,maxDistance:e}:void 0),c=Xe().filter(e=>!r.includes(e));return t(`div`,{className:`mt-1 space-y-1.5`,children:[o(rr,{value:r,placeholder:`Plate text…`,onChange:a}),c.length>0&&t(`div`,{className:`flex flex-wrap items-center gap-1`,children:[o(`span`,{className:`text-[10px] text-foreground-subtle`,children:`Seen:`}),c.slice(0,12).map(e=>o(`button`,{type:`button`,onClick:()=>a([...r,e]),className:`rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground-subtle hover:bg-surface-hover hover:text-foreground`,children:e},e))]}),t(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[`Max distance`,o(g,{type:`number`,min:0,max:3,step:1,value:i,className:`max-w-[5rem]`,onChange:e=>{let t=Number(e.target.value);s(Number.isFinite(t)?Math.max(0,Math.min(3,t)):1)}})]})]})}function gr({gateable:e,value:n,onChange:r}){let i=er(),a=e.find(e=>e.id===n?.deviceId),s=new Set(n?.states??[]),c=e=>{let t=Number(e);if(!Number.isFinite(t)||t===0)return r(void 0);r({deviceId:t,states:[]})},l=e=>{if(n===void 0)return;let t=new Set(s);t.has(e)?t.delete(e):t.add(e),r(t.size===0?void 0:{deviceId:n.deviceId,states:[...t]})};return t(`div`,{className:`mt-1 space-y-2`,children:[o(h,{value:n===void 0?``:String(n.deviceId),options:[{value:``,label:`— no device gate —`},...e.map(e=>({value:String(e.id),label:e.name}))],onChange:e=>c(e.target.value)}),a!==void 0&&o(`div`,{className:`flex flex-wrap gap-1.5`,children:a.states.map(e=>o(`button`,{type:`button`,onClick:()=>l(e),className:s.has(e)?`rounded-md border border-primary bg-primary/10 px-2 py-0.5 text-[11px] text-primary`:`rounded-md border border-border px-2 py-0.5 text-[11px] text-foreground-subtle`,children:i(e)},e))}),a!==void 0&&a.states.length===0&&o(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:`This device reports no state the gate can read, so it cannot arm a rule.`}),n!==void 0&&o(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:`The rule is silent while the device is in any other state — including when its state cannot be read at all.`})]})}function _r(e,t){let n=t(e.verdict);return e.latched?`${n} · ${t(`latched`)}`:n}function vr({scenes:e,value:n,onChange:r}){let{t:i}=T(),a=er(),s=e.find(e=>e.sceneId===n?.sceneId),c=t=>{if(t===``)return r(void 0);let i=e.find(e=>e.sceneId===t);if(i===void 0)return r(void 0);r({sceneId:t,deviceId:i.deviceId,requiredState:n?.requiredState??`diverged`,...n?.latched===void 0?{}:{latched:n.latched}})},l=e=>{n!==void 0&&r({...n,requiredState:e===`matched`?`matched`:`diverged`})},u=e=>{if(n!==void 0){if(e===``){let{latched:e,...t}=n;return r(t)}r({...n,latched:e===`latched`})}};return e.length===0?o(`p`,{className:Z,children:i(`notificationRules.scene.none`,`No scenes yet — create one on the Scenes page.`)}):t(`div`,{className:`mt-1 space-y-2`,children:[o(h,{value:n?.sceneId??``,options:[{value:``,label:i(`notificationRules.scene.noGate`,`— no scene gate —`)},...e.map(e=>({value:e.sceneId,label:`${e.cameraName} · ${e.label} — ${_r(e,a)}`}))],onChange:e=>c(e.target.value)}),n!==void 0&&t(`div`,{className:`flex flex-wrap items-center gap-2`,children:[t(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[i(`notificationRules.scene.onlyWhile`,`Only while it is`),o(h,{value:n.requiredState,options:[{value:`diverged`,label:a(`diverged`)},{value:`matched`,label:a(`matched`)}],onChange:e=>l(e.target.value)})]}),t(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[i(`notificationRules.scene.read`,`Read`),o(h,{value:n.latched===void 0?``:n.latched?`latched`:`live`,options:[{value:``,label:s===void 0?i(`notificationRules.scene.readOwn`,`The scene's own setting`):`${i(`notificationRules.scene.readOwn`,`The scene's own setting`)} (${a(s.emit)})`},{value:`latched`,label:a(`latched`)},{value:`live`,label:a(`live`)}],onChange:e=>u(e.target.value)})]})]}),s!==void 0&&t(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:[i(`notificationRules.scene.rightNow`,`Right now:`),` `,_r(s,a)]}),n!==void 0&&s===void 0&&o(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:i(`notificationRules.scene.missing`,`This scene no longer exists — pick another or remove the gate.`)})]})}var Q={days:[0,1,2,3,4,5,6],minute:480},yr=[{value:1,label:`Mon`},{value:2,label:`Tue`},{value:3,label:`Wed`},{value:4,label:`Thu`},{value:5,label:`Fri`},{value:6,label:`Sat`},{value:0,label:`Sun`}];function br(e){let t=Math.floor(e/60),n=e%60;return`${String(t).padStart(2,`0`)}:${String(n).padStart(2,`0`)}`}function $(e){let[t,n]=e.split(`:`),r=Number(t)*60+Number(n);return Number.isFinite(r)?Math.max(0,Math.min(1439,r)):0}function xr(e){if(typeof e!=`object`||!e||!(`data`in e))return;let t=e.data;if(!(typeof t!=`object`||!t||!(`code`in t)))return typeof t.code==`string`?t.code:void 0}function Sr(e){let t=Object.entries(e).map(([e,t])=>`${e} ${String(t)}`);return t.length>0?`Left out by this rule's filters or a camera mute: ${t.join(`, `)}.`:null}function Cr(e,t,n,r=`rule`){if(e===`error`)return xr(n)===`NOT_FOUND`?{lines:[`This hub does not serve summary rules yet — update @camstack/server first. A rule saved now would be stored without its summary, and stay instant.`]}:{lines:[`The preview could not be read: ${n instanceof Error?n.message:String(n)}`]};if(e!==`success`||t===void 0)return null;let i=[];if(r===`section`&&t.split===void 0&&i.push(`This hub does not send per-category summaries yet — update @camstack/server first. Until then it sends one message.`),t.empty)i.push(`Nothing to report right now — no notification would be sent.`);else if(t.split===`section`&&t.rows!==void 0){let e=t.rows.length;i.push(`${String(e)} notification${e===1?``:`s`} would be sent now, one per category:`);for(let e of t.rows)i.push(`${e.title}\n${e.text}`)}else i.push(`${String(t.count)} item(s) would be sent now:\n${t.text}`);let a=Sr(t.dropped);return a!==null&&i.push(a),t.excludedGroups.includes(`backups-exports`)&&i.push(`Backups and exports are completed jobs, not a state — they are not in a summary.`),{lines:i}}function wr(e,t){return{...e,schedule:t}}function Tr(e,t){let{split:n,...r}=e;return t===`section`?{...r,split:t}:r}function Er(e){return br(e)}function Dr(e){return $(e)}function Or(){return{days:[1,2,3,4,5],startMinute:540,endMinute:1080}}function kr(e){return{days:[...Q.days],minute:e}}function Ar({value:e,onChange:t,mode:n=`windows`,defaultMinute:r=Q.minute}){return n===`times`?o(Mr,{value:e,onChange:t,defaultMinute:r}):o(jr,{value:e,onChange:t})}function jr({value:e,onChange:n}){let r=e?.windows??[],i=e?.invert??!1,a=(t,r)=>{if(t.length===0){n(void 0);return}n({windows:t,...r?{invert:!0}:{},...e?.timezone?{timezone:e.timezone}:{}})},s=()=>a([...r,Or()],i),c=e=>a(r.filter((t,n)=>n!==e),i),l=(e,t)=>a(r.map((n,r)=>r===e?t:n),i);return t(`div`,{className:`mt-1 space-y-2`,"data-testid":`schedule-field-windows`,children:[r.length===0?o(`p`,{className:Z,children:`Always active — add a window to restrict when the rule fires.`}):r.map((e,t)=>o(Nr,{window:e,onChange:e=>l(t,e),onRemove:()=>c(t)},t)),t(`div`,{className:`flex items-center gap-3`,children:[t(`button`,{type:`button`,onClick:s,className:`flex items-center gap-1 rounded-md bg-surface-hover px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground`,children:[o(te,{className:`h-3 w-3`}),` Add window`]}),r.length>0&&t(`label`,{className:`flex items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[o(`input`,{type:`checkbox`,checked:i,onChange:e=>a([...r],e.target.checked),className:`accent-primary`}),`Active outside the windows`]})]})]})}function Mr({value:e,onChange:n,defaultMinute:r}){let i=e?.timezone,a=e===void 0?{times:[],approximated:!1}:fe(e);if(a===null)return t(`div`,{className:`mt-1 space-y-2`,"data-testid":`schedule-field-times-fallback`,children:[o(`p`,{className:Z,children:`Inverted schedule — shown as bands. Clear the invert flag (or the windows) to author punctual times.`}),o(jr,{value:e,onChange:n})]});let s=a.times,c=e=>{if(e.length===0){n(void 0);return}n(ye(e,i))};return t(`div`,{className:`mt-1 space-y-2`,"data-testid":`schedule-field-times`,children:[a.approximated&&o(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,"data-testid":`schedule-field-times-approximated`,children:`Shown as send-at times from each window's end (when the summary fires). Edit or save to store them as punctual one-minute windows.`}),s.length===0?o(`p`,{className:Z,children:`No times yet — add one to send on those days at that clock time.`}):s.map((e,t)=>o(Pr,{time:e,index:t,onChange:e=>c(s.map((n,r)=>r===t?e:n)),onRemove:s.length>1?()=>c(s.filter((e,n)=>n!==t)):void 0},t)),t(`button`,{type:`button`,onClick:()=>c([...s,kr(r)]),className:`flex items-center gap-1 rounded-md bg-surface-hover px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground`,"data-testid":`schedule-field-add-time`,children:[o(te,{className:`h-3 w-3`}),` Add a time`]})]})}function Nr({window:e,onChange:n,onRemove:r}){return t(`div`,{className:`space-y-1.5 rounded-md border border-border p-2`,children:[t(`div`,{className:`flex items-center gap-2 text-xs`,children:[o(`input`,{type:`time`,value:Er(e.startMinute),onChange:t=>n({...e,startMinute:Dr(t.target.value)}),className:`rounded-md border border-border bg-background px-1 py-0.5`}),o(`span`,{className:`text-foreground-subtle`,children:`→`}),o(`input`,{type:`time`,value:Er(e.endMinute),onChange:t=>n({...e,endMinute:Dr(t.target.value)}),className:`rounded-md border border-border bg-background px-1 py-0.5`}),o(`span`,{className:`flex-1`}),o(`button`,{type:`button`,onClick:r,"aria-label":`Remove window`,className:`text-foreground-subtle hover:text-danger`,children:o(c,{className:`h-3.5 w-3.5`})})]}),o(Fr,{days:e.days,onToggle:t=>{let r=e.days.includes(t)?e.days.filter(e=>e!==t):[...e.days,t];r.length!==0&&n({...e,days:r})}})]})}function Pr({time:e,index:n,onChange:r,onRemove:i}){return t(`div`,{className:`space-y-1.5 rounded-md border border-border p-2`,children:[t(`div`,{className:`flex items-center gap-2 text-xs`,children:[o(`span`,{className:`text-foreground-subtle`,children:`At`}),o(`input`,{type:`time`,value:br(e.minute),onChange:t=>r({...e,minute:$(t.target.value)}),className:`rounded-md border border-border bg-background px-1 py-0.5`,"data-testid":`schedule-field-time-${String(n)}`}),o(`span`,{className:`flex-1`}),i!==void 0&&o(`button`,{type:`button`,onClick:i,"aria-label":`Remove time`,className:`text-foreground-subtle hover:text-danger`,children:o(c,{className:`h-3.5 w-3.5`})})]}),o(Fr,{days:e.days,onToggle:t=>{let n=e.days.includes(t)?e.days.filter(e=>e!==t):[...e.days,t];n.length!==0&&r({...e,days:n})}})]})}function Fr({days:e,onToggle:t}){return o(`div`,{className:`flex flex-wrap gap-1`,children:yr.map(n=>o(`button`,{type:`button`,onClick:()=>t(n.value),className:`rounded px-1.5 py-0.5 text-[10px] ${e.includes(n.value)?`bg-primary text-primary-foreground`:`bg-surface-hover text-foreground-subtle`}`,children:n.label},n.value))})}export{nn as $,wt as $t,fn as A,St as At,xn as B,it as Bt,Qn as C,ht as Ct,Wn as D,A as Dt,Gn as E,M as Et,_n as F,F as Ft,K as G,ft as Gt,pn as H,st as Ht,Dn as I,dt as It,rn as J,et as Jt,q as K,gt as Kt,gn as L,Qe as Lt,Pn as M,at as Mt,Sn as N,Ct as Nt,zn as O,N as Ot,bn as P,xt as Pt,ln as Q,vt as Qt,Y as R,$e as Rt,Xn as S,kt as St,Kn as T,pt as Tt,En as U,bt as Ut,Cn as V,ot as Vt,cn as W,At as Wt,on as X,yt as Xt,an as Y,nt as Yt,sn as Z,_t as Zt,rr as _,Ue as _n,H as _t,Tr as a,Le as an,W as at,Zn as b,Lt as bt,nr as c,Pe as cn,Xt as ct,Z as d,Re as dn,Ft as dt,tt as en,un as et,tr as f,Be as fn,Gt as ft,vr as g,Ne as gn,Wt as gt,hr as h,Ie as hn,Ut as ht,wr as i,He as in,$t as it,kn as j,Dt as jt,dn as k,j as kt,gr as l,Fe as ln,Jt as lt,fr as m,ze as mn,zt as mt,Q as n,Ye as nn,G as nt,mr as o,Me as on,Zt as ot,ar as p,Ge as pn,Ht as pt,J as q,mt as qt,Cr as r,D as rn,Qt as rt,or as s,We as sn,Yt as st,Ar as t,O as tn,Kt as tt,lr as u,Ve as un,Vt as ut,ir as v,qe as vn,R as vt,Jn as w,ut as wt,Yn as x,P as xt,cr as y,Ke as yn,V as yt,wn as z,Ot as zt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as e,I as t,J as n,L as r,O as i,Q as a,S as o,W as s,b as c,k as l,q as u,x as d,z as f}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{_t as p}from"./src-BMvSPnxA.js";a();var m=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),h=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ee=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),g=e=>{let t=ee(e);return t.charAt(0).toUpperCase()+t.slice(1)},_={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},v=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},te=l(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a=``,children:o,iconNode:s,...c},l)=>i(`svg`,{ref:l,..._,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:m(`lucide`,a),...!o&&!v(c)&&{"aria-hidden":`true`},...c},[...s.map(([e,t])=>i(e,t)),...Array.isArray(o)?o:[o]]));a();var y=(e,t)=>{let n=l(({className:n,...r},a)=>i(te,{ref:a,iconNode:t,className:m(`lucide-${h(g(e))}`,`lucide-${e}`,n),...r}));return n.displayName=g(e),n},b=y(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),x=y(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),S=y(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),C=y(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),w=y(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),T=y(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),E=y(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),D=y(`mic-off`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]),ne=y(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),re=y(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),ie=y(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),ae=y(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);a();function O(t,n){if(typeof globalThis>`u`)return e(n);let r=globalThis.__camstackSharedContexts,i=r??new Map;r||(globalThis.__camstackSharedContexts=i);let a=i.get(t);if(a)return a;let o=e(n);return i.set(t,o),o}a();var k=O(`camstack:system`,null);function oe({system:e,children:t}){return d(k.Provider,{value:e,children:t})}function se(){let e=r(k);if(!e)throw Error(`useSystem(): no <SystemProvider> in tree`);return e}function ce(){return r(k)}var le=`camstack-mount`,ue=/^\/(?:[A-Za-z0-9_\-.]+\/)*$/,A=null;function j(e){if(e==null||e===``)return null;let t=e.endsWith(`/`)?e:`${e}/`;return!ue.test(t)||t.includes(`/../`)||t.includes(`/./`)?null:t}function M(){if(typeof document>`u`)return`/`;let e=j(document.querySelector(`meta[name="${le}"]`)?.getAttribute(`content`));if(e!==null)return e;if(document.querySelector(`base[href]`)!==null)try{let e=new URL(document.baseURI);if(e.origin===window.location.origin){let t=j(e.pathname);if(t!==null)return t}}catch{}return`/`}function N(){return A===null&&(A=M()),A}function P(){return N().replace(/\/$/,``)}function F(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith(`//`)}function I(e){if(F(e))return e;let t=N(),n=e.replace(/^\/+/,``);return t!==`/`&&(e===P()||e.startsWith(t))?e:`${t}${n}`}function L(){return`${typeof window<`u`?window.location.origin:``}${P()}`}function R(e){return F(e)?e:`${L()}${I(e).slice(P().length)}`}function z(e){return R(e).replace(/^http/,`ws`)}function B(){A=null}a();function V({title:e,icon:t,headerRight:n,collapsible:r=!1,defaultOpen:i=!0,bodyClassName:a=`p-3`,children:s}){let[l,f]=u(i),p=!r||l,m=o(c,{children:[o(`span`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-wider text-foreground`,children:[t,e]}),r?d(l?x:S,{className:`h-3.5 w-3.5 text-foreground-subtle`}):n]}),h=`px-4 py-2 flex items-center justify-between ${p?`border-b border-border`:``}`;return o(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[r?d(`button`,{type:`button`,onClick:()=>f(e=>!e),className:`w-full text-left ${h}`,children:m}):d(`div`,{className:h,children:m}),p?d(`div`,{className:a,children:s}):null]})}function H({label:e,icon:t,children:n,footer:r}){return o(`div`,{className:`rounded-md border border-border/60 bg-background/40 px-3 py-2`,children:[o(`div`,{className:`mb-1 flex items-center gap-1.5 text-[11px] uppercase tracking-wider text-foreground-subtle`,children:[t,e]}),d(`div`,{className:`text-sm font-medium text-foreground`,children:n}),r?d(`div`,{className:`mt-0.5 text-[10px] text-foreground-subtle`,children:r}):null]})}a();var U=`capability.binding-changed`;function W(e,t){let[n,r]=u(null);return f(()=>{if(t===null){r(null);return}let n=!1,i=async()=>{try{let i=await e.deviceManager.getBindings.query({deviceId:t});n||r(i)}catch{n||r(e=>e)}};i();let a=e.live?.onEvent.subscribe({category:U},{onData:e=>{let n=e.data?.source;if(!n){i();return}n.type===`device`&&n.id===t&&i()}});return()=>{n=!0,a?.unsubscribe()}},[e,t]),s(()=>n?p(e,n):null,[e,n])}function G(e){let r=t(t=>e?e.subscribe(()=>t()):()=>void 0,[e]),i=t(()=>e?.value,[e]);return n(r,i,i)}function de(e,t,n){let r=W(e,t);return G(r?n(r.state):void 0)}a();var K=`/addon/snapshot/media`;function fe(e,n={}){let{width:r,baseUrl:i}=n,[a,o]=u(0);return{src:s(()=>{if(e===null||e<=0)return null;let t=i===void 0?P():i.replace(/\/+$/,``),n=new URLSearchParams;r!==void 0&&Number.isInteger(r)&&r>0&&n.set(`w`,String(r)),a>0&&(n.set(`force`,`1`),n.set(`r`,String(a)));let o=n.toString();return`${t}${K}/${String(e)}.jpg${o.length>0?`?${o}`:``}`},[e,r,i,a]),loading:!1,refresh:t(()=>{o(e=>e+1)},[])}}function pe(e){if(typeof e!=`object`||!e)return null;let t=Reflect.get(e,`data`);if(typeof t==`object`&&t){let e=Reflect.get(t,`capRouteReason`);if(typeof e==`string`)return e}return null}function me(e){let t=pe(e);return t===null?(e instanceof Error?e.message:String(e)).includes(`provider not available`):t===`no-provider`||t===`node-offline`}var q=[`day`,`ir`],he={day:`Daylight`,ir:`Night (IR)`,night:`Night`,dawn:`Dawn`,dusk:`Dusk`};function J(e){return he[e]??e}function ge(e){let t=new Set(e.coveredConditions),n=q.map(e=>`${J(e)} ${t.has(e)?`✓`:`✗`}`),r=[...t].filter(e=>!q.some(t=>t===e));for(let e of r)n.push(`${J(e)} ✓`);let i=q.filter(e=>!t.has(e));if(i.length===0)return n.join(` · `);if(t.size===0)return`${n.join(` · `)} — nothing captured yet, so this scene is not watching.`;let a=i.map(e=>J(e).toLowerCase()).join(` and `);return e.onUncoveredCondition===`judge-anyway`?`${n.join(` · `)} — ${a} judged against the references you do have.`:`${n.join(` · `)} — optional; checks in ${a} are skipped.`}function _e(e){if(e.suspendedCondition===null)return null;let t=J(e.suspendedCondition).toLowerCase();return`Paused — nothing was captured in ${t}, so checks are on hold until the light changes back. Capture ${t} if you want it watched around the clock.`}var ve={"no-reference-for-condition":`can’t tell — nothing has been captured for this scene yet. Press “Capture daylight” to photograph what normal looks like.`,"view-shifted":`can’t tell — the camera view has moved since the reference was captured. Re-capture it.`,"no-vision-profile":`can’t tell — the vision model is unreachable, so the change is on hold.`,"encoder-model-changed":`can’t tell — the embedding model changed, so the stored references are unreadable. Re-capture them.`,"no-snapshot":`can’t tell — this camera did not return a frame.`};function ye(e,t){if(e.states.length===0)return`Not armed yet — capture the initial state to start watching.`;if(e.verdict===`unknown`)return e.unavailable===null?`can’t tell right now.`:ve[e.unavailable];let n=e.verdict===`diverged`?e.divergedAt:e.armedAt,r=n===null?``:` for ${X(Math.max(0,t-n))}`;if(e.latched)return e.verdict===`diverged`?`CHANGED${r} — press Reset when you have dealt with it.`:`Back to normal, but still flagged as changed${r}. Press Reset to clear it.`;let i=_e(e);return i===null?e.verdict===`diverged`?`CHANGED${r}`:`Normal${r}`:i}function be(e){return e.states.length===0?{text:`Not armed`,tone:`unknown`}:e.latched?{text:`Changed`,tone:`alarm`}:e.suspendedCondition===null?e.verdict===`unknown`?{text:`Can’t tell`,tone:`unknown`}:e.verdict===`diverged`?{text:`Changed`,tone:`alarm`}:{text:`Normal`,tone:`ok`}:{text:`Paused`,tone:`unknown`}}var Y=.4;function xe(e){return e.width*e.height>Y}function X(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<48?`${r}h`:`${Math.floor(r/24)}d`}var Se=`rounded-lg border border-border bg-surface overflow-hidden`,Ce=`border-b border-border px-3 sm:px-4 py-1.5 sm:py-2`,we=`p-2 sm:p-3 lg:p-4`,Te=`space-y-3 sm:space-y-4`,Ee=`gap-2 sm:gap-3`,De=`px-3 sm:px-4 py-1.5 sm:py-2`,Oe=`grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-4`,ke=`grid grid-cols-1 lg:grid-cols-2`,Ae=`flex flex-col-reverse md:flex-row`,je=`w-full md:w-44 lg:w-52 md:flex-shrink-0 border-b md:border-b-0 md:border-l border-border`,Me=`sm`,Ne=`flex min-w-0 flex-col gap-0.5 py-1.5 sm:flex-row sm:items-center`,Pe=`min-w-0 text-[11px] leading-tight text-foreground-subtle sm:w-32 sm:shrink-0 sm:pr-2`,Fe=`flex w-full min-w-0 items-center gap-1 sm:flex-1`,Ie=`min-w-0 break-all text-xs text-foreground sm:truncate`,Le=`text-[10px] sm:text-[11px] font-semibold text-foreground uppercase tracking-wider`,Re=`text-[11px] sm:text-xs text-foreground`,ze=`text-[10px] text-foreground-subtle`,Be=`text-[11px] sm:text-xs font-medium text-foreground`,Ve=`text-base sm:text-lg font-semibold leading-tight text-foreground`,He=`inline-flex items-center justify-center gap-1 rounded border border-border bg-surface px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-foreground hover:bg-surface-hover transition-colors disabled:opacity-40`,Ue=`inline-flex items-center justify-center gap-1 rounded border border-primary/40 bg-primary/15 px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-primary hover:bg-primary/25 transition-colors disabled:opacity-40`,Z=`inline-flex items-center justify-center gap-1 rounded border border-danger/40 bg-danger/10 px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-danger hover:bg-danger/20 transition-colors disabled:opacity-40`,We=`inline-flex items-center justify-center gap-1 rounded border border-warning/40 bg-warning/10 px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-warning hover:bg-warning/20 transition-colors disabled:opacity-40`,Ge=`w-full rounded border border-border bg-background px-1.5 py-0.5 sm:px-2 sm:py-1 text-[11px] sm:text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none`,Ke=`inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium transition-colors`,qe=`border-primary/50 bg-primary/15 text-primary`,Je=`border-border bg-surface text-foreground-subtle hover:bg-surface-hover`;a();var Q=O(`camstack:player-overlays-state`,null),$=O(`camstack:player-overlays-actions`,null);function Ye({children:e}){let[n,r]=u(()=>new Map),[i,a]=u(()=>new Map),o=t(e=>{r(t=>{let n=new Map(t);return n.set(e.id,e),n})},[]),c=t(e=>{r(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),l=t(e=>{a(t=>{let n=new Map(t);return n.set(e.id,e),n})},[]),f=t(e=>{a(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),p=s(()=>({layers:n,buttons:i}),[n,i]),m=s(()=>({setLayer:o,removeLayer:c,setButton:l,removeButton:f}),[o,c,l,f]);return d(Q.Provider,{value:p,children:d($.Provider,{value:m,children:e})})}function Xe(){let e=r(Q);return s(()=>e?[...e.layers.values()].toSorted((e,t)=>e.order-t.order):[],[e])}function Ze(){let e=r(Q);return s(()=>e?[...e.buttons.values()].toSorted((e,t)=>e.order-t.order):[],[e])}function Qe(e){let t=r($);f(()=>{if(!(!t||!e))return t.setLayer(e),()=>t.removeLayer(e.id)},[t,e])}function $e(e){let t=r($);f(()=>{if(!(!t||!e))return t.setButton(e),()=>t.removeButton(e.id)},[t,e])}export{z as $,ze as A,ye as B,Me as C,je as D,Ae as E,q as F,W as G,me as H,be as I,H as J,de as K,ge as L,Le as M,Be as N,Te as O,Y as P,R as Q,X as R,Pe as S,Ie as T,K as U,J as V,fe as W,L as X,V as Y,I as Z,De as _,x as _t,Ze as a,se as at,Ce as b,Ue as c,ie as ct,Ke as d,D as dt,N as et,Je as f,E as ft,Ge as g,S as gt,Oe as h,C as ht,$e as i,ce as it,Ve as j,Re as k,We as l,re as lt,ke as m,w as mt,Qe as n,P as nt,He as o,O as ot,Ee as p,T as pt,G as q,Xe as r,oe as rt,Z as s,ae as st,Ye as t,B as tt,qe as u,ne as ut,we as v,b as vt,Fe as w,Ne as x,Se as y,y as yt,xe as z};
|
|
1
|
+
import{D as e,I as t,J as n,L as r,O as i,Q as a,S as o,W as s,b as c,k as l,q as u,x as d,z as f}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{vt as p}from"./src-Cq9_wgDT.js";a();var m=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),h=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ee=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),g=e=>{let t=ee(e);return t.charAt(0).toUpperCase()+t.slice(1)},_={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},v=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},te=l(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a=``,children:o,iconNode:s,...c},l)=>i(`svg`,{ref:l,..._,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:m(`lucide`,a),...!o&&!v(c)&&{"aria-hidden":`true`},...c},[...s.map(([e,t])=>i(e,t)),...Array.isArray(o)?o:[o]]));a();var y=(e,t)=>{let n=l(({className:n,...r},a)=>i(te,{ref:a,iconNode:t,className:m(`lucide-${h(g(e))}`,`lucide-${e}`,n),...r}));return n.displayName=g(e),n},b=y(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),x=y(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),S=y(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),C=y(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),w=y(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),T=y(`grid-2x2`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]),E=y(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),D=y(`mic-off`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]),ne=y(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),re=y(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),ie=y(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),ae=y(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);a();function O(t,n){if(typeof globalThis>`u`)return e(n);let r=globalThis.__camstackSharedContexts,i=r??new Map;r||(globalThis.__camstackSharedContexts=i);let a=i.get(t);if(a)return a;let o=e(n);return i.set(t,o),o}a();var k=O(`camstack:system`,null);function oe({system:e,children:t}){return d(k.Provider,{value:e,children:t})}function se(){let e=r(k);if(!e)throw Error(`useSystem(): no <SystemProvider> in tree`);return e}function ce(){return r(k)}var le=`camstack-mount`,ue=/^\/(?:[A-Za-z0-9_\-.]+\/)*$/,A=null;function j(e){if(e==null||e===``)return null;let t=e.endsWith(`/`)?e:`${e}/`;return!ue.test(t)||t.includes(`/../`)||t.includes(`/./`)?null:t}function M(){if(typeof document>`u`)return`/`;let e=j(document.querySelector(`meta[name="${le}"]`)?.getAttribute(`content`));if(e!==null)return e;if(document.querySelector(`base[href]`)!==null)try{let e=new URL(document.baseURI);if(e.origin===window.location.origin){let t=j(e.pathname);if(t!==null)return t}}catch{}return`/`}function N(){return A===null&&(A=M()),A}function P(){return N().replace(/\/$/,``)}function F(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith(`//`)}function I(e){if(F(e))return e;let t=N(),n=e.replace(/^\/+/,``);return t!==`/`&&(e===P()||e.startsWith(t))?e:`${t}${n}`}function L(){return`${typeof window<`u`?window.location.origin:``}${P()}`}function R(e){return F(e)?e:`${L()}${I(e).slice(P().length)}`}function z(e){return R(e).replace(/^http/,`ws`)}function B(){A=null}a();function V({title:e,icon:t,headerRight:n,collapsible:r=!1,defaultOpen:i=!0,bodyClassName:a=`p-3`,children:s}){let[l,f]=u(i),p=!r||l,m=o(c,{children:[o(`span`,{className:`flex items-center gap-2 text-xs font-semibold uppercase tracking-wider text-foreground`,children:[t,e]}),r?d(l?x:S,{className:`h-3.5 w-3.5 text-foreground-subtle`}):n]}),h=`px-4 py-2 flex items-center justify-between ${p?`border-b border-border`:``}`;return o(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[r?d(`button`,{type:`button`,onClick:()=>f(e=>!e),className:`w-full text-left ${h}`,children:m}):d(`div`,{className:h,children:m}),p?d(`div`,{className:a,children:s}):null]})}function H({label:e,icon:t,children:n,footer:r}){return o(`div`,{className:`rounded-md border border-border/60 bg-background/40 px-3 py-2`,children:[o(`div`,{className:`mb-1 flex items-center gap-1.5 text-[11px] uppercase tracking-wider text-foreground-subtle`,children:[t,e]}),d(`div`,{className:`text-sm font-medium text-foreground`,children:n}),r?d(`div`,{className:`mt-0.5 text-[10px] text-foreground-subtle`,children:r}):null]})}a();var U=`capability.binding-changed`;function W(e,t){let[n,r]=u(null);return f(()=>{if(t===null){r(null);return}let n=!1,i=async()=>{try{let i=await e.deviceManager.getBindings.query({deviceId:t});n||r(i)}catch{n||r(e=>e)}};i();let a=e.live?.onEvent.subscribe({category:U},{onData:e=>{let n=e.data?.source;if(!n){i();return}n.type===`device`&&n.id===t&&i()}});return()=>{n=!0,a?.unsubscribe()}},[e,t]),s(()=>n?p(e,n):null,[e,n])}function G(e){let r=t(t=>e?e.subscribe(()=>t()):()=>void 0,[e]),i=t(()=>e?.value,[e]);return n(r,i,i)}function de(e,t,n){let r=W(e,t);return G(r?n(r.state):void 0)}a();var K=`/addon/snapshot/media`;function fe(e,n={}){let{width:r,baseUrl:i}=n,[a,o]=u(0);return{src:s(()=>{if(e===null||e<=0)return null;let t=i===void 0?P():i.replace(/\/+$/,``),n=new URLSearchParams;r!==void 0&&Number.isInteger(r)&&r>0&&n.set(`w`,String(r)),a>0&&(n.set(`force`,`1`),n.set(`r`,String(a)));let o=n.toString();return`${t}${K}/${String(e)}.jpg${o.length>0?`?${o}`:``}`},[e,r,i,a]),loading:!1,refresh:t(()=>{o(e=>e+1)},[])}}function pe(e){if(typeof e!=`object`||!e)return null;let t=Reflect.get(e,`data`);if(typeof t==`object`&&t){let e=Reflect.get(t,`capRouteReason`);if(typeof e==`string`)return e}return null}function me(e){let t=pe(e);return t===null?(e instanceof Error?e.message:String(e)).includes(`provider not available`):t===`no-provider`||t===`node-offline`}var q=[`day`,`ir`],he={day:`Daylight`,ir:`Night (IR)`,night:`Night`,dawn:`Dawn`,dusk:`Dusk`};function J(e){return he[e]??e}function ge(e){let t=new Set(e.coveredConditions),n=q.map(e=>`${J(e)} ${t.has(e)?`✓`:`✗`}`),r=[...t].filter(e=>!q.some(t=>t===e));for(let e of r)n.push(`${J(e)} ✓`);let i=q.filter(e=>!t.has(e));if(i.length===0)return n.join(` · `);if(t.size===0)return`${n.join(` · `)} — nothing captured yet, so this scene is not watching.`;let a=i.map(e=>J(e).toLowerCase()).join(` and `);return e.onUncoveredCondition===`judge-anyway`?`${n.join(` · `)} — ${a} judged against the references you do have.`:`${n.join(` · `)} — optional; checks in ${a} are skipped.`}function _e(e){if(e.suspendedCondition===null)return null;let t=J(e.suspendedCondition).toLowerCase();return`Paused — nothing was captured in ${t}, so checks are on hold until the light changes back. Capture ${t} if you want it watched around the clock.`}var ve={"no-reference-for-condition":`can’t tell — nothing has been captured for this scene yet. Press “Capture daylight” to photograph what normal looks like.`,"view-shifted":`can’t tell — the camera view has moved since the reference was captured. Re-capture it.`,"no-vision-profile":`can’t tell — the vision model is unreachable, so the change is on hold.`,"encoder-model-changed":`can’t tell — the embedding model changed, so the stored references are unreadable. Re-capture them.`,"no-snapshot":`can’t tell — this camera did not return a frame.`};function ye(e,t){if(e.states.length===0)return`Not armed yet — capture the initial state to start watching.`;if(e.verdict===`unknown`)return e.unavailable===null?`can’t tell right now.`:ve[e.unavailable];let n=e.verdict===`diverged`?e.divergedAt:e.armedAt,r=n===null?``:` for ${X(Math.max(0,t-n))}`;if(e.latched)return e.verdict===`diverged`?`CHANGED${r} — press Reset when you have dealt with it.`:`Back to normal, but still flagged as changed${r}. Press Reset to clear it.`;let i=_e(e);return i===null?e.verdict===`diverged`?`CHANGED${r}`:`Normal${r}`:i}function be(e){return e.states.length===0?{text:`Not armed`,tone:`unknown`}:e.latched?{text:`Changed`,tone:`alarm`}:e.suspendedCondition===null?e.verdict===`unknown`?{text:`Can’t tell`,tone:`unknown`}:e.verdict===`diverged`?{text:`Changed`,tone:`alarm`}:{text:`Normal`,tone:`ok`}:{text:`Paused`,tone:`unknown`}}var Y=.4;function xe(e){return e.width*e.height>Y}function X(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<48?`${r}h`:`${Math.floor(r/24)}d`}var Se=`rounded-lg border border-border bg-surface overflow-hidden`,Ce=`border-b border-border px-3 sm:px-4 py-1.5 sm:py-2`,we=`p-2 sm:p-3 lg:p-4`,Te=`space-y-3 sm:space-y-4`,Ee=`gap-2 sm:gap-3`,De=`px-3 sm:px-4 py-1.5 sm:py-2`,Oe=`grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-4`,ke=`grid grid-cols-1 lg:grid-cols-2`,Ae=`flex flex-col-reverse md:flex-row`,je=`w-full md:w-44 lg:w-52 md:flex-shrink-0 border-b md:border-b-0 md:border-l border-border`,Me=`sm`,Ne=`flex min-w-0 flex-col gap-0.5 py-1.5 sm:flex-row sm:items-center`,Pe=`min-w-0 text-[11px] leading-tight text-foreground-subtle sm:w-32 sm:shrink-0 sm:pr-2`,Fe=`flex w-full min-w-0 items-center gap-1 sm:flex-1`,Ie=`min-w-0 break-all text-xs text-foreground sm:truncate`,Le=`text-[10px] sm:text-[11px] font-semibold text-foreground uppercase tracking-wider`,Re=`text-[11px] sm:text-xs text-foreground`,ze=`text-[10px] text-foreground-subtle`,Be=`text-[11px] sm:text-xs font-medium text-foreground`,Ve=`text-base sm:text-lg font-semibold leading-tight text-foreground`,He=`inline-flex items-center justify-center gap-1 rounded border border-border bg-surface px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-foreground hover:bg-surface-hover transition-colors disabled:opacity-40`,Ue=`inline-flex items-center justify-center gap-1 rounded border border-primary/40 bg-primary/15 px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-primary hover:bg-primary/25 transition-colors disabled:opacity-40`,Z=`inline-flex items-center justify-center gap-1 rounded border border-danger/40 bg-danger/10 px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-danger hover:bg-danger/20 transition-colors disabled:opacity-40`,We=`inline-flex items-center justify-center gap-1 rounded border border-warning/40 bg-warning/10 px-1.5 py-0.5 sm:px-2 sm:py-1 text-[10px] sm:text-[11px] font-medium text-warning hover:bg-warning/20 transition-colors disabled:opacity-40`,Ge=`w-full rounded border border-border bg-background px-1.5 py-0.5 sm:px-2 sm:py-1 text-[11px] sm:text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none`,Ke=`inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium transition-colors`,qe=`border-primary/50 bg-primary/15 text-primary`,Je=`border-border bg-surface text-foreground-subtle hover:bg-surface-hover`;a();var Q=O(`camstack:player-overlays-state`,null),$=O(`camstack:player-overlays-actions`,null);function Ye({children:e}){let[n,r]=u(()=>new Map),[i,a]=u(()=>new Map),o=t(e=>{r(t=>{let n=new Map(t);return n.set(e.id,e),n})},[]),c=t(e=>{r(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),l=t(e=>{a(t=>{let n=new Map(t);return n.set(e.id,e),n})},[]),f=t(e=>{a(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),p=s(()=>({layers:n,buttons:i}),[n,i]),m=s(()=>({setLayer:o,removeLayer:c,setButton:l,removeButton:f}),[o,c,l,f]);return d(Q.Provider,{value:p,children:d($.Provider,{value:m,children:e})})}function Xe(){let e=r(Q);return s(()=>e?[...e.layers.values()].toSorted((e,t)=>e.order-t.order):[],[e])}function Ze(){let e=r(Q);return s(()=>e?[...e.buttons.values()].toSorted((e,t)=>e.order-t.order):[],[e])}function Qe(e){let t=r($);f(()=>{if(!(!t||!e))return t.setLayer(e),()=>t.removeLayer(e.id)},[t,e])}function $e(e){let t=r($);f(()=>{if(!(!t||!e))return t.setButton(e),()=>t.removeButton(e.id)},[t,e])}export{z as $,ze as A,ye as B,Me as C,je as D,Ae as E,q as F,W as G,me as H,be as I,H as J,de as K,ge as L,Le as M,Be as N,Te as O,Y as P,R as Q,X as R,Pe as S,Ie as T,K as U,J as V,fe as W,L as X,V as Y,I as Z,De as _,x as _t,Ze as a,se as at,Ce as b,Ue as c,ie as ct,Ke as d,D as dt,N as et,Je as f,E as ft,Ge as g,S as gt,Oe as h,C as ht,$e as i,ce as it,Ve as j,Re as k,We as l,re as lt,ke as m,w as mt,Qe as n,P as nt,He as o,O as ot,Ee as p,T as pt,G as q,Xe as r,oe as rt,Z as s,ae as st,Ye as t,B as tt,qe as u,ne as ut,we as v,b as vt,Fe as w,Ne as x,Se as y,y as yt,xe as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_--fCbD2Tp.js";export{t as get,e as init};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{yt as e}from"./player-overlays-
|
|
1
|
+
import{yt as e}from"./player-overlays-aOXZvSE_.js";var t=e(`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`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{yt as e}from"./player-overlays-
|
|
1
|
+
import{yt as e}from"./player-overlays-aOXZvSE_.js";var t=e(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{yt as e}from"./player-overlays-
|
|
1
|
+
import{yt as e}from"./player-overlays-aOXZvSE_.js";var t=e(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]);export{t};
|