@camstack/addon-admin-ui 1.2.633 → 1.2.635
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/CHANGELOG.md +19 -0
- package/dist/assets/Addons-it-7xyWO.js +5 -0
- package/dist/assets/{AdminPage-qJOk9zLV.js → AdminPage-C28MWSEJ.js} +1 -1
- package/dist/assets/{AdminSectionedPage-6ia7-NOq.js → AdminSectionedPage-N7ZzoaCA.js} +1 -1
- package/dist/assets/AiProfiles-DvvGmPqc.js +3 -0
- package/dist/assets/Authentication-CdkAuFpQ.js +1 -0
- package/dist/assets/Build-Dj-J_LDL.js +39 -0
- package/dist/assets/Calendars-Bl2YxKcY.js +1 -0
- package/dist/assets/{CameraGrids-6qF94V5t.js → CameraGrids-BmuQfQwD.js} +1 -1
- package/dist/assets/Cluster-BHVazygn.js +1 -0
- package/dist/assets/CompositionBlockEditor-BJo6-Hg-.js +2 -0
- package/dist/assets/{CompositionEditorPage-CWZ3xs4r.js → CompositionEditorPage-CSgC3j3b.js} +1 -1
- package/dist/assets/Data-DMpGwsud.js +2 -0
- package/dist/assets/DeviceDetail-C5qPLFqX.js +2 -0
- package/dist/assets/{Devices-BOH8vYTs.js → Devices-DfUS0XHQ.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-C_vCpba9.js → EmbedPlayerPage-CXqkku3M.js} +1 -1
- package/dist/assets/History-Bu9dClRP.js +1 -0
- package/dist/assets/Identity-P-9FfQY9.js +1 -0
- package/dist/assets/InstancesTable-D2wYEpEv.js +1 -0
- package/dist/assets/IntegrationDetail-Ckv-pM-X.js +1 -0
- package/dist/assets/Integrations-BAN_fC9m.js +1 -0
- package/dist/assets/Integrations-DM8ICLWP.js +2 -0
- package/dist/assets/{Library-CjMpU1z4.js → Library-Boz_glAa.js} +1 -1
- package/dist/assets/Locations-G2ggYLH1.js +3 -0
- package/dist/assets/{Logs-DdYenNXH.js → Logs-BUWUMnM2.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-BUlGep7c.js → MaskShapeCanvas-GSzxL0sb.js} +1 -1
- package/dist/assets/{MotionZonesSettings-D-p5zCf3.js → MotionZonesSettings-zuXI8WDy.js} +1 -1
- package/dist/assets/MyAccess-BEvsl84G.js +2 -0
- package/dist/assets/Network-Q3AVjSDy.js +1 -0
- package/dist/assets/NodeAddonsSettingsPanel-DY9KrknX.js +1 -0
- package/dist/assets/Notifications-B09FRQLf.js +1 -0
- package/dist/assets/{Pipeline-6wFxNxvt.js → Pipeline-DzMkRdB8.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-Dg6-TYO8.js → PrivacyMaskSettings-B4NUHvPx.js} +1 -1
- package/dist/assets/Recordings-d918Fao6.js +1 -0
- package/dist/assets/{ScanSubnetEditor-OCs9fxGF.js → ScanSubnetEditor-C7Np_Myd.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-BN2MUyfb.js → SceneMonitorEditor-D5EfTLG4.js} +1 -1
- package/dist/assets/SessionsList--ByXUdry.js +2 -0
- package/dist/assets/{Showroom-WT2aGukX.js → Showroom-CpQU2YYQ.js} +1 -1
- package/dist/assets/{StorageLocationsTable-v7uRI6wX.js → StorageLocationsTable-Cb-zvsAa.js} +1 -1
- package/dist/assets/{System-C-Wi0R37.js → System-c-od2eUi.js} +1 -1
- package/dist/assets/{Templates-BM9fxZRe.js → Templates-DbOHcEoP.js} +1 -1
- package/dist/assets/{Terminal-C847xq6i.js → Terminal-vgjKTZ6i.js} +3 -3
- package/dist/assets/{TrainingProviders-BH0hkh_G.js → TrainingProviders-DwApoYD1.js} +1 -1
- package/dist/assets/{Viewer-QrN8oh5h.js → Viewer-wmQSDFx4.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CwnnOJMX.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BJYMJYN7.js} +1 -1
- package/dist/assets/{action-draft-Crz0i79d.js → action-draft-SrqFGFVW.js} +1 -1
- package/dist/assets/{ai-page.helpers-Be8k9kZ4.js → ai-page.helpers-C_Yr1xBa.js} +1 -1
- package/dist/assets/{archive-DGPpEtwM.js → archive-CnD3EIbI.js} +1 -1
- package/dist/assets/{assignment-candidates-ClbN3vh0.js → assignment-candidates-JnnkKMNk.js} +1 -1
- package/dist/assets/{authed-media-CUTTPdjp.js → authed-media-b_KsU6o6.js} +1 -1
- package/dist/assets/{bell-off-BaiHllVH.js → bell-off-DXoIeft3.js} +1 -1
- package/dist/assets/{board-model-Ccqx56nE.js → board-model-Dhq6ifuR.js} +1 -1
- package/dist/assets/{boxes-DnnTX6mW.js → boxes-2HiFvbRi.js} +1 -1
- package/dist/assets/{calendar-clock-NTy1EQqz.js → calendar-clock-BdVpCjGZ.js} +1 -1
- package/dist/assets/{circle-arrow-up-Cllm80_u.js → circle-arrow-up-DtE1a3jK.js} +1 -1
- package/dist/assets/circle-slash-DD5DGeBE.js +1 -0
- package/dist/assets/client-DtixJSIH.js +839 -0
- package/dist/assets/create-composition-CdHcgM5T.js +2 -0
- package/dist/assets/crop-DtJsKDRR.js +1 -0
- package/dist/assets/{database-zap-A6aYF05g.js → database-zap-hwvWqFAr.js} +1 -1
- package/dist/assets/{device-integration-icon-DVMYz-vI.js → device-integration-icon-JcbJW-sx.js} +1 -1
- package/dist/assets/device-picker-model-BhZ3nUKX.js +1 -0
- package/dist/assets/dist-DN98Ncd8.js +839 -0
- package/dist/assets/{dist-Bc83aezd.js → dist-DtXy-_hV.js} +1 -1
- package/dist/assets/{eraser-CPpEl9FB.js → eraser-0igUeEn4.js} +1 -1
- package/dist/assets/{file-up-EKvcLASy.js → file-up-Bim5lEKk.js} +1 -1
- package/dist/assets/{format-BvHHmnnW.js → format-ClefNnBA.js} +1 -1
- package/dist/assets/{framework-packages-DoBKjjer.js → framework-packages-B0ugw-Ay.js} +1 -1
- package/dist/assets/{hard-drive-download-CBedquYl.js → hard-drive-download-BqaDoqeT.js} +1 -1
- package/dist/assets/{hostInit-BGVjaa92.js → hostInit-Zt1c3yOY.js} +1 -1
- package/dist/assets/i18n-xBJb_nV7.js +1 -0
- package/dist/assets/icons-DWvhrrHw.js +1 -0
- package/dist/assets/index-BZIzoUuI.css +2 -0
- package/dist/assets/index-IUYaCNr3.js +4 -0
- package/dist/assets/{key-Dks99Kuc.js → key-OpPYfUdn.js} +1 -1
- package/dist/assets/{languages-D8mCMm-X.js → languages-NKFv36FH.js} +1 -1
- package/dist/assets/{layers-CyOvLvrD.js → layers-BYYEeSk8.js} +1 -1
- package/dist/assets/{link-2-off-CCNPt42m.js → link-2-off-BQUSK1Q1.js} +1 -1
- package/dist/assets/{linked-devices-model-xeSRaZ5b.js → linked-devices-model-CNibZiAj.js} +1 -1
- package/dist/assets/{memory-stick-RflhALyu.js → memory-stick-FrjSgbSx.js} +1 -1
- package/dist/assets/{message-square-plus-sPbUjNji.js → message-square-plus-R1KzFT_3.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-85ddd095.js → mf-entry-bootstrap-0-b11ec2f0.js} +2 -2
- package/dist/assets/{mic-off-Cf-DmhrZ.js → mic-off-D-uv270W.js} +1 -1
- package/dist/assets/{monitor-off-DGKq_9gK.js → monitor-off-23GJfNCk.js} +1 -1
- package/dist/assets/{monitor-smartphone-DBKTTNaQ.js → monitor-smartphone-Bv9btLO7.js} +1 -1
- package/dist/assets/mount-BhZ3nUKX.js +1 -0
- package/dist/assets/{notification-rule-status-Dr5Ltfqw.js → notification-rule-status-CSdUF_tS.js} +1 -1
- package/dist/assets/{player-overlays-BKIlLQtG.js → player-overlays-DS6dT7SD.js} +1 -1
- package/dist/assets/remoteEntry-C8Nu6Wkp.js +1 -0
- package/dist/assets/{ruler-B8ZZMxwR.js → ruler-B5-PAq3K.js} +1 -1
- package/dist/assets/{scan-eye-D1ZsIGgI.js → scan-eye-B6Jzl98g.js} +1 -1
- package/dist/assets/{scissors-DwgJrnip.js → scissors-DSuf9Nu7.js} +1 -1
- package/dist/assets/{search-x-Bj7fMm_4.js → search-x-DikQGG4z.js} +1 -1
- package/dist/assets/{send-DyRREUxn.js → send-DjOMX7BE.js} +1 -1
- package/dist/assets/{settings-2-B8eP_-6i.js → settings-2-RGt6KSqH.js} +1 -1
- package/dist/assets/{shapes-4U4P5B81.js → shapes-C2fW7MJb.js} +1 -1
- package/dist/assets/{sigma-HiZmJE9-.js → sigma-BhKqPZ7F.js} +1 -1
- package/dist/assets/src-D1sUPCi1.js +169 -0
- package/dist/assets/{sso-popup-C4lkcIhh.js → sso-popup-C1hR2YBu.js} +1 -1
- package/dist/assets/{step-inspector-model-lh7rNx6M.js → step-inspector-model-BuQhYJra.js} +1 -1
- package/dist/assets/{table-2-CiaXJiWX.js → table-2-CMyjawoR.js} +1 -1
- package/dist/assets/{timer-reset-Ceu_GJmW.js → timer-reset-B7vcTXYk.js} +1 -1
- package/dist/assets/{ungroup-ErdVuJVk.js → ungroup-cZrrI4SI.js} +1 -1
- package/dist/assets/{unlink-BPj-qE3a.js → unlink-CU8i3fPe.js} +1 -1
- package/dist/assets/{usb-CcWPr3D2.js → usb-CZTccxRm.js} +1 -1
- package/dist/assets/{use-scenes-feed-GqqV5spb.js → use-scenes-feed-DzJr-F4l.js} +1 -1
- package/dist/assets/{use-stationary-objects-cBSXDbXO.js → use-stationary-objects-DWdYOvvX.js} +1 -1
- package/dist/assets/{useAdminDeviceRemoval-Cdkfxxp-.js → useAdminDeviceRemoval-BRmWRglP.js} +1 -1
- package/dist/assets/useEventInvalidation-BhZ3nUKX.js +1 -0
- package/dist/assets/useNodeUrlSelection-BHycntFj.js +1 -0
- package/dist/assets/useTemplateSave-BIt_84s3.js +1 -0
- package/dist/assets/user-round-Cdt6x46z.js +1 -0
- package/dist/assets/{user-x-DEwjaZ8m.js → user-x-C8J-JEQi.js} +1 -1
- package/dist/assets/{variable-BRyqOw_Y.js → variable-B1tjLNN5.js} +1 -1
- package/dist/assets/{video-KcKb1EGQ.js → video-lKXIQOeO.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DYoAuAOy.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-aKVCr1TV.js} +2 -2
- package/dist/index.html +10 -10
- package/dist/server/addon.js +487 -190
- package/package.json +2 -2
- package/dist/assets/Addons-DAtKqTxT.js +0 -5
- package/dist/assets/AiProfiles-DXlOmw6q.js +0 -3
- package/dist/assets/Authentication-DG_r2ZOT.js +0 -1
- package/dist/assets/Build-BWUDROVR.js +0 -39
- package/dist/assets/Calendars-wR9C5_Q6.js +0 -1
- package/dist/assets/Cluster-BBoz1LE8.js +0 -1
- package/dist/assets/CompositionBlockEditor-DXLfPQlx.js +0 -2
- package/dist/assets/Data-g7Kbrph5.js +0 -2
- package/dist/assets/DeviceDetail-B2c4ckLc.js +0 -2
- package/dist/assets/History-BsjInzOS.js +0 -1
- package/dist/assets/Identity-BgGgOHnB.js +0 -1
- package/dist/assets/InstanceSwitchCell-BQoXIdUa.js +0 -1
- package/dist/assets/InstancesTable-CNSVtHMp.js +0 -1
- package/dist/assets/IntegrationDetail-BrNTNbjW.js +0 -1
- package/dist/assets/IntegrationHub-Bf1lt0KM.js +0 -1
- package/dist/assets/Integrations-93yE-RaT.js +0 -2
- package/dist/assets/Integrations-Cr9Rw6WQ.js +0 -1
- package/dist/assets/Locations-C1_w99Cs.js +0 -3
- package/dist/assets/MyAccess-D0-76Kec.js +0 -2
- package/dist/assets/Network-DbuDxhSk.js +0 -1
- package/dist/assets/NodeAddonsSettingsPanel-CsKoP3i9.js +0 -1
- package/dist/assets/Notifications-CEA9sMPD.js +0 -1
- package/dist/assets/Recordings-BetXUQK1.js +0 -1
- package/dist/assets/SessionsList-CYT6gOnD.js +0 -2
- package/dist/assets/circle-slash-no8PPK_r.js +0 -1
- package/dist/assets/client-DOy-5eny.js +0 -839
- package/dist/assets/create-composition-sKLGvMam.js +0 -2
- package/dist/assets/crop-DgEmL35-.js +0 -1
- package/dist/assets/device-picker-model-B5S9Xa-E.js +0 -1
- package/dist/assets/dist-V2fdBIvE.js +0 -839
- package/dist/assets/i18n-DS8SDP-9.js +0 -1
- package/dist/assets/icons-BPWrt0Wo.js +0 -1
- package/dist/assets/index-Bs8L45gs.js +0 -4
- package/dist/assets/index-CYCJ_V8d.css +0 -2
- package/dist/assets/key-square-BkCelpwh.js +0 -1
- package/dist/assets/mount-B5S9Xa-E.js +0 -1
- package/dist/assets/remoteEntry-Cl4QxImR.js +0 -1
- package/dist/assets/src-LHvMQiO5.js +0 -169
- package/dist/assets/useEventInvalidation-B5S9Xa-E.js +0 -1
- package/dist/assets/useNodeUrlSelection-DGJHAY81.js +0 -1
- package/dist/assets/useTemplateSave-CSxF4TWe.js +0 -1
- package/dist/assets/user-round-D-hD-jsE.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,K as t,R as n,S as r,V as i,Y as a,et as o,o as s,x as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Di as l,Kt as u,Sa as d,St as f,Tr as p,Vr as m,Y as h,Yt as g,ct as _,ei as v,gt as y,li as b,mi as x,qi as S,ut as C}from"./player-overlays-BKIlLQtG.js";import{Bs as w}from"./client-DOy-5eny.js";import{n as T,t as E}from"./scissors-DwgJrnip.js";import{$o as D,Bf as O,Fu as k,Gl as A,Gr as j,Iu as M,Jn as N,Jr as P,Kr as F,Lf as I,Lu as ee,Mu as te,Nu as ne,Oi as L,Pu as re,Ru as ie,Ti as ae,Vl as oe,Wr as se,Xr as ce,Yn as le,Yr as ue,_d as de,ai as R,bd as fe,cl as pe,dd as me,fd as he,fl as ge,gd as _e,hd as ve,ia as z,ju as ye,ld as B,md as be,mf as V,ml as xe,na as H,oi as U,ol as Se,pd as Ce,ud as we,vd as Te,yd as Ee,yr as W}from"./src-LHvMQiO5.js";import{t as G}from"./i18n-DS8SDP-9.js";import{t as K}from"./useTranslation-BJr-n0es.js";import{O as De,Pr as Oe,S as ke}from"./index-Bs8L45gs.js";import{t as Ae}from"./AdminSectionedPage-6ia7-NOq.js";import{n as je}from"./authed-media-CUTTPdjp.js";import{t as q}from"./format-size-DIxKXxtj.js";import{n as Me,r as Ne,t as Pe}from"./StorageLocationsTable-v7uRI6wX.js";o();var Fe=[{value:`all`,labelKey:`common.all`},{value:`recording`,labelKey:`recordings.activitySection.domainRecordings`},{value:`events`,labelKey:`common.events`}],Ie={recording:`bg-primary/10 text-primary`,events:`bg-violet-500/10 text-violet-400`},Le={columnKey:`at`,dir:`desc`};function Re(e){return new Date(e).toLocaleString()}function ze(){let{t:n,i18n:i}=K(),[o,s]=a(`all`),{data:l,isLoading:f,isError:m}=ne({},{refetchOnWindowFocus:!1}),{data:h,isLoading:g,isError:_}=ge({},{refetchOnWindowFocus:!1}),{data:v}=D({isCamera:!0,projection:`slim`}),y=t(()=>{let e=new Map;for(let t of v??[])e.set(t.id,t.name);return e},[v]),b=t(()=>{let e=[...l??[],...h??[]];return(o===`all`?e:e.filter(e=>e.domain===o)).toSorted((e,t)=>t.at-e.at)},[l,h,o]),x=t(()=>{let e=[];return m&&o!==`events`&&e.push(n(`recordings.activitySection.domainRecordings`)),_&&o!==`recording`&&e.push(n(`common.events`)),e},[m,_,o,n]),S=t(()=>new Intl.ListFormat(i.language,{type:`conjunction`}).format(x),[x,i.language]),C=t(()=>[{key:`at`,header:n(`recordings.activitySection.when`,`When`),nowrap:!0,sortValue:e=>e.at,render:e=>r(`span`,{className:`text-foreground-subtle tabular-nums`,children:Re(e.at)})},{key:`domain`,header:n(`recordings.activitySection.domain`,`Domain`),sortValue:e=>e.domain,render:e=>r(`span`,{className:`inline-flex rounded px-1.5 py-0.5 text-[10px] font-medium ${Ie[e.domain]}`,children:e.domain})},{key:`op`,header:n(`recordings.activitySection.operation`,`Operation`),sortValue:e=>e.op,render:e=>r(`span`,{className:`text-foreground`,children:e.op})},{key:`reason`,header:n(`recordings.activitySection.reason`,`Reason`),sortValue:e=>e.reason,render:e=>r(`span`,{className:`text-foreground-subtle`,children:e.reason})},{key:`device`,header:n(`recordings.activitySection.camera`,`Camera`),sortValue:e=>e.deviceId===null?`cluster`:y.get(e.deviceId)??`#${String(e.deviceId)}`,render:e=>e.deviceId===null?r(`span`,{className:`text-foreground-subtle`,children:n(`common.cluster`)}):r(`span`,{className:`text-foreground`,children:y.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`items`,header:n(`recordings.activitySection.items`,`Items`),align:`right`,nowrap:!0,sortValue:e=>e.itemsAffected,render:e=>r(`span`,{className:`tabular-nums`,children:e.itemsAffected.toLocaleString()})},{key:`bytes`,header:n(`recordings.activitySection.reclaimed`,`Reclaimed`),align:`right`,nowrap:!0,sortValue:e=>e.bytesReclaimed,render:e=>r(`span`,{className:`tabular-nums`,children:e.bytesReclaimed>0?q(e.bytesReclaimed):`—`})}],[y,n]),w=f||g;return e(`div`,{className:`flex flex-col gap-4`,children:[r(`div`,{className:`flex items-center gap-1`,children:Fe.map(e=>r(L,{variant:`unstyled`,onClick:()=>s(e.value),className:`rounded px-2 py-1 text-xs font-medium ${o===e.value?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-muted`}`,children:n(e.labelKey)},e.value))}),w&&b.length===0?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(p,{className:`h-4 w-4 animate-spin`}),n(`recordings.activitySection.loadingActivity`,`Loading activity…`)]}):b.length===0?x.length>0?r(R,{icon:u,title:n(`recordings.activitySection.activityCouldNotBeRead`,`Activity could not be read`),description:n(`recordings.activitySection.theOpsLogDidNot`,`The {{value1}} ops log did not answer. This is not "nothing happened" — retry, or check the node that owns it.`,{value1:S})}):r(R,{icon:d,title:n(`recordings.activitySection.noActivityYet`,`No activity yet`),description:n(`recordings.activitySection.pruneDeleteAndRescanOperations`,`Prune, delete and rescan operations across recordings and events show up here.`)}):e(c,{children:[x.length>0&&e(`p`,{className:`flex items-center gap-1.5 text-[11px] text-amber-500`,children:[r(u,{className:`h-3 w-3 shrink-0`}),n(`recordings.activitySection.domainsMissing`,{count:x.length,names:S})]}),r(N,{columns:C,rows:b,rowKey:e=>e.id,minWidthPx:720,maxBodyHeight:le,defaultSort:Le})]})]})}o();function Be(){let{t:n}=K(),i=D({isCamera:!0,projection:`slim`}),o=t(()=>(i.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[i.data]),[s,c]=a(null),l=s??o[0]?.id??null;return!i.isLoading&&o.length===0?r(R,{icon:S,title:n(`recordings.cameraRecordingSettingsSection.noCameras`,`No cameras`),description:n(`recordings.cameraRecordingSettingsSection.addACameraFirst`,`Add a camera first.`)}):e(`div`,{className:`space-y-3`,children:[e(`div`,{children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:n(`recordings.cameraRecordingSettingsSection.perCameraRecordingRetention`,`Per-camera recording & retention`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:n(`recordings.cameraRecordingSettingsSection.recordingModeScheduleBandsAnd`,`Recording mode, schedule bands and the retention policy for one camera — the same controls as the camera's own Recording tab. Retention is one policy over footage and analytics; per-camera event deletion lives on the Events tab.`)})]}),e(`div`,{className:`flex items-center gap-2`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:n(`recordings.cameraRecordingSettingsSection.camera`,`Camera`)}),r(C,{wrapperClassName:`inline-block w-auto`,value:l??``,onChange:e=>c(Number(e.target.value)),children:o.map(e=>r(`option`,{value:e.id,children:e.name},e.id))})]}),l!==null&&r(ae,{deviceId:l,children:r(De,{deviceId:l,sectionFilter:e=>e.location===`top-tab`&&e.tab===`recording`})},l)]})}function Ve({types:e}){return r(Pe,{kinds:e})}o();var He=`pipeline-analytics`,Ue=`pipeline-analytics`;function We(e){for(let t of e?.sections??[])for(let e of t.fields??[])if(e.key===`postProcessingNodeId`&&typeof e.value==`string`)return e.value;return`hub`}function Ge(){let{t:n}=K(),i=s(),{nodes:a}=I(),{data:o,isLoading:c}=H({addonId:He,cap:Ue,scope:`cluster`}),l=We(o),u=z({onSuccess:()=>{i.invalidateQueries({queryKey:[[`addonSettings`,`getScopedSettings`]]})}}),d=t(()=>{let e=a.filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,l,...e])].filter(Boolean)},[a,l]);return e(`div`,{className:`flex flex-col gap-6`,children:[e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground`,children:n(`pipeline.clusterEventsTab.postProcessingNode`,`Post-processing node`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:n(`pipeline.clusterEventsTab.theSingleNodeThatRuns`,`The single node that runs detection post-processing (events, media, audio & motion). Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`)}),e(`div`,{className:`mt-3 flex items-center gap-2`,children:[c?r(p,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r(C,{wrapperClassName:`inline-block w-auto`,value:l,onChange:e=>{e.target.value!==l&&u.mutate({addonId:He,cap:Ue,scope:`cluster`,patch:{postProcessingNodeId:e.target.value}})},disabled:u.isPending,children:d.map(e=>r(`option`,{value:e,children:e===`hub`?n(`pipeline.clusterEventsTab.hubDefault`,`hub (default)`):e},e))}),u.isPending&&r(p,{className:`h-4 w-4 animate-spin text-primary`})]})]}),e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:n(`pipeline.clusterEventsTab.eventsFolder`,`Events folder`)}),r(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:n(`pipeline.clusterEventsTab.whereEventCropsFullFrames`,`Where event crops / full frames are stored. A single folder — no collection / equal-splitting.`)}),r(Ve,{types:[`eventMedia`]})]})]})}o();var Ke=[[`pipelineAnalytics`]],qe=1440*60*1e3;function Je(e,t){return t.get(e)??G.t(`recordings.eventsManagementSection.removedCamera`,{id:String(e)})}var Ye=[{days:1},{days:7},{days:30},{days:90}];function Xe(){let{t:i}=K(),o=s(),c=_(),[l,u]=a(30),[d,f]=a(null),{data:m,isLoading:v}=pe({},{refetchOnWindowFocus:!1}),{data:y}=D({isCamera:!0,projection:`slim`}),b=t(()=>{let e=new Map;for(let t of y??[])e.set(t.id,t.name);return e},[y]),S=n(()=>{o.invalidateQueries({queryKey:Ke})},[o]),w=xe({onSuccess:S}),T=Se(),O=n(async()=>{await c({title:i(`recordings.eventsManagementSection.pruneTitle`,{count:l}),message:i(`recordings.eventsManagementSection.permanentlyDeletesEveryEventMotion`,`Permanently deletes every event (motion / object / audio) older than the cutoff across all cameras, and their media. This cannot be undone.`),confirmLabel:i(`recordings.eventsManagementSection.pruneEvents`,`Prune events`),variant:`danger`})&&w.mutate({olderThanMs:Date.now()-l*qe,reason:`retention`})},[c,w,l,i]),k=n(async e=>{let t=Je(e.deviceId,b);if(await c({title:i(`recordings.eventsManagementSection.deleteAllEventsFor`,`Delete all events for {{label}}?`,{label:t}),message:i(`recordings.eventsManagementSection.deleteRowsMessage`,{count:e.rows,size:q(e.bytes)}),confirmLabel:i(`recordings.eventsManagementSection.deleteEvents`,`Delete events`),variant:`danger`})){f(null);try{let n=await T.mutateAsync({deviceId:e.deviceId});S();let r=n.motion+n.object+n.audio;if(r===0&&e.bytes>0){f(`0 events deleted for ${t}. Media still listed (${q(e.bytes)}) — those blobs are not event rows; use Management → Count leftovers or Disk reconcile.`);return}f(`Deleted ${String(r)} event${r===1?``:`s`} for ${t}.`)}catch(e){f(e instanceof Error?e.message:String(e))}}},[c,T,b,S,i]),A=t(()=>[{key:`camera`,header:i(`recordings.eventsManagementSection.camera`,`Camera`),render:e=>r(`span`,{className:`text-foreground`,children:Je(e.deviceId,b)})},{key:`rows`,header:i(`recordings.eventsManagementSection.events`,`Events`),align:`right`,nowrap:!0,render:e=>r(`span`,{className:`tabular-nums`,children:e.rows.toLocaleString()})},{key:`bytes`,header:i(`recordings.eventsManagementSection.media`,`Media`),align:`right`,nowrap:!0,render:e=>r(`span`,{className:`tabular-nums`,children:q(e.bytes)})},{key:`actions`,header:``,align:`right`,render:t=>e(L,{variant:`unstyled`,onClick:()=>{k(t)},disabled:T.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,title:i(`recordings.eventsManagementSection.deleteAllEventsForThis`,`Delete all events for this camera`),children:[r(g,{className:`h-3 w-3`}),i(`common.delete`,`Delete`)]})}],[b,k,T.isPending,i]);return v&&!m?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(p,{className:`h-4 w-4 animate-spin`}),i(`recordings.eventsManagementSection.loadingEventStoreFootprint`,`Loading event-store footprint…`)]}):m?e(`div`,{className:`flex flex-col gap-6`,children:[e(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[r(h,{label:i(`recordings.eventsManagementSection.totalEvents`,`Total events`),icon:r(x,{className:`h-3 w-3`}),footer:`across ${String(m.devices.length)} camera${m.devices.length===1?``:`s`}`,children:m.totalRows.toLocaleString()}),r(h,{label:i(`recordings.eventsManagementSection.eventMediaOnDisk`,`Event media on disk`),children:q(m.totalBytes)})]}),e(`section`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[r(`span`,{className:`text-foreground-subtle`,children:i(`recordings.eventsManagementSection.pruneEventsOlderThan`,`Prune events older than`)}),r(C,{wrapperClassName:`inline-block w-auto`,value:l,onChange:e=>u(Number(e.target.value)),children:Ye.map(e=>r(`option`,{value:e.days,children:i(`recordings.eventsManagementSection.ageDays`,{count:e.days})},e.days))}),e(L,{variant:`unstyled`,onClick:()=>{O()},disabled:w.isPending,className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-xs font-medium text-foreground-subtle hover:bg-warning/10 hover:text-warning disabled:opacity-50`,children:[w.isPending?r(p,{className:`h-3 w-3 animate-spin`}):r(E,{className:`h-3 w-3`}),i(`recordings.eventsManagementSection.pruneNow`,`Prune now`)]})]}),m.devices.length===0?r(R,{icon:x,title:i(`recordings.eventsManagementSection.noStoredEvents`,`No stored events`),description:i(`recordings.eventsManagementSection.noCameraHasPersistedEvents`,`No camera has persisted events yet.`)}):r(N,{columns:A,rows:[...m.devices],rowKey:e=>e.deviceId,minWidthPx:480}),d===null?null:r(`p`,{className:d.startsWith(`Deleted `)?`text-[11px] text-foreground-subtle`:`text-[11px] text-destructive`,children:d})]}):r(R,{icon:x,title:i(`recordings.eventsManagementSection.noEventData`,`No event data`),description:i(`recordings.eventsManagementSection.pipelineAnalyticsHasNotReported`,`Pipeline analytics has not reported any event-store footprint yet.`)})}function Ze(){let{t}=K();return e(`div`,{className:`flex flex-col gap-8`,children:[e(`div`,{children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.eventsSection.eventStore`,`Event store`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.eventsSection.whatTheDurableEventStore`,`What the durable event store occupies, per camera, with fleet-wide prune-by-age and delete-all-events.`)}),r(`div`,{className:`mt-3`,children:r(Xe,{})})]}),e(`div`,{children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.eventsSection.postProcessingNodeFolders`,`Post-processing node & folders`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.eventsSection.theSingleNodeThatWrites`,`The single node that writes event crops, and the storage location they land in.`)}),r(`div`,{className:`mt-3`,children:r(Ge,{})})]})]})}function Qe(e){let t=[];return e.timelapse?t.push(`timelapse ${String(e.timelapse.everyMs/1e3)}s`):(t.push(`${String(e.speed??1)}×`),e.includeAudio&&t.push(`+ audio`)),t.join(` `)}function $e(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function et(e,t){let n=Math.max(0,Math.round((t-e)/1e3)),r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60,o=r>0?`${String(r)}:${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`:`${String(i)}:${String(a).padStart(2,`0`)}`;return`${$e(e)} · ${o}`}function tt(e,t){let n=e-t;if(n<=0)return G.t(`helpers.exportFormat.expired`);let r=Math.floor(n/6e4);if(r<60)return G.t(`helpers.exportFormat.inMinutes`,{n:String(r)});let i=Math.floor(r/60);return i<24?G.t(`helpers.exportFormat.inHours`,{n:String(i)}):G.t(`helpers.exportFormat.inDays`,{n:String(Math.floor(i/24))})}function nt(e,t,n,r){return e.map(e=>{if(e.state===`expired`||e.state===`deleted`)return e;let i=r.get(e.id);if(i)return{...e,state:`failed`,error:i.error,progressPct:null};let a=n.get(e.id);if(a)return{...e,state:`ready`,fileBytes:a.fileBytes,progressPct:100};let o=t.get(e.id);return o&&(e.state===`queued`||e.state===`rendering`)?{...e,state:`rendering`,progressPct:o.progressPct}:e})}o();var rt=[`high`,`mid`,`low`],it=[{value:1,labelKey:`recordings.newExportModal.speedRealTime`},{value:2,labelKey:null},{value:4,labelKey:null},{value:8,labelKey:null},{value:16,labelKey:null}],at=10080*60*1e3;function ot(e){let t=new Date(Date.now()-e*6e4),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function st({onClose:n,onCreated:i}){let{t:o}=K(),s=D({isCamera:!0,projection:`slim`}),c=t(()=>(s.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[s.data]),[l,u]=a(``),[d,f]=a(`high`),[p,m]=a(ot(60)),[h,g]=a(ot(0)),[_,y]=a(1),[b,x]=a(!0),[S,w]=a(``),[T,E]=a(null),O=l===``?c[0]?.id??null:l,k=new Date(p).getTime(),A=new Date(h).getTime(),N=Number.isFinite(k)&&Number.isFinite(A)&&k<A,I=M({onSuccess:()=>{i(),n()},onError:e=>E(e instanceof Error?e.message:String(e))});return r(se,{open:!0,onOpenChange:e=>!e&&n(),children:e(F,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[r(ue,{children:e(ce,{className:`flex items-center gap-1.5`,children:[r(v,{className:`h-3.5 w-3.5`}),o(`recordings.newExportModal.newExport`,`New export`)]})}),e(j,{className:`space-y-3`,children:[e(`div`,{className:`grid grid-cols-2 gap-3`,children:[e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:o(`recordings.newExportModal.camera`,`Camera`)}),r(C,{value:O??``,onChange:e=>u(Number(e.target.value)),className:`w-full`,children:c.map(e=>r(`option`,{value:e.id,children:e.name},e.id))})]}),e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:o(`recordings.newExportModal.profile`,`Profile`)}),r(C,{value:d,onChange:e=>f(e.target.value),className:`w-full`,children:rt.map(e=>r(`option`,{value:e,children:e},e))})]})]}),e(`div`,{className:`grid grid-cols-2 gap-3`,children:[e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:o(`recordings.newExportModal.from`,`From`)}),r(V,{type:`datetime-local`,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`})]}),e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:o(`recordings.newExportModal.to`,`To`)}),r(V,{type:`datetime-local`,value:h,onChange:e=>g(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`})]})]}),e(`div`,{className:`grid grid-cols-2 gap-3`,children:[e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:o(`recordings.newExportModal.speed`,`Speed`)}),r(C,{value:_,onChange:e=>y(Number(e.target.value)),className:`w-full`,children:it.map(e=>r(`option`,{value:e.value,children:e.labelKey===null?`${e.value}×`:o(e.labelKey)},e.value))})]}),e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:o(`recordings.newExportModal.titleOptional`,`Title (optional)`)}),r(V,{type:`text`,value:S,onChange:e=>w(e.target.value),placeholder:o(`recordings.newExportModal.eGCourierAtThe`,`e.g. courier at the gate`),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground placeholder:text-foreground-subtle`})]})]}),e(`label`,{className:`flex items-center gap-2 text-xs text-foreground cursor-pointer`,children:[r(W,{checked:b,disabled:_!==1,onChange:e=>x(e.target.checked),className:`accent-primary`}),o(_===1?`recordings.newExportModal.includeAudio`:`recordings.newExportModal.includeAudioRealtimeOnly`)]}),!N&&r(`p`,{className:`text-[11px] text-danger`,children:o(`recordings.newExportModal.fromMustBeBeforeTo`,`"From" must be before "To".`)}),T&&r(`p`,{className:`text-[11px] text-danger`,children:T})]}),e(P,{children:[r(L,{variant:`outline`,size:`sm`,onClick:n,children:o(`common.cancel`,`Cancel`)}),r(L,{size:`sm`,onClick:()=>{if(O===null||!N)return;E(null);let e=S.trim();I.mutate({deviceId:O,profile:d,fromMs:k,toMs:A,options:{includeAudio:b,maxLifeMs:at,deleteAfterDownload:!1,..._===1?{}:{speed:_},...e.length>0?{title:e}:{}}})},disabled:O===null||!N||I.isPending,children:I.isPending?o(`recordings.newExportModal.queuing`,`Queuing…`):o(`recordings.newExportModal.createExport`,`Create export`)})]})]})})}o();var ct=[[`recordingExport`]],lt={queued:{cls:`bg-muted text-foreground-subtle`,labelKey:`recordings.exportsSection.queued`},rendering:{cls:`bg-primary/10 text-primary`,labelKey:`recordings.exportsSection.rendering`,spin:!0},ready:{cls:`bg-success/10 text-success`,labelKey:`recordings.exportsSection.ready`},failed:{cls:`bg-danger/10 text-danger`,labelKey:`recordings.exportsSection.failed`},expired:{cls:`bg-muted text-foreground-subtle`,labelKey:`recordings.exportsSection.expired`},deleted:{cls:`bg-muted text-foreground-subtle`,labelKey:`recordings.exportsSection.deleted`}};function ut(){let{data:e,isLoading:n}=ie({},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`queued`||e.state===`rendering`)?3e3:!1}),{map:r}=O(w.RecordingExportProgress,e=>e.exportId),{map:i}=O(w.RecordingExportCompleted,e=>e.exportId),{map:a}=O(w.RecordingExportFailed,e=>e.exportId);return{rows:t(()=>nt(e??[],r,i,a),[e,r,i,a]),isLoading:n}}function dt(e){let[t,n]=a(()=>Date.now());return i(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function ft(){let{t:i}=K(),o=s(),[c,u]=a(!1),d=()=>{o.invalidateQueries({queryKey:[[`recordingExport`,`listExports`]]})},f=_(),m=y().trpcClient,h=dt(6e4),{rows:x,isLoading:S}=ut(),{data:C}=D({isCamera:!0,projection:`slim`}),w=t(()=>{let e=new Map;for(let t of C??[])e.set(t.id,t.name);return e},[C]),T=n(()=>{o.invalidateQueries({queryKey:ct})},[o]),E=k({onSuccess:T}),O=ee({onSuccess:T}),[A,j]=a(null),M=n(async e=>{j(e.id);try{let{url:t}=await m.recordingExport.getDownloadUrl.query({exportId:e.id}),n=await je(t),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${e.options.title??e.id}.mp4`,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r),T()}finally{j(null)}},[m,T]),P=n(async e=>{await f({title:i(`recordings.exportsSection.cancelThisExport`,`Cancel this export?`),message:i(`recordings.exportsSection.stopsTheRenderThePartial`,`Stops the render. The partial file is discarded.`),confirmLabel:i(`recordings.exportsSection.cancelExport`,`Cancel export`),variant:`danger`})&&E.mutate({exportId:e.id})},[f,E,i]),F=n(async e=>{await f({title:i(`recordings.exportsSection.deleteThisExport`,`Delete this export?`),message:i(`recordings.exportsSection.permanentlyRemovesTheRenderedFile`,`Permanently removes the rendered file and its history row.`),confirmLabel:i(`common.delete`,`Delete`),variant:`danger`})&&O.mutate({exportId:e.id})},[f,O,i]),I=t(()=>[{key:`camera`,header:i(`recordings.exportsSection.camera`,`Camera`),render:e=>r(`span`,{className:`text-foreground`,children:w.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`range`,header:i(`recordings.exportsSection.range`,`Range`),nowrap:!0,render:e=>r(`span`,{className:`tabular-nums`,children:et(e.fromMs,e.toMs)})},{key:`variant`,header:i(`recordings.exportsSection.variant`,`Variant`),render:e=>r(`span`,{className:`text-foreground-subtle`,children:Qe(e.options)})},{key:`state`,header:i(`recordings.exportsSection.state`,`State`),render:t=>{let n=lt[t.state];return e(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium ${n.cls}`,children:[n.spin&&r(p,{className:`h-2.5 w-2.5 animate-spin`}),i(n.labelKey),t.state===`rendering`&&t.progressPct!==null&&e(`span`,{className:`tabular-nums`,children:[t.progressPct,`%`]})]})}},{key:`expiry`,header:i(`recordings.exportsSection.expires`,`Expires`),nowrap:!0,render:e=>e.state===`deleted`?r(`span`,{className:`text-foreground-subtle`,children:`—`}):r(`span`,{className:`text-foreground-subtle tabular-nums`,children:tt(e.expiresAt,h)})},{key:`size`,header:i(`recordings.exportsSection.size`,`Size`),align:`right`,nowrap:!0,render:e=>r(`span`,{className:`tabular-nums`,children:e.fileBytes===null?`—`:q(e.fileBytes)})},{key:`actions`,header:``,align:`right`,render:t=>{let n=t.state===`ready`,a=t.state===`queued`||t.state===`rendering`,o=t.state!==`deleted`;return e(`div`,{className:`flex items-center justify-end gap-1`,children:[n&&e(L,{variant:`unstyled`,onClick:()=>{M(t)},disabled:A===t.id,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-primary/10 hover:text-foreground disabled:opacity-50`,title:i(`recordings.exportsSection.downloadMp4`,`Download MP4`),children:[A===t.id?r(p,{className:`h-3 w-3 animate-spin`}):r(b,{className:`h-3 w-3`}),i(`recordings.exportsSection.download`,`Download`)]}),a&&e(L,{variant:`unstyled`,onClick:()=>{P(t)},disabled:E.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-amber-500/10 hover:text-amber-500 disabled:opacity-50`,title:i(`recordings.exportsSection.cancelRender`,`Cancel render`),children:[r(l,{className:`h-3 w-3`}),i(`common.cancel`,`Cancel`)]}),o&&r(L,{variant:`unstyled`,onClick:()=>{F(t)},disabled:O.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,title:i(`recordings.exportsSection.deleteExport`,`Delete export`),children:r(g,{className:`h-3 w-3`})})]})}}],[w,h,A,E.isPending,O.isPending,M,P,F,i]);return S&&x.length===0?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(p,{className:`h-4 w-4 animate-spin`}),i(`recordings.exportsSection.loadingExports`,`Loading exports…`)]}):e(`div`,{className:`space-y-3`,children:[r(`div`,{className:`flex justify-end`,children:e(L,{variant:`unstyled`,onClick:()=>u(!0),className:`inline-flex items-center gap-1.5 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground`,children:[r(v,{className:`h-3.5 w-3.5`}),i(`recordings.exportsSection.newExport`,`New export`)]})}),x.length===0?r(R,{icon:v,title:i(`recordings.exportsSection.noExportsYet`,`No exports yet`),description:i(`recordings.exportsSection.createOneHereNewExport`,`Create one here (New export) or from a camera's timeline in the viewer. Rendered clips show up here to download or manage.`)}):r(N,{columns:I,rows:x,rowKey:e=>e.id,minWidthPx:720}),c&&r(st,{onClose:()=>u(!1),onCreated:d})]})}var pt=`inline-flex w-fit items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`;o();var mt=`storage-migration`,ht=new Set([`orphans`,`debug-media`,`ghost-ledger`]);function gt(e){return[`${e.orphansReclaimed} orphan rows (${q(e.orphanBytesReclaimed)})`,e.includeDebugMedia?`${e.debugMediaReclaimed} debug files (${q(e.debugMediaBytesReclaimed)})`:null,`${e.ghostsForgotten} ghost rows (${q(e.ghostBytesForgotten)})`].filter(e=>e!==null).join(` · `)}function _t(){let{t:e}=K(),t=U(mt);return t===`pending`?null:t===`unknown`?r(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:e(`recordings.cleanupSection.couldNotCheckWhetherStorage`,`Could not check whether storage cleanup is installed on this hub.`)}):t===`present`?r(vt,{}):null}function vt(){let{t}=K(),n=_(),[i,o]=a(!1),[s,c]=a(null),l=Ce({},{refetchInterval:2e3}),u=l.data??null,d=u!==null&&ht.has(u.phase),f=he(),m=me(),h=async()=>{if(await n({title:t(`recordings.cleanupSection.runStorageCleanup`,`Run storage cleanup?`),message:i?t(`recordings.cleanupSection.reclaimsLeftoverAnalyticsRowsAnd`,`Reclaims leftover analytics rows and files, debug stills/filmstrips, and ghost footage rows on frozen locations. Safe to re-run.`):t(`recordings.cleanupSection.reclaimsLeftoverAnalyticsRowsAnd2`,`Reclaims leftover analytics rows and files, and ghost footage rows on frozen locations. Debug stills are left alone. Safe to re-run.`),confirmLabel:t(`recordings.cleanupSection.runCleanup`,`Run cleanup`),variant:`danger`})){c(null);try{await f.mutateAsync({includeDebugMedia:i}),await l.refetch()}catch(e){c(e instanceof Error?e.message:String(e))}}},v=async()=>{if(u&&await n({title:t(`recordings.cleanupSection.cancelCleanup`,`Cancel cleanup?`),message:t(`recordings.cleanupSection.stopsAfterTheCurrentStep`,`Stops after the current step. Work already done stays done.`),confirmLabel:t(`recordings.cleanupSection.cancelCleanup2`,`Cancel cleanup`),variant:`danger`}))try{await m.mutateAsync({jobId:u.jobId}),await l.refetch()}catch{}};return e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.cleanupSection.cleanup`,`Cleanup`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.cleanupSection.onePassOverLeftoverAnalytics`,`One pass over leftover analytics (database + files) and ghost footage rows on frozen locations. Does not time out — progress updates here until it finishes.`)}),e(`label`,{className:`mt-3 flex items-start gap-2 text-[11px] text-foreground`,children:[r(W,{checked:i,disabled:d,onChange:e=>{o(e.target.checked)},className:`mt-0.5 h-3.5 w-3.5 accent-primary`}),r(`span`,{children:t(`recordings.cleanupSection.alsoRemoveDebugMediaMotion`,`Also remove debug media (motion stills and track filmstrips)`)})]}),e(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[e(L,{variant:`unstyled`,type:`button`,disabled:d||f.isPending,onClick:()=>{h()},className:pt,children:[(d||f.isPending)&&r(p,{className:`h-3 w-3 animate-spin`}),r(g,{className:`h-3 w-3`}),t(`recordings.cleanupSection.runCleanup`,`Run cleanup`)]}),d&&r(L,{variant:`unstyled`,type:`button`,onClick:()=>{v()},className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,children:t(`common.cancel`,`Cancel`)})]}),s&&r(`p`,{className:`mt-2 text-[11px] text-danger`,children:s}),u&&e(`div`,{className:`mt-3 space-y-1 rounded-md border border-border px-2.5 py-2`,children:[e(`p`,{className:`text-xs text-foreground`,children:[t(`recordings.cleanupSection.phase`,`Phase:`),` `,r(`span`,{className:`font-medium`,children:u.phase}),d&&r(p,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),u.detail&&r(`p`,{className:`text-[11px] text-foreground-subtle`,children:u.detail}),r(`p`,{className:`text-[11px] text-foreground-subtle`,children:gt(u)}),u.error&&r(`p`,{className:`text-[11px] text-danger`,children:u.error})]})]})}o();var yt=2e3;function bt(){let{t}=K(),n=_(),a=s(),o=A(),c=oe(void 0,{refetchInterval:e=>e.state.data?.state===`running`?yt:!1}),l=c.data,u=l?.state===`running`,d=u||o.isPending;i(()=>{l?.state!==`done`||l.finishedAtMs===null||(a.invalidateQueries({queryKey:[[`recording`]]}),a.invalidateQueries({queryKey:[[`pipelineAnalytics`]]}))},[l?.state,l?.finishedAtMs,a]);let f=async()=>{await n({title:t(`recordings.diskReconcileSection.reconcileStorageFromDisk`,`Reconcile storage from disk?`),message:t(`recordings.diskReconcileSection.makesTheDatabaseMatchThe`,`Makes the database match the filesystem: recordings index, tracks, events and media whose files are gone. Favourited tracks without files are deleted. Snapshot-less motion/audio events are deleted. Enrolled identities stay. This cannot be undone.`),confirmLabel:t(`recordings.diskReconcileSection.reconcile`,`Reconcile`),variant:`warning`})&&(await o.mutateAsync(),await c.refetch())},h=u?l.total>0?`Reconciling ${String(l.completed)}/${String(l.total)}…`:`Reconciling…`:o.isPending?`Reconciling…`:`Reconcile from disk`;return e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.diskReconcileSection.diskReconcile`,`Disk reconcile`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.diskReconcileSection.deletesDatabaseRowsWhoseFiles`,`Deletes database rows whose files are gone. Enrolled identities stay.`)}),e(`div`,{className:`mt-3 flex flex-col gap-2`,children:[e(L,{variant:`unstyled`,type:`button`,onClick:()=>void f(),disabled:d,className:`inline-flex w-fit items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium border border-border text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[d?r(p,{className:`h-3.5 w-3.5 animate-spin`}):r(m,{className:`h-3.5 w-3.5`}),h]}),l?.state===`done`?e(`p`,{className:`text-[11px] text-foreground-subtle`,children:[t(`recordings.diskReconcileSection.lastRun`,`Last run:`),` `,t(`recordings.diskReconcileSection.summary`,{completed:String(l.completed),tracks:String(l.tracks),events:String(l.events),media:String(l.mediaDropped)}),l.failed.length>0?t(`recordings.diskReconcileSection.failed`,`, {{value1}} failed ({{value2}})`,{value1:String(l.failed.length),value2:l.failed.join(`, `)}):``,`.`]}):null,l?.state===`error`&&l.error!==null?e(`p`,{className:`text-[11px] text-destructive`,children:[t(`recordings.diskReconcileSection.reconcileFailed`,`Reconcile failed:`),` `,l.error]}):null]})]})}var J=1e3,Y=60*J,X=60*Y;function Z(e){return e.toLocaleString(`en-US`)}function xt(e){if(!Number.isFinite(e)||e<0)return`—`;if(e>=X){let t=Math.floor(e/X),n=Math.round(e%X/Y);return`${t.toString()}h ${n.toString()}m`}if(e>=Y){let t=Math.floor(e/Y),n=Math.round(e%Y/J);return`${t.toString()}m ${n.toString()}s`}return`${Math.max(0,Math.round(e/J)).toString()}s`}function St(e){let t=Math.max(0,e.observedAt-e.startedAt),n=e.filesTotal===null?`${Z(e.filesMoved)} files`:`${Z(e.filesMoved)} / ${Z(e.filesTotal)} files`,r=e.filesTotal===null||e.filesTotal===0?null:Math.min(1,e.filesMoved/e.filesTotal),i=t>0&&e.filesMoved>0,a=i?`${q(e.bytesMoved/t*J)}/s`:null,o=e.filesTotal===null?null:e.filesTotal-e.filesMoved,s=!i||o===null||o<=0?null:`~${xt(o*t/e.filesMoved)} left`;return{counted:n,fraction:r,moved:`${q(e.bytesMoved)} moved`,rate:a,eta:s}}function Ct(e){let t=St(e);return[t.counted,t.moved,t.rate,t.eta].filter(e=>e!==null).join(` · `)}o();var wt=`storage-migration`,Q=[{id:`recordings`,labelKey:`recordings.storageMigrationSection.classRecordings`,locationType:`recordings`},{id:`recordingsLow`,labelKey:`recordings.storageMigrationSection.classRecordingsLow`,locationType:`recordingsLow`},{id:`eventMedia`,labelKey:`recordings.storageMigrationSection.classEventMedia`,locationType:`eventMedia`}],Tt=new Set([`planning`,`sealing`,`pausing`,`moving`,`draining`,`verifying`,`repointing`,`refreshing`,`resuming`]);function Et(){let{t}=K(),n=U(wt);return n===`pending`?e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(p,{className:`h-4 w-4 animate-spin`}),t(`migration.storageMigrationSection.checkingWhetherStorageMigrationIs`,`Checking whether storage migration is installed…`)]}):n===`unknown`?r(R,{icon:u,title:t(`migration.storageMigrationSection.couldnTCheckWhetherStorage`,`Couldn't check whether storage migration is installed`),description:t(`migration.storageMigrationSection.theCapabilityRegistryDidNot`,`The capability registry did not answer, so this panel has nothing to report either way — it is not a statement that the capability is missing. Reload to ask again.`)}):n===`absent`?r(R,{icon:T,title:t(`migration.storageMigrationSection.storageMigrationNotInstalled`,`Storage migration not installed`),description:t(`migration.storageMigrationSection.theCapabilityRegistryAnsweredNo`,`The capability registry answered: no addon in this cluster provides storage-migration. Once one is deployed, this panel moves recordings, low-res recordings and event media to new storage locations in one coordinated, verified operation.`)}):r(Dt,{})}function Dt(){let{t:n}=K(),i=_(),{data:o}=B({}),[s,c]=a({}),[l,u]=a({}),[d,m]=a(null),[h,g]=a(null),v=t(()=>{let e=new Map;for(let t of o??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[o]),y=t(()=>{let e=new Map;for(let t of o??[]){if(t.enabled===!1)continue;let n=e.get(t.type);n?n.push(t.id):e.set(t.type,[t.id])}let t=new Map;for(let[n,r]of e)r.length===1&&t.set(n,r[0]);return t},[o]),b=fe({},{refetchInterval:2e3}),x=b.data??null,S=x!==null&&Tt.has(x.phase),w=t(()=>{let e={};for(let t of Q){let n=s[t.id];n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[s]),E=t(()=>{let e={};for(let t of Q){if(!s[t.id])continue;let n=l[t.id]??y.get(t.locationType);n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[s,l,y]),D=t(()=>({destinations:w??{},...E?{sources:E}:{}}),[w,E]),O=de(D,{enabled:!1,retry:!1}),k=Ee(),A=we(),j=async()=>{if(!w)return;g(null);let e=await O.refetch();if(e.error){g(e.error instanceof Error?e.error.message:String(e.error));return}m(e.data??null)},M=async()=>{if(w&&await i({title:n(`migration.storageMigrationSection.startStorageMigration`,`Start storage migration?`),message:n(`migration.storageMigrationSection.copiesTheSelectedClassesFrom`,`Copies the selected classes from the chosen source to the destination, verifies, then either makes the destination the default (if the source was) or disables the source. Safe to re-run if interrupted.`),confirmLabel:n(`migration.storageMigrationSection.startMigration`,`Start migration`),variant:`danger`})){g(null);try{await k.mutateAsync(D),m(null),await b.refetch()}catch(e){g(e instanceof Error?e.message:String(e))}}},N=async()=>{if(x&&await i({title:n(`migration.storageMigrationSection.cancelMigration`,`Cancel migration?`),message:n(`migration.storageMigrationSection.stopsTheInProgressMigration`,`Stops the in-progress migration. Data already moved and verified stays at the destination; anything already repointed is not reverted.`),confirmLabel:n(`migration.storageMigrationSection.cancelMigration2`,`Cancel migration`),variant:`danger`}))try{await A.mutateAsync({jobId:x.jobId}),await b.refetch()}catch{}};return e(`div`,{className:`flex flex-col gap-6`,children:[e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[e(`h3`,{className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[r(T,{className:`h-3.5 w-3.5`}),n(`migration.storageMigrationSection.storageMigration`,`Storage migration`)]}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:n(`migration.storageMigrationSection.moveRecordingsLowResRecordings`,`Move recordings, low-res recordings and/or event media from one location to another: copies via the recorder / pipeline-analytics movers, verifies, then either repoints the default (when the source was the default) or disables the source (when it was not). Skip a class with an empty destination.`)}),r(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-3`,children:Q.map(t=>{let i=v.get(t.locationType)??[],a=y.get(t.locationType)??``;return e(`div`,{className:`space-y-2`,children:[r(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:n(t.labelKey)}),e(`div`,{className:`space-y-1`,children:[r(`label`,{htmlFor:`migration-from-${t.id}`,className:`text-[10px] text-foreground-subtle`,children:n(`recordings.storageMigrationSection.classFrom`,{label:n(t.labelKey)})}),r(C,{id:`migration-from-${t.id}`,value:l[t.id]??a,onChange:e=>{let n=e.target.value;u(e=>({...e,[t.id]:n}))},disabled:S,className:`w-full`,children:i.map(t=>e(`option`,{value:t.id,children:[t.displayName,t.enabled===!1?` (${n(`recordings.storageMigrationSection.readOnly`)})`:``]},t.id))})]}),e(`div`,{className:`space-y-1`,children:[r(`label`,{htmlFor:`migration-dest-${t.id}`,className:`text-[10px] text-foreground-subtle`,children:n(`recordings.storageMigrationSection.classTo`,{label:n(t.labelKey)})}),e(C,{id:`migration-dest-${t.id}`,value:s[t.id]??``,onChange:e=>{let n=e.target.value;c(e=>({...e,[t.id]:n}))},disabled:S,className:`w-full`,children:[r(`option`,{value:``,children:n(`migration.storageMigrationSection.skip`,`— skip —`)}),i.map(e=>r(`option`,{value:e.id,children:e.displayName},e.id))]})]})]},t.id)})}),h&&r(`p`,{className:`mt-2 text-[11px] text-danger`,children:h}),e(`div`,{className:`mt-3 flex items-center gap-2`,children:[e(L,{variant:`unstyled`,type:`button`,onClick:()=>{j()},disabled:!w||O.isFetching||S,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover disabled:opacity-50`,children:[O.isFetching&&r(p,{className:`h-3 w-3 animate-spin`}),n(`migration.storageMigrationSection.plan`,`Plan`)]}),e(L,{variant:`unstyled`,type:`button`,onClick:()=>{M()},disabled:!w||k.isPending||S,className:`inline-flex items-center gap-1.5 rounded bg-primary px-2.5 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:[k.isPending&&r(p,{className:`h-3 w-3 animate-spin`}),n(`migration.storageMigrationSection.startMigration`,`Start migration`)]})]}),d&&r(`div`,{className:`mt-3 divide-y divide-border rounded-md border border-border`,children:d.moves.length===0?r(`p`,{className:`px-2.5 py-1.5 text-[11px] text-foreground-subtle`,children:n(`migration.storageMigrationSection.nothingToMoveSelectedDestinations`,`Nothing to move — selected destinations match the current defaults.`)}):d.moves.map(t=>e(`div`,{className:`px-2.5 py-1.5 text-[11px] text-foreground`,children:[t.storageClass,`: `,t.fromLocationId,` → `,t.toLocationId]},`${t.storageClass}-${t.toLocationId}`))}),x&&e(`div`,{className:`mt-4 border-t border-border pt-3`,children:[e(`div`,{className:`flex items-center justify-between`,children:[r(`h4`,{className:`text-xs font-semibold text-foreground`,children:n(`migration.storageMigrationSection.migrationStatus`,`Migration status`)}),S&&e(L,{variant:`unstyled`,type:`button`,onClick:()=>{N()},className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10`,children:[r(f,{className:`h-3 w-3`}),n(`common.cancel`,`Cancel`)]})]}),e(`p`,{className:`mt-1 text-xs text-foreground`,children:[n(`migration.storageMigrationSection.phase`,`Phase:`),` `,r(`span`,{className:`font-medium`,children:x.phase}),S&&r(p,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),x.error&&r(`p`,{className:`mt-1 text-[11px] text-danger`,children:x.error}),x.pausedParticipants.length>0&&e(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:[n(`migration.storageMigrationSection.paused`,`Paused:`),` `,x.pausedParticipants.join(`, `)]}),r(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:x.moves.map(e=>r(Ot,{move:e},`${e.storageClass}-${e.fromLocationId}`))})]}),r(kt,{})]}),r(At,{running:S}),r(Mt,{})]})}function Ot({move:t}){let{t:n}=K(),i=t.progress===null?null:St(t.progress);return e(`div`,{className:`px-2.5 py-1.5 text-[11px]`,children:[e(`div`,{className:`flex items-center justify-between`,children:[e(`span`,{className:`text-foreground`,children:[t.storageClass,`: `,t.fromLocationId,` → `,t.toLocationId]}),e(`span`,{className:`text-foreground-subtle`,children:[t.state??n(`common.pending`),t.error?` (${t.error})`:``]})]}),t.progress!==null&&e(`div`,{className:`mt-1 space-y-1`,children:[i!==null&&i.fraction!==null&&r(`div`,{className:`h-1 w-full overflow-hidden rounded bg-border`,children:r(`div`,{className:`h-full bg-primary`,style:{width:`${(i.fraction*100).toFixed(1)}%`}})}),r(`p`,{className:`text-[10px] text-foreground-subtle`,children:Ct(t.progress)})]})]})}function kt(){let{t}=K(),{data:n}=ve({});return!n||n.length===0?null:e(`div`,{className:`mt-4 border-t border-border pt-3`,children:[r(`h4`,{className:`text-xs font-semibold text-foreground`,children:t(`migration.storageMigrationSection.migrationHistory`,`Migration history`)}),r(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:n.map(t=>e(`div`,{className:`px-2.5 py-1.5 text-[11px] text-foreground-subtle`,children:[r(`span`,{className:`font-medium text-foreground`,children:t.phase}),` · `,Object.entries(t.destinations).filter(e=>typeof e[1]==`string`).map(([e,t])=>`${e} → ${t}`).join(`, `),` · `,new Date(t.startedAt).toLocaleString()]},t.jobId))})]})}function At({running:t}){let{t:n}=K(),i=_(),o=Te({},{staleTime:1/0,refetchOnWindowFocus:!1}),s=be(),[c,l]=a(null),u=o.data??[];if(u.length===0)return null;let d=async e=>{if(await i({title:n(`migration.storageMigrationSection.drainRemaining`,`Drain remaining {{storageClass}}?`,{storageClass:e.storageClass}),message:`Moves what is still on ${e.fromLocationId} to ${e.toLocationId}. Nothing is paused and no default is changed — this is the second half of a migration, run on its own. It is resumable: cancelling leaves everything readable from both locations.`,confirmLabel:n(`migration.storageMigrationSection.drainRemaining2`,`Drain remaining`),variant:`danger`})){l(null);try{await s.mutateAsync({classes:[e.storageClass]}),await o.refetch()}catch(e){l(e instanceof Error?e.message:String(e))}}};return e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[e(`div`,{className:`flex items-start justify-between gap-2`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground`,children:n(`migration.storageMigrationSection.leftOnTheOldLocation`,`Left on the old location`)}),e(`div`,{className:`flex shrink-0 items-center gap-2`,children:[r(`span`,{className:`text-[10px] text-foreground-subtle`,children:o.dataUpdatedAt>0?n(`migration.storageMigrationSection.measured`,`Measured {{value1}}`,{value1:new Date(o.dataUpdatedAt).toLocaleTimeString()}):n(`migration.storageMigrationSection.measuredNever`,`Measured — never`)}),r(L,{variant:`unstyled`,type:`button`,onClick:()=>{o.refetch()},disabled:o.isFetching,className:`rounded border border-border px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`,children:o.isFetching?n(`migration.storageMigrationSection.counting`,`Counting…`):n(`common.refresh`,`Refresh`)})]})]}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:n(`migration.storageMigrationSection.aMigrationRepointsFirstAnd`,`A migration repoints first and drains behind. If the drain was cancelled, failed, or was interrupted by a restart, the data below is still on the source — readable, but not where the defaults now point. Draining moves it; it changes no default and pauses nothing.`)}),r(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:n(`migration.storageMigrationSection.thisCountIsTakenOn`,`This count is taken on demand: measuring it walks the whole media collection, so it is not refreshed on a timer. Press Refresh after a drain finishes.`)}),c&&r(`p`,{className:`mt-2 text-[11px] text-danger`,children:c}),r(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:u.map(i=>e(`div`,{className:`flex items-center justify-between gap-2 px-2.5 py-1.5 text-[11px]`,children:[e(`span`,{className:`text-foreground`,children:[i.storageClass,`: `,i.fromLocationId,` → `,i.toLocationId,r(`span`,{className:`ml-2 text-foreground-subtle`,children:jt(i)})]}),r(L,{variant:`unstyled`,type:`button`,onClick:()=>{d(i)},disabled:t||s.isPending,className:`shrink-0 rounded border border-border px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`,children:n(`migration.storageMigrationSection.drainRemaining2`,`Drain remaining`)})]},`${i.storageClass}-${i.fromLocationId}`))})]})}function jt(e){if(e.items===null)return G.t(`recordings.storageMigrationSection.residueUnknown`);let t=e.items.toLocaleString(`en-US`);return e.bytes===null?G.t(`recordings.storageMigrationSection.residueRows`,{count:e.items,items:t}):G.t(`recordings.storageMigrationSection.residueSegments`,{count:e.items,items:t,size:q(e.bytes)})}function Mt(){let{t}=K(),{data:n}=_e({},{refetchInterval:2e3}),i=(n??[]).filter(e=>e.migrationJobId===null&&e.job.state===`running`);return i.length===0?null:e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground`,children:t(`migration.storageMigrationSection.moversRunningOutsideAMigration`,`Movers running outside a migration`)}),r(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:i.map(t=>e(`div`,{className:`px-2.5 py-1.5 text-[11px]`,children:[e(`div`,{className:`text-foreground`,children:[t.lane,`: `,t.job.fromLocationId,` → `,t.job.toLocationId]}),r(`p`,{className:`mt-1 text-[10px] text-foreground-subtle`,children:Ct({filesMoved:t.job.filesMoved,filesTotal:t.job.filesTotal,bytesMoved:t.job.bytesMoved,startedAt:t.job.startedAt,observedAt:t.observedAt})})]},t.job.jobId))})]})}function Nt(){let{t}=K();return e(`div`,{className:`flex flex-col gap-4`,children:[r(_t,{}),r(bt,{}),e(`section`,{children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.recordingsManagementSection.moveStorage`,`Move storage`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.recordingsManagementSection.copyRecordingsLowResRecordings`,`Copy recordings, low-res recordings or event media to a new location, verify, then repoint the default. Applies to every camera.`)}),r(`div`,{className:`mt-3`,children:r(Et,{})})]})]})}o();var Pt=`recorder`,Ft=`recording`;function It(e,t,n){for(let n of e?.sections??[])for(let e of n.fields??[])if(e.key===t&&typeof e.value==`string`)return e.value;return n}function Lt(){let{t:n}=K(),i=s(),{nodes:a}=I(),{data:o,isLoading:c}=H({addonId:Pt,cap:Ft,scope:`cluster`}),l=It(o,`recordingNodeId`,`hub`),u=z({onSuccess:()=>{i.invalidateQueries({queryKey:[[`addonSettings`,`getScopedSettings`]]})}}),d=t(()=>{let e=a.filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,l,...e])].filter(Boolean)},[a,l]);return e(`div`,{className:`flex flex-col gap-6`,children:[e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground`,children:n(`pipeline.clusterRecordingTab.recordingNode`,`Recording node`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:n(`pipeline.clusterRecordingTab.theSingleNodeThatRecords`,`The single node that records (continuous & events) and serves playback. Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`)}),e(`div`,{className:`mt-3 flex items-center gap-2`,children:[c?r(p,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):r(C,{wrapperClassName:`inline-block w-auto`,value:l,onChange:e=>{e.target.value!==l&&u.mutate({addonId:Pt,cap:Ft,scope:`cluster`,patch:{recordingNodeId:e.target.value}})},disabled:u.isPending,children:d.map(e=>r(`option`,{value:e,children:e===`hub`?n(`pipeline.clusterRecordingTab.hubDefault`,`hub (default)`):e},e))}),u.isPending&&r(p,{className:`h-4 w-4 animate-spin text-primary`})]}),l!==`hub`&&r(`p`,{className:`mt-2 text-[11px] text-amber-500`,children:r(Oe,{i18nKey:`pipeline.clusterRecordingTab.hubOnlyNote`,values:{node:l},components:{b:r(`span`,{className:`font-medium`})}})})]}),e(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[r(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:n(`pipeline.clusterRecordingTab.recordingsFolders`,`Recordings folders`)}),r(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:n(`pipeline.clusterRecordingTab.whereRecordingsAreStoredMulti`,`Where recordings are stored. Multi-location collections — segments are split across the locations of a type. Add a location to grow capacity; mark one default per type.`)}),r(Ve,{types:[`recordings`,`recordingsLow`]})]})]})}function Rt(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function zt(e,t){let n=Rt(e);return n.length===0?G.t(`helpers.cameraDisk.defaultRoot`):n.map(e=>t.get(e)??e).join(` + `)}function Bt(e,t,n){if(e.length===0)return null;let r=e[0];if(e.length===1&&r!==void 0)return{label:zt(r,t),exact:!0};if(n===null)return null;let i=e.find(e=>Rt(e).includes(n));return i===void 0?null:{label:zt(i,t),exact:!1}}o();var Vt=[[`recording`]],Ht=[{value:`retention`,labelKey:`recordings.storageSection.pruneRetention`},{value:`quota`,labelKey:`recordings.storageSection.pruneQuota`},{value:`operator`,labelKey:`recordings.storageSection.pruneOperator`}],Ut={ok:`bg-primary`,warn:`bg-amber-500`,critical:`bg-danger`},Wt={ok:`text-foreground-subtle`,warn:`text-amber-500`,critical:`text-danger`};function $(e){return`${String(Math.round(e*100))}%`}function Gt(e){return e==null?`—`:new Date(e).toLocaleString()}function Kt(e,t){let n=e.locationIds??(e.locationId===null?[]:[e.locationId]),r=n.map(e=>t.get(e)).filter(e=>e!==void 0);return r.length>0?r.join(` + `):e.root===void 0?n.length>0?n.join(` + `):G.t(`recordings.storageSection.defaultRoot`):e.root}function qt(){let{t:i}=K(),o=s(),c=_(),[l,u]=a(`retention`),{data:d,isLoading:f}=te({},{refetchOnWindowFocus:!1}),{data:v}=D({isCamera:!0,projection:`slim`}),{data:y}=B({}),b=t(()=>{let e=new Map;for(let t of v??[])e.set(t.id,t.name);return e},[v]),x=t(()=>{let e=new Map;for(let t of y??[])e.set(t.id,t.displayName);return e},[y]),S=t(()=>{let e=y??[];return e.find(e=>e.type===`recordings`&&e.enabled!==!1)?.id??e.find(e=>e.type===`recordings`)?.id??null},[y]),w=t(()=>d?.locations??[],[d?.locations]),T=t(()=>Bt(w,x,S),[w,x,S]),O=t(()=>Ne(w),[w]),k=n(()=>{o.invalidateQueries({queryKey:Vt})},[o]),A=re({onSuccess:k}),j=ye({onSuccess:k}),M=n(async e=>{await c({title:i(`recordings.storageSection.prune`,`Prune {{label}}?`,{label:b.get(e.deviceId)??`#${String(e.deviceId)}`}),message:i(`recordings.storageSection.appliesTheRetentionPolicyNow`,`Applies the retention policy now (reason: {{reason}}). Footage beyond the policy is permanently deleted.`,{reason:l}),confirmLabel:i(`recordings.storageSection.pruneNow`,`Prune now`),variant:`danger`})&&A.mutate({deviceId:e.deviceId,reason:l})},[c,A,l,b,i]),P=n(async e=>{await c({title:i(`recordings.storageSection.deleteAllFootageFor`,`Delete all footage for {{label}}?`,{label:b.get(e.deviceId)??`#${String(e.deviceId)}`}),message:i(`recordings.storageSection.permanentlyDeletesOfRecordedFootage`,`Permanently deletes {{value1}} of recorded footage for this camera. This cannot be undone.`,{value1:q(e.usedBytes)}),confirmLabel:i(`recordings.storageSection.delete`,`Delete {{value1}}`,{value1:q(e.usedBytes)}),variant:`danger`})&&j.mutate({deviceId:e.deviceId})},[c,j,b,i]),F=t(()=>[{key:`camera`,header:i(`recordings.storageSection.camera`,`Camera`),render:e=>r(`span`,{className:`text-foreground`,children:b.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`disk`,header:i(`recordings.storageSection.disk`,`Disk`),nowrap:!0,render:()=>T===null?r(`span`,{className:`text-foreground-subtle`,children:`—`}):e(`span`,{className:T.exact?`text-foreground`:`text-foreground-subtle`,title:T.exact?i(`recordings.storageSection.theOnlyRecordingsVolumeOn`,`The only recordings volume on this node — this camera can only be here.`):i(`recordings.storageSection.theRecordingsDefaultThisNode`,`The recordings DEFAULT. This node has several recordings volumes and the per-camera placement is not reported by recording.getStorageUsage, so this is where footage lands by default rather than a per-camera fact.`),children:[T.label,!T.exact&&r(`span`,{className:`ml-1 text-foreground-subtle`,children:i(`recordings.storageSection.default`,`(default)`)})]})},{key:`used`,header:i(`recordings.storageSection.used`,`Used`),align:`right`,nowrap:!0,render:e=>r(`span`,{className:`tabular-nums`,children:q(e.usedBytes)})},{key:`oldest`,header:i(`recordings.storageSection.oldestFootage`,`Oldest footage`),align:`right`,nowrap:!0,render:e=>r(`span`,{className:`tabular-nums text-foreground-subtle`,title:i(`recordings.storageSection.theOldestSegmentTheArchive`,`The oldest segment the ARCHIVE holds for this camera — the per-camera answer to 'is retention actually holding?'.`),children:Gt(e.oldestMs)})},{key:`actions`,header:``,align:`right`,render:t=>e(`div`,{className:`flex items-center justify-end gap-1`,children:[e(L,{variant:`unstyled`,onClick:()=>{M(t)},disabled:A.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-foreground-subtle hover:bg-amber-500/10 hover:text-amber-500 disabled:opacity-50`,title:i(`recordings.storageSection.applyRetentionPolicyNow`,`Apply retention policy now`),children:[r(E,{className:`h-3 w-3`}),i(`recordings.storageSection.prune2`,`Prune`)]}),e(L,{variant:`unstyled`,onClick:()=>{P(t)},disabled:j.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,title:i(`recordings.storageSection.deleteAllFootage`,`Delete all footage`),children:[r(g,{className:`h-3 w-3`}),i(`common.delete`,`Delete`)]})]})}],[b,T,M,P,A.isPending,j.isPending,i]);if(f&&!d)return e(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[r(p,{className:`h-4 w-4 animate-spin`}),i(`recordings.storageSection.loadingStorageUsage`,`Loading storage usage…`)]});if(!d)return r(R,{icon:m,title:i(`recordings.storageSection.noStorageData`,`No storage data`),description:i(`recordings.storageSection.theRecordingNodeHasNot`,`The recording node has not reported any storage usage yet.`)});let I=d.devices.length;return e(`div`,{className:`flex flex-col gap-6`,children:[e(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[r(h,{label:i(`recordings.storageSection.totalUsed`,`Total used`),icon:r(m,{className:`h-3 w-3`}),footer:`${String(I)} camera${I===1?``:`s`} on ${d.nodeId}`,children:q(d.totalUsedBytes)}),O!==null&&O.severity!==null&&r(h,{label:i(`recordings.storageSection.freeOnRecordingsVolumes`,`Free on recordings volumes`),icon:r(m,{className:`h-3 w-3`}),footer:`across ${String(O.knownVolumes)} volume${O.knownVolumes===1?``:`s`} of ${q(O.totalBytes)}`+(O.unknownVolumes>0?` · ${String(O.unknownVolumes)} did not report capacity`:``),children:r(`span`,{className:`tabular-nums ${Wt[O.severity]}`,children:q(O.freeBytes)})}),w.map(t=>{let n=Me(t),a=t.locationId??t.root??`default`;return r(h,{label:i(`recordings.storageSection.disk2`,`Disk: {{label}}`,{label:Kt(t,x)}),footer:n===null?`${q(t.usedBytes)} of recordings · volume capacity unknown`:`${q(n.freeBytes)} free of ${q(n.totalBytes)} · ${q(t.usedBytes)} recordings (${$(n.recordingsFraction)})`,children:n===null?r(`span`,{className:`tabular-nums`,children:q(t.usedBytes)}):e(`div`,{className:`flex items-center gap-2`,title:i(`recordings.storageSection.volumeFillEverythingOnThe`,`Volume fill — everything on the disk, not only recordings. Warn at 85%, critical at 95%.`),children:[r(`div`,{className:`h-2 flex-1 overflow-hidden rounded bg-muted`,children:r(`div`,{className:`h-full rounded ${Ut[n.severity]}`,style:{width:$(n.fraction)}})}),r(`span`,{className:`tabular-nums text-xs ${Wt[n.severity]}`,children:$(n.fraction)})]})},a)})]}),e(`section`,{className:`flex items-center gap-2 text-xs`,children:[r(`label`,{htmlFor:`prune-reason`,className:`text-foreground-subtle`,children:i(`recordings.storageSection.pruneReason`,`Prune reason`)}),r(C,{wrapperClassName:`inline-block w-auto`,id:`prune-reason`,value:l,onChange:e=>{let t=Ht.find(t=>t.value===e.target.value);t&&u(t.value)},children:Ht.map(e=>r(`option`,{value:e.value,children:i(e.labelKey)},e.value))})]}),I===0?r(R,{icon:m,title:d.devicesRead===`unavailable`?i(`recordings.storageSection.perCameraUsageUnavailable`,`Per-camera usage unavailable`):i(`recordings.storageSection.noRecordedFootage`,`No recorded footage`),description:d.devicesRead===`unavailable`?i(`recordings.storageSection.thisRecordingNodeHasNo`,`This recording node has no footage ledger, so it refused to answer the per-camera table rather than report what it happens to hold in memory. The disk totals above are unaffected.`):i(`recordings.storageSection.noCameraHasRecordedFootage`,`No camera has recorded footage on this node yet.`)}):r(N,{columns:F,rows:[...d.devices],rowKey:e=>e.deviceId,minWidthPx:480})]})}function Jt(){let{t}=K();return e(`div`,{className:`flex flex-col gap-8`,children:[e(`div`,{children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.recordingsStorageSection.footageOnDisk`,`Footage on disk`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.recordingsStorageSection.whatRecordedFootageOccupiesPer`,`What recorded footage occupies, per camera and per volume, with prune-by-policy and delete-all-footage.`)}),r(`div`,{className:`mt-3`,children:r(qt,{})})]}),e(`div`,{children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`recordings.recordingsStorageSection.recordingNodeFolders`,`Recording node & folders`)}),r(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`recordings.recordingsStorageSection.theSingleNodeThatRecords`,`The single node that records and serves playback, and the storage locations footage is written to.`)}),r(`div`,{className:`mt-3`,children:r(Lt,{})})]})]})}function Yt(){let{t:e}=K(),t=ke(`/recordings`,{t:e,isAdmin:!0})??{icon:v,title:e(`nav.recordings`,`Recordings`)};return r(Ae,{icon:t.icon,title:t.title,subtitle:e(`recordings.recordedFootageAndTheDurable`,`Recorded footage and the durable event store — what each occupies, where it is written, and the operations that move or reconcile both.`),defaultSection:`storage`,sectionsLabel:`${t.title} sections`,sections:[{id:`storage`,label:e(`recordings.recordings`,`Recordings`),content:r(Jt,{})},{id:`events`,label:e(`recordings.events`,`Events`),content:r(Ze,{})},{id:`cameras`,label:e(`recordings.cameras`,`Cameras`),content:r(Be,{})},{id:`exports`,label:e(`recordings.export`,`Export`),content:r(ft,{})},{id:`activity`,label:e(`recordings.activity`,`Activity`),content:r(ze,{})},{id:`management`,label:e(`recordings.management`,`Management`),content:r(Nt,{})}]})}export{Yt as RecordingsPage};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{C as e,K as t,S as n,V as r,Y as i,et as a}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Cn as o,D as s,Ni as c,Oa as l,St as u,Tr as d,Yt as f,ct as p,dt as m,lt as h,ri as g,ut as _,wn as v}from"./player-overlays-BKIlLQtG.js";import{a as y,c as b,f as x,o as S}from"./video-KcKb1EGQ.js";import{$o as C,Bn as w,Ct as ee,Dt as T,Gr as E,Hf as D,Ht as O,Ii as k,Jn as A,Jr as j,Kn as M,Kr as N,Oi as P,Qd as F,Rn as I,St as te,Wr as L,Xr as R,Yn as z,Yr as B,br as V,fr as H,hf as U,ii as W,kt as G,mf as ne,pr as K,ur as re,yr as ie,zi as ae,zn as q}from"./src-LHvMQiO5.js";import{t as J}from"./i18n-DS8SDP-9.js";import{t as Y}from"./useTranslation-BJr-n0es.js";import{L as oe,Pr as se,n as ce}from"./index-Bs8L45gs.js";a();function X({id:t,title:r,icon:i,description:a,actions:o,tone:c=`default`,notice:l=null,onDismissNotice:u,children:d}){return n(M,{headingId:`access-${t}`,title:r,icon:i,actions:o,testId:`access-${t}`,children:e(`div`,{className:`${s} space-y-3`,children:[n(`div`,{className:m(`text-[11px] leading-relaxed`,c===`danger`?`rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-foreground`:`text-foreground-subtle`),children:a}),l!==null&&n(ue,{notice:l,onDismiss:u}),d]})})}var le={success:{icon:c,line:`border-success/30 text-foreground`,mark:`text-success`},danger:{icon:y,line:`border-danger/40 text-danger`,mark:`text-danger`}};function ue({notice:t,onDismiss:r}){let{t:i}=Y(),a=le[t.tone],o=a.icon;return e(`div`,{role:t.tone===`danger`?`alert`:`status`,className:m(`flex items-start gap-2 rounded-md border bg-surface px-3 py-2 text-[11px]`,a.line),children:[n(o,{className:m(`mt-0.5 h-3.5 w-3.5 shrink-0`,a.mark),"aria-hidden":!0}),n(`span`,{className:`min-w-0 flex-1`,children:t.message}),r!==void 0&&n(U,{type:`button`,variant:`ghost`,size:`sm`,icon:u,"aria-label":i(`access.accessSection.dismiss`,`Dismiss`),onClick:r,className:`-my-1 h-5 w-5`})]})}function Z(){let{data:e}=F();return t(()=>{let t=new Map;for(let n of e??[])t.set(n.id,n.username);return t},[e])}function de(e,t=null){return e===null?t:{tone:`danger`,message:e}}var fe={active:`access.credentialColumns.statusActive`,expired:`access.credentialColumns.statusExpired`,revoked:`access.credentialColumns.statusRevoked`,current:`access.credentialColumns.statusCurrent`};function pe(e){return J.t(fe[e])}var me={active:`success`,expired:`warning`,revoked:`default`,current:`info`},he={current:0,active:1,expired:2,revoked:3};function ge(e,t){if(e===null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?`—`:n.toLocaleString()}function _e({status:e}){return n(k,{variant:me[e],className:`text-[10px]`,children:pe(e)})}function ve({row:t,action:r}){if(!r.isAvailable(t))return null;let i=r.icon,a=r.busyId===t.id;return e(P,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>r.onRun(t),disabled:r.disabled,"aria-label":J.t(`access.credentialColumns.actionOn`,{action:r.label,name:t.name}),className:r.tone===`neutral`?void 0:`text-danger hover:bg-danger/10`,children:[a?n(d,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):n(i,{className:`h-3 w-3`,"aria-hidden":!0}),r.label]})}function ye(t){return[{key:`name`,header:J.t(`access.credentialColumns.name`,`Name`),sortValue:e=>e.name.toLowerCase(),render:t=>e(`div`,{className:`min-w-0 max-w-[18rem]`,children:[n(`div`,{className:`truncate font-medium text-foreground`,title:t.name,children:t.name}),t.detail!==null&&n(`div`,{className:`truncate font-mono text-[10px] text-foreground-subtle`,title:t.detail,children:t.detail})]})},t.hideOwner?null:{key:`owner`,header:J.t(`access.credentialColumns.owner`,`Owner`),sortValue:e=>e.ownerName.toLowerCase(),render:e=>e.ownerName},{key:`kind`,header:J.t(`access.credentialColumns.kindScope`,`Kind / scope`),sortValue:e=>e.kind.toLowerCase(),nowrap:!1,render:t=>e(`div`,{className:`min-w-[8rem] max-w-[16rem]`,children:[n(`div`,{className:`text-foreground`,children:t.kind}),t.scope!==null&&n(`div`,{className:`line-clamp-2 text-[10px] text-foreground-subtle`,title:t.scope,children:t.scope})]})},{key:`status`,header:J.t(`access.credentialColumns.status`,`Status`),sortValue:e=>he[e.status],render:e=>n(_e,{status:e.status})},{key:`created`,header:J.t(`access.credentialColumns.created`,`Created`),sortValue:e=>e.createdAt,render:e=>n(`span`,{className:`text-foreground-subtle`,children:ge(e.createdAt,`—`)})},{key:`lastUsed`,header:J.t(`access.credentialColumns.lastUsed`,`Last used`),sortValue:e=>e.lastUsedAt,render:e=>n(`span`,{className:`text-foreground-subtle`,children:ge(e.lastUsedAt,J.t(`access.credentialColumns.never`))})},{key:`expires`,header:J.t(`access.credentialColumns.expires`,`Expires`),sortValue:e=>e.expiresAt,render:e=>n(`span`,{className:`text-foreground-subtle`,children:ge(e.expiresAt,t.expiresNone)})},t.action===null?null:{key:`actions`,header:``,align:`right`,notSortableReason:J.t(`access.credentialColumns.actionsHeader`),render:e=>n(`div`,{className:`flex items-center justify-end gap-1`,children:[...t.extraActions??[],t.action].map(t=>t===null?null:n(ve,{row:e,action:t},t.label))})}].filter(e=>e!==null)}a();var be=6,xe={"current-session":`access.bulk.skipCurrentSession`,"not-active":`access.bulk.skipNotActive`};function Se(e){let t=xe[e];return t===void 0?e:J.t(t)}function Ce(e,t){return J.t(t.key,{count:e})}function Q(e,t){return J.t(`access.bulk.countOf`,{count:e,noun:Ce(e,t)})}function we(e){let t=new Map;for(let n of e)t.set(n.status,(t.get(n.status)??0)+1);return[...t.entries()].map(([e,t])=>J.t(`access.bulk.statusCount`,{count:t,status:pe(e).toLowerCase()})).join(`, `)}function Te(e,t){let n=e.slice(0,be).map(e=>`• ${e.name} — ${e.ownerName}`),r=e.length>be?[J.t(`access.bulk.previewMore`,{count:e.length-be})]:[];return[J.t(`access.bulk.previewIntro`,{what:Q(e.length,t),breakdown:we(e)}),``,...n,...r].join(`
|
|
2
|
-
`)}async function Ee(e,t,n){let r=String(t.length),i=await e({title:J.t(`access.bulk.confirmTitle`,{what:Q(t.length,n)}),message:Te(t,n),label:J.t(`access.bulk.confirmLabel`,{expected:r}),placeholder:r,confirmLabel:J.t(`access.bulk.confirmButton`,{expected:r}),variant:`danger`,validate:e=>e.trim()===r?null:J.t(`access.bulk.confirmMismatch`,{expected:r,noun:Ce(2,n)})});return i!==null&&i.trim()===r}function De(e,t){let n=h(),r=D.auth.revokeCredentials.useMutation(),[a,o]=i(null);return{run:async i=>{if(i.length===0||!await Ee(n,i,e))return!1;o(null);try{let t=await r.mutateAsync({ids:i.map(e=>e.id),confirmCount:i.length}),n=t.skipped.map(e=>Se(e.reason));return o({tone:`success`,message:n.length>0?J.t(`access.bulk.revokedSkipped`,{what:Q(t.revoked.length,e),count:n.length,reasons:[...new Set(n)].join(`, `)}):J.t(`access.bulk.revoked`,{what:Q(t.revoked.length,e)})}),!0}catch(e){return o({tone:`danger`,message:J.t(`access.bulk.revokeFailed`,{error:e instanceof Error?e.message:J.t(`access.bulk.requestFailed`)})}),!1}finally{t()}},busy:r.isPending,outcome:a,dismiss:()=>o(null)}}function Oe(e,t,n){let r=h(),[a,o]=i(!1),[s,c]=i(null);return{run:async i=>{if(i.length===0||!await Ee(r,i,e))return!1;c(null),o(!0);let a=[],s=0;for(let e of i)try{await t(e.id),s+=1}catch(t){a.push(`${e.name}: ${t instanceof Error?t.message:J.t(`access.bulk.requestFailed`)}`)}return o(!1),n(),a.length===0?(c({tone:`success`,message:J.t(`access.bulk.revoked`,{what:Q(s,e)})}),!0):(c({tone:`danger`,message:J.t(a.length>3?`access.bulk.eachPartialMore`:`access.bulk.eachPartial`,{what:Q(s,e),count:a.length,details:a.slice(0,3).join(`; `)})}),s>0)},busy:a,outcome:s,dismiss:()=>c(null)}}a();var ke={searchText:e=>[e.name,e.detail??``,e.ownerName,e.kind,e.scope??``],facetGroups:[{id:`status`,value:e=>e.status},{id:`owner`,value:e=>e.ownerName},{id:`kind`,value:e=>e.kind}]},Ae={status:`access.credentialTable.groupStatus`,owner:`access.credentialTable.groupOwner`,kind:`access.credentialTable.groupKind`},je=e=>e.status!==`current`,Me=[`active`,`current`];function Ne({rows:r,label:a,isLoading:o,loadError:s,emptyText:c,hideOwner:l=!1,expiresNone:u,action:f,extraActions:p,bulk:m,defaultStatus:h=Me}){let{t:g}=Y(),[_]=i(()=>h.length===0?{search:``,facets:[]}:{search:``,facets:[],groups:{status:[...h]}}),v=I(r,ke,_),[y,b]=i(()=>new Set),x=u??g(`access.credentialColumns.never`),S=t(()=>ye({hideOwner:l,expiresNone:x,action:f??null,...p===void 0?{}:{extraActions:p}}),[l,x,f,p,g]),C=t(()=>m===void 0?()=>!1:e=>je(e)&&m.isSelectable(e),[m]),w=t(()=>v.rows.filter(e=>y.has(e.id)&&C(e)),[v.rows,y,C]);return o?e(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[n(d,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),g(`access.credentialTable.loading`,{label:a})]}):s===null?e(`div`,{className:`space-y-3`,children:[n(q,{state:v.state,facets:v.facets,groups:v.groups.filter(e=>!(l&&e.id===`owner`)).map(e=>({...e,label:Ae[e.id]===void 0?e.id:g(Ae[e.id]),...e.id===`status`?{facetLabel:e=>pe(e)}:{}})),labels:{searchPlaceholder:g(`access.credentialTable.searchPlaceholder`,{label:a}),searchLabel:g(`access.credentialTable.searchLabel`,{label:a}),facetsLabel:g(`access.credentialTable.facetsLabel`,{label:a}),clearLabel:g(`access.credentialTable.clearFilters`)},onSearch:v.setSearch,onToggleFacet:v.toggleFacet,onToggleGroupFacet:v.toggleGroupFacet,onClear:v.clear}),m!==void 0&&n(Pe,{bulk:m,shown:v.rows.filter(C),targets:w,onSelect:b}),n(A,{columns:S,rows:v.rows,rowKey:e=>e.id,minWidthPx:l?760:860,maxBodyHeight:z,defaultSort:{columnKey:`created`,dir:`desc`},pageSize:25,paginationLabels:{navLabel:g(`access.credentialTable.pagesLabel`,{label:a}),previous:g(`access.credentialTable.previousPage`),next:g(`access.credentialTable.nextPage`),range:(e,t,n)=>g(`access.credentialTable.range`,{from:e,to:t,total:n})},emptyMessage:v.active?g(`access.credentialTable.noMatchTheFilters`,`No {{label}} match the filters.`,{label:a}):c,rowClassName:e=>e.status===`revoked`||e.status===`expired`?`opacity-70`:void 0,...m===void 0?{}:{selection:{selected:y,onChange:b,isSelectable:C,rowLabel:e=>g(`access.credentialTable.rowLabel`,{name:e.name,owner:e.ownerName}),pageLabel:g(`access.credentialTable.pageLabel`,{noun:Ce(1,m.noun)})}}})]}):n(W,{title:g(`access.credentialTable.couldNotLoad`,`Could not load {{label}}`,{label:a}),message:s})}function Pe({bulk:t,shown:r,targets:i,onSelect:a}){let{t:o}=Y(),{revoke:s,noun:c}=t,l=(t.quickSelect??[]).map(e=>({...e,rows:r.filter(e.match)})).filter(e=>e.rows.length>0),p=async()=>{await s.run(i)&&a(new Set)};return e(`div`,{className:`flex flex-wrap items-center gap-2`,"data-testid":`bulk-bar`,children:[r.length>0&&n(P,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(new Set(r.map(e=>e.id))),children:o(`access.credentialTable.selectAllShown`,{count:r.length})}),l.map(t=>e(P,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>a(new Set(t.rows.map(e=>e.id))),children:[t.label,` (`,String(t.rows.length),`)`]},t.label)),i.length>0&&e(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:[n(`span`,{className:`text-[11px] tabular-nums text-foreground`,"aria-live":`polite`,children:o(`access.credentialTable.selectedLabel`,{what:Q(i.length,c)})}),e(P,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>a(new Set),children:[n(u,{className:`h-3 w-3`,"aria-hidden":!0}),o(`access.credentialTable.clearSelection`,`Clear selection`)]}),e(P,{type:`button`,variant:`danger`,size:`sm`,disabled:s.busy,onClick:()=>void p(),children:[s.busy?n(d,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):n(f,{className:`h-3 w-3`,"aria-hidden":!0}),o(`access.credentialTable.revoke`,{what:Q(i.length,c)})]})]})]})}var Fe=(e,t)=>t===null?`—`:e.get(t)??t;function Ie(e,t){return e!=null&&e<=t?`expired`:`active`}function Le(e,t,n){return{id:e.id,name:n.client(e.client),detail:e.ip,ownerId:e.userId,ownerName:Fe(t,e.userId),kind:n.method(e.method),scope:null,status:e.current?`current`:`active`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function Re(e,t){return{id:e.id,name:e.integrationId,detail:null,ownerId:e.userId,ownerName:e.username,kind:e.integrationId,scope:t,status:e.revokedAt===null?`active`:`revoked`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:null}}var ze=`All permissions`,Be=`View link`,Ve=`Scoped`,He={"grid-view":`Grid`,"events-view":`Events`};function Ue(e,t){return e.map(e=>t.get(e)??`#${String(e)}`).join(`, `)}function We(e){return e!==`*`&&e.type===`share-view`&&`grant`in e}function Ge(e,t,n){return e===`*`?ze:We(e)?`${`${He[e.grant.kind]} view${e.grant.talk===!0?` + talk`:``}`}: ${Ue(e.grant.deviceIds,t)}`:n(e)}function Ke(e){return e.includes(`*`)?ze:e.some(We)?Be:Ve}function qe(e,t,n,r){return{id:e.id,name:e.label,detail:null,ownerId:e.subjectId,ownerName:Fe(t,e.subjectId),kind:Ke(e.scopes),scope:n,status:e.revokedAt===null?Ie(e.expiresAt,r):`revoked`,createdAt:e.createdAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function Je(e){return`${e.provider}\u0000${e.subject}`}function Ye(e,t){return{id:Je(e),name:e.label??e.subject,detail:e.issuer,ownerId:e.userId,ownerName:Fe(t,e.userId),kind:e.provider,scope:null,status:`active`,createdAt:e.linkedAt,lastUsedAt:null,expiresAt:null}}var Xe=40,Ze=[{test:/Electron\//,name:`CamStack desktop`},{test:/Edg(e|A|iOS)?\//,name:`Edge`},{test:/OPR\/|Opera/,name:`Opera`},{test:/Firefox\/|FxiOS\//,name:`Firefox`},{test:/Chrome\/|CriOS\//,name:`Chrome`},{test:/Version\/[\d.]+.*Safari\//,name:`Safari`}],Qe=[{test:/iPhone/,name:`iPhone`},{test:/iPad/,name:`iPad`},{test:/Android/,name:`Android`},{test:/Mac OS X|Macintosh/,name:`macOS`},{test:/Windows/,name:`Windows`},{test:/CrOS/,name:`ChromeOS`},{test:/Linux/,name:`Linux`}],$e=[{test:/CFNetwork\/.*Darwin\//,name:`CamStack app on iOS`},{test:/^okhttp\//i,name:`CamStack app on Android`},{test:/^(node|undici)\b/i,name:`Script (Node.js)`},{test:/^curl\//i,name:`curl`}];function et(e,t){return e.find(e=>e.test.test(t))?.name??null}function tt(e){return e.length<=Xe?e:`${e.slice(0,Xe)}…`}function nt(e){if(e===null||e.trim().length===0)return{label:J.t(`helpers.sessionClient.unknownDevice`),raw:null};let t=e.trim(),n=et($e,t);if(n!==null)return{label:n,raw:t};let r=et(Ze,t),i=et(Qe,t);return r!==null&&i!==null?{label:J.t(`helpers.sessionClient.browserOnSystem`,{browser:r,system:i}),raw:t}:r===null?{label:tt(t),raw:t}:{label:r,raw:t}}var rt={password:`helpers.sessionClient.method.password`,passkey:`helpers.sessionClient.method.passkey`,sso:`helpers.sessionClient.method.sso`,handoff:`helpers.sessionClient.method.handoff`,"cli-approval":`helpers.sessionClient.method.cliApproval`,exchange:`helpers.sessionClient.method.exchange`};function it(e){let t=rt[e];return t===void 0?e:J.t(t)}function at(e){if(e==null)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString()}function ot({token:t,label:r,onClose:i}){let{t:a}=Y();return n(L,{open:!0,onOpenChange:e=>!e&&i(),children:e(N,{width:`md`,scroll:`body`,children:[n(B,{children:n(R,{children:a(`auth.tokenModals.token`,`Token: {{label}}`,{label:r})})}),e(E,{className:`space-y-3`,children:[n(`div`,{className:`rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning`,children:a(`auth.tokenModals.copyThisTokenNowOnce`,`Copy this token now. Once you close this dialog the secret cannot be displayed again.`)}),n(`div`,{className:`select-all break-all rounded-md border border-border bg-background p-2 font-mono text-[11px] text-foreground`,children:t})]}),e(j,{children:[n(w,{value:t,label:a(`common.copy`,`Copy`),srLabel:`token`}),n(P,{type:`button`,variant:`primary`,size:`sm`,onClick:i,children:a(`auth.tokenModals.done`,`Done`)})]})]})})}var st={token:`newToken`,scoped:`newScoped`,admin:`newAdmin`};a();var ct=80,$=86400,lt=[{value:`1`,seconds:$},{value:`7`,seconds:7*$},{value:`30`,seconds:30*$},{value:`90`,seconds:90*$},{value:`never`,seconds:`never`}],ut={type:`device-multiselect`,key:`cameras`,deviceFilter:{types:[`camera`]},maxItems:64},dt={type:`capability`,target:``,access:[`view`,`create`]};function ft({open:a,users:s,onClose:c,onSubmit:u,submitting:f,formError:p,awaitingProof:m}){let{t:h}=Y(),y=l(),{user:b}=oe(),S=b?.isAdmin===!0,C=S?null:b?.scopes??[],[w,T]=i(`scopes`),[E,D]=i(b?.id??``),[O,k]=i(``),[A,j]=i([dt]),[M,N]=i([]),[F,I]=i(`grid-view`),[L,R]=i(!1),[z,B]=i(`30`);r(()=>{a||(T(`scopes`),D(b?.id??``),k(``),j([dt]),N([]),I(`grid-view`),R(!1),B(`30`))},[a,b?.id]),r(()=>{w!==`view-link`&&z===`never`&&B(`30`)},[w,z]);let U=t(()=>lt.filter(e=>e.seconds!==`never`||w===`view-link`).map(e=>({value:e.value,label:e.seconds===`never`?h(`access.createTokenModal.never`,`Never (until revoked)`):h(`access.createTokenModal.days`,{count:Number(e.value)})})),[w,h]),W=O.trim(),q=w===`scopes`?ee(A,y):null,J=M.map(Number).filter(e=>Number.isInteger(e)&&e>=0),ce=lt.find(e=>e.value===z)?.seconds??30*$,X=()=>w===`all`?[`*`]:w===`view-link`?[{type:`share-view`,grant:{kind:F,deviceIds:J,...L?{talk:!0}:{}}}]:A,le=W.length>0&&W.length<=ct&&!f&&!m&&(w===`all`?S:w===`view-link`?J.length>0:A.length>0&&q===null),ue=()=>{if(!le)return;let e=S&&w!==`all`&&E!==``&&E!==b?.id;u({scopes:X(),expiresIn:ce,label:W,...e?{subjectId:E}:{}})},Z=w===`all`,de=Z?v:o;return n(G,{open:a,onClose:c,title:h(`access.createTokenModal.createToken`,`Create token`),icon:Z?v:x,error:p,width:`md`,testId:`create-token-dialog`,footer:e(P,{type:`button`,variant:Z?`danger`:`primary`,size:`sm`,onClick:ue,disabled:!le,"data-testid":`create-token-submit`,children:[f||m?n(d,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}):n(de,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),h(`access.createTokenModal.issueToken`,`Issue token`)]}),children:e(`div`,{className:`space-y-3`,children:[e(`div`,{className:`space-y-1`,children:[n(V,{children:h(`access.createTokenModal.whatItMayDo`,`What it may do`)}),n(re,{appearance:`pills`,value:w,onValueChange:e=>{(e===`scopes`||e===`view-link`||e===`all`)&&T(e)},children:e(H,{"aria-label":h(`access.createTokenModal.whatItMayDo`,`What it may do`),children:[e(K,{value:`scopes`,"data-testid":`token-reach-scopes`,children:[n(o,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),h(`access.createTokenModal.reachScopes`,`Scopes`)]}),e(K,{value:`view-link`,"data-testid":`token-reach-view-link`,children:[n(g,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),h(`access.createTokenModal.reachViewLink`,`View link`)]}),S?e(K,{value:`all`,"data-testid":`token-reach-all`,children:[n(v,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),h(`access.createTokenModal.reachAll`,`All permissions`)]}):null]})})]}),Z?n(`div`,{className:`space-y-1 rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px] leading-relaxed text-foreground`,"data-testid":`admin-token-warning`,children:n(`p`,{children:n(se,{i18nKey:`auth.adminTokenNoticeShort`,components:{strong:n(`strong`,{})}})})}):null,S&&w!==`all`&&s.length>1?e(`div`,{className:`space-y-1`,children:[n(V,{htmlFor:`token-user`,children:h(`access.createTokenModal.onBehalfOfUser`,`On behalf of user`)}),n(_,{id:`token-user`,value:E,onChange:e=>D(e.target.value),options:s.map(e=>({value:e.id,label:e.username}))})]}):null,e(`div`,{className:`space-y-1`,children:[n(V,{htmlFor:`token-name`,children:h(`access.createTokenModal.label`,`Label`)}),n(ne,{id:`token-name`,value:O,maxLength:ct,required:!0,onChange:e=>k(e.target.value),placeholder:w===`view-link`?`kitchen-wall`:`nightly-backup`,autoFocus:!0})]}),w===`scopes`?e(`div`,{className:`space-y-1`,children:[n(V,{children:h(`access.createTokenModal.scopes`,`Scopes`)}),n(te,{value:A,onChange:j,clampToParent:C}),q&&n(`p`,{className:`text-[10px] text-danger`,children:q}),n(`p`,{className:`text-[10px] text-foreground-subtle`,children:h(`access.createTokenModal.eachScopePicksACap`,`Each scope picks a (cap or addon) target + one or more access flavours. The token can access ONLY what's listed.`)})]}):null,w===`view-link`?e(`div`,{className:`space-y-2`,"data-testid":`token-view-link`,children:[e(`div`,{className:`space-y-1`,children:[n(V,{children:h(`access.createTokenModal.cameras`,`Cameras`)}),n(ae,{field:{...ut,label:h(`access.createTokenModal.cameras`,`Cameras`)},value:M,onChange:e=>N(Array.isArray(e)?e.filter(e=>typeof e==`string`):[])})]}),e(`div`,{className:`space-y-1`,children:[n(V,{htmlFor:`token-view-kind`,children:h(`access.createTokenModal.viewKind`,`Shows`)}),n(_,{id:`token-view-kind`,value:F,onChange:e=>I(e.target.value===`events-view`?`events-view`:`grid-view`),options:[{value:`grid-view`,label:h(`access.createTokenModal.viewGrid`,`Live grid`)},{value:`events-view`,label:h(`access.createTokenModal.viewEvents`,`Events`)}]})]}),F===`grid-view`?e(`label`,{className:`flex items-start gap-2 text-sm text-foreground`,children:[n(ie,{className:`mt-0.5`,checked:L,onChange:e=>R(e.target.checked),"data-testid":`token-view-talk`}),n(`span`,{children:h(`access.createTokenModal.talk`,`Allow talk-back on these cameras`)})]}):null]}):null,e(`div`,{className:`space-y-1`,children:[n(V,{htmlFor:`token-lifetime`,children:h(`access.createTokenModal.expires`,`Expires after`)}),n(_,{id:`token-lifetime`,value:z,onChange:e=>B(e.target.value),options:U})]})]})})}a();var pt={key:`access.nouns.token`};function mt(e){return typeof e==`object`&&!!e&&`kind`in e}function ht(e,t){let n=e.access===void 0?``:` [${e.access.join(`, `)}]`;return e.type===`device`?`device:[${mt(e.selector)?O(e.selector,t):`?`}]${n}`:e.type===`addon-routes`?`${t(`access.tokensSection.everyAddonRoutes`,`every addon's routes`)}${n}`:`${e.type}:${e.target??``}${n}`}function gt({headerOwnsCreate:a=!1,createRequested:o=!1,onCreateConsumed:s,ownOnly:c=!1}){let{t:u}=Y(),d=l(),{user:m}=oe(),h=p(),g=D.useUtils(),_=Z(),{data:v}=F(),y=t(()=>v??[],[v]),{data:b}=C({}),S=t(()=>{let e=new Map;for(let t of b??[])e.set(t.id,t.name);return e},[b]),w=D.auth.listTokens.useQuery(void 0),{requestProof:ee,dialog:E}=ce(`Creating a token with all permissions`),{state:O,openNew:k,close:A}=T({newKey:st.token}),[j,M]=i(null),[N,I]=i(null),[te,L]=i(!1),[R,z]=i(null),[B,V]=i(null);r(()=>{o&&(k(),s?.())},[o,k,s]);let H=()=>{g.auth.listTokens.invalidate(),g.auth.listAuthAudit.invalidate()},U=D.auth.mintToken.useMutation({onSuccess:({token:e,record:t})=>{H(),A(),I(null),L(!1),z({token:e,label:t.label})},onError:e=>{I(`Create failed: ${e.message}`),L(!1)}}),W=D.auth.revokeToken.useMutation({onSuccess:()=>{V(null),H()},onError:e=>{V(null),M(`Revoke failed: ${e.message}`)}}),G=De(pt,H),ne=Date.now(),K=(w.data??[]).filter(e=>!c||e.subjectId===m?.id).map(e=>qe(e,_,e.scopes.includes(`*`)?null:e.scopes.map(e=>Ge(e,S,e=>ht(e,d))).join(`, `),ne)),re=async e=>{await h({title:u(`access.tokensSection.revoke`,`Revoke "{{name}}"?`,{name:e.name}),message:e.kind===`All permissions`?u(`access.tokensSection.everyScriptUsingItLoses`,`Every script using it loses access immediately. This cannot be undone.`):u(`access.tokensSection.stopsWorking`,`Whoever holds it loses access immediately. This cannot be undone.`),confirmLabel:u(`access.tokensSection.revoke2`,`Revoke`),variant:`danger`})&&(M(null),V(e.id),W.mutate({id:e.id}))},ie=e=>{(async()=>{M(null),I(null);let t;if(e.scopes.includes(`*`)){L(!0);let e=await ee();if(L(!1),e===null)return;t=e}U.mutate({scopes:[...e.scopes],expiresIn:e.expiresIn,label:e.label,...e.subjectId===void 0?{}:{subjectId:e.subjectId},...t===void 0?{}:{reauthToken:t}})})()};return e(`div`,{"data-testid":`tokens`,children:[E,n(X,{notice:de(j,G.outcome),onDismissNotice:()=>{M(null),G.dismiss()},id:c?`my-tokens`:`tokens`,title:c?u(`access.tokensSection.myTokens`,`My tokens`):u(`access.tokensSection.tokens`,`Tokens`),icon:x,actions:a?void 0:e(P,{size:`sm`,type:`button`,"data-testid":`tokens-new`,onClick:k,children:[n(x,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),u(`system.access.newToken`,`New token`)]}),description:u(`access.tokensSection.oneFormat`,`Every token is its scopes: a few permissions for a script, all permissions for an admin script, or a view of some cameras for a share link. Revoking one stops it on its next use.`),children:n(Ne,{rows:K,label:u(`common.tokensLabel`),isLoading:w.isLoading,loadError:w.isError?w.error?.message??`Request failed`:null,emptyText:u(`access.tokensSection.noTokens`,`No tokens.`),action:{label:u(`access.tokensSection.revoke2`,`Revoke`),icon:f,isAvailable:e=>e.status===`active`,onRun:e=>void re(e),busyId:B,disabled:G.busy||B!==null},...m?.isAdmin===!0?{bulk:{revoke:G,noun:pt,isSelectable:e=>e.status===`active`}}:{}})}),n(ft,{open:O.mode===`new`,users:y.map(e=>({id:e.id,username:e.username})),onClose:()=>{A(),I(null),L(!1)},submitting:U.isPending,formError:N,awaitingProof:te,onSubmit:ie}),R&&n(ot,{token:R.token,label:R.label,onClose:()=>z(null)})]})}var _t=864e5,vt={qr:`QR (by an admin)`,self:`Self-enrolled`},yt={ios:`iOS`,android:`Android`,web:`Web`,other:`Other`};function bt(e){return e.status===`revoked`}function xt(e){return e.status!==`revoked`}function St(e,t=`—`){if(e===null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:n.toLocaleString()}function Ct(e,t){return e===null||Number.isNaN(e)?null:Math.floor((e-t)/_t)}function wt(e,t){let n=Ct(e,t);return n===null?`unknown`:n<0?`expired`:n<30?`soon`:`ok`}function Tt(e,t){let n=Ct(e,t);return n===null?J.t(`helpers.certificateModel.unknown`):n===0?J.t(`helpers.certificateModel.today`):n>0?J.t(`helpers.certificateModel.inDays`,{count:n}):J.t(`helpers.certificateModel.daysAgo`,{count:-n})}function Et(e){if(e===null)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function Dt(e){return e===null||e.length===0?`—`:e.length<=17?e:`${e.slice(0,8)}…${e.slice(-8)}`}function Ot(e){return e.length<=10?e:`${e.slice(0,10)}…`}function kt(e){if(!e.online)return{allowed:!1,reason:J.t(`helpers.certificateModel.nodeOffline`)};if(e.isHub&&e.https.kind===`served`){if(e.https.status.mode===`uploaded`)return{allowed:!1,reason:J.t(`helpers.certificateModel.uploadedCert`)};if(e.https.status.mode===`disabled`)return{allowed:!1,reason:J.t(`helpers.certificateModel.tlsDisabled`)}}return{allowed:!0,reason:null}}var At={prepare:`helpers.certificateModel.stage.prepare`,issue:`helpers.certificateModel.stage.issue`,install:`helpers.certificateModel.stage.install`,reconnect:`helpers.certificateModel.stage.reconnect`,confirm:`helpers.certificateModel.stage.confirm`};function jt(e){if(e.ok)return{tone:`success`,message:J.t(`helpers.certificateModel.renewed`,{nodeId:e.nodeId,serial:Ot(e.newSerial)})};let t=e.keptPreviousLeaf?J.t(`helpers.certificateModel.keptPrevious`):J.t(`helpers.certificateModel.maybeNoCert`);return{tone:`danger`,message:J.t(`helpers.certificateModel.renewalFailed`,{nodeId:e.nodeId,stage:J.t(At[e.stage]),reason:e.reason,kept:t})}}function Mt(e,t){let n=Math.max(0,e-t),r=Math.ceil(n/1e3),i=Math.floor(r/60),a=r%60;return{expired:n===0,label:`${String(i)}:${String(a).padStart(2,`0`)}`}}var Nt=11;function Pt(e,t){let n=e.slice(0,Nt);return t===null?n:`${n} · ${t}`}function Ft(e){return{id:e.id,name:e.deviceName,detail:Pt(e.fingerprint,e.lastUsedFrom),ownerId:e.userId,ownerName:e.username??e.userId,kind:yt[e.platform],scope:vt[e.enrolledVia],status:e.status,createdAt:e.issuedAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function It(e,t){return{id:e.id,name:e.deviceName,detail:null,ownerId:null,ownerName:t,kind:yt[e.platform],scope:null,status:e.status,createdAt:e.issuedAt,lastUsedAt:e.lastUsedAt,expiresAt:e.expiresAt}}function Lt({sessions:t,isLoading:r,loadError:i,emptyText:a,onRevoke:o,revokingId:s}){let{t:c}=Y();return r?e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[n(d,{className:`h-3.5 w-3.5 animate-spin`}),c(`auth.sessionsList.loadingSessions`,`Loading sessions…`)]}):i===null?t.length===0?n(`div`,{className:`rounded border border-dashed border-border px-3 py-4 text-xs text-foreground-subtle text-center`,children:a}):n(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:t.map(e=>n(Rt,{session:e,revoking:s===e.id,onRevoke:()=>o(e)},e.id))}):e(`div`,{className:`text-[11px] text-danger`,children:[c(`auth.sessionsList.couldNotLoadSessions`,`Could not load sessions:`),` `,i]})}function Rt({session:t,revoking:r,onRevoke:i}){let{t:a}=Y(),o=nt(t.client);return e(`li`,{"data-testid":`session-row`,className:`flex items-start gap-3 px-3 py-2 text-xs`,children:[n(S,{className:`h-3.5 w-3.5 mt-0.5 shrink-0 text-foreground-subtle`}),e(`div`,{className:`flex-1 min-w-0 space-y-0.5`,children:[e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[n(`span`,{className:`font-medium text-foreground truncate`,title:o.raw??void 0,children:o.label}),t.current&&n(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary`,children:a(`auth.sessionsList.thisDevice`,`This device`)})]}),e(`div`,{className:`flex flex-wrap gap-x-3 text-[11px] text-foreground-subtle`,children:[n(`span`,{children:it(t.method)}),n(`span`,{className:`font-mono`,children:t.ip??a(`auth.sessionsList.ipUnknown`,`IP unknown`)}),n(`span`,{children:a(`auth.sessionsList.lastActive`,{when:at(t.lastUsedAt)})}),n(`span`,{children:a(`auth.sessionsList.expires`,{when:at(t.expiresAt)})})]})]}),!t.current&&e(P,{variant:`unstyled`,onClick:i,disabled:r,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] text-danger hover:bg-danger/10 disabled:opacity-50`,children:[r?n(d,{className:`h-3 w-3 animate-spin`}):n(b,{className:`h-3 w-3`}),a(`auth.sessionsList.signOut`,`Sign out`)]})]})}export{Le as C,X as D,Oe as E,de as O,Re as S,De as T,nt as _,xt as a,Je as b,Tt as c,St as d,kt as f,st as g,gt as h,bt as i,Z as k,jt as l,Ot as m,Ft as n,Mt as o,Dt as p,It as r,Et as s,Lt as t,wt as u,it as v,Ne as w,Ye as x,at as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ca as e}from"./player-overlays-BKIlLQtG.js";var t=e(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]);export{t};
|