@camstack/addon-admin-ui 1.2.447 → 1.2.448
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/{AddonAssetIcon-4Dl3K5Yu.js → AddonAssetIcon-YlaeLmP_.js} +1 -1
- package/dist/assets/Addons-D0RNa7cq.js +4 -0
- package/dist/assets/{AdminPage-CTKQzYSK.js → AdminPage-Y0f_vb0G.js} +1 -1
- package/dist/assets/{AdminSectionedPage-DB1wuvwM.js → AdminSectionedPage-CvrbRm6V.js} +1 -1
- package/dist/assets/AiProfiles-CSfexEul.js +3 -0
- package/dist/assets/{BrokerForm-DgJKJJ9V.js → BrokerForm-D3VJOkFb.js} +1 -1
- package/dist/assets/Build-DqFGOChc.js +40 -0
- package/dist/assets/Calendars-BDpDvL0Q.js +1 -0
- package/dist/assets/{Cluster-CUFJA8Yh.js → Cluster-CTGHGuyd.js} +1 -1
- package/dist/assets/{ClusterStepModel-G54nm4iG.js → ClusterStepModel-DnRSJW9o.js} +1 -1
- package/dist/assets/CompositionEditor-D_p_gdiC.js +1 -0
- package/dist/assets/{CompositionEditorPage-DqCZgEdJ.js → CompositionEditorPage-B6Blr6a5.js} +1 -1
- package/dist/assets/Data-Cn6tMPDf.js +2 -0
- package/dist/assets/DeviceDetail-D_Vyvh2M.js +2 -0
- package/dist/assets/{DeviceDoActionFields-CU_AKA1W.js → DeviceDoActionFields-DtRDOGnl.js} +1 -1
- package/dist/assets/{Devices-CdmAtZP1.js → Devices-BqbXuY4u.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-OyxmU511.js → EmbedPlayerPage-DYNkVSGX.js} +1 -1
- package/dist/assets/History-4K69b4zC.js +1 -0
- package/dist/assets/Identity-BuytRDu0.js +1 -0
- package/dist/assets/IntegrationDetail-B9PHPBT2.js +1 -0
- package/dist/assets/IntegrationHub-CATt3sSb.js +1 -0
- package/dist/assets/Integrations-6bieSjRq.js +1 -0
- package/dist/assets/Integrations-6cJP9_gE.js +1 -0
- package/dist/assets/Library-BPUNgYx9.js +1 -0
- package/dist/assets/Locations-0VOpTZRT.js +3 -0
- package/dist/assets/{Logs-CaO5TsuY.js → Logs-hq9A8gPf.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-CnazBudR.js → MaskShapeCanvas-DaES9o_d.js} +1 -1
- package/dist/assets/{MotionZonesSettings-BcEiYvgb.js → MotionZonesSettings-BB1OPY-Z.js} +1 -1
- package/dist/assets/MyAccess-BwHAEcsT.js +2 -0
- package/dist/assets/{Network-BNthoi6m.js → Network-CELjk0fc.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-CpONFsu0.js → NodeAddonsSettingsPanel-C5TYpzdG.js} +1 -1
- package/dist/assets/Notifications-C_tBdjVZ.js +1 -0
- package/dist/assets/{PrivacyMaskSettings-B89MVHxL.js → PrivacyMaskSettings-dl0SaDLU.js} +1 -1
- package/dist/assets/Recordings-BebI9rhV.js +1 -0
- package/dist/assets/{ScanNetworkModal-B9n2JdTA.js → ScanNetworkModal-DpScPCmx.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-Bmn_UcYs.js → SceneMonitorEditor-D_JR8OEY.js} +1 -1
- package/dist/assets/SessionsList-KUtPcHl3.js +2 -0
- package/dist/assets/{Showroom-BaHMWO3G.js → Showroom-BxILBL8f.js} +1 -1
- package/dist/assets/System-oJXxolQh.js +1 -0
- package/dist/assets/{Terminal-TaTeiXX0.js → Terminal-Cf5lX56U.js} +3 -3
- package/dist/assets/{Viewer-DXjhAdbS.js → Viewer-CDsUYSir.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BYUIhxrf.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CC77R0_e.js} +1 -1
- package/dist/assets/{addon-icons-context-0MDrwtIo.js → addon-icons-context-F-l6JxP6.js} +1 -1
- package/dist/assets/{archive-C3J7kPmp.js → archive-gt6xpkGA.js} +1 -1
- package/dist/assets/{authed-media-dGvmAGIm.js → authed-media-BKSVGA1M.js} +1 -1
- package/dist/assets/{bell-off-Df5MKmnk.js → bell-off-DkFzAVbQ.js} +1 -1
- package/dist/assets/{board-model-BVOHJW-k.js → board-model-BEF98n5Q.js} +1 -1
- package/dist/assets/{boxes-B4UVG1kT.js → boxes-DD515hf_.js} +1 -1
- package/dist/assets/circle-slash-Dvu6elI8.js +1 -0
- package/dist/assets/client-Dv9yZvWI.js +358 -0
- package/dist/assets/{cloud-upload-I7yc63rr.js → cloud-upload-DRbR_RgV.js} +1 -1
- package/dist/assets/crop-NbQapATy.js +1 -0
- package/dist/assets/{device-integration-icon-C_jsalSP.js → device-integration-icon-BrsSuZkc.js} +1 -1
- package/dist/assets/device-picker-model-B9RFllo3.js +1 -0
- package/dist/assets/{dist-BOKrykX2.js → dist-CtaM7tdj.js} +1 -1
- package/dist/assets/dist-eeXLB_WF.js +358 -0
- package/dist/assets/{eraser-WGJr5dAG.js → eraser-CYGvrt-o.js} +1 -1
- package/dist/assets/{hard-drive-download-BqS2ahXp.js → hard-drive-download-RpoYwcJW.js} +1 -1
- package/dist/assets/{hostInit-Cn05saXf.js → hostInit-SPnLNFAH.js} +1 -1
- package/dist/assets/i18n-DBncQ6jl.js +1 -0
- package/dist/assets/{icons-BgfaaZCZ.js → icons-Ctu1Y05s.js} +1 -1
- package/dist/assets/{index-2_qB4G1l.js → index-CXOYQeji.js} +3 -3
- package/dist/assets/{key-D741QkPA.js → key-BYpSoaTE.js} +1 -1
- package/dist/assets/{key-round-_blTK3l4.js → key-round-CUnNZTAz.js} +1 -1
- package/dist/assets/{layers-CBNWlTsd.js → layers-DlmuW7b-.js} +1 -1
- package/dist/assets/{linked-devices-model-Csh4WaVK.js → linked-devices-model-BEA1lr2Y.js} +1 -1
- package/dist/assets/{list-ordered-BTh8rts2.js → list-ordered-CoANKD7e.js} +1 -1
- package/dist/assets/{location-owned-usage-Dqp8xgaw.js → location-owned-usage-BOD2xEtr.js} +1 -1
- package/dist/assets/{log-in-Fh5saGuL.js → log-in-Ch8A1qlw.js} +1 -1
- package/dist/assets/{memory-stick-2qy4HWOo.js → memory-stick-Bsklsl2s.js} +1 -1
- package/dist/assets/{message-square-plus-D70FuCBB.js → message-square-plus-C5arEPSf.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-1defdd87.js → mf-entry-bootstrap-0-cf438d0a.js} +2 -2
- package/dist/assets/{mic-off-MTwAUBdb.js → mic-off-D9VVE1hf.js} +1 -1
- package/dist/assets/{monitor-off-Dn82QkPx.js → monitor-off-BCaF7zDl.js} +1 -1
- package/dist/assets/{monitor-smartphone-K0Y4ODGq.js → monitor-smartphone-B1lc4syi.js} +1 -1
- package/dist/assets/mount-B9RFllo3.js +1 -0
- package/dist/assets/notification-schedule-field-w-B_hHnB.js +1 -0
- package/dist/assets/{player-overlays-DyNPyo_W.js → player-overlays-DxE-ZGs_.js} +1 -1
- package/dist/assets/{recycle-DO1B1SCp.js → recycle-vSXkN2mG.js} +1 -1
- package/dist/assets/remoteEntry-S5WkZciN.js +1 -0
- package/dist/assets/{scan-eye-DSsbXKWH.js → scan-eye-BrgwL9sQ.js} +1 -1
- package/dist/assets/{scissors-CGMgxeDq.js → scissors-BKN5a41L.js} +1 -1
- package/dist/assets/{search-x-CUa_1rys.js → search-x-BFtEEQ7u.js} +1 -1
- package/dist/assets/{send-CKZO6JbT.js → send-DUwpyQRD.js} +1 -1
- package/dist/assets/{settings-2-Dee5_Dd_.js → settings-2-Cy16RU0G.js} +1 -1
- package/dist/assets/{speaker-CGMtKx0N.js → speaker-0YT_wAR4.js} +1 -1
- package/dist/assets/src-BXyxUvfL.js +67 -0
- package/dist/assets/{timer-reset-Dg8WnmrV.js → timer-reset-BXot0J3z.js} +1 -1
- package/dist/assets/{ungroup-DqYydoru.js → ungroup-CaZBfFGG.js} +1 -1
- package/dist/assets/{unlink-XIrgZrQf.js → unlink-sHJt-6l3.js} +1 -1
- package/dist/assets/{usb-33G087e5.js → usb-DhSYhQLg.js} +1 -1
- package/dist/assets/{use-scenes-feed-DsXuB27l.js → use-scenes-feed-gpHOmo_k.js} +1 -1
- package/dist/assets/{use-stationary-objects-D_FqXLHG.js → use-stationary-objects-1xlyjyv9.js} +1 -1
- package/dist/assets/useEventInvalidation-B9RFllo3.js +1 -0
- package/dist/assets/{useNodeUrlSelection-DWli8jTd.js → useNodeUrlSelection-Bn1gQlh_.js} +1 -1
- package/dist/assets/user-round-BN8VNM_n.js +1 -0
- package/dist/assets/{user-x-ODLis0Xn.js → user-x-BjgNc3OJ.js} +1 -1
- package/dist/assets/{video-BtFmM3eg.js → video-Ds3z1Mgy.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CHMiEHNO.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DpZo3iGZ.js} +2 -2
- package/dist/index.html +10 -10
- package/dist/server/addon.js +10 -16
- package/package.json +1 -1
- package/dist/assets/Addons-D6G-9sO_.js +0 -4
- package/dist/assets/AiProfiles-DGYy6F5H.js +0 -3
- package/dist/assets/Build-ChuBRxJe.js +0 -40
- package/dist/assets/Calendars-DTLTaLNh.js +0 -1
- package/dist/assets/CompositionEditor-ZIvK82Sw.js +0 -1
- package/dist/assets/Data-Dt-vrsjS.js +0 -2
- package/dist/assets/DeviceDetail-B-JixtlL.js +0 -2
- package/dist/assets/History-CYEo0VmZ.js +0 -1
- package/dist/assets/Identity-CFqxjMZh.js +0 -1
- package/dist/assets/IntegrationDetail-Cv36j4Pb.js +0 -1
- package/dist/assets/IntegrationHub-Debcc46Y.js +0 -1
- package/dist/assets/Integrations-CTza89BR.js +0 -1
- package/dist/assets/Integrations-lU3DuymB.js +0 -1
- package/dist/assets/Library-D6P3tPHr.js +0 -1
- package/dist/assets/Locations-C0hvZIQb.js +0 -3
- package/dist/assets/MyAccess-CaTk0IGs.js +0 -2
- package/dist/assets/Notifications-WmYoCGsa.js +0 -1
- package/dist/assets/Recordings-BBu3Qb1s.js +0 -1
- package/dist/assets/SessionsList-D93VogSm.js +0 -2
- package/dist/assets/System-D-2Ma-Kz.js +0 -1
- package/dist/assets/circle-slash-BTU53Q69.js +0 -1
- package/dist/assets/client-CRCWO8cg.js +0 -358
- package/dist/assets/crop-B9ZtPXzr.js +0 -1
- package/dist/assets/device-picker-model-B0uThmDr.js +0 -1
- package/dist/assets/dist-C6cNUgRP.js +0 -358
- package/dist/assets/i18n-DzruZdmx.js +0 -1
- package/dist/assets/mount-B0uThmDr.js +0 -1
- package/dist/assets/notification-schedule-field-CeZmOaz1.js +0 -1
- package/dist/assets/remoteEntry-BiLc8a2-.js +0 -1
- package/dist/assets/src-_mtQMfPm.js +0 -67
- package/dist/assets/useEventInvalidation-B0uThmDr.js +0 -1
- package/dist/assets/user-round-CKL9ygyb.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ra as e}from"./player-overlays-
|
|
1
|
+
import{ra as e}from"./player-overlays-DxE-ZGs_.js";var t=e(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),n=e(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),r=e(`key-square`,[[`path`,{d:`M12.4 2.7a2.5 2.5 0 0 1 3.4 0l5.5 5.5a2.5 2.5 0 0 1 0 3.4l-3.7 3.7a2.5 2.5 0 0 1-3.4 0L8.7 9.8a2.5 2.5 0 0 1 0-3.4z`,key:`165ttr`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`m9.4 10.6-6.814 6.814A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814`,key:`1ubxi2`}]]),i=e(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]);export{t as i,r as n,n as r,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ra as e}from"./player-overlays-
|
|
1
|
+
import{ra as e}from"./player-overlays-DxE-ZGs_.js";var t=e(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ra as e}from"./player-overlays-
|
|
1
|
+
import{ra as e}from"./player-overlays-DxE-ZGs_.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Kr as e,ni as t,ri as n,si as r}from"./client-Dv9yZvWI.js";import{U as i,W as a}from"./src-BXyxUvfL.js";import{t as o}from"./i18n-DBncQ6jl.js";import"./device-picker-model-B9RFllo3.js";var s=[{id:`motion`,labelKey:`customize.assign.filters.motion`,caps:[`motion`]},{id:`contact`,labelKey:`customize.assign.filters.contact`,caps:[`contact`]},{id:`all`,labelKey:`customize.assign.filters.all`,caps:t}];function c(e,n){return n!==null&&e.includes(n)?n:t.find(t=>e.includes(t))??null}function l(e,t){let n=[e,t].filter(e=>e!==null&&e!==``);return n.length===0?null:n.join(` · `)}function u(t,n){if(t.id===n.hostId||t.type===r.Container||n.excludeCameras&&t.isCamera)return!1;let i=e({addonId:t.addonId,stableId:t.stableId});return!n.assigned.has(i)}function d(e){return e.devices.flatMap(t=>{if(!u(t,e))return[];let r=e.capIndex.get(t.id)??[],i=c(r,e.preferredCap);if(i===null)return[];let a=n[i];return[{deviceId:t.id,ref:{addonId:t.addonId,stableId:t.stableId},name:t.name,detail:l(t.integration,t.location),meta:i,caps:r,value:a===void 0?null:{deviceId:t.id,cap:i,path:a}}]}).toSorted((e,t)=>e.name.localeCompare(t.name))}function f(e,t,n){let r=i(t);return e.filter(e=>{if(n!==null&&!e.caps.some(e=>n.caps.includes(e)))return!1;if(r.length===0)return!0;let t=a({id:e.deviceId,name:e.name,...e.detail===null?{}:{detail:e.detail},...e.meta===null?{}:{type:e.meta}});return r.every(e=>t.includes(e))})}function p(e){let t=e.find(e=>e.query.status===`error`);if(t!==void 0)return{kind:`unknown`,reason:t.query.error?.message??o.t(`helpers.customize.requestFailed`)};if(e.some(e=>e.query.status!==`success`||e.query.data===void 0))return{kind:`pending`};let n=new Map;for(let t of e)for(let e of t.query.data??[])n.set(e,[...n.get(e)??[],t.cap]);return{kind:`known`,value:n}}function m(e){return e.slot===`linked-devices`}function h(e){if(e.status===`error`)return{kind:`unknown`,reason:e.error?.message??o.t(`helpers.customize.requestFailed`)};if(e.status===`pending`||e.data===void 0)return{kind:`pending`};for(let t of e.data)if(t.state===`ok`&&t.slot===`linked-devices`&&m(t.value))return{kind:`present`,slot:t,value:t.value};let t=e.data.find(e=>e.state===`unreachable`);return t!==void 0&&t.state===`unreachable`?{kind:`unknown`,reason:t.reason}:{kind:`absent`}}function g(e,t){let n=t.trackedDeviceIds??[],r=e=>t=>({deviceId:t.deviceId,name:t.name,health:t.health,implied:e,tracked:n.includes(t.deviceId)});return[...e.sources.map(r(!1)),...(e.impliedSources??[]).map(r(!0))]}function _(e,t){let n=new Set([...e.sources,...e.impliedSources??[]].map(e=>e.deviceId));return(t.trackedDeviceIds??[]).filter(e=>!n.has(e))}function v(e,t){return{...e,deviceIds:[...e.deviceIds,...t.filter(t=>!e.deviceIds.includes(t))]}}function y(e,t){return{...e,deviceIds:e.deviceIds.filter(e=>e!==t),...e.trackedDeviceIds===void 0?{}:{trackedDeviceIds:e.trackedDeviceIds.filter(e=>e!==t)}}}function b(e,t,n){let r=e.trackedDeviceIds??[],i=n?[...r.filter(e=>e!==t),t]:r.filter(e=>e!==t);return{...e,trackedDeviceIds:i}}function x(e,t,n){return e.flatMap(e=>{let r=t.get(e.deviceId);return n.has(e.deviceId)||r===void 0?[]:[{deviceId:e.deviceId,ref:{addonId:r.addonId,stableId:r.stableId},name:e.parentName===null?e.name:`${e.parentName} · ${e.name}`,detail:l(r.integration,e.location),meta:e.type,caps:[],value:null}]})}export{v as a,s as c,f as d,c as f,_ as i,l,g as n,b as o,d as p,h as r,y as s,x as t,p as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ra as e}from"./player-overlays-
|
|
1
|
+
import{ra as e}from"./player-overlays-DxE-ZGs_.js";var t=e(`images`,[[`path`,{d:`m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16`,key:`9kzy35`}],[`path`,{d:`M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2`,key:`1t0f0t`}],[`circle`,{cx:`13`,cy:`7`,r:`1`,fill:`currentColor`,key:`1obus6`}],[`rect`,{x:`8`,y:`2`,width:`14`,height:`14`,rx:`2`,key:`1gvhby`}]]),n=e(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),r=e(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]);export{n,t as r,r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,B as t,G as n,J as r,L as i,S as a,o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{Br as c,D as l,En as u,Fn as d,It as f,Si as p,Sr as m,bi as h,dt as g,kn as _,or as v,ot as y}from"./player-overlays-DyNPyo_W.js";import{mi as b}from"./client-CRCWO8cg.js";import{t as x}from"./archive-C3J7kPmp.js";import{t as S}from"./eraser-WGJr5dAG.js";import{t as C}from"./hard-drive-download-BqS2ahXp.js";import{$n as w,Er as T,Nl as ee,Qn as te,Yr as E,er as ne,hr as D,ht as re,ir as ie,mn as O,nr as k,rr as ae,xl as oe}from"./src-_mtQMfPm.js";import{t as A}from"./i18n-DzruZdmx.js";import{t as j}from"./useTranslation-D3Is_4B6.js";import{Z as se,z as ce}from"./index-2_qB4G1l.js";import{t as M}from"./format-size-DIxKXxtj.js";e();function N(e){let t=e.trim().toLowerCase();return t.length===0?``:t.replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function P(e,t){let n=N(t);return`${e}:${n.length>0?n:`default`}`}var F=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`]),I=[`recordings`,`data`,`mnt`,`media`,`Volumes`];function L(e){let t=I.findIndex(t=>t===`recordings`?e.startsWith(t):e===t);return t===-1?I.length:t}function le(e){return e.filter(e=>!e.name.startsWith(`.`)&&!F.has(e.name)).toSorted((e,t)=>{let n=L(e.name)-L(t.name);return n===0?e.name.localeCompare(t.name):n}).map(e=>e.path)}function ue({nodeId:e,value:n,onChange:o}){let{t:c}=j(),l=y().trpcClient,[u,d]=r([]),[f,p]=r(n),[m,h]=r(null),[g,_]=r(null),[v,b]=r(``),x=i(async(t,n)=>{_(null);try{let r=await l.filesystemBrowse.browse.query({nodeId:e,path:t});h(r),p(r.path),n&&o(r.path)}catch(e){_(e instanceof Error?e.message:`browse failed`)}},[l,e,o]);t(()=>{p(n),(async()=>{let t=await l.filesystemBrowse.browse.query({nodeId:e,path:`/`}).then(e=>e).catch(()=>null);if(t){d(le(t.entries)),await x(n.startsWith(`/`)?n:`/`,!1);return}try{let t=await l.filesystemBrowse.listAllowedRoots.query({nodeId:e});d(t),await x(n&&t.some(e=>n.startsWith(e))?n:t[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`)}})()},[e]);let S=async()=>{if(!(!v.trim()||!m)){_(null);try{let t=`${m.path.replace(/\/+$/,``)}/${v.trim()}`;await l.filesystemBrowse.createDir.mutate({nodeId:e,path:t}),b(``),await x(m.path,!0)}catch(e){_(e instanceof Error?e.message:`create failed`)}}},C=e=>`${(e/1e9).toFixed(1)} GB`;return a(`div`,{className:`space-y-2 rounded border border-border p-2`,children:[s(`div`,{className:`flex flex-wrap gap-1`,children:u.map(e=>s(`button`,{onClick:()=>void x(e,!0),className:`rounded border border-border px-2 py-0.5 text-[10px] font-mono hover:border-primary/40`,children:e},e))}),s(`input`,{value:f,onChange:e=>{p(e.target.value),o(e.target.value)},placeholder:`/absolute/path`,className:`w-full rounded border border-border bg-background px-2 py-1 text-[11px] font-mono`}),m&&s(`div`,{className:`text-[10px] text-foreground-subtle`,children:c(`storage.pathBrowser.free`,{free:C(m.freeBytes),total:C(m.totalBytes)})}),s(`div`,{className:`max-h-40 space-y-0.5 overflow-y-auto`,children:m?.entries.map(e=>a(`button`,{onClick:()=>void x(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))}),a(`div`,{className:`flex gap-1`,children:[s(`input`,{value:v,onChange:e=>b(e.target.value),placeholder:c(`storage.pathBrowser.newFolder`,`new folder`),className:`flex-1 rounded border border-border bg-background px-2 py-1 text-xs`}),s(`button`,{onClick:()=>void S(),className:`rounded border border-border px-2 py-1 text-xs hover:border-primary/40`,children:c(`storage.pathBrowser.create`,`Create`)})]}),g&&s(`div`,{className:`text-[10px] text-red-400`,children:g})]})}e();function R({initialType:e,onClose:t,onCreated:i}){let{t:c}=j(),l=o(),u=y().trpcClient,[d,f]=r(`picker`),[p,m]=r(e),[g,_]=r(null),[b,x]=r({}),[S,C]=r(``),[T,E]=r(null),[D,O]=r(!1),[k,A]=r(`hub`),[M,N]=r(null),[F,I]=r(!1),L=e=>x(t=>({...t,basePath:e})),le=typeof b.basePath==`string`?b.basePath:``,R=oe(),z=n(()=>{let e=R.data;return Array.isArray(e)?e:[]},[R.data]),B=R.isLoading,V=ee({onSuccess:()=>{l.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),i()}}),H=n(()=>T!==null&&T.length>0?T:P(p,S),[p,S,T]),U=async()=>{if(g){I(!0),N(null);try{N(await(e=>u.storage.testConfig.query(e))({providerId:g.providerId,config:b}))}catch(e){N({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{I(!1)}}};return s(te,{open:!0,onOpenChange:e=>!e&&t(),children:a(ne,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(ae,{children:[s(ie,{children:{picker:`Add Location — Pick provider`,config:`Add Location — ${g?.displayName??``}`,naming:`Add Location — Name`}[d]}),a(`p`,{className:`text-xs text-foreground-subtle`,children:[c(`storage.addLocationWizard.type`,`Type:`),` `,s(`span`,{className:`font-mono`,children:p})]})]}),a(w,{children:[d===`picker`&&a(`div`,{className:`space-y-2`,children:[B&&s(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:c(`storage.addLocationWizard.loadingProviders`,`Loading providers…`)}),!B&&z.length===0&&s(`div`,{className:`rounded border border-border bg-background px-3 py-4 text-center text-xs text-foreground-subtle`,children:s(se,{i18nKey:`storage.addLocationWizard.noProvider`,values:{type:p},components:{code:s(`code`,{className:`font-mono`})}})}),z.map(e=>a(`button`,{onClick:()=>{_(e),f(`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:[a(`div`,{className:`flex-1 min-w-0`,children:[s(`p`,{className:`text-xs font-semibold text-foreground`,children:e.displayName}),s(`p`,{className:`text-[10px] text-foreground-subtle font-mono mt-0.5 truncate`,children:e.providerId})]}),s(h,{className:`h-4 w-4 text-foreground-subtle flex-shrink-0`})]},e.providerId))]}),d===`config`&&g&&a(`div`,{className:`space-y-3`,children:[s(ce,{schema:g.configSchema,values:b,onChange:x}),g.nodeLocal&&a(`div`,{className:`space-y-2`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:c(`storage.addLocationWizard.node`,`Node`)}),s(re,{selectedNodeId:k,onSelect:A,alwaysShow:!0}),s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:c(`storage.addLocationWizard.path`,`Path`)}),s(ue,{nodeId:k,value:le,onChange:L})]}),M&&s(`div`,{className:`rounded border px-3 py-2 text-[11px] ${M.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:M.ok?c(`storage.addLocationWizard.connectionOk`,`Connection OK.`):c(`storage.addLocationWizard.testFailed`,`Test failed: {{value1}}`,{value1:M.error??`unknown error`})}),a(`div`,{className:`flex items-center justify-between pt-1`,children:[s(`button`,{onClick:()=>f(`picker`),className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:c(`common.back`,`Back`)}),a(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{onClick:()=>{U()},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?c(`storage.addLocationWizard.testing`,`Testing…`):c(`storage.addLocationWizard.testConnection`,`Test connection`)}),s(`button`,{onClick:()=>f(`naming`),className:`rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:c(`common.next`,`Next`)})]})]})]}),d===`naming`&&g&&a(`div`,{className:`space-y-3`,children:[a(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:c(`storage.addLocationWizard.displayName`,`Display name`)}),s(`input`,{type:`text`,value:S,onChange:e=>C(e.target.value),placeholder:c(`storage.addLocationWizard.on`,`{{type}} on {{displayName}}`,{type:p,displayName:g.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`})]}),a(`div`,{className:`space-y-1`,children:[a(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:[c(`storage.addLocationWizard.idLabel`),` `,s(`span`,{className:`lowercase tracking-normal text-foreground-subtle`,children:c(`storage.addLocationWizard.autoDerivedOverrideIfNeeded`,`— auto-derived; override if needed`)})]}),s(`input`,{type:`text`,value:H,onChange:e=>E(e.target.value),placeholder:P(p,S),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`}),a(`p`,{className:`text-[10px] text-foreground-subtle`,children:[c(`storage.addLocationWizard.format`,`Format:`),` `,s(`code`,{className:`font-mono`,children:c(`storage.addLocationWizard.typeSlug`,`<type>:<slug>`)}),`. Lowercase letters, digits, and hyphens only.`]})]}),a(`label`,{className:`flex items-start gap-2 rounded border border-border bg-background px-3 py-2 cursor-pointer hover:bg-primary/5`,children:[s(`input`,{type:`checkbox`,checked:D,onChange:e=>O(e.target.checked),className:`accent-primary mt-0.5`}),a(`div`,{className:`space-y-0.5`,children:[s(`div`,{className:`text-xs font-medium text-foreground`,children:c(`storage.addLocationWizard.enableImmediately`,`Enable immediately`)}),s(`div`,{className:`text-[10px] text-foreground-subtle`,children:c(`storage.addLocationWizard.aDisabledLocationReceivesNo`,`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.`)})]})]}),V.isError&&s(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:V.error instanceof Error?V.error.message:String(V.error)}),a(`div`,{className:`flex items-center justify-between pt-1`,children:[s(`button`,{onClick:()=>f(`config`),className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:c(`common.back`,`Back`)}),a(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{onClick:()=>{m(e),_(null),x({}),C(``),E(null),O(!1),N(null),f(`picker`)},className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:c(`common.reset`,`Reset`)}),a(`button`,{onClick:()=>{g&&V.mutate({id:H,type:p,displayName:S.trim(),providerId:g.providerId,config:b,enabled:D,nodeId:g.nodeLocal?k:void 0})},disabled:V.isPending||S.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:[V.isPending?s(v,{className:`h-3.5 w-3.5 animate-spin`}):null,V.isPending?c(`storage.addLocationWizard.saving`,`Saving…`):c(`common.save`,`Save`)]})]})]})]})]})]})})}function z(e){return b(e)}function B(e){return e===`active`}var V=[{mode:`active`,get label(){return A.t(`helpers.locationMode.activeLabel`)},get consequence(){return A.t(`helpers.locationMode.activeConsequence`)},requiresConfirmation:!1},{mode:`readonly`,get label(){return A.t(`helpers.locationMode.readonlyLabel`)},get consequence(){return A.t(`helpers.locationMode.readonlyConsequence`)},requiresConfirmation:!1},{mode:`drain`,get label(){return A.t(`helpers.locationMode.drainLabel`)},get consequence(){return A.t(`helpers.locationMode.drainConsequence`)},requiresConfirmation:!1},{mode:`disabled`,get label(){return A.t(`helpers.locationMode.disabledLabel`)},get consequence(){return A.t(`helpers.locationMode.disabledConsequence`)},requiresConfirmation:!0}];function H(e){return V.find(t=>t.mode===e)??V[0]}function U(e){return H(e).requiresConfirmation}var de=`Blocked: this is the last location of its type still accepting writes — new data would have nowhere to go.`;function W(e,t,n){return B(n)||!B(z(e))||t.some(t=>t.id!==e.id&&B(z(t)))?{blocked:!1,reason:``}:{blocked:!0,reason:de}}function fe(e,t){return{active:W(e,t,`active`).reason,readonly:W(e,t,`readonly`).reason,drain:W(e,t,`drain`).reason,disabled:W(e,t,`disabled`).reason}}function pe(e,t,n){return!(n===`single`||t.length<=1||B(z(e))&&t.filter(e=>B(z(e))).length<=1)}function me(e){return e===`active`?{enabled:!0,readOnly:!1}:e===`readonly`?{enabled:!1,readOnly:!1}:{enabled:!1,readOnly:!0}}function he(e,t){let n={...t.config??e.config};t.mode!==void 0&&(me(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:me(t.mode).enabled}}var ge=1024**3;function G(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function _e(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 ve(e,t){return G(e[t===`gb`?`minFreeGb`:`minFreePercent`])}function ye(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 be(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 xe(e,t,n=10){if(e.unit===`gb`&&e.value!==null)return e.value*ge;let r=e.value??n;return t===null||t<=0?null:t*Math.min(100,Math.max(0,r))/100}function Se(e){return e===`gb`?A.t(`helpers.locationProtection.unitGb`):A.t(`helpers.locationProtection.unitPercent`)}function Ce(e,t=10){let n=e.value===null?A.t(`helpers.locationProtection.targetDefault`,{percent:String(t)}):e.unit===`gb`?A.t(`helpers.locationProtection.targetGb`,{value:String(e.value)}):A.t(`helpers.locationProtection.targetPercent`,{value:String(e.value)});return A.t(`helpers.locationProtection.helpText`,{target:n,percent:String(t)})}function we(e){return G(e.maxUsedGb)}function Te(e,t){let n=G(e.maxUsedGb);return n===null||n<0?null:{bytes:n*ge,reason:t===`drain`?`drain`:`legacy`}}e();function Ee({config:e,defaultPercent:t=10,onChange:n}){let{t:i}=j(),[o,c]=r(()=>_e(e).unit),l=ve(e,o),u={unit:o,value:l},d=we(e),f=t=>{c(t),n(ye(e,{unit:t,value:null}))},p=t=>{n(ye(e,{unit:o,value:be(t,o)}))};return a(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:i(`storage.protectionPolicyField.protectedFreeSpace`,`Protected free space`)}),a(`div`,{className:`flex items-center gap-2`,children:[a(`select`,{"aria-label":i(`storage.protectionPolicyField.protectionUnit`,`Protection unit`),value:o,onChange:e=>{f(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:[s(`option`,{value:`percent`,children:i(`storage.protectionPolicyField.ofTheVolume`,`% of the volume`)}),s(`option`,{value:`gb`,children:i(`storage.protectionPolicyField.gbOfFreeSpace`,`GB of free space`)})]}),s(`input`,{type:`number`,"aria-label":Se(o),min:0,max:o===`percent`?100:void 0,value:l===null?``:l,placeholder:o===`percent`?String(t):i(`common.defaultWord`),onChange:e=>{p(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`})]}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:Ce(u,t)}),d!==null&&s(`p`,{className:`text-[10px] text-foreground-subtle italic`,children:i(`storage.protectionPolicyField.legacyMax`,{gb:d})})]})}e();function De({location:e,onClose:t,onSaved:i}){let{t:c}=j(),l=o(),u=y().trpcClient,[d,f]=r({...e.config}),[p,m]=r(e.displayName),[h,g]=r(null),[_,b]=r(!1),x=oe(),S=n(()=>{let t=x.data;return Array.isArray(t)?t.find(t=>t.providerId===e.providerId)??null:null},[x.data,e.providerId]),C=ee({onSuccess:()=>{l.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),i()}}),T=S?.shouldSaveDiskSpace===!0,E=S?.nodeLocal===!0,[O,A]=r(typeof e.nodeId==`string`?e.nodeId:`hub`),M=typeof d.basePath==`string`?d.basePath:``,N=e=>f(t=>({...t,basePath:e})),P=S?.minFreePercent??10,F=async()=>{b(!0),g(null);try{g(await(e=>u.storage.testConfig.query(e))({providerId:e.providerId,locationId:e.id,config:d}))}catch(e){g({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{b(!1)}};return s(te,{open:!0,onOpenChange:e=>!e&&t(),children:a(ne,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(ae,{children:[s(ie,{children:c(`storage.editLocationModal.title`,{name:e.displayName})}),a(`p`,{className:`text-xs text-foreground-subtle`,children:[s(`span`,{className:`font-mono`,children:e.id}),` ·`,` `,S?.displayName??e.providerId]})]}),a(w,{className:`space-y-3`,children:[a(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:c(`storage.editLocationModal.displayName`,`Display name`)}),s(`input`,{type:`text`,value:p,onChange:e=>m(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`})]}),S&&s(ce,{schema:S.configSchema,values:d,onChange:f}),E&&a(`div`,{className:`space-y-2`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:c(`storage.editLocationModal.node`,`Node`)}),s(re,{selectedNodeId:O,onSelect:A,alwaysShow:!0}),s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:c(`storage.editLocationModal.path`,`Path`)}),s(ue,{nodeId:O,value:M,onChange:N})]}),T&&s(Ee,{config:d,defaultPercent:P,onChange:f}),!S&&!x.isLoading&&s(`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:s(se,{i18nKey:`storage.editLocationModal.providerGone`,values:{id:e.providerId},components:{code:s(`code`,{className:`font-mono`})}})}),h&&s(`div`,{className:`rounded border px-3 py-2 text-[11px] ${h.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:h.ok?c(`storage.editLocationModal.connectionOk`,`Connection OK.`):c(`storage.editLocationModal.testFailed`,`Test failed: {{value1}}`,{value1:h.error??`unknown error`})}),C.isError&&s(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:C.error instanceof Error?C.error.message:String(C.error)})]}),a(k,{className:`justify-between`,children:[s(D,{variant:`outline`,size:`sm`,onClick:t,children:c(`common.cancel`,`Cancel`)}),a(`div`,{className:`flex items-center gap-2`,children:[s(D,{variant:`outline`,size:`sm`,onClick:()=>{F()},disabled:_||!S,children:_?c(`storage.editLocationModal.testing`,`Testing…`):c(`storage.editLocationModal.testConnection`,`Test connection`)}),a(D,{size:`sm`,onClick:()=>{C.mutate(he(e,{displayName:p.trim(),config:d,nodeId:E?O:e.nodeId}))},disabled:C.isPending||p.trim().length===0,children:[C.isPending?s(v,{className:`h-3.5 w-3.5 animate-spin`}):null,C.isPending?c(`storage.editLocationModal.saving`,`Saving…`):c(`common.save`,`Save`)]})]})]})]})})}function Oe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function ke(e){if(!Oe(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 Ae(e){let t=new Map;if(!Array.isArray(e))return t;for(let n of e){let e=ke(n);e!==null&&t.set(e.locationId,e)}return t}function je(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 Me(e,t){return e?t===void 0?{kind:`unreported`}:t.drained||t.bytesRemaining<=0?{kind:`drained`}:{kind:`draining`,bytesRemaining:t.bytesRemaining,drainedFraction:je(t),estimatedEmptyAtMs:t.estimatedEmptyAtMs}:{kind:`idle`}}function Ne(e){return e.mode===`drain`?!0:e.config.readOnly===!0}function Pe(e){return`${(e/1024**3).toFixed(e>=100*1024**3?0:1)} GB`}function Fe(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function Ie({drain:e}){let{t}=j();if(e.kind===`idle`)return null;if(e.kind===`unreported`)return s(`span`,{"data-testid":`drain-unreported`,className:`text-[10px] text-foreground-subtle`,title:t(`storage.drainProgressLine.thisLocationIsDrainingThe`,`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:t(`storage.drainProgressLine.drainingRemainingNotReportedYet`,`Draining · remaining not reported yet`)});if(e.kind===`drained`)return s(`span`,{"data-testid":`drain-done`,className:`text-[10px] text-success`,title:t(`storage.drainProgressLine.everythingThatWasHereHas`,`Everything that was here has been moved. The location is still in drain mode — it receives no new writes until you change that.`),children:t(`storage.drainProgressLine.drainedNothingLeftToMove`,`Drained · nothing left to move`)});let n=e.drainedFraction===null?null:Math.round(e.drainedFraction*100);return a(`span`,{"data-testid":`drain-progress`,className:`flex items-center gap-1.5 text-[10px] text-foreground-subtle tabular-nums`,children:[n!==null&&s(`span`,{"data-testid":`drain-bar`,className:`inline-block h-1 w-10 rounded-full bg-border overflow-hidden`,role:`progressbar`,"aria-label":t(`storage.drainProgressLine.drainProgress`,`Drain progress`),"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,children:s(`span`,{className:`block h-full bg-warning`,style:{width:`${n}%`}})}),a(`span`,{children:[t(`storage.drainProgressLine.left`,{size:Pe(e.bytesRemaining)}),n!==null&&` · ${t(`storage.drainProgressLine.moved`,{percent:n})}`]}),e.estimatedEmptyAtMs===null?s(`span`,{"data-testid":`drain-eta-absent`,title:t(`storage.drainProgressLine.theDrainIsPacedBy`,`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:t(`storage.drainProgressLine.emptyTimeNotKnownYet`,`· empty time not known yet`)}):a(`span`,{"data-testid":`drain-eta`,children:[`·`,` `,t(`storage.drainProgressLine.empty`,{when:Fe(e.estimatedEmptyAtMs)})]})]})}var Le=[`ok`,`warn`,`critical`];function Re(e){return e>=.95?`critical`:e>=.85?`warn`:`ok`}function ze(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=ze((n-t)/n);return{fraction:r,severity:Re(r),recordingsFraction:ze(e.usedBytes/n),freeBytes:t,totalBytes:n}}function Be(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||Le.indexOf(e.severity)>Le.indexOf(a))&&(a=e.severity)}return{knownVolumes:t,unknownVolumes:n,totalBytes:r,freeBytes:i,severity:a}}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 Ve(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:M(n.ownedBytes);return{kind:`unknown`,owned:e,summary:e===null?A.t(`helpers.locationCapacityBar.unknownSummary`):A.t(`helpers.locationCapacityBar.unknownSummaryOwned`,{size:e})}}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?Re(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:M(r),freeTotal:M(a),freeTotalPercent:X(a/r),used:M(p),usedPercent:X(p/r),free:M(u),freePercent:X(u/r),reserve:s===0?null:A.t(`helpers.locationCapacityBar.reserveKept`,{size:M(s)}),owned:f===null||_===null?null:A.t(`helpers.locationCapacityBar.ownedOfRecordings`,{size:M(f),percent:X(_)}),cap:v===null?null:v.reason===`drain`?A.t(`helpers.locationCapacityBar.capDrain`,{size:M(v.bytes)}):A.t(`helpers.locationCapacityBar.capCap`,{size:M(v.bytes)})},S=[A.t(`helpers.locationCapacityBar.summaryFree`,{free:x.freeTotal,total:x.total,percent:x.freeTotalPercent}),x.owned===null?null:A.t(`helpers.locationCapacityBar.summaryOwned`,{owned:x.owned}),x.reserve===null?null:l?A.t(`helpers.locationCapacityBar.summaryReserveShort`,{reserve:x.reserve}):x.reserve,x.cap===null?null:b?A.t(`helpers.locationCapacityBar.summaryCapBelow`,{cap:x.cap}):x.cap].filter(e=>e!==null).join(` · `),C=[];return c>0&&C.push({segment:`reserve`,label:A.t(`helpers.locationCapacityBar.legendKeptFree`),value:M(s),alarming:l}),x.owned!==null&&C.push({segment:`owned`,label:A.t(`helpers.locationCapacityBar.legendCamstack`),value:x.owned,alarming:!1}),C.push({segment:`used`,label:f===null?A.t(`helpers.locationCapacityBar.legendUsed`):A.t(`helpers.locationCapacityBar.legendOtherData`),value:`${x.used} (${x.usedPercent})`,alarming:g===`critical`}),C.push({segment:`free`,label:A.t(`helpers.locationCapacityBar.legendFree`),value:`${x.free} (${x.freePercent})`,alarming:l}),v!==null&&C.push({segment:`cap`,label:v.reason===`drain`?A.t(`helpers.locationCapacityBar.legendDrainTarget`):A.t(`helpers.locationCapacityBar.legendCap`),value:A.t(`helpers.locationCapacityBar.legendCapValue`,{size:M(v.bytes)}),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 He={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 Ue(e,t){return e===`used`?He[t]:Z[e]}function We({location:e,ownedBytes:t}){let{t:n}=j(),r=e.capacity??null,i=xe(_e(e.config),r?.totalBytes??null),o=Ve({totalBytes:r?.totalBytes??null,availableBytes:r?.availableBytes??null},i,{ownedBytes:t??null,cap:Te(e.config,z(e))});return o.kind===`unknown`?s(`div`,{className:`text-[10px] text-foreground-subtle italic`,title:o.summary,children:o.owned===null?n(`storage.locationCapacityBar.capacityUnknown`,`Capacity unknown`):n(`storage.locationCapacityBar.capacityUnknownCamstackHolds`,`Capacity unknown · CamStack holds {{owned}}`,{owned:o.owned})}):a(`div`,{className:`mt-1 space-y-1`,title:o.summary,children:[a(`div`,{className:`relative flex h-2 w-full max-w-md overflow-hidden rounded-full bg-border`,children:[o.segments.reservePercent>0&&s(`div`,{className:Z.reserve,style:{width:`${String(o.segments.reservePercent)}%`}}),o.segments.ownedPercent!==null&&s(`div`,{className:Z.owned,style:{width:`${String(o.segments.ownedPercent)}%`}}),s(`div`,{className:He[o.severity],style:{width:`${String(o.segments.usedPercent)}%`}}),s(`div`,{className:Z.free,style:{width:`${String(o.segments.freePercent)}%`}}),o.segments.capPercent!==null&&s(`div`,{className:`absolute inset-y-0 w-px ${o.capBelowOwned?`bg-danger`:Z.cap}`,style:{left:`${String(o.segments.capPercent)}%`}})]}),s(`ul`,{className:`flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:o.legend.map(e=>a(`li`,{className:`flex items-center gap-1`,children:[s(`span`,{"aria-hidden":`true`,className:`inline-block h-2 w-2 shrink-0 rounded-sm ${Ue(e.segment,o.severity)}`}),a(`span`,{className:`text-[10px] tabular-nums ${e.alarming?`text-danger`:`text-foreground-subtle`}`,children:[e.label,` `,e.value]})]},e.segment))})]})}var Ge={eventMedia:[`events`],recordingsLow:[`low`],recordings:[`high`,`mid`]},Ke={eventMedia:`pipeline-analytics`,recordingsLow:`recorder`,recordings:`recorder`},qe=`storage.discardLocation`,Je=`storage.discardLocationStatus`,Ye=`storage.discardLocationCancel`;function Xe(e){return Ge[e]??null}function Ze(e){return Ke[e]??null}function Qe(e){return!B(z(e))}function $e(e,t){return Xe(e.type)===null||!Qe(e)?!1:t.some(t=>t.id!==e.id&&B(z(t)))}var et=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 tt(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`||!et.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 nt(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}e();var rt=2e3;function it({location:e,siblings:t}){return $e(e,t)?s(at,{location:e}):null}function at({location:e}){let{t:n}=j(),i=T(),o=E(),c=Ze(e.type),[l,u]=r(null),[d,f]=r(null),[p,m]=r(!1);if(t(()=>{if(c===null)return;let e=!1,t=async()=>{try{let t=await o.mutateAsync({addonId:c,action:Je,input:{}});if(e)return;u(tt(t))}catch{}};t();let n=setInterval(()=>void t(),rt);return()=>{e=!0,clearInterval(n)}},[c,e.id]),c===null)return null;let h=l!==null&&l.locationId===e.id,_=h&&l.running,y=h&&l.phase!==`idle`,b=async()=>{if(await i({title:n(`storage.locationDiscardControl.discardLeftoversOn`,`Discard leftovers on "{{displayName}}"?`,{displayName:e.displayName}),message:n(`storage.locationDiscardControl.permanentlyDeletesLeftoverFilesAnd`,`Permanently deletes leftover files and records on this location. Other locations are not affected. This cannot be undone and may take hours.`),confirmLabel:n(`storage.locationDiscardControl.discardLeftovers`,`Discard leftovers`),variant:`danger`})){f(null),m(!0);try{await o.mutateAsync({addonId:c,action:qe,input:{locationId:e.id}}),u(tt(await o.mutateAsync({addonId:c,action:Je,input:{}})))}catch(e){f(e instanceof Error?e.message:String(e))}finally{m(!1)}}},x=async()=>{try{await o.mutateAsync({addonId:c,action:Ye,input:{}})}catch(e){f(e instanceof Error?e.message:String(e))}};return a(`div`,{className:`flex flex-col gap-1 min-w-[9rem] max-w-[16rem]`,children:[_?a(`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:[s(g,{className:`h-3 w-3`}),n(`common.cancel`,`Cancel`)]}):a(`button`,{type:`button`,onClick:()=>void b(),disabled:p,title:n(`storage.locationDiscardControl.permanentlyDeleteLeftoverFilesOn`,`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:[p?s(v,{className:`h-3 w-3 animate-spin`}):s(S,{className:`h-3 w-3`}),n(`storage.locationDiscardControl.discardLeftovers`,`Discard leftovers`)]}),y&&l!==null&&a(`div`,{className:`space-y-0.5`,children:[s(`div`,{className:`h-1 rounded bg-border overflow-hidden`,children:s(`div`,{className:`h-full bg-primary transition-[width] duration-300`,style:{width:`${nt(l)}%`}})}),a(`p`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[l.phase,l.camerasTotal>0?` · ${n(`storage.locationDiscardControl.camsProgress`,{done:l.camerasDone,total:l.camerasTotal})}`:``,l.dbRowsDeleted>0?` · ${n(`storage.locationDiscardControl.rowsDeleted`,{count:l.dbRowsDeleted})}`:``,l.detail?` · ${l.detail}`:``]})]}),(d||h&&l?.error)&&s(`p`,{className:`text-[10px] text-danger leading-tight`,children:d??l?.error})]})}e();var ot={active:u,readonly:x,drain:C,disabled:c},st={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 ct({mode:e,open:t,onToggle:n}){let{t:r}=j(),i=H(e),o=ot[e];return a(`button`,{type:`button`,"aria-expanded":t,"aria-label":r(`storage.locationModeSelector.locationState`,`Location state`),onClick:n,title:i.consequence,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium border ${st[e]}`,children:[s(o,{className:`h-3 w-3`}),i.label,s(p,{className:`h-3 w-3 ${t?`rotate-180`:``}`})]})}function lt({mode:e,blockedReasons:n,onSelect:r,onDismiss:i}){let{t:o}=j();return t(()=>{let e=e=>{e.key===`Escape`&&i()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[i]),a(`div`,{className:`w-full basis-full rounded-lg border border-border bg-background p-1`,role:`group`,"aria-label":o(`storage.locationModeSelector.locationStateChoices`,`Location state choices`),children:[a(`div`,{className:`flex items-center justify-between px-2 py-1`,children:[s(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:o(`storage.locationModeSelector.locationState`,`Location state`)}),s(`button`,{type:`button`,"aria-label":o(`storage.locationModeSelector.closeLocationStateChoices`,`Close location state choices`),onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:s(g,{className:`h-3 w-3`})})]}),V.map(t=>{let c=n[t.mode],l=c!==``,u=ot[t.mode],d=t.mode===e;return a(`button`,{type:`button`,role:`radio`,"aria-checked":d,"aria-label":t.label,disabled:l,onClick:()=>{l||(i(),d||r(t.mode))},className:`flex w-full flex-col items-start gap-0.5 rounded px-2 py-1.5 text-left ${l?`cursor-not-allowed opacity-60`:d?`bg-primary/10`:`hover:bg-primary/5`}`,children:[a(`span`,{className:`flex items-center gap-1.5 text-[11px] font-medium text-foreground`,children:[s(u,{className:`h-3 w-3`}),t.label,d&&s(`span`,{className:`text-[9px] uppercase text-primary`,children:o(`common.current`)})]}),s(`span`,{className:`text-[10px] leading-snug text-foreground-subtle`,children:t.consequence}),l&&s(`span`,{className:`text-[10px] leading-snug text-warning`,children:c})]},t.mode)})]})}e();function ut(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 dt({location:e,onEdit:t,onDelete:n,onSetMode:i,blockedReasons:o,canDelete:c,siblings:l=[],drain:u,ownedBytes:p}){let{t:m}=j(),[h,g]=r(!1),_=ut(e.config),v=z(e);return a(`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:[a(`div`,{className:`flex items-start gap-2 min-w-0 flex-1 basis-72`,children:[s(`div`,{className:`shrink-0 sm:w-32`,"data-testid":`location-badge-slot`,children:s(`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})}),a(`div`,{className:`min-w-0 flex-1`,children:[s(`div`,{className:`text-xs font-medium text-foreground truncate`,children:e.displayName}),_&&s(`div`,{className:`text-[10px] text-foreground-subtle truncate font-mono`,children:_}),s(We,{location:e,ownedBytes:p??null}),u!==void 0&&s(Ie,{drain:u})]})]}),a(`div`,{className:`flex flex-wrap items-center gap-1 shrink-0`,children:[s(it,{location:e,siblings:l}),s(ct,{mode:v,open:h,onToggle:()=>{g(e=>!e)}}),a(`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:[s(d,{className:`h-3 w-3`}),m(`common.edit`,`Edit`)]}),c&&s(`button`,{onClick:()=>n(e),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,title:m(`storage.locationCard.deleteLocation`,`Delete location`),children:s(f,{className:`h-3 w-3`})})]}),h&&s(lt,{mode:v,blockedReasons:o,onSelect:t=>i(e,t),onDismiss:()=>{g(!1)}})]})}e();function ft({type:e,displayName:t,description:r,cardinality:i,locations:o,onAdd:c,onEdit:u,onDelete:d,onSetMode:f,ownedBytesById:p,drainById:h}){let{t:g}=j(),v=n(()=>{let e=[...o];return e.sort((e,t)=>{let n=B(z(e));return n===B(z(t))?e.displayName.localeCompare(t.displayName):n?-1:1}),e},[o]);return a(O,{headingId:`storage-location-${e}`,title:t,icon:m,testId:`storage-location-group-${e}`,actions:i===`multi`?a(D,{size:`sm`,type:`button`,onClick:()=>c(e),children:[s(_,{className:`h-3 w-3`}),g(`common.add`,`Add`)]}):void 0,children:[a(`div`,{className:`${l} space-y-2`,children:[a(`div`,{className:`space-y-0.5`,children:[s(`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}),r!==void 0&&r!==``&&s(`p`,{className:`text-[11px] leading-relaxed text-foreground-subtle`,children:r}),i===`single`&&s(`p`,{className:`text-[10px] text-foreground-subtle italic`,children:g(`storage.locationGroup.singleOneLocationPerType`,`Single — one location per type. Edit the existing entry; it can't be split.`)})]}),v.length===0&&s(`div`,{className:`py-2 text-center text-[11px] text-foreground-subtle italic`,children:i===`multi`?g(`storage.locationGroup.noLocationRegisteredClickAdd`,`No location registered. Click "Add" to register one.`):g(`storage.locationGroup.noLocationRegisteredYetShould`,`No location registered yet — should be auto-seeded at next boot.`)})]}),v.length>0&&s(`div`,{className:`border-t border-border`,children:v.map(e=>s(dt,{location:e,cardinality:i,canDelete:pe(e,v,i),onEdit:u,onDelete:d,onSetMode:f,blockedReasons:fe(e,v),ownedBytes:p?.get(e.id)??null,drain:Me(Ne(e),h?.get(e.id)),siblings:v},e.id))})]})}var pt=[`recordings`,`recordingsLow`];function mt(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function ht(e,t){if(t===void 0||!pt.includes(e.type))return null;let n=t.find(t=>mt(t).includes(e.id));return n===void 0||!Number.isFinite(n.usedBytes)||n.usedBytes<0?null:n.usedBytes}function gt(e,t){let n=new Map;for(let r of e){let e=ht(r,t);e!==null&&n.set(r.id,e)}return n}export{Ae as a,H as c,Be as i,U as l,ft as n,De as o,q as r,he as s,gt as t,R as u};
|
|
1
|
+
import{$ as e,B as t,G as n,J as r,L as i,S as a,o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{Br as c,D as l,En as u,Fn as d,It as f,Si as p,Sr as m,bi as h,dt as g,kn as _,or as v,ot as y}from"./player-overlays-DxE-ZGs_.js";import{Ti as b}from"./client-Dv9yZvWI.js";import{t as x}from"./archive-gt6xpkGA.js";import{t as S}from"./eraser-CYGvrt-o.js";import{t as C}from"./hard-drive-download-RpoYwcJW.js";import{$n as ee,$r as w,Ar as T,Ll as te,Qn as ne,Tl as re,er as ie,hr as E,ht as D,ir as ae,mn as O,nr as k,rr as oe}from"./src-BXyxUvfL.js";import{t as A}from"./i18n-DBncQ6jl.js";import{t as j}from"./useTranslation-D3Is_4B6.js";import{Z as se,z as ce}from"./index-CXOYQeji.js";import{t as M}from"./format-size-DIxKXxtj.js";e();function N(e){let t=e.trim().toLowerCase();return t.length===0?``:t.replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function P(e,t){let n=N(t);return`${e}:${n.length>0?n:`default`}`}var F=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`]),I=[`recordings`,`data`,`mnt`,`media`,`Volumes`];function L(e){let t=I.findIndex(t=>t===`recordings`?e.startsWith(t):e===t);return t===-1?I.length:t}function le(e){return e.filter(e=>!e.name.startsWith(`.`)&&!F.has(e.name)).toSorted((e,t)=>{let n=L(e.name)-L(t.name);return n===0?e.name.localeCompare(t.name):n}).map(e=>e.path)}function ue({nodeId:e,value:n,onChange:o}){let{t:c}=j(),l=y().trpcClient,[u,d]=r([]),[f,p]=r(n),[m,h]=r(null),[g,_]=r(null),[v,b]=r(``),x=i(async(t,n)=>{_(null);try{let r=await l.filesystemBrowse.browse.query({nodeId:e,path:t});h(r),p(r.path),n&&o(r.path)}catch(e){_(e instanceof Error?e.message:`browse failed`)}},[l,e,o]);t(()=>{p(n),(async()=>{let t=await l.filesystemBrowse.browse.query({nodeId:e,path:`/`}).then(e=>e).catch(()=>null);if(t){d(le(t.entries)),await x(n.startsWith(`/`)?n:`/`,!1);return}try{let t=await l.filesystemBrowse.listAllowedRoots.query({nodeId:e});d(t),await x(n&&t.some(e=>n.startsWith(e))?n:t[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`)}})()},[e]);let S=async()=>{if(!(!v.trim()||!m)){_(null);try{let t=`${m.path.replace(/\/+$/,``)}/${v.trim()}`;await l.filesystemBrowse.createDir.mutate({nodeId:e,path:t}),b(``),await x(m.path,!0)}catch(e){_(e instanceof Error?e.message:`create failed`)}}},C=e=>`${(e/1e9).toFixed(1)} GB`;return a(`div`,{className:`space-y-2 rounded border border-border p-2`,children:[s(`div`,{className:`flex flex-wrap gap-1`,children:u.map(e=>s(`button`,{onClick:()=>void x(e,!0),className:`rounded border border-border px-2 py-0.5 text-[10px] font-mono hover:border-primary/40`,children:e},e))}),s(`input`,{value:f,onChange:e=>{p(e.target.value),o(e.target.value)},placeholder:`/absolute/path`,className:`w-full rounded border border-border bg-background px-2 py-1 text-[11px] font-mono`}),m&&s(`div`,{className:`text-[10px] text-foreground-subtle`,children:c(`storage.pathBrowser.free`,{free:C(m.freeBytes),total:C(m.totalBytes)})}),s(`div`,{className:`max-h-40 space-y-0.5 overflow-y-auto`,children:m?.entries.map(e=>a(`button`,{onClick:()=>void x(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))}),a(`div`,{className:`flex gap-1`,children:[s(`input`,{value:v,onChange:e=>b(e.target.value),placeholder:c(`storage.pathBrowser.newFolder`,`new folder`),className:`flex-1 rounded border border-border bg-background px-2 py-1 text-xs`}),s(`button`,{onClick:()=>void S(),className:`rounded border border-border px-2 py-1 text-xs hover:border-primary/40`,children:c(`storage.pathBrowser.create`,`Create`)})]}),g&&s(`div`,{className:`text-[10px] text-red-400`,children:g})]})}e();function R({initialType:e,onClose:t,onCreated:i}){let{t:c}=j(),l=o(),u=y().trpcClient,[d,f]=r(`picker`),[p,m]=r(e),[g,_]=r(null),[b,x]=r({}),[S,C]=r(``),[w,T]=r(null),[E,O]=r(!1),[k,A]=r(`hub`),[M,N]=r(null),[F,I]=r(!1),L=e=>x(t=>({...t,basePath:e})),le=typeof b.basePath==`string`?b.basePath:``,R=re(),z=n(()=>{let e=R.data;return Array.isArray(e)?e:[]},[R.data]),B=R.isLoading,V=te({onSuccess:()=>{l.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),i()}}),H=n(()=>w!==null&&w.length>0?w:P(p,S),[p,S,w]),U=async()=>{if(g){I(!0),N(null);try{N(await(e=>u.storage.testConfig.query(e))({providerId:g.providerId,config:b}))}catch(e){N({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{I(!1)}}};return s(ne,{open:!0,onOpenChange:e=>!e&&t(),children:a(ie,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(oe,{children:[s(ae,{children:{picker:`Add Location — Pick provider`,config:`Add Location — ${g?.displayName??``}`,naming:`Add Location — Name`}[d]}),a(`p`,{className:`text-xs text-foreground-subtle`,children:[c(`storage.addLocationWizard.type`,`Type:`),` `,s(`span`,{className:`font-mono`,children:p})]})]}),a(ee,{children:[d===`picker`&&a(`div`,{className:`space-y-2`,children:[B&&s(`div`,{className:`text-xs text-foreground-subtle animate-pulse`,children:c(`storage.addLocationWizard.loadingProviders`,`Loading providers…`)}),!B&&z.length===0&&s(`div`,{className:`rounded border border-border bg-background px-3 py-4 text-center text-xs text-foreground-subtle`,children:s(se,{i18nKey:`storage.addLocationWizard.noProvider`,values:{type:p},components:{code:s(`code`,{className:`font-mono`})}})}),z.map(e=>a(`button`,{onClick:()=>{_(e),f(`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:[a(`div`,{className:`flex-1 min-w-0`,children:[s(`p`,{className:`text-xs font-semibold text-foreground`,children:e.displayName}),s(`p`,{className:`text-[10px] text-foreground-subtle font-mono mt-0.5 truncate`,children:e.providerId})]}),s(h,{className:`h-4 w-4 text-foreground-subtle flex-shrink-0`})]},e.providerId))]}),d===`config`&&g&&a(`div`,{className:`space-y-3`,children:[s(ce,{schema:g.configSchema,values:b,onChange:x}),g.nodeLocal&&a(`div`,{className:`space-y-2`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:c(`storage.addLocationWizard.node`,`Node`)}),s(D,{selectedNodeId:k,onSelect:A,alwaysShow:!0}),s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:c(`storage.addLocationWizard.path`,`Path`)}),s(ue,{nodeId:k,value:le,onChange:L})]}),M&&s(`div`,{className:`rounded border px-3 py-2 text-[11px] ${M.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:M.ok?c(`storage.addLocationWizard.connectionOk`,`Connection OK.`):c(`storage.addLocationWizard.testFailed`,`Test failed: {{value1}}`,{value1:M.error??`unknown error`})}),a(`div`,{className:`flex items-center justify-between pt-1`,children:[s(`button`,{onClick:()=>f(`picker`),className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:c(`common.back`,`Back`)}),a(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{onClick:()=>{U()},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?c(`storage.addLocationWizard.testing`,`Testing…`):c(`storage.addLocationWizard.testConnection`,`Test connection`)}),s(`button`,{onClick:()=>f(`naming`),className:`rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:c(`common.next`,`Next`)})]})]})]}),d===`naming`&&g&&a(`div`,{className:`space-y-3`,children:[a(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:c(`storage.addLocationWizard.displayName`,`Display name`)}),s(`input`,{type:`text`,value:S,onChange:e=>C(e.target.value),placeholder:c(`storage.addLocationWizard.on`,`{{type}} on {{displayName}}`,{type:p,displayName:g.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`})]}),a(`div`,{className:`space-y-1`,children:[a(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:[c(`storage.addLocationWizard.idLabel`),` `,s(`span`,{className:`lowercase tracking-normal text-foreground-subtle`,children:c(`storage.addLocationWizard.autoDerivedOverrideIfNeeded`,`— auto-derived; override if needed`)})]}),s(`input`,{type:`text`,value:H,onChange:e=>T(e.target.value),placeholder:P(p,S),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`}),a(`p`,{className:`text-[10px] text-foreground-subtle`,children:[c(`storage.addLocationWizard.format`,`Format:`),` `,s(`code`,{className:`font-mono`,children:c(`storage.addLocationWizard.typeSlug`,`<type>:<slug>`)}),`. Lowercase letters, digits, and hyphens only.`]})]}),a(`label`,{className:`flex items-start gap-2 rounded border border-border bg-background px-3 py-2 cursor-pointer hover:bg-primary/5`,children:[s(`input`,{type:`checkbox`,checked:E,onChange:e=>O(e.target.checked),className:`accent-primary mt-0.5`}),a(`div`,{className:`space-y-0.5`,children:[s(`div`,{className:`text-xs font-medium text-foreground`,children:c(`storage.addLocationWizard.enableImmediately`,`Enable immediately`)}),s(`div`,{className:`text-[10px] text-foreground-subtle`,children:c(`storage.addLocationWizard.aDisabledLocationReceivesNo`,`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.`)})]})]}),V.isError&&s(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:V.error instanceof Error?V.error.message:String(V.error)}),a(`div`,{className:`flex items-center justify-between pt-1`,children:[s(`button`,{onClick:()=>f(`config`),className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:c(`common.back`,`Back`)}),a(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{onClick:()=>{m(e),_(null),x({}),C(``),T(null),O(!1),N(null),f(`picker`)},className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:c(`common.reset`,`Reset`)}),a(`button`,{onClick:()=>{g&&V.mutate({id:H,type:p,displayName:S.trim(),providerId:g.providerId,config:b,enabled:E,nodeId:g.nodeLocal?k:void 0})},disabled:V.isPending||S.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:[V.isPending?s(v,{className:`h-3.5 w-3.5 animate-spin`}):null,V.isPending?c(`storage.addLocationWizard.saving`,`Saving…`):c(`common.save`,`Save`)]})]})]})]})]})]})})}function z(e){return b(e)}function B(e){return e===`active`}var V=[{mode:`active`,get label(){return A.t(`helpers.locationMode.activeLabel`)},get consequence(){return A.t(`helpers.locationMode.activeConsequence`)},requiresConfirmation:!1},{mode:`readonly`,get label(){return A.t(`helpers.locationMode.readonlyLabel`)},get consequence(){return A.t(`helpers.locationMode.readonlyConsequence`)},requiresConfirmation:!1},{mode:`drain`,get label(){return A.t(`helpers.locationMode.drainLabel`)},get consequence(){return A.t(`helpers.locationMode.drainConsequence`)},requiresConfirmation:!1},{mode:`disabled`,get label(){return A.t(`helpers.locationMode.disabledLabel`)},get consequence(){return A.t(`helpers.locationMode.disabledConsequence`)},requiresConfirmation:!0}];function H(e){return V.find(t=>t.mode===e)??V[0]}function U(e){return H(e).requiresConfirmation}var de=`Blocked: this is the last location of its type still accepting writes — new data would have nowhere to go.`;function W(e,t,n){return B(n)||!B(z(e))||t.some(t=>t.id!==e.id&&B(z(t)))?{blocked:!1,reason:``}:{blocked:!0,reason:de}}function fe(e,t){return{active:W(e,t,`active`).reason,readonly:W(e,t,`readonly`).reason,drain:W(e,t,`drain`).reason,disabled:W(e,t,`disabled`).reason}}function pe(e,t,n){return!(n===`single`||t.length<=1||B(z(e))&&t.filter(e=>B(z(e))).length<=1)}function me(e){return e===`active`?{enabled:!0,readOnly:!1}:e===`readonly`?{enabled:!1,readOnly:!1}:{enabled:!1,readOnly:!0}}function he(e,t){let n={...t.config??e.config};t.mode!==void 0&&(me(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:me(t.mode).enabled}}var ge=1024**3;function G(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function _e(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 ve(e,t){return G(e[t===`gb`?`minFreeGb`:`minFreePercent`])}function ye(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 be(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 xe(e,t,n=10){if(e.unit===`gb`&&e.value!==null)return e.value*ge;let r=e.value??n;return t===null||t<=0?null:t*Math.min(100,Math.max(0,r))/100}function Se(e){return e===`gb`?A.t(`helpers.locationProtection.unitGb`):A.t(`helpers.locationProtection.unitPercent`)}function Ce(e,t=10){let n=e.value===null?A.t(`helpers.locationProtection.targetDefault`,{percent:String(t)}):e.unit===`gb`?A.t(`helpers.locationProtection.targetGb`,{value:String(e.value)}):A.t(`helpers.locationProtection.targetPercent`,{value:String(e.value)});return A.t(`helpers.locationProtection.helpText`,{target:n,percent:String(t)})}function we(e){return G(e.maxUsedGb)}function Te(e,t){let n=G(e.maxUsedGb);return n===null||n<0?null:{bytes:n*ge,reason:t===`drain`?`drain`:`legacy`}}e();function Ee({config:e,defaultPercent:t=10,onChange:n}){let{t:i}=j(),[o,c]=r(()=>_e(e).unit),l=ve(e,o),u={unit:o,value:l},d=we(e),f=t=>{c(t),n(ye(e,{unit:t,value:null}))},p=t=>{n(ye(e,{unit:o,value:be(t,o)}))};return a(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:i(`storage.protectionPolicyField.protectedFreeSpace`,`Protected free space`)}),a(`div`,{className:`flex items-center gap-2`,children:[a(`select`,{"aria-label":i(`storage.protectionPolicyField.protectionUnit`,`Protection unit`),value:o,onChange:e=>{f(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:[s(`option`,{value:`percent`,children:i(`storage.protectionPolicyField.ofTheVolume`,`% of the volume`)}),s(`option`,{value:`gb`,children:i(`storage.protectionPolicyField.gbOfFreeSpace`,`GB of free space`)})]}),s(`input`,{type:`number`,"aria-label":Se(o),min:0,max:o===`percent`?100:void 0,value:l===null?``:l,placeholder:o===`percent`?String(t):i(`common.defaultWord`),onChange:e=>{p(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`})]}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:Ce(u,t)}),d!==null&&s(`p`,{className:`text-[10px] text-foreground-subtle italic`,children:i(`storage.protectionPolicyField.legacyMax`,{gb:d})})]})}e();function De({location:e,onClose:t,onSaved:i}){let{t:c}=j(),l=o(),u=y().trpcClient,[d,f]=r({...e.config}),[p,m]=r(e.displayName),[h,g]=r(null),[_,b]=r(!1),x=re(),S=n(()=>{let t=x.data;return Array.isArray(t)?t.find(t=>t.providerId===e.providerId)??null:null},[x.data,e.providerId]),C=te({onSuccess:()=>{l.invalidateQueries({queryKey:[[`storage`,`listLocations`]]}),i()}}),w=S?.shouldSaveDiskSpace===!0,T=S?.nodeLocal===!0,[O,A]=r(typeof e.nodeId==`string`?e.nodeId:`hub`),M=typeof d.basePath==`string`?d.basePath:``,N=e=>f(t=>({...t,basePath:e})),P=S?.minFreePercent??10,F=async()=>{b(!0),g(null);try{g(await(e=>u.storage.testConfig.query(e))({providerId:e.providerId,locationId:e.id,config:d}))}catch(e){g({ok:!1,error:e instanceof Error?e.message:String(e)})}finally{b(!1)}};return s(ne,{open:!0,onOpenChange:e=>!e&&t(),children:a(ie,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[a(oe,{children:[s(ae,{children:c(`storage.editLocationModal.title`,{name:e.displayName})}),a(`p`,{className:`text-xs text-foreground-subtle`,children:[s(`span`,{className:`font-mono`,children:e.id}),` ·`,` `,S?.displayName??e.providerId]})]}),a(ee,{className:`space-y-3`,children:[a(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:c(`storage.editLocationModal.displayName`,`Display name`)}),s(`input`,{type:`text`,value:p,onChange:e=>m(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`})]}),S&&s(ce,{schema:S.configSchema,values:d,onChange:f}),T&&a(`div`,{className:`space-y-2`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:c(`storage.editLocationModal.node`,`Node`)}),s(D,{selectedNodeId:O,onSelect:A,alwaysShow:!0}),s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:c(`storage.editLocationModal.path`,`Path`)}),s(ue,{nodeId:O,value:M,onChange:N})]}),w&&s(Ee,{config:d,defaultPercent:P,onChange:f}),!S&&!x.isLoading&&s(`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:s(se,{i18nKey:`storage.editLocationModal.providerGone`,values:{id:e.providerId},components:{code:s(`code`,{className:`font-mono`})}})}),h&&s(`div`,{className:`rounded border px-3 py-2 text-[11px] ${h.ok?`border-success/30 bg-success/5 text-success`:`border-danger/30 bg-danger/5 text-danger`}`,children:h.ok?c(`storage.editLocationModal.connectionOk`,`Connection OK.`):c(`storage.editLocationModal.testFailed`,`Test failed: {{value1}}`,{value1:h.error??`unknown error`})}),C.isError&&s(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:C.error instanceof Error?C.error.message:String(C.error)})]}),a(k,{className:`justify-between`,children:[s(E,{variant:`outline`,size:`sm`,onClick:t,children:c(`common.cancel`,`Cancel`)}),a(`div`,{className:`flex items-center gap-2`,children:[s(E,{variant:`outline`,size:`sm`,onClick:()=>{F()},disabled:_||!S,children:_?c(`storage.editLocationModal.testing`,`Testing…`):c(`storage.editLocationModal.testConnection`,`Test connection`)}),a(E,{size:`sm`,onClick:()=>{C.mutate(he(e,{displayName:p.trim(),config:d,nodeId:T?O:e.nodeId}))},disabled:C.isPending||p.trim().length===0,children:[C.isPending?s(v,{className:`h-3.5 w-3.5 animate-spin`}):null,C.isPending?c(`storage.editLocationModal.saving`,`Saving…`):c(`common.save`,`Save`)]})]})]})]})})}function Oe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function ke(e){if(!Oe(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 Ae(e){let t=new Map;if(!Array.isArray(e))return t;for(let n of e){let e=ke(n);e!==null&&t.set(e.locationId,e)}return t}function je(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 Me(e,t){return e?t===void 0?{kind:`unreported`}:t.drained||t.bytesRemaining<=0?{kind:`drained`}:{kind:`draining`,bytesRemaining:t.bytesRemaining,drainedFraction:je(t),estimatedEmptyAtMs:t.estimatedEmptyAtMs}:{kind:`idle`}}function Ne(e){return e.mode===`drain`?!0:e.config.readOnly===!0}function Pe(e){return`${(e/1024**3).toFixed(e>=100*1024**3?0:1)} GB`}function Fe(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}function Ie({drain:e}){let{t}=j();if(e.kind===`idle`)return null;if(e.kind===`unreported`)return s(`span`,{"data-testid":`drain-unreported`,className:`text-[10px] text-foreground-subtle`,title:t(`storage.drainProgressLine.thisLocationIsDrainingThe`,`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:t(`storage.drainProgressLine.drainingRemainingNotReportedYet`,`Draining · remaining not reported yet`)});if(e.kind===`drained`)return s(`span`,{"data-testid":`drain-done`,className:`text-[10px] text-success`,title:t(`storage.drainProgressLine.everythingThatWasHereHas`,`Everything that was here has been moved. The location is still in drain mode — it receives no new writes until you change that.`),children:t(`storage.drainProgressLine.drainedNothingLeftToMove`,`Drained · nothing left to move`)});let n=e.drainedFraction===null?null:Math.round(e.drainedFraction*100);return a(`span`,{"data-testid":`drain-progress`,className:`flex items-center gap-1.5 text-[10px] text-foreground-subtle tabular-nums`,children:[n!==null&&s(`span`,{"data-testid":`drain-bar`,className:`inline-block h-1 w-10 rounded-full bg-border overflow-hidden`,role:`progressbar`,"aria-label":t(`storage.drainProgressLine.drainProgress`,`Drain progress`),"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,children:s(`span`,{className:`block h-full bg-warning`,style:{width:`${n}%`}})}),a(`span`,{children:[t(`storage.drainProgressLine.left`,{size:Pe(e.bytesRemaining)}),n!==null&&` · ${t(`storage.drainProgressLine.moved`,{percent:n})}`]}),e.estimatedEmptyAtMs===null?s(`span`,{"data-testid":`drain-eta-absent`,title:t(`storage.drainProgressLine.theDrainIsPacedBy`,`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:t(`storage.drainProgressLine.emptyTimeNotKnownYet`,`· empty time not known yet`)}):a(`span`,{"data-testid":`drain-eta`,children:[`·`,` `,t(`storage.drainProgressLine.empty`,{when:Fe(e.estimatedEmptyAtMs)})]})]})}var Le=[`ok`,`warn`,`critical`];function Re(e){return e>=.95?`critical`:e>=.85?`warn`:`ok`}function ze(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=ze((n-t)/n);return{fraction:r,severity:Re(r),recordingsFraction:ze(e.usedBytes/n),freeBytes:t,totalBytes:n}}function Be(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||Le.indexOf(e.severity)>Le.indexOf(a))&&(a=e.severity)}return{knownVolumes:t,unknownVolumes:n,totalBytes:r,freeBytes:i,severity:a}}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 Ve(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:M(n.ownedBytes);return{kind:`unknown`,owned:e,summary:e===null?A.t(`helpers.locationCapacityBar.unknownSummary`):A.t(`helpers.locationCapacityBar.unknownSummaryOwned`,{size:e})}}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?Re(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:M(r),freeTotal:M(a),freeTotalPercent:X(a/r),used:M(p),usedPercent:X(p/r),free:M(u),freePercent:X(u/r),reserve:s===0?null:A.t(`helpers.locationCapacityBar.reserveKept`,{size:M(s)}),owned:f===null||_===null?null:A.t(`helpers.locationCapacityBar.ownedOfRecordings`,{size:M(f),percent:X(_)}),cap:v===null?null:v.reason===`drain`?A.t(`helpers.locationCapacityBar.capDrain`,{size:M(v.bytes)}):A.t(`helpers.locationCapacityBar.capCap`,{size:M(v.bytes)})},S=[A.t(`helpers.locationCapacityBar.summaryFree`,{free:x.freeTotal,total:x.total,percent:x.freeTotalPercent}),x.owned===null?null:A.t(`helpers.locationCapacityBar.summaryOwned`,{owned:x.owned}),x.reserve===null?null:l?A.t(`helpers.locationCapacityBar.summaryReserveShort`,{reserve:x.reserve}):x.reserve,x.cap===null?null:b?A.t(`helpers.locationCapacityBar.summaryCapBelow`,{cap:x.cap}):x.cap].filter(e=>e!==null).join(` · `),C=[];return c>0&&C.push({segment:`reserve`,label:A.t(`helpers.locationCapacityBar.legendKeptFree`),value:M(s),alarming:l}),x.owned!==null&&C.push({segment:`owned`,label:A.t(`helpers.locationCapacityBar.legendCamstack`),value:x.owned,alarming:!1}),C.push({segment:`used`,label:f===null?A.t(`helpers.locationCapacityBar.legendUsed`):A.t(`helpers.locationCapacityBar.legendOtherData`),value:`${x.used} (${x.usedPercent})`,alarming:g===`critical`}),C.push({segment:`free`,label:A.t(`helpers.locationCapacityBar.legendFree`),value:`${x.free} (${x.freePercent})`,alarming:l}),v!==null&&C.push({segment:`cap`,label:v.reason===`drain`?A.t(`helpers.locationCapacityBar.legendDrainTarget`):A.t(`helpers.locationCapacityBar.legendCap`),value:A.t(`helpers.locationCapacityBar.legendCapValue`,{size:M(v.bytes)}),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 He={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 Ue(e,t){return e===`used`?He[t]:Z[e]}function We({location:e,ownedBytes:t}){let{t:n}=j(),r=e.capacity??null,i=xe(_e(e.config),r?.totalBytes??null),o=Ve({totalBytes:r?.totalBytes??null,availableBytes:r?.availableBytes??null},i,{ownedBytes:t??null,cap:Te(e.config,z(e))});return o.kind===`unknown`?s(`div`,{className:`text-[10px] text-foreground-subtle italic`,title:o.summary,children:o.owned===null?n(`storage.locationCapacityBar.capacityUnknown`,`Capacity unknown`):n(`storage.locationCapacityBar.capacityUnknownCamstackHolds`,`Capacity unknown · CamStack holds {{owned}}`,{owned:o.owned})}):a(`div`,{className:`mt-1 space-y-1`,title:o.summary,children:[a(`div`,{className:`relative flex h-2 w-full max-w-md overflow-hidden rounded-full bg-border`,children:[o.segments.reservePercent>0&&s(`div`,{className:Z.reserve,style:{width:`${String(o.segments.reservePercent)}%`}}),o.segments.ownedPercent!==null&&s(`div`,{className:Z.owned,style:{width:`${String(o.segments.ownedPercent)}%`}}),s(`div`,{className:He[o.severity],style:{width:`${String(o.segments.usedPercent)}%`}}),s(`div`,{className:Z.free,style:{width:`${String(o.segments.freePercent)}%`}}),o.segments.capPercent!==null&&s(`div`,{className:`absolute inset-y-0 w-px ${o.capBelowOwned?`bg-danger`:Z.cap}`,style:{left:`${String(o.segments.capPercent)}%`}})]}),s(`ul`,{className:`flex flex-wrap items-center gap-x-3 gap-y-0.5`,children:o.legend.map(e=>a(`li`,{className:`flex items-center gap-1`,children:[s(`span`,{"aria-hidden":`true`,className:`inline-block h-2 w-2 shrink-0 rounded-sm ${Ue(e.segment,o.severity)}`}),a(`span`,{className:`text-[10px] tabular-nums ${e.alarming?`text-danger`:`text-foreground-subtle`}`,children:[e.label,` `,e.value]})]},e.segment))})]})}var Ge={eventMedia:[`events`],recordingsLow:[`low`],recordings:[`high`,`mid`]},Ke={eventMedia:`pipeline-analytics`,recordingsLow:`recorder`,recordings:`recorder`},qe=`storage.discardLocation`,Je=`storage.discardLocationStatus`,Ye=`storage.discardLocationCancel`;function Xe(e){return Ge[e]??null}function Ze(e){return Ke[e]??null}function Qe(e){return!B(z(e))}function $e(e,t){return Xe(e.type)===null||!Qe(e)?!1:t.some(t=>t.id!==e.id&&B(z(t)))}var et=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 tt(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`||!et.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 nt(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}e();var rt=2e3;function it({location:e,siblings:t}){return $e(e,t)?s(at,{location:e}):null}function at({location:e}){let{t:n}=j(),i=T(),o=w(),c=Ze(e.type),[l,u]=r(null),[d,f]=r(null),[p,m]=r(!1);if(t(()=>{if(c===null)return;let e=!1,t=async()=>{try{let t=await o.mutateAsync({addonId:c,action:Je,input:{}});if(e)return;u(tt(t))}catch{}};t();let n=setInterval(()=>void t(),rt);return()=>{e=!0,clearInterval(n)}},[c,e.id]),c===null)return null;let h=l!==null&&l.locationId===e.id,_=h&&l.running,y=h&&l.phase!==`idle`,b=async()=>{if(await i({title:n(`storage.locationDiscardControl.discardLeftoversOn`,`Discard leftovers on "{{displayName}}"?`,{displayName:e.displayName}),message:n(`storage.locationDiscardControl.permanentlyDeletesLeftoverFilesAnd`,`Permanently deletes leftover files and records on this location. Other locations are not affected. This cannot be undone and may take hours.`),confirmLabel:n(`storage.locationDiscardControl.discardLeftovers`,`Discard leftovers`),variant:`danger`})){f(null),m(!0);try{await o.mutateAsync({addonId:c,action:qe,input:{locationId:e.id}}),u(tt(await o.mutateAsync({addonId:c,action:Je,input:{}})))}catch(e){f(e instanceof Error?e.message:String(e))}finally{m(!1)}}},x=async()=>{try{await o.mutateAsync({addonId:c,action:Ye,input:{}})}catch(e){f(e instanceof Error?e.message:String(e))}};return a(`div`,{className:`flex flex-col gap-1 min-w-[9rem] max-w-[16rem]`,children:[_?a(`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:[s(g,{className:`h-3 w-3`}),n(`common.cancel`,`Cancel`)]}):a(`button`,{type:`button`,onClick:()=>void b(),disabled:p,title:n(`storage.locationDiscardControl.permanentlyDeleteLeftoverFilesOn`,`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:[p?s(v,{className:`h-3 w-3 animate-spin`}):s(S,{className:`h-3 w-3`}),n(`storage.locationDiscardControl.discardLeftovers`,`Discard leftovers`)]}),y&&l!==null&&a(`div`,{className:`space-y-0.5`,children:[s(`div`,{className:`h-1 rounded bg-border overflow-hidden`,children:s(`div`,{className:`h-full bg-primary transition-[width] duration-300`,style:{width:`${nt(l)}%`}})}),a(`p`,{className:`text-[10px] text-foreground-subtle leading-tight`,children:[l.phase,l.camerasTotal>0?` · ${n(`storage.locationDiscardControl.camsProgress`,{done:l.camerasDone,total:l.camerasTotal})}`:``,l.dbRowsDeleted>0?` · ${n(`storage.locationDiscardControl.rowsDeleted`,{count:l.dbRowsDeleted})}`:``,l.detail?` · ${l.detail}`:``]})]}),(d||h&&l?.error)&&s(`p`,{className:`text-[10px] text-danger leading-tight`,children:d??l?.error})]})}e();var ot={active:u,readonly:x,drain:C,disabled:c},st={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 ct({mode:e,open:t,onToggle:n}){let{t:r}=j(),i=H(e),o=ot[e];return a(`button`,{type:`button`,"aria-expanded":t,"aria-label":r(`storage.locationModeSelector.locationState`,`Location state`),onClick:n,title:i.consequence,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium border ${st[e]}`,children:[s(o,{className:`h-3 w-3`}),i.label,s(p,{className:`h-3 w-3 ${t?`rotate-180`:``}`})]})}function lt({mode:e,blockedReasons:n,onSelect:r,onDismiss:i}){let{t:o}=j();return t(()=>{let e=e=>{e.key===`Escape`&&i()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[i]),a(`div`,{className:`w-full basis-full rounded-lg border border-border bg-background p-1`,role:`group`,"aria-label":o(`storage.locationModeSelector.locationStateChoices`,`Location state choices`),children:[a(`div`,{className:`flex items-center justify-between px-2 py-1`,children:[s(`span`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:o(`storage.locationModeSelector.locationState`,`Location state`)}),s(`button`,{type:`button`,"aria-label":o(`storage.locationModeSelector.closeLocationStateChoices`,`Close location state choices`),onClick:i,className:`text-foreground-subtle hover:text-foreground`,children:s(g,{className:`h-3 w-3`})})]}),V.map(t=>{let c=n[t.mode],l=c!==``,u=ot[t.mode],d=t.mode===e;return a(`button`,{type:`button`,role:`radio`,"aria-checked":d,"aria-label":t.label,disabled:l,onClick:()=>{l||(i(),d||r(t.mode))},className:`flex w-full flex-col items-start gap-0.5 rounded px-2 py-1.5 text-left ${l?`cursor-not-allowed opacity-60`:d?`bg-primary/10`:`hover:bg-primary/5`}`,children:[a(`span`,{className:`flex items-center gap-1.5 text-[11px] font-medium text-foreground`,children:[s(u,{className:`h-3 w-3`}),t.label,d&&s(`span`,{className:`text-[9px] uppercase text-primary`,children:o(`common.current`)})]}),s(`span`,{className:`text-[10px] leading-snug text-foreground-subtle`,children:t.consequence}),l&&s(`span`,{className:`text-[10px] leading-snug text-warning`,children:c})]},t.mode)})]})}e();function ut(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 dt({location:e,onEdit:t,onDelete:n,onSetMode:i,blockedReasons:o,canDelete:c,siblings:l=[],drain:u,ownedBytes:p}){let{t:m}=j(),[h,g]=r(!1),_=ut(e.config),v=z(e);return a(`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:[a(`div`,{className:`flex items-start gap-2 min-w-0 flex-1 basis-72`,children:[s(`div`,{className:`shrink-0 sm:w-32`,"data-testid":`location-badge-slot`,children:s(`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})}),a(`div`,{className:`min-w-0 flex-1`,children:[s(`div`,{className:`text-xs font-medium text-foreground truncate`,children:e.displayName}),_&&s(`div`,{className:`text-[10px] text-foreground-subtle truncate font-mono`,children:_}),s(We,{location:e,ownedBytes:p??null}),u!==void 0&&s(Ie,{drain:u})]})]}),a(`div`,{className:`flex flex-wrap items-center gap-1 shrink-0`,children:[s(it,{location:e,siblings:l}),s(ct,{mode:v,open:h,onToggle:()=>{g(e=>!e)}}),a(`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:[s(d,{className:`h-3 w-3`}),m(`common.edit`,`Edit`)]}),c&&s(`button`,{onClick:()=>n(e),className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,title:m(`storage.locationCard.deleteLocation`,`Delete location`),children:s(f,{className:`h-3 w-3`})})]}),h&&s(lt,{mode:v,blockedReasons:o,onSelect:t=>i(e,t),onDismiss:()=>{g(!1)}})]})}e();function ft({type:e,displayName:t,description:r,cardinality:i,locations:o,onAdd:c,onEdit:u,onDelete:d,onSetMode:f,ownedBytesById:p,drainById:h}){let{t:g}=j(),v=n(()=>{let e=[...o];return e.sort((e,t)=>{let n=B(z(e));return n===B(z(t))?e.displayName.localeCompare(t.displayName):n?-1:1}),e},[o]);return a(O,{headingId:`storage-location-${e}`,title:t,icon:m,testId:`storage-location-group-${e}`,actions:i===`multi`?a(E,{size:`sm`,type:`button`,onClick:()=>c(e),children:[s(_,{className:`h-3 w-3`}),g(`common.add`,`Add`)]}):void 0,children:[a(`div`,{className:`${l} space-y-2`,children:[a(`div`,{className:`space-y-0.5`,children:[s(`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}),r!==void 0&&r!==``&&s(`p`,{className:`text-[11px] leading-relaxed text-foreground-subtle`,children:r}),i===`single`&&s(`p`,{className:`text-[10px] text-foreground-subtle italic`,children:g(`storage.locationGroup.singleOneLocationPerType`,`Single — one location per type. Edit the existing entry; it can't be split.`)})]}),v.length===0&&s(`div`,{className:`py-2 text-center text-[11px] text-foreground-subtle italic`,children:i===`multi`?g(`storage.locationGroup.noLocationRegisteredClickAdd`,`No location registered. Click "Add" to register one.`):g(`storage.locationGroup.noLocationRegisteredYetShould`,`No location registered yet — should be auto-seeded at next boot.`)})]}),v.length>0&&s(`div`,{className:`border-t border-border`,children:v.map(e=>s(dt,{location:e,cardinality:i,canDelete:pe(e,v,i),onEdit:u,onDelete:d,onSetMode:f,blockedReasons:fe(e,v),ownedBytes:p?.get(e.id)??null,drain:Me(Ne(e),h?.get(e.id)),siblings:v},e.id))})]})}var pt=[`recordings`,`recordingsLow`];function mt(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function ht(e,t){if(t===void 0||!pt.includes(e.type))return null;let n=t.find(t=>mt(t).includes(e.id));return n===void 0||!Number.isFinite(n.usedBytes)||n.usedBytes<0?null:n.usedBytes}function gt(e,t){let n=new Map;for(let r of e){let e=ht(r,t);e!==null&&n.set(r.id,e)}return n}export{Ae as a,H as c,Be as i,U as l,ft as n,De as o,q as r,he as s,gt as t,R as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ra as e}from"./player-overlays-
|
|
1
|
+
import{ra as e}from"./player-overlays-DxE-ZGs_.js";var t=e(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ra as e}from"./player-overlays-
|
|
1
|
+
import{ra as e}from"./player-overlays-DxE-ZGs_.js";var t=e(`memory-stick`,[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ra as e}from"./player-overlays-
|
|
1
|
+
import{ra as e}from"./player-overlays-DxE-ZGs_.js";var t=e(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]);export{t};
|
|
@@ -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-SPnLNFAH.js");
|
|
16
16
|
await __mfHostInit.__tla;
|
|
17
17
|
const { initHost } = __mfHostInit;
|
|
18
18
|
await initHost();
|
|
19
|
-
})().then(() => __mfImport("./index-
|
|
19
|
+
})().then(() => __mfImport("./index-CXOYQeji.js"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ra as e}from"./player-overlays-
|
|
1
|
+
import{ra as e}from"./player-overlays-DxE-ZGs_.js";var t=e(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),n=e(`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`}]]);export{t as n,n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ra as e}from"./player-overlays-
|
|
1
|
+
import{ra as e}from"./player-overlays-DxE-ZGs_.js";var t=e(`monitor-off`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M17 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 1.184-1.826`,key:`cv7jms`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`path`,{d:`M8.656 3H20a2 2 0 0 1 2 2v10a2 2 0 0 1-.293 1.042`,key:`z8ni2w`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ra as e}from"./player-overlays-
|
|
1
|
+
import{ra as e}from"./player-overlays-DxE-ZGs_.js";var t=e(`monitor-smartphone`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./src-BXyxUvfL.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as e,G as t,J as n,S as r,b as i,i 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-CEHpkaJP.js";import{It as s,dt as c,fn as l,kn as u,na as d,ot as f}from"./player-overlays-DxE-ZGs_.js";import{Bt as p,Et as m,F as h,Ft as g,Ht as _,I as ee,It as te,K as ne,L as re,Lt as v,Mt as ie,N as ae,Ot as oe,P as y,Rt as se,St as b,Tt as ce,Ut as le,Vt as ue,Wt as de,_t as fe,bt as x,dt as pe,er as me,ft as he,gt as S,ht as ge,jt as C,k as _e,kt as ve,mt as ye,pt as be,q as xe,si as Se,tr as Ce,ut as we,wt as Te,xt as w,z as Ee,zt as De}from"./client-Dv9yZvWI.js";import{Ao as Oe,Du as T,F as ke,Fr as Ae,Mu as E,el as je,nl as Me}from"./src-BXyxUvfL.js";import{t as D}from"./i18n-DBncQ6jl.js";import{t as O}from"./useTranslation-D3Is_4B6.js";e();function k(e){return t=>Object.prototype.hasOwnProperty.call(e,t)}var Ne=k({devices:!0}),Pe=k({classes:!0,classesExclude:!0,labelEquals:!0,identities:!0,identitiesExclude:!0,eventTypeTokens:!0,sensorKinds:!0}),Fe=k({minConfidence:!0,minImportance:!0,minLabelConfidence:!0}),Ie=k({minDwellSeconds:!0}),Le=k({source:!0}),Re=k({crossing:!0}),ze=k({packagePhase:!0}),Be=k({sensorTransition:!0}),Ve=k({plates:!0}),He=k({occupancy:!0}),Ue=k({audio:!0}),We=k({systemEvent:!0}),Ge=k({deviceState:!0}),Ke=k({scene:!0});function qe(e,t){let n=e[t];return Array.isArray(n)?n:[]}function Je(e,t){let n=e[t];return typeof n==`number`?n:void 0}function A(e,n){let r=f().trpcClient,i=a({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 t(()=>{let e=[],t=new Set;for(let r of i){if(!r.data)continue;let i=n.find(e=>e.id===r.data.deviceId)?.name;for(let n of r.data.zones)t.has(n.id)||(t.add(n.id),e.push({value:n.id,label:n.name,...i===void 0?{}:{hint:i}}))}return{options:e,loading:i.some(e=>e.isLoading),failed:i.some(e=>e.isError)}},[i,n])}function Ye(e){let n=f().trpcClient,r=a({queries:e.map(e=>({queryKey:[[`nc-pickers`,`event-kinds`],{deviceId:e}],staleTime:6e4,queryFn:async()=>(await n.pipelineAnalytics.listEventKinds.query({deviceId:e})).map(e=>({kind:e.kind,label:e.label}))}))});return t(()=>{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 Xe(){let e=Oe();return t(()=>({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 Ze(){let e=je({limit:200}),n=Me();return t(()=>{let t=new Set;for(let e of n.data??[])e.name.trim().length>0&&t.add(e.name);let r=new Set;for(let t of e.data??[])t.text.trim().length>0&&r.add(t.text);return[...[...t].sort(),...[...r].sort()]},[e.data,n.data])}function j({options:e,value:i,onChange:a,loading:s,emptyHint:c,placeholder:l,noFreeText:u=!1}){let{t:d}=O(),[f,p]=n(``),m=t(()=>new Set(e.map(e=>e.value)),[e]),h=t(()=>new Set(i),[i]),g=i.filter(e=>!m.has(e)),_=e=>{a(h.has(e)?i.filter(t=>t!==e):[...i,e])},ee=()=>{let e=f.trim();e.length===0||i.includes(e)||(a([...i,e]),p(``))};return r(`div`,{className:`mt-1 space-y-1.5`,children:[g.length>0&&o(`div`,{className:`flex flex-wrap gap-1`,children:g.map(e=>r(`button`,{type:`button`,onClick:()=>a(i.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:d(`system.notificationRulePickers.customValueClickToRemove`,`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=>r(`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:h.has(e.value),onChange:()=>_(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?d(`common.loading`,`Loading…`):c}),!u&&o(`input`,{value:f,onChange:e=>p(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 M=[{value:`immediate`,get label(){return D.t(`helpers.ruleFormParsers.immediate`)},get hint(){return D.t(`helpers.ruleFormParsers.immediateHint`)}},{value:`track-end`,get label(){return D.t(`helpers.ruleFormParsers.trackEnd`)},get hint(){return D.t(`helpers.ruleFormParsers.trackEndHint`)}},{value:`device-event`,get label(){return D.t(`helpers.ruleFormParsers.deviceEvent`)},get hint(){return D.t(`helpers.ruleFormParsers.deviceEventHint`)}},{value:`package-event`,get label(){return D.t(`helpers.ruleFormParsers.packageEvent`)},get hint(){return D.t(`helpers.ruleFormParsers.packageEventHint`)}},{value:`system-event`,get label(){return D.t(`helpers.ruleFormParsers.systemEvent`)},get hint(){return D.t(`helpers.ruleFormParsers.systemEventHint`)}}],Qe=`Immediate, grouped`,$e=M.flatMap(e=>e.value===`immediate`?[e,{value:`immediate-grouped`,get label(){return D.t(`notificationRules.grouping.choice`)},get hint(){return D.t(`helpers.ruleFormParsers.groupedHint`)}}]:[e]);function et(e){return e.groupingSec!==void 0&&x(e)?`immediate-grouped`:e.delivery}function tt(e){let t=(e.delivery===`immediate`||e.delivery===`track-end`)&&x({delivery:`immediate`,conditions:e.conditions});return $e.filter(e=>e.value!==`immediate-grouped`||t)}function nt(e){return $e.find(t=>t.value===e)?.value}function rt(e,t=Qe){return et(e)===`immediate-grouped`?`${t} · ${String(e.groupingSec)} s`:at(e.delivery)}function it(e){if(e.trim().length===0)return;let t=Number(e);return Number.isFinite(t)&&t>=0?Math.trunc(t):void 0}function at(e){return M.find(t=>t.value===e)?.label??e}function ot(e){return M.some(t=>t.value===e)}var st=[{key:`all`,get label(){return D.t(`helpers.ruleFormParsers.sec_all_label`)},get blurb(){return D.t(`helpers.ruleFormParsers.sec_all_blurb`)},get newRuleLabel(){return D.t(`helpers.ruleFormParsers.sec_all_new`)},get emptyHint(){return D.t(`helpers.ruleFormParsers.sec_all_empty`)},creatable:!0},{key:`detection`,get label(){return D.t(`helpers.ruleFormParsers.sec_detection_label`)},get blurb(){return D.t(`helpers.ruleFormParsers.sec_detection_blurb`)},get newRuleLabel(){return D.t(`helpers.ruleFormParsers.sec_detection_new`)},get emptyHint(){return D.t(`helpers.ruleFormParsers.sec_detection_empty`)},creatable:!0},{key:`sensor`,get label(){return D.t(`helpers.ruleFormParsers.sec_sensor_label`)},get blurb(){return D.t(`helpers.ruleFormParsers.sec_sensor_blurb`)},get newRuleLabel(){return D.t(`helpers.ruleFormParsers.sec_sensor_new`)},get emptyHint(){return D.t(`helpers.ruleFormParsers.sec_sensor_empty`)},creatable:!0},{key:`audio`,get label(){return D.t(`helpers.ruleFormParsers.sec_audio_label`)},get blurb(){return D.t(`helpers.ruleFormParsers.sec_audio_blurb`)},get newRuleLabel(){return D.t(`helpers.ruleFormParsers.sec_audio_new`)},get emptyHint(){return D.t(`helpers.ruleFormParsers.sec_audio_empty`)},creatable:!0},{key:`occupancy`,get label(){return D.t(`helpers.ruleFormParsers.sec_occupancy_label`)},get blurb(){return D.t(`helpers.ruleFormParsers.sec_occupancy_blurb`)},get newRuleLabel(){return D.t(`helpers.ruleFormParsers.sec_occupancy_new`)},get emptyHint(){return D.t(`helpers.ruleFormParsers.sec_occupancy_empty`)},creatable:!0},{key:`device-events`,get label(){return D.t(`helpers.ruleFormParsers.sec_deviceEvents_label`)},get blurb(){return D.t(`helpers.ruleFormParsers.sec_deviceEvents_blurb`)},get newRuleLabel(){return D.t(`helpers.ruleFormParsers.sec_deviceEvents_new`)},get emptyHint(){return D.t(`helpers.ruleFormParsers.sec_deviceEvents_empty`)},creatable:!0},{key:`system`,get label(){return D.t(`helpers.ruleFormParsers.sec_system_label`)},get blurb(){return D.t(`helpers.ruleFormParsers.sec_system_blurb`)},get newRuleLabel(){return D.t(`helpers.ruleFormParsers.sec_system_new`)},get emptyHint(){return D.t(`helpers.ruleFormParsers.sec_system_empty`)},creatable:!0},{key:`alarm`,get label(){return D.t(`helpers.ruleFormParsers.sec_alarm_label`)},get blurb(){return D.t(`helpers.ruleFormParsers.sec_alarm_blurb`)},get newRuleLabel(){return D.t(`helpers.ruleFormParsers.sec_alarm_new`)},get emptyHint(){return D.t(`helpers.ruleFormParsers.sec_alarm_empty`)},creatable:!0},{key:`mixed`,get label(){return D.t(`helpers.ruleFormParsers.sec_mixed_label`)},get blurb(){return D.t(`helpers.ruleFormParsers.sec_mixed_blurb`)},get newRuleLabel(){return D.t(`helpers.ruleFormParsers.sec_mixed_new`)},get emptyHint(){return D.t(`helpers.ruleFormParsers.sec_mixed_empty`)},creatable:!1}];function ct(e){return b(w(e)).editable}function lt(e){return fe(ut(e))}function ut(e){switch(e){case`device-events`:case`system`:case`alarm`:case`mixed`:return e;default:return}}var dt=new Map([[0,`helpers.ruleFormParsers.cdNone`],[60,`helpers.ruleFormParsers.cd1m`],[3600,`helpers.ruleFormParsers.cd1h`]]),ft=86400;function pt(e){let t=dt.get(e);return t===void 0?e%3600==0?D.t(`helpers.ruleFormParsers.cdHours`,{count:e/3600}):e%60==0?D.t(`helpers.ruleFormParsers.cdMinutes`,{count:e/60}):D.t(`helpers.ruleFormParsers.cdSeconds`,{count:e}):D.t(t)}function mt(e){if(e.trim().length===0)return;let t=Number(e);return Number.isFinite(t)&&t>=0?Math.trunc(t):void 0}var ht=[{value:`rule-device`,get label(){return D.t(`helpers.ruleFormParsers.scopeDevice`)}},{value:`rule`,get label(){return D.t(`helpers.ruleFormParsers.scopeRule`)}}];function gt(e){return ht.find(t=>t.value===e)?.value}var _t=[{value:`per-class`,get label(){return D.t(`helpers.ruleFormParsers.granPerClass`)}},{value:`shared`,get label(){return D.t(`helpers.ruleFormParsers.granShared`)}}];function vt(e){return _t.find(t=>t.value===e)?.value}var yt=[{value:`scene-boxes`,get label(){return D.t(`helpers.ruleFormParsers.imageSceneBoxes`)},get description(){return D.t(`helpers.ruleFormParsers.imageSceneBoxesDesc`)}},{value:`crop`,get label(){return D.t(`helpers.ruleFormParsers.imageCrop`)},get description(){return D.t(`helpers.ruleFormParsers.imageCropDesc`)}},{value:`clean`,get label(){return D.t(`helpers.ruleFormParsers.imageClean`)},get description(){return D.t(`helpers.ruleFormParsers.imageCleanDesc`)}},{value:`none`,get label(){return D.t(`helpers.ruleFormParsers.imageNone`)},get description(){return D.t(`helpers.ruleFormParsers.imageNoneDesc`)}}];function bt(e){return yt.find(t=>t.value===e)?.value}var N=[{value:``,get label(){return D.t(`helpers.ruleFormParsers.linkedDefault`)}},{value:`mosaic`,get label(){return D.t(`helpers.ruleFormParsers.linkedMosaic`)}},{value:`each`,get label(){return D.t(`helpers.ruleFormParsers.linkedEach`)}}];function xt(e){let t=N.find(t=>t.value===e)?.value;return t===``?void 0:t}var P=[{value:``,get label(){return D.t(`helpers.ruleFormParsers.profileLowest`)}},{value:`low`,get label(){return D.t(`helpers.ruleFormParsers.profileLow`)}},{value:`mid`,get label(){return D.t(`helpers.ruleFormParsers.profileMid`)}},{value:`high`,get label(){return D.t(`helpers.ruleFormParsers.profileHigh`)}}];function St(e){let t=P.find(t=>t.value===e)?.value;return t===``?void 0:t}var Ct=[{value:`any`,get label(){return D.t(`helpers.ruleFormParsers.srcAny`)}},{value:`pipeline`,get label(){return D.t(`helpers.ruleFormParsers.srcPipeline`)}},{value:`onboard`,get label(){return D.t(`helpers.ruleFormParsers.srcOnboard`)}},{value:`sensor`,get label(){return D.t(`helpers.ruleFormParsers.srcSensor`)}}],wt=[{value:`delivered`,get label(){return D.t(`helpers.ruleFormParsers.phaseDelivered`)}},{value:`picked-up`,get label(){return D.t(`helpers.ruleFormParsers.phasePickedUp`)}},{value:`both`,get label(){return D.t(`helpers.ruleFormParsers.phaseBoth`)}}],Tt=[{value:``,get label(){return D.t(`helpers.ruleFormParsers.stBoth`)}},{value:`raised`,get label(){return D.t(`helpers.ruleFormParsers.stRaised`)}},{value:`cleared`,get label(){return D.t(`helpers.ruleFormParsers.stCleared`)}}];function Et(e){return e===`raised`||e===`cleared`?e:void 0}function F(e,t){return e===`sensorTransition`?xe(t.sensorKinds):!0}var Dt=[{value:`enter`,get label(){return D.t(`helpers.ruleFormParsers.crossEnter`)}},{value:`exit`,get label(){return D.t(`helpers.ruleFormParsers.crossExit`)}},{value:`any`,get label(){return D.t(`helpers.ruleFormParsers.crossAny`)}}],Ot=`enter`;function I(e){return e===`exit`||e===`any`?e:void 0}var kt=[{value:1,get label(){return D.t(`helpers.ruleFormParsers.prioMin`)}},{value:2,get label(){return D.t(`helpers.ruleFormParsers.prioLow`)}},{value:3,get label(){return D.t(`helpers.ruleFormParsers.prioDefault`)}},{value:4,get label(){return D.t(`helpers.ruleFormParsers.prioHigh`)}},{value:5,get label(){return D.t(`helpers.ruleFormParsers.prioMax`)}}];function At(e,t){return e.options&&e.options.length>0?e.options:t}var jt=[{value:``,get label(){return D.t(`helpers.ruleFormParsers.speedDefault`)}},{value:`1`,get label(){return D.t(`helpers.ruleFormParsers.speedReal`)}},{value:`2`,label:`2×`},{value:`3`,label:`3×`},{value:`4`,label:`4×`},{value:`6`,label:`6×`},{value:`8`,label:`8×`}];function Mt(e){if(e===``)return;let t=Number(e);return Number.isFinite(t)&&t>=1&&t<=8?t:void 0}var Nt=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`,"recording-stalled":`Recording stalled`,"recording-healthy":`Recording healthy again`,"recording-degraded":`Recording degraded (restart storm)`,"storage-location-low":`Storage location low`,"storage-location-critical":`Storage location critical`,"storage-location-ok":`Storage location ok again`,"node-offline":`Node offline`,"node-online":`Node online`,"node-restarting":`Node restarting`,"node-updating":`Node updating (restart imminent)`,"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`,"alert-critical":`Critical alert raised`,"alert-error":`Error alert raised`,"alert-critical-resolved":`Critical alert resolved`,"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 Pt(e){return Nt.get(e)}var Ft={"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.`,recording:`A camera whose recording is on but no footage is landing (stall), a writer that burned its restart budget (degraded), and (optionally) the return to healthy writing.`,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.`,"addon-updates":`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.`,alerts:`A critical or error alert opening — a runner that failed or was refused, a recording location out of space, an expired sign-in — and (optionally) a critical alert resolving. One notification per alert episode.`,storage:`A storage location running low or critical on free space — or whose capacity probe failed — and (optionally) its return to ok.`,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=ve.map(e=>({id:e.id,family:e.family,label:e.label,hint:Ft[e.id]??``,kinds:e.kinds.flatMap(e=>{let t=Pt(e);return t===void 0?[]:[{value:e,label:t}]})}));function R(e){return L.filter(t=>t.family===e)}function z(e){let t=Te(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 It(e){return{devices:C(e,`deviceIds`),deviceTypes:C(e,`deviceTypes`),nodes:C(e,`nodeIds`),packages:C(e,`packageNames`),consumableThreshold:C(e,`consumableLowPercent`)}}function H(e,t){let n=oe[e],r=It(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 Lt=Object.values(Se).map(e=>({value:e,label:Rt(e)})).toSorted((e,t)=>e.label.localeCompare(t.label));function Rt(e){let t=e.replaceAll(`-`,` `);return t.charAt(0).toUpperCase()+t.slice(1)}function zt(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:Ht(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 Bt(e,t){return t===void 0?void 0:Ht(t,t.kinds,e)}function Vt(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 Ht(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 Ut=95;function Wt(e){let t=e.trim();if(t===``)return{kind:`clear`};let n=Number(t);return Number.isInteger(n)&&n>=1&&n<=Ut?{kind:`set`,value:n}:{kind:`invalid`}}function Gt(e,t=2){if(e===void 0||e.length===0)return D.t(`helpers.notificationSystemEvents.noneSelected`);let n=e.slice(0,t).map(V).join(`, `),r=e.length-Math.min(t,e.length);return r>0?`${n} +${r}`:n}function Kt(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(Rt).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 qt(e){return e===void 0||(e.deviceTypes?.length??0)===0?!1:e.kinds.some(e=>me.includes(e))}var Jt=[`all`,`only`,`except`];function Yt(e,t){return(e??[]).length>0?`only`:(t??[]).length>0?`except`:`all`}function W(e,t){let n=[...e??[]],r=[...t??[]];return{mode:Yt(n,r),include:n,exclude:r,legacyBoth:n.length>0&&r.length>0}}function Xt(e,t){return{...e,mode:t}}function Zt(e){switch(e.mode){case`only`:return e.include;case`except`:return e.exclude;case`all`:return[]}}function Qt(e,t){switch(e.mode){case`only`:return{...e,include:[...t]};case`except`:return{...e,exclude:[...t]};case`all`:return e}}function $t(e){return e.mode===`only`&&e.legacyBoth?e.exclude:[]}function en(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=$t(e);return{...e.include.length>0?{include:[...e.include]}:{},...t.length>0?{exclude:[...t]}:{}}}}}function tn(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:{get title(){return D.t(`helpers.notificationRuleActions.onActivationTitle`)},get hint(){return D.t(`helpers.notificationRuleActions.onActivationHint`)}},onDeactivation:{get title(){return D.t(`helpers.notificationRuleActions.onDeactivationTitle`)},get hint(){return D.t(`helpers.notificationRuleActions.onDeactivationHint`)}},onTrigger:{get title(){return D.t(`helpers.notificationRuleActions.onTriggerTitle`)},get hint(){return D.t(`helpers.notificationRuleActions.onTriggerHint`)}},onTriggerOff:{get title(){return D.t(`helpers.notificationRuleActions.onTriggerOffTitle`)},get hint(){return D.t(`helpers.notificationRuleActions.onTriggerOffHint`)}}},nn={onActivation:[],onDeactivation:[],onTrigger:[],onTriggerOff:[],buttons:[]};function rn(e){return e===void 0?nn:{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 an(e,t){let n=[];for(let r of K){let i=e[r];i.length>4&&n.push({kind:`too-many`,message:D.t(`helpers.notificationRuleActions.tooMany`,{title:q[r].title})});for(let e of i)e.kind===`sequence`&&!t.has(e.sequenceId)&&n.push({kind:`unknown-sequence`,message:D.t(`helpers.notificationRuleActions.hookUnknownSeq`,{title:q[r].title})})}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:D.t(`helpers.notificationRuleActions.dupButton`,{id:e})}),r.add(e),t.has(i.sequenceId.trim())||n.push({kind:`unknown-sequence`,message:D.t(`helpers.notificationRuleActions.buttonUnknownSeq`,{label:i.label||e})}))}return n}function on(e,t){return{id:`action-${String(e+1)}`,label:D.t(`helpers.notificationRuleActions.newButtonLabel`),sequenceId:t}}function sn(){return{kind:`do`,action:{kind:`cap`,deviceId:0,cap:``,method:``}}}function cn(e){return{kind:`sequence`,sequenceId:e}}function ln(){return{kind:`wait`,seconds:5}}var un=[{value:`acknowledge`,get label(){return D.t(`helpers.notificationRuleActions.icon_acknowledge`)}},{value:`dismiss`,get label(){return D.t(`helpers.notificationRuleActions.icon_dismiss`)}},{value:`silence`,get label(){return D.t(`helpers.notificationRuleActions.icon_silence`)}},{value:`snooze`,get label(){return D.t(`helpers.notificationRuleActions.icon_snooze`)}},{value:`view`,get label(){return D.t(`helpers.notificationRuleActions.icon_view`)}},{value:`play`,get label(){return D.t(`helpers.notificationRuleActions.icon_play`)}},{value:`camera`,get label(){return D.t(`helpers.notificationRuleActions.icon_camera`)}},{value:`open`,get label(){return D.t(`helpers.notificationRuleActions.icon_open`)}},{value:`close`,get label(){return D.t(`helpers.notificationRuleActions.icon_close`)}},{value:`unlock`,get label(){return D.t(`helpers.notificationRuleActions.icon_unlock`)}},{value:`lock`,get label(){return D.t(`helpers.notificationRuleActions.icon_lock`)}},{value:`disarm`,get label(){return D.t(`helpers.notificationRuleActions.icon_disarm`)}},{value:`arm`,get label(){return D.t(`helpers.notificationRuleActions.icon_arm`)}},{value:`arm-home`,get label(){return D.t(`helpers.notificationRuleActions.icon_arm_home`)}},{value:`arm-away`,get label(){return D.t(`helpers.notificationRuleActions.icon_arm_away`)}},{value:`arm-night`,get label(){return D.t(`helpers.notificationRuleActions.icon_arm_night`)}},{value:`light`,get label(){return D.t(`helpers.notificationRuleActions.icon_light`)}},{value:`alert`,get label(){return D.t(`helpers.notificationRuleActions.icon_alert`)}}],dn=[10,30,60],fn=[5,10,15,30,60,120,240,480];function pn(e){return e>=60&&e%60==0?D.t(`helpers.ruleFormState.snoozeHours`,{count:e/60}):D.t(`helpers.ruleFormState.snoozeMin`,{count:e})}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=w(n);return e.some(e=>e.id===t&&ye(e,n.delivery,r))}function Sn(e=`immediate`,t={}){return{name:``,enabled:!0,delivery:e,targetIds:[],targetUsers:[],targetParams:{},priority:3,mediaImage:we({},w({delivery:e,conditions:t})),mediaShowTriggerZone:!1,mediaShowSubjectPath:!1,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:nn,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,mediaImage:we(e.media,w(e)),mediaShowTriggerZone:e.media.showTriggerZone===!0,mediaShowSubjectPath:e.media.showSubjectPath===!0,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:rn(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(se(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(ft)} (24 hours). 0 means every match is delivered.`),Y(e))for(let t of re({delivery:e.delivery,conditions:e.conditions,...e.systemEventDelivery===void 0?{}:{systemEventDelivery:e.systemEventDelivery},...J(e.actions)===void 0?{}:{actions:J(e.actions)}}))n.push(ae(t));return n}function Tn(e){let t=e.systemEventDelivery;if(t===void 0)return{};if(!S(e.delivery))return t.mode===`summary`?{systemEventDelivery:{mode:`instant`}}:{};if(t.mode===`summary`&&ee(t.schedule)===null){let e=h(t.schedule);if(e!==null&&e.times.length>0)return{systemEventDelivery:{...t,schedule:y(e.times,t.schedule.timezone)}}}return{systemEventDelivery:t}}function En(e){if(!Y(e))return null;if(!Ee(e.templateBody))return D.t(`helpers.ruleFormState.summaryWarnNone`,{token:`{{summaryText}}`});let t=e.templateBody;return(e.systemEventDelivery?.mode===`summary`?e.systemEventDelivery.split:void 0)===`section`&&t.trim().length>0&&!/\{\{\s*summaryText\s*\}\}/.test(t)?D.t(`helpers.ruleFormState.summaryWarnSplit`,{token:`{{summaryText}}`}):null}function Y(e){return S(e.delivery)&&e.systemEventDelivery?.mode===`summary`}function Dn(e,t,n=new Set){return wn(e,t).length===0&&ot(e.delivery)&&(!S(e.delivery)||Fn(e)>0)&&w(e)!==`mixed`&&e.name.trim().length>0&&(e.targetIds.length>0||e.targetUsers.length>0)&&an(e.actions,n).length===0}function On(e,t){let n=Nn(e.conditions,t);return S(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&&x(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 m(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=Ce.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=w({delivery:t,conditions:e})){let i=n.length===0?null:new Set(n.filter(e=>e.id!==`schedule`&&ye(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=Bt(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=w(e),c=b(s),l=ce(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),_=Bn(g,e.delivery,n,s);return{name:e.name.trim(),enabled:e.enabled,delivery:e.delivery,conditions:{..._,...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?{image:e.mediaImage,...e.mediaShowTriggerZone&&e.mediaImage!==`crop`&&e.mediaImage!==`none`&&pe(_).length>0?{showTriggerZone:!0}:{},...e.mediaShowSubjectPath&&e.mediaImage!==`none`&&he(s)?{showSubjectPath:!0}:{},...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.mediaImage!==`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}:{}}:{image:`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`,get label(){return D.t(`helpers.ruleFormTabs.tab_rule`)},fields:[`name`,`enabled`,`delivery`,`groupingSec`,`targetIds`,`targetUsers`,`targetParams`]},{key:`devices`,get label(){return D.t(`helpers.ruleFormTabs.tab_devices`)},fields:[`deviceScope`]},{key:`conditions`,get label(){return D.t(`helpers.ruleFormTabs.tab_conditions`)},fields:[`conditions`,`classScope`,`schedule`,`systemEventDelivery`]},{key:`notification`,get label(){return D.t(`helpers.ruleFormTabs.tab_notification`)},fields:[`priority`,`mediaImage`,`mediaShowTriggerZone`,`mediaShowSubjectPath`,`mediaGif`,`mediaClip`,`mediaProfile`,`mediaClipSpeed`,`mediaLinkedCameras`,`templateTitle`,`templateBody`]},{key:`actions`,get label(){return D.t(`helpers.ruleFormTabs.tab_actions`)},fields:[`actions`]},{key:`advanced`,get label(){return D.t(`helpers.ruleFormTabs.tab_advanced`)},fields:[`snoozeAllowGlobal`,`snoozeOptions`,`cooldownSec`,`cooldownScope`,`cooldownGranularity`]}];function Jn(e,t={}){let n=w({delivery:e,conditions:t}),r=b(n),i=qn.map(e=>e.key===`conditions`?{...e,label:r.label}:e);return fe(n)?i.filter(e=>e.key!==`devices`):i}function Yn(e){if(e.audio!==void 0)return D.t(`helpers.ruleFormTabs.condSound`);if(e.occupancy!==void 0)return D.t(`helpers.ruleFormTabs.condOccupancy`)}function Xn(e){let t=w(e),n=ge(yn(e),t);return t===`sensor`&&e.conditions.sensorTransition!==void 0&&!F(`sensorTransition`,e.conditions)?[...n,{conditionId:`sensorTransition`,reason:ne}]: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}=O(),t=$n(e.language);return e=>_e(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(ke,{devices:e,listState:t.state,fleet:t,value:n,onChange:r,emptyMeansAll:i,savedHadDevices:a})}function rr({value:e,placeholder:t,onChange:i}){let{t:a}=O(),[s,l]=n(``),u=()=>{let t=s.trim();if(t.length===0||e.includes(t)){l(``);return}i([...e,t]),l(``)},d=t=>i(e.filter(e=>e!==t));return r(`div`,{className:`mt-1 space-y-1.5`,children:[e.length>0&&o(`div`,{className:`flex flex-wrap gap-1`,children:e.map(e=>r(`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:()=>d(e),"aria-label":a(`system.notificationConditionWidgets.remove`,`remove {{v}}`,{v:e}),className:`text-foreground-subtle hover:text-danger`,children:o(c,{className:`h-3 w-3`})})]},e))}),o(E,{value:s,placeholder:t,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),u())},onBlur:u})]})}function ir({picker:e,value:n,onChange:i}){let{t:a}=O(),s=t(()=>ie(e),[e]),c=t(()=>new Set(n),[n]),l=n.filter(e=>!s.has(e)),u=e=>{i(c.has(e)?n.filter(t=>t!==e):[...n,e])};return r(`div`,{className:`space-y-2`,children:[l.length>0&&o(`div`,{className:`flex flex-wrap gap-1`,children:l.map(e=>r(`button`,{type:`button`,onClick:()=>i(n.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:a(`system.notificationConditionWidgets.customValueClickToRemove`,`Custom value — click to remove`),children:[e,` ×`]},e))}),e.groups.map(e=>r(`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=c.has(e.value);return o(`button`,{type:`button`,"aria-pressed":t,onClick:()=>u(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:t,max:n,step:i,onChange:a}){let{t:s}=O();return r(`div`,{className:`mt-1 flex items-center gap-2`,children:[o(E,{type:`number`,value:e??``,min:t,max:n,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&&n!==void 0&&o(`input`,{type:`range`,min:t,max:n,step:i,value:e,onChange:e=>a(Number(e.target.value)),className:`flex-1 accent-primary`,"aria-label":s(`common.valueWord`)})]})}function or({value:e,onChange:t,options:n}){let{t:i}=O(),a=sr(n??[]),s=a.length>0?a:Dt;return r(`div`,{className:`mt-1 space-y-1`,children:[o(T,{value:e??`enter`,options:s.map(e=>({value:e.value,label:i(`notificationRules.crossing.${e.value}`,e.label)})),onChange:e=>t(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`?Ot: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}=A(e,t);return o(j,{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{t:r}=O(),{options:i,loading:a}=Ye(e);return o(j,{options:i,value:t,onChange:n,loading:a,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:r(`system.notificationConditionWidgets.eventToken`,`Event token…`)})}var ur=[{value:`became-occupied`,labelKey:`system.notificationConditionWidgets.opBecameOccupied`},{value:`became-free`,labelKey:`system.notificationConditionWidgets.opBecameFree`},{value:`>=`,labelKey:`system.notificationConditionWidgets.opCountAtLeast`},{value:`<=`,labelKey:`system.notificationConditionWidgets.opCountAtMost`}];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:D.t(`system.notificationConditionWidgets.subTypeNeverCountsAlways`,`{{stored}} — sub-type, never counts (always 0)`,{stored:t})}]}function fr({deviceIds:e,cameras:t,classOptions:n,value:i,onChange:a}){let{t:s}=O(),{options:c,loading:l}=A(e,t),u=i??be,d=e=>a({...u,...e}),f=u.op===`became-occupied`||u.op===`became-free`,p=dr(n,u.className);return r(`div`,{className:`mt-1 space-y-1.5`,children:[r(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[o(`div`,{className:`min-w-[10rem]`,children:o(T,{value:u.zoneId??``,options:[{value:``,label:l?s(`system.notificationConditionWidgets.loadingZones`,`Loading zones…`):s(`system.notificationConditionWidgets.wholeFrame`,`— whole frame —`)},...c.map(e=>({value:e.value,label:e.label}))],onChange:e=>d({zoneId:e.target.value===``?void 0:e.target.value})})}),o(`div`,{className:`min-w-[9rem]`,children:o(T,{value:u.className??``,options:[{value:``,label:s(`system.notificationConditionWidgets.anyClass`,`— any class —`)},...p],onChange:e=>d({className:e.target.value===``?void 0:e.target.value})})}),o(`div`,{className:`min-w-[9rem]`,children:o(T,{value:u.op,options:ur.map(e=>({value:e.value,label:s(e.labelKey)})),onChange:e=>{let t=ur.find(t=>t.value===e.target.value);t&&d({op:t.value})}})})]}),r(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-foreground-subtle`,children:[r(`label`,{className:`flex items-center gap-1`,children:[f?s(`system.notificationConditionWidgets.threshold`,`Threshold`):s(`system.notificationConditionWidgets.count`,`Count`),o(E,{type:`number`,min:0,className:`w-16`,value:String(u.count),onChange:e=>d({count:Math.max(0,Number(e.target.value)||0)})})]}),r(`label`,{className:`flex items-center gap-1`,children:[s(`system.notificationConditionWidgets.holdFor`,`Hold for`),o(E,{type:`number`,min:0,max:3600,className:`w-16`,value:String(u.sustainSeconds),onChange:e=>d({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:s(`system.notificationConditionWidgets.clear`,`Clear`)})]}),e.length===0&&o(`p`,{className:`text-[11px] text-warning`,children:s(`system.notificationConditionWidgets.noCameraPickedOnThe`,`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:s(`system.notificationConditionWidgets.countsConfirmedTrackedObjectsFrom`,`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`,labelKey:`system.notificationConditionWidgets.audioModeLabel`,Icon:l},{value:`level`,labelKey:`system.notificationConditionWidgets.audioModeLevel`,Icon:d}];function mr({taxonomy:e,value:t,onChange:n}){let{t:a}=O(),s=ue(t),c=e=>n(le(t,e)),{choices:l,unknownLabels:u}=De(e,s.labels),d=p(t)??`label`;return r(`div`,{className:`mt-1 space-y-2`,children:[r(`div`,{className:`flex flex-wrap items-center gap-1`,children:[pr.map(e=>o(`button`,{type:`button`,"aria-pressed":d===e.value,onClick:()=>c({mode:e.value}),className:`rounded border px-2 py-0.5 text-[11px] ${d===e.value?`border-primary bg-primary/15 text-foreground`:`border-border text-foreground-subtle hover:bg-surface-hover`}`,children:r(`span`,{className:`inline-flex items-center gap-1`,children:[o(e.Icon,{className:`h-3 w-3`}),a(e.labelKey)]})},e.value)),t===void 0?null:o(`button`,{type:`button`,onClick:()=>n(void 0),className:`ml-1 text-xs text-foreground-subtle underline hover:text-foreground`,children:a(`system.notificationConditionWidgets.clear`,`Clear`)})]}),d===`label`?r(i,{children:[o(`div`,{className:`flex flex-wrap gap-1`,children:l.map(e=>{let t=_(s.labels,e.value),n=e.unknown?`border-dashed border-warning text-warning`:t?`border-primary bg-primary/15 text-foreground`:`border-border text-foreground hover:bg-surface-hover`;return o(`button`,{type:`button`,"aria-pressed":t,title:e.unknown?a(`system.notificationConditionWidgets.storedByTheRuleNot`,`Stored by the rule — not offered by this hub`):void 0,onClick:()=>c({labels:de(s.labels,e.value)}),className:`rounded border px-1.5 py-0.5 text-[10px] ${n}`,children:r(`span`,{className:`inline-flex items-center gap-1`,children:[o(Ae,{iconId:e.iconId,size:12}),e.label]})},e.value)})}),u.length>0&&r(`p`,{className:`text-[10px] text-warning`,children:[a(`system.notificationConditionWidgets.keptFromTheRuleUnknown`,`Kept from the rule, unknown to this hub:`),` `,u.join(`, `)]}),r(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-foreground-subtle`,children:[r(`label`,{className:`flex items-center gap-1`,children:[a(`system.notificationConditionWidgets.confirmAfter`,`Confirm after`),o(E,{type:`number`,min:1,max:20,step:1,className:`w-16`,value:String(s.confirmHits??2),onChange:e=>c({confirmHits:Number(e.target.value)})}),a(`system.notificationConditionWidgets.frames`)]}),r(`label`,{className:`flex items-center gap-1`,children:[a(`system.notificationConditionWidgets.within`),o(E,{type:`number`,min:1,max:60,step:1,className:`w-16`,value:String(s.confirmWindowSec??5),onChange:e=>c({confirmWindowSec:Number(e.target.value)})}),`s`]})]}),o(`p`,{className:`text-[11px] text-foreground-subtle`,children:a(`system.notificationConditionWidgets.audioConfirmHint`,{hits:2,window:5})})]}):r(i,{children:[o(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-foreground-subtle`,children:r(`label`,{className:`flex items-center gap-1`,children:[a(`system.notificationConditionWidgets.louderThan`,`Louder than`),o(E,{type:`number`,min:g,max:0,step:3,className:`w-20`,value:String(s.dbThreshold??te),onChange:e=>c({dbThreshold:Number(e.target.value)})}),`dBFS`]})}),r(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-foreground-subtle`,children:[r(`label`,{className:`flex items-center gap-1`,children:[a(`system.notificationConditionWidgets.hits`,`Hits`),o(E,{type:`number`,min:1,max:100,step:5,className:`w-16`,value:String(s.hitPercent),onChange:e=>c({hitPercent:Number(e.target.value)})}),a(`system.notificationConditionWidgets.hitsPercentDefault`,{value:v.hitPercent})]}),r(`label`,{className:`flex items-center gap-1`,children:[a(`system.notificationConditionWidgets.over`),o(E,{type:`number`,min:1,max:300,step:5,className:`w-16`,value:String(s.samplingSeconds),onChange:e=>c({samplingSeconds:Number(e.target.value)})}),a(`system.notificationConditionWidgets.secondsDefault`,{value:v.samplingSeconds})]})]}),o(`p`,{className:`text-[11px] text-foreground-subtle`,children:a(`system.notificationConditionWidgets.dbfsHint`,{min:g})})]}),se(t)?o(`p`,{className:`text-[11px] text-warning`,children:a(`system.notificationConditionWidgets.withNeitherASoundNor`,`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:t}){let{t:n}=O(),i=e?.values??[],a=e?.maxDistance??1,s=e=>t(e.length>0?{values:e,maxDistance:a}:void 0),c=e=>t(i.length>0?{values:i,maxDistance:e}:void 0),l=Ze().filter(e=>!i.includes(e));return r(`div`,{className:`mt-1 space-y-1.5`,children:[o(rr,{value:i,placeholder:n(`system.notificationConditionWidgets.plateText`,`Plate text…`),onChange:s}),l.length>0&&r(`div`,{className:`flex flex-wrap items-center gap-1`,children:[o(`span`,{className:`text-[10px] text-foreground-subtle`,children:n(`system.notificationConditionWidgets.seen`,`Seen:`)}),l.slice(0,12).map(e=>o(`button`,{type:`button`,onClick:()=>s([...i,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))]}),r(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[n(`system.notificationConditionWidgets.maxDistance`,`Max distance`),o(E,{type:`number`,min:0,max:3,step:1,value:a,className:`max-w-[5rem]`,onChange:e=>{let t=Number(e.target.value);c(Number.isFinite(t)?Math.max(0,Math.min(3,t)):1)}})]})]})}function gr({gateable:e,value:t,onChange:n}){let{t:i}=O(),a=er(),s=e.find(e=>e.id===t?.deviceId),c=new Set(t?.states??[]),l=e=>{let t=Number(e);if(!Number.isFinite(t)||t===0)return n(void 0);n({deviceId:t,states:[]})},u=e=>{if(t===void 0)return;let r=new Set(c);r.has(e)?r.delete(e):r.add(e),n(r.size===0?void 0:{deviceId:t.deviceId,states:[...r]})};return r(`div`,{className:`mt-1 space-y-2`,children:[o(T,{value:t===void 0?``:String(t.deviceId),options:[{value:``,label:i(`system.notificationConditionWidgets.noDeviceGate`,`— no device gate —`)},...e.map(e=>({value:String(e.id),label:e.name}))],onChange:e=>l(e.target.value)}),s!==void 0&&o(`div`,{className:`flex flex-wrap gap-1.5`,children:s.states.map(e=>o(`button`,{type:`button`,onClick:()=>u(e),className:c.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:a(e)},e))}),s!==void 0&&s.states.length===0&&o(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:i(`system.notificationConditionWidgets.thisDeviceReportsNoState`,`This device reports no state the gate can read, so it cannot arm a rule.`)}),t!==void 0&&o(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:i(`system.notificationConditionWidgets.theRuleIsSilentWhile`,`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:t,onChange:n}){let{t:i}=O(),a=er(),s=e.find(e=>e.sceneId===t?.sceneId),c=r=>{if(r===``)return n(void 0);let i=e.find(e=>e.sceneId===r);if(i===void 0)return n(void 0);n({sceneId:r,deviceId:i.deviceId,requiredState:t?.requiredState??`diverged`,...t?.latched===void 0?{}:{latched:t.latched}})},l=e=>{t!==void 0&&n({...t,requiredState:e===`matched`?`matched`:`diverged`})},u=e=>{if(t!==void 0){if(e===``){let{latched:e,...r}=t;return n(r)}n({...t,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.`)}):r(`div`,{className:`mt-1 space-y-2`,children:[o(T,{value:t?.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)}),t!==void 0&&r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[i(`notificationRules.scene.onlyWhile`,`Only while it is`),o(T,{value:t.requiredState,options:[{value:`diverged`,label:a(`diverged`)},{value:`matched`,label:a(`matched`)}],onChange:e=>l(e.target.value)})]}),r(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[i(`notificationRules.scene.read`,`Read`),o(T,{value:t.latched===void 0?``:t.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&&r(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:[i(`notificationRules.scene.rightNow`,`Right now:`),` `,_r(s,a)]}),t!==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,get label(){return D.t(`helpers.notificationSystemEventDelivery.wd_mon`)}},{value:2,get label(){return D.t(`helpers.notificationSystemEventDelivery.wd_tue`)}},{value:3,get label(){return D.t(`helpers.notificationSystemEventDelivery.wd_wed`)}},{value:4,get label(){return D.t(`helpers.notificationSystemEventDelivery.wd_thu`)}},{value:5,get label(){return D.t(`helpers.notificationSystemEventDelivery.wd_fri`)}},{value:6,get label(){return D.t(`helpers.notificationSystemEventDelivery.wd_sat`)}},{value:0,get label(){return D.t(`helpers.notificationSystemEventDelivery.wd_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?D.t(`helpers.notificationSystemEventDelivery.dropped`,{parts: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}}var Ar=`Always active — add a window to restrict when the rule fires.`;function jr({value:e,onChange:t,mode:n=`windows`,defaultMinute:r=Q.minute,emptyHint:i}){return n===`times`?o(Nr,{value:e,onChange:t,defaultMinute:r}):o(Mr,{value:e,onChange:t,emptyHint:i??Ar})}function Mr({value:e,onChange:t,emptyHint:n}){let{t:i}=O(),a=e?.windows??[],s=e?.invert??!1,c=(n,r)=>{if(n.length===0){t(void 0);return}t({windows:n,...r?{invert:!0}:{},...e?.timezone?{timezone:e.timezone}:{}})},l=()=>c([...a,Or()],s),d=e=>c(a.filter((t,n)=>n!==e),s),f=(e,t)=>c(a.map((n,r)=>r===e?t:n),s);return r(`div`,{className:`mt-1 space-y-2`,"data-testid":`schedule-field-windows`,children:[a.length===0?o(`p`,{className:Z,children:n}):a.map((e,t)=>o(Pr,{window:e,onChange:e=>f(t,e),onRemove:()=>d(t)},t)),r(`div`,{className:`flex items-center gap-3`,children:[r(`button`,{type:`button`,onClick:l,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(u,{className:`h-3 w-3`}),` `,i(`system.notificationScheduleField.addWindow`)]}),a.length>0&&r(`label`,{className:`flex items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[o(`input`,{type:`checkbox`,checked:s,onChange:e=>c([...a],e.target.checked),className:`accent-primary`}),i(`system.notificationScheduleField.activeOutsideTheWindows`,`Active outside the windows`)]})]})]})}function Nr({value:e,onChange:t,defaultMinute:n}){let{t:i}=O(),a=e?.timezone,s=e===void 0?{times:[],approximated:!1}:h(e);if(s===null)return r(`div`,{className:`mt-1 space-y-2`,"data-testid":`schedule-field-times-fallback`,children:[o(`p`,{className:Z,children:i(`system.notificationScheduleField.invertedScheduleShownAsBands`,`Inverted schedule — shown as bands. Clear the invert flag (or the windows) to author punctual times.`)}),o(Mr,{value:e,onChange:t,emptyHint:Ar})]});let c=s.times,l=e=>{if(e.length===0){t(void 0);return}t(y(e,a))};return r(`div`,{className:`mt-1 space-y-2`,"data-testid":`schedule-field-times`,children:[s.approximated&&o(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,"data-testid":`schedule-field-times-approximated`,children:i(`system.notificationScheduleField.shownAsSendAtTimes`,`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.`)}),c.length===0?o(`p`,{className:Z,children:i(`system.notificationScheduleField.noTimesYetAddOne`,`No times yet — add one to send on those days at that clock time.`)}):c.map((e,t)=>o(Fr,{time:e,index:t,onChange:e=>l(c.map((n,r)=>r===t?e:n)),onRemove:c.length>1?()=>l(c.filter((e,n)=>n!==t)):void 0},t)),r(`button`,{type:`button`,onClick:()=>l([...c,kr(n)]),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(u,{className:`h-3 w-3`}),` `,i(`system.notificationScheduleField.addTime`)]})]})}function Pr({window:e,onChange:t,onRemove:n}){let{t:i}=O();return r(`div`,{className:`space-y-1.5 rounded-md border border-border p-2`,children:[r(`div`,{className:`flex items-center gap-2 text-xs`,children:[o(`input`,{type:`time`,value:Er(e.startMinute),onChange:n=>t({...e,startMinute:Dr(n.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:n=>t({...e,endMinute:Dr(n.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:n,"aria-label":i(`system.notificationScheduleField.removeWindow`,`Remove window`),className:`text-foreground-subtle hover:text-danger`,children:o(s,{className:`h-3.5 w-3.5`})})]}),o(Ir,{days:e.days,onToggle:n=>{let r=e.days.includes(n)?e.days.filter(e=>e!==n):[...e.days,n];r.length!==0&&t({...e,days:r})}})]})}function Fr({time:e,index:t,onChange:n,onRemove:i}){let{t:a}=O();return r(`div`,{className:`space-y-1.5 rounded-md border border-border p-2`,children:[r(`div`,{className:`flex items-center gap-2 text-xs`,children:[o(`span`,{className:`text-foreground-subtle`,children:a(`system.notificationScheduleField.at`,`At`)}),o(`input`,{type:`time`,value:br(e.minute),onChange:t=>n({...e,minute:$(t.target.value)}),className:`rounded-md border border-border bg-background px-1 py-0.5`,"data-testid":`schedule-field-time-${String(t)}`}),o(`span`,{className:`flex-1`}),i!==void 0&&o(`button`,{type:`button`,onClick:i,"aria-label":a(`system.notificationScheduleField.removeTime`,`Remove time`),className:`text-foreground-subtle hover:text-danger`,children:o(s,{className:`h-3.5 w-3.5`})})]}),o(Ir,{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 Ir({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{Jt as $,A as $t,fn as A,Tt as At,xn as B,St as Bt,Qn as C,ht as Ct,Wn as D,wt as Dt,Gn as E,N as Et,_n as F,tt as Ft,K as G,nt as Gt,pn as H,mt as Ht,Dn as I,At as It,on as J,bt as Jt,q as K,it as Kt,gn as L,ot as Lt,Pn as M,F as Mt,Sn as N,pt as Nt,zn as O,kt as Ot,bn as P,et as Pt,an as Q,Xe as Qt,Y as R,ct as Rt,Xn as S,ft as St,Kn as T,yt as Tt,En as U,vt as Ut,Cn as V,Mt as Vt,un as W,gt as Wt,cn as X,rt as Xt,sn as Y,Et as Yt,ln as Z,j as Zt,rr as _,V as _t,Tr as a,Ie as an,Zt as at,Zn as b,jt as bt,nr as c,Ve as cn,Ut as ct,Z as d,Le as dn,Wt as dt,Ue as en,G as et,tr as f,Pe as fn,Vt as ft,vr as g,R as gt,hr as h,qe as hn,H as ht,wr as i,Fe as in,$t as it,kn as j,Ct as jt,dn as k,st as kt,gr as l,Ke as ln,Lt as lt,fr as m,Je as mn,Kt as mt,Q as n,Ne as nn,tn as nt,mr as o,He as on,Qt as ot,ar as p,We as pn,Gt as pt,J as q,xt as qt,Cr as r,Ge as rn,W as rt,or as s,ze as sn,Xt as st,jr as t,Re as tn,en as tt,lr as u,Be as un,qt as ut,ir as v,zt as vt,Jn as w,Qe as wt,Yn as x,_t as xt,cr as y,P as yt,wn as z,lt as zt};
|