@camstack/addon-admin-ui 1.2.98 → 1.2.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/assets/{AddLocationWizard-BH8qzKUS.js → AddLocationWizard-ww2FaZ1E.js} +1 -1
  2. package/dist/assets/{AddonCollectionPage-DBot-bgj.js → AddonCollectionPage-2an6cPDR.js} +1 -1
  3. package/dist/assets/Addons-Dnc-RXgM.js +1 -0
  4. package/dist/assets/{AdminTabs-Dk1eLBgE.js → AdminTabs-Bp6VWjqO.js} +1 -1
  5. package/dist/assets/AiProfiles-DpS2g7XY.js +3 -0
  6. package/dist/assets/{BrokerForm-GsfCv1ks.js → BrokerForm-MO0zLICQ.js} +1 -1
  7. package/dist/assets/{Build-D3dp29Pc.js → Build-C6grDXZj.js} +3 -3
  8. package/dist/assets/Capabilities-C1oKrOiJ.js +1 -0
  9. package/dist/assets/{CapabilityBadges-DGA5_XiI.js → CapabilityBadges-CQ8iNKjJ.js} +1 -1
  10. package/dist/assets/{Cluster-DV1zGnLF.js → Cluster-BlBr9mrc.js} +1 -1
  11. package/dist/assets/{Data-zSfgUsc7.js → Data-CbSER22j.js} +1 -1
  12. package/dist/assets/DetectionIntelligence-CZyeSCJf.js +1 -0
  13. package/dist/assets/{DeviceAggregateSection-BSMvAqDX.js → DeviceAggregateSection-DJUAmzyp.js} +1 -1
  14. package/dist/assets/{DeviceDetail-DH0vN28R.js → DeviceDetail-DmgBCV4a.js} +2 -2
  15. package/dist/assets/{Devices-BYXPSPMY.js → Devices-BrElFvY3.js} +1 -1
  16. package/dist/assets/{EmbedPlayerPage-Chq0wty0.js → EmbedPlayerPage-4Ay_8z3U.js} +1 -1
  17. package/dist/assets/Events-KnLsawMq.js +1 -0
  18. package/dist/assets/FormBuilder-CEw554z0.js +1 -0
  19. package/dist/assets/{Identity-CQZ5NPpO.js → Identity-bGGI1QWE.js} +1 -1
  20. package/dist/assets/IntegrationDetail-eQjr_VZf.js +1 -0
  21. package/dist/assets/Integrations-CDOiRBS9.js +1 -0
  22. package/dist/assets/{Integrations-Defjpzw9.js → Integrations-R6vGB8m2.js} +1 -1
  23. package/dist/assets/{Logs-DvLobSoL.js → Logs-It8Tm5s9.js} +1 -1
  24. package/dist/assets/{MotionZonesSettings-B_MAiEkW.js → MotionZonesSettings-DwzHsRPk.js} +1 -1
  25. package/dist/assets/MyAccess-Bo811JUn.js +2 -0
  26. package/dist/assets/Network-B6zVgaCe.js +1 -0
  27. package/dist/assets/{NodeAddonsSettingsPanel-kZjm-up8.js → NodeAddonsSettingsPanel-hGBeOFYH.js} +1 -1
  28. package/dist/assets/{NodeInferenceDevices-CW1MDnBG.js → NodeInferenceDevices-BCmCXC5y.js} +1 -1
  29. package/dist/assets/Notifications-DSAFFXJr.js +1 -0
  30. package/dist/assets/{Pipeline-BBVvpBCd.js → Pipeline-BbnF9Ozb.js} +1 -1
  31. package/dist/assets/Plates-Ck6zc0jT.js +1 -0
  32. package/dist/assets/{PrivacyMaskSettings-axbq_wSU.js → PrivacyMaskSettings-B_z0irSV.js} +1 -1
  33. package/dist/assets/{ProviderIcon-DllNEady.js → ProviderIcon-DupRG1e9.js} +1 -1
  34. package/dist/assets/Recordings-BmEupF3w.js +1 -0
  35. package/dist/assets/{ScanNetworkModal-CW0yYE5R.js → ScanNetworkModal-D0r0hQ_h.js} +1 -1
  36. package/dist/assets/{SceneMonitorEditor-Cq2t8wbg.js → SceneMonitorEditor-CGXIUSVs.js} +1 -1
  37. package/dist/assets/{Scenes-Xn6O5H7e.js → Scenes-BNeqc2nK.js} +1 -1
  38. package/dist/assets/{Settings-D9Vlv2hw.js → Settings-Bh1XKvEL.js} +1 -1
  39. package/dist/assets/{Showroom-Bp6aCuMd.js → Showroom-BzVgVZC7.js} +1 -1
  40. package/dist/assets/{Terminal-7vWKE2zb.js → Terminal-B58p5WIp.js} +4 -4
  41. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DrOgR36u.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-TBqHL73f.js} +1 -1
  42. package/dist/assets/{bell-ring-D4Iz5fKj.js → bell-ring-DTczejZ4.js} +1 -1
  43. package/dist/assets/{boxes-BFsuQuon.js → boxes-C985Wrl0.js} +1 -1
  44. package/dist/assets/{build-cluster-graph-Cl_uvOCR.js → build-cluster-graph-CipaA_oB.js} +2 -2
  45. package/dist/assets/circle-check-big-Bj2tv0Uy.js +1 -0
  46. package/dist/assets/{circle-x-y_k7wCKw.js → circle-x-CDQw-Oki.js} +1 -1
  47. package/dist/assets/clock-BcKuptwD.js +1 -0
  48. package/dist/assets/{copy-BrVxemF7.js → copy-CAOXjD5r.js} +1 -1
  49. package/dist/assets/{debounced-invalidate-CNZ2w-7t.js → debounced-invalidate-DpIEFwPp.js} +1 -1
  50. package/dist/assets/dist-BHaLZy2_.js +349 -0
  51. package/dist/assets/{dist-C7L1HtAB.js → dist-CI4L7l-2.js} +1 -1
  52. package/dist/assets/{download-DPw0c0lm.js → download-CAJNFrAB.js} +1 -1
  53. package/dist/assets/face-bbox-BFgt9EZy.js +1 -0
  54. package/dist/assets/{hostInit-D5R1Qfsh.js → hostInit-CAD--nfI.js} +1 -1
  55. package/dist/assets/index-9YoL1cUW.css +2 -0
  56. package/dist/assets/index-KHEomj2t.js +4 -0
  57. package/dist/assets/{key-round-fO7JDI-O.js → key-round-D_sH_q8V.js} +1 -1
  58. package/dist/assets/{mf-entry-bootstrap-0-f566460e.js → mf-entry-bootstrap-0-c4e36f72.js} +2 -2
  59. package/dist/assets/{pencil-B4i0ErRE.js → pencil-CqqsHO49.js} +1 -1
  60. package/dist/assets/play-I3HZudQM.js +1 -0
  61. package/dist/assets/{player-overlays-DLbOIwJR.js → player-overlays-bbH94q-C.js} +1 -1
  62. package/dist/assets/plus-CJqabi49.js +1 -0
  63. package/dist/assets/power-txJcg2ZI.js +1 -0
  64. package/dist/assets/{radio-CxioeWPp.js → radio-Cug4imoO.js} +1 -1
  65. package/dist/assets/{refresh-cw-B8ABC_pB.js → refresh-cw-BGCphjMn.js} +1 -1
  66. package/dist/assets/remoteEntry-BG1pNM_r.js +1 -0
  67. package/dist/assets/rotate-ccw-h1d3r46-.js +1 -0
  68. package/dist/assets/rotate-cw-Bfa_vcNi.js +1 -0
  69. package/dist/assets/{send-BqmuTM7o.js → send-C5aDTEjJ.js} +1 -1
  70. package/dist/assets/{server-D9l8GGnn.js → server-3wNyeBU4.js} +1 -1
  71. package/dist/assets/{shield-B_7hlY3B.js → shield-DplCqcL2.js} +1 -1
  72. package/dist/assets/square-BTe4gnO3.js +1 -0
  73. package/dist/assets/{square-check-big-B8iw67nQ.js → square-check-big-DH3-Pa_W.js} +1 -1
  74. package/dist/assets/src-CEeJOwlR.js +349 -0
  75. package/dist/assets/src-D7V1-vUs.js +67 -0
  76. package/dist/assets/{star-BTw7N-6p.js → star-Y4-10BmL.js} +1 -1
  77. package/dist/assets/{undo-2-DG5MLTW-.js → undo-2-DEYHOb0E.js} +1 -1
  78. package/dist/assets/{upload-DAJfnCVB.js → upload-BtP3VBCU.js} +1 -1
  79. package/dist/assets/{use-scenes-feed-B6yeT27i.js → use-scenes-feed-BXzv1F4x.js} +1 -1
  80. package/dist/assets/useEventInvalidation-Bzw3MDRD.js +1 -0
  81. package/dist/assets/{video-D4j_U5zK.js → video-CXx7eETO.js} +1 -1
  82. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Di4hPkeF.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DyH01HQs.js} +2 -2
  83. package/dist/assets/{wifi-BW00qcYq.js → wifi-ClKydJp-.js} +1 -1
  84. package/dist/assets/{zap-BSOiEhX4.js → zap-Dnj7qxTO.js} +1 -1
  85. package/dist/index.html +6 -6
  86. package/dist/server/addon.js +234 -77
  87. package/package.json +1 -1
  88. package/dist/assets/Addons-D9EFNHE1.js +0 -1
  89. package/dist/assets/AiProfiles-BQ_3LDPD.js +0 -3
  90. package/dist/assets/Capabilities-CoYla6oL.js +0 -1
  91. package/dist/assets/DetectionIntelligence-aHCL16Cy.js +0 -1
  92. package/dist/assets/Events-EROtLWJf.js +0 -1
  93. package/dist/assets/FormBuilder-C7GWtsAC.js +0 -1
  94. package/dist/assets/IntegrationDetail-CWL7rGIm.js +0 -1
  95. package/dist/assets/Integrations-DAIDYD8x.js +0 -1
  96. package/dist/assets/MyAccess-Ci2ZSSm5.js +0 -2
  97. package/dist/assets/Network-BovHq3wO.js +0 -1
  98. package/dist/assets/Notifications-C8I3Vz31.js +0 -1
  99. package/dist/assets/Plates-qD8BtBqF.js +0 -1
  100. package/dist/assets/Recordings-CzEDQqtj.js +0 -1
  101. package/dist/assets/circle-check-big-HrHc_ipL.js +0 -1
  102. package/dist/assets/clock-D2qlcgwd.js +0 -1
  103. package/dist/assets/dist-JjXjac1y.js +0 -349
  104. package/dist/assets/face-bbox-d1aWGz2s.js +0 -1
  105. package/dist/assets/index-DM8saR4E.css +0 -2
  106. package/dist/assets/index-iNi1Y7nh.js +0 -4
  107. package/dist/assets/play-BxkaaFOu.js +0 -1
  108. package/dist/assets/plus-DE5rskj6.js +0 -1
  109. package/dist/assets/power-CzV5Z-a_.js +0 -1
  110. package/dist/assets/remoteEntry-DXwp0vbz.js +0 -1
  111. package/dist/assets/rotate-ccw-CD3wu9ON.js +0 -1
  112. package/dist/assets/rotate-cw-8vMRQVny.js +0 -1
  113. package/dist/assets/search-Dia6mspm.js +0 -1
  114. package/dist/assets/square-Cj45Ro71.js +0 -1
  115. package/dist/assets/src-CQrwlltP.js +0 -349
  116. package/dist/assets/src-UiaZA05p.js +0 -67
  117. package/dist/assets/useEventInvalidation-D7ElHW62.js +0 -1
@@ -1 +0,0 @@
1
- import{K as e,Q as t,S as n,W as r,b as i,o as a,q as o,x as s,z as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{At as l,Br as u,Co as d,Dt as f,Et as p,Fs as m,It as h,Lt as g,Ot as _,Pt as v,So as y,_o as b,bo as x,fo as S,go as C,ho as w,kt as T,mo as E,po as D,vo as O,wo as k,wt as A,xo as j,yo as M}from"./src-UiaZA05p.js";import{Rt as N}from"./src-CQrwlltP.js";import{a as P,i as ee,n as F,r as I,t as L}from"./face-bbox-d1aWGz2s.js";import{a as R,c as z,f as B,i as te,l as ne,m as V,n as H,o as re,p as ie,r as U,s as ae,t as W,u as oe}from"./debounced-invalidate-CNZ2w-7t.js";import{t as G}from"./pencil-B4i0ErRE.js";import{t as K}from"./plus-DE5rskj6.js";import{t as se}from"./square-check-big-B8iw67nQ.js";import{t as q}from"./square-Cj45Ro71.js";import{B as J,C as Y,I as ce,K as le,R as ue,i as X,s as Z,z as de}from"./index-iNi1Y7nh.js";import{t as fe}from"./AdminPage-CCD07UMs.js";import{r as pe,t as me}from"./authed-media-BPd_L9jr.js";var he=le(`badge-check`,[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]);t();var Q=[[`plateGallery`]];function ge({vehicleId:e}){let t=a(),{data:r,isLoading:i}=M({vehicleId:e}),o=j();function c(n){o.mutate({vehicleId:e,sampleId:n.id},{onSettled:()=>{t.invalidateQueries({queryKey:Q})}})}return i?n(`div`,{className:`flex items-center gap-2 py-3 text-xs text-foreground-subtle`,children:[s(Y,{className:`h-3.5 w-3.5 animate-spin`}),`Loading plates…`]}):!r||r.length===0?s(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:`No plates yet.`}):s(`div`,{className:`mt-2 grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-6`,children:r.map(e=>n(`div`,{className:`group relative overflow-hidden rounded-md border border-border bg-surface`,children:[n(`div`,{className:`relative aspect-[2/1] overflow-hidden bg-surface-hover`,children:[e.base64?s(`img`,{src:`data:image/jpeg;base64,${e.base64}`,alt:e.text,className:`h-full w-full object-cover`}):s(`div`,{className:`flex h-full w-full items-center justify-center text-foreground-subtle`,children:s(J,{className:`h-6 w-6`})}),s(`button`,{type:`button`,onClick:()=>c(e),disabled:o.isPending,className:`absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 transition-opacity group-hover:opacity-100 disabled:cursor-not-allowed`,"aria-label":`Remove plate sample`,children:s(X,{className:`h-4 w-4 text-white`})})]}),s(`p`,{className:`truncate px-1.5 py-1 text-center font-mono text-[11px] font-semibold tracking-wide text-foreground`,title:e.text,children:e.text})]},e.id))})}function _e({vehicle:e,expanded:t,onToggle:r}){let c=a(),[u,d]=o(``),[m,b]=o(!1),[x,S]=o(!1),w=y(),E=C();function D(){d(e.name),b(!0)}function O(){b(!1),d(``)}function k(){let t=u.trim();if(!t||t===e.name){O();return}w.mutate({id:e.id,name:t},{onSettled:()=>{c.invalidateQueries({queryKey:Q}),O()}})}function j(){E.mutate({id:e.id},{onSettled:()=>{c.invalidateQueries({queryKey:Q}),S(!1)}})}return n(`div`,{className:`rounded-md border border-border bg-surface`,children:[n(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[s(`div`,{className:`h-8 w-12 shrink-0 overflow-hidden rounded border border-border bg-surface-hover`,children:e.coverBase64?s(`img`,{src:`data:image/jpeg;base64,${e.coverBase64}`,alt:e.name,className:`h-full w-full object-cover`}):s(`div`,{className:`flex h-full w-full items-center justify-center`,children:s(J,{className:`h-4 w-4 text-foreground-subtle`})})}),s(`div`,{className:`flex flex-1 min-w-0 items-center gap-2`,children:m?n(i,{children:[s(v,{value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&k(),e.key===`Escape`&&O()},className:`h-6 text-xs`,autoFocus:!0}),s(`button`,{type:`button`,onClick:k,disabled:w.isPending,className:`text-success hover:text-success/80 disabled:opacity-50`,"aria-label":`Confirm rename`,children:s(de,{className:`h-3.5 w-3.5`})}),s(`button`,{type:`button`,onClick:O,className:`text-foreground-subtle hover:text-foreground`,"aria-label":`Cancel rename`,children:s(X,{className:`h-3.5 w-3.5`})})]}):s(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name})}),s(h,{variant:`default`,className:`text-[10px]`,children:e.sampleCount}),!m&&n(`div`,{className:`flex items-center gap-1`,children:[s(`button`,{type:`button`,onClick:D,className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle hover:text-foreground`,"aria-label":`Rename`,children:s(G,{className:`h-3.5 w-3.5`})}),s(`button`,{type:`button`,onClick:()=>S(!0),className:`p-1 rounded hover:bg-danger/10 text-foreground-subtle hover:text-danger`,"aria-label":`Delete`,children:s(Z,{className:`h-3.5 w-3.5`})})]}),s(`button`,{type:`button`,onClick:r,className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle`,"aria-label":t?`Collapse`:`Expand`,children:s(t?ue:ce,{className:`h-3.5 w-3.5`})})]}),t&&s(`div`,{className:`border-t border-border px-3 pb-3 pt-2`,children:s(ge,{vehicleId:e.id})}),s(A,{open:x,onOpenChange:e=>!e&&S(!1),children:n(p,{children:[n(T,{children:[s(l,{children:`Delete vehicle`}),n(f,{children:[`Delete `,s(`strong`,{children:e.name}),` and all its plate samples? This cannot be undone.`]})]}),n(_,{children:[s(g,{variant:`secondary`,onClick:()=>S(!1),children:`Cancel`}),n(g,{variant:`danger`,onClick:j,disabled:E.isPending,children:[E.isPending?s(Y,{className:`h-3.5 w-3.5 animate-spin`}):null,`Delete`]})]})]})})]})}function ve(){let e=a(),[t,r]=o(``),i=E();function c(){let n=t.trim();n&&i.mutate({name:n},{onSettled:()=>{e.invalidateQueries({queryKey:Q}),r(``)}})}return n(`div`,{className:`flex items-center gap-2 pt-2`,children:[s(v,{placeholder:`New vehicle name…`,value:t,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&c()},className:`h-7 text-xs flex-1`}),n(g,{variant:`primary`,size:`sm`,onClick:c,disabled:i.isPending||!t.trim(),children:[i.isPending?s(Y,{className:`h-3.5 w-3.5 animate-spin`}):s(K,{className:`h-3.5 w-3.5`}),`Add`]})]})}function ye(){let{data:e,isLoading:t}=x(),[r,i]=o(null);function a(e){i(t=>t===e?null:e)}return t?n(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[s(Y,{className:`h-4 w-4 animate-spin`}),`Loading vehicles…`]}):n(`div`,{className:`space-y-2`,children:[(!e||e.length===0)&&s(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:`No vehicles enrolled yet. Add one below.`}),e?.map(e=>s(_e,{vehicle:e,expanded:r===e.id,onToggle:()=>a(e.id)},e.id)),s(ve,{})]})}function be(e){return e==null?null:e.cropUrl!==void 0&&e.cropUrl.length>0?e.cropUrl:e.base64!==void 0&&e.base64.length>0?`data:image/jpeg;base64,${e.base64}`:null}t();var xe=[[`plateGallery`]];function Se({plateIds:e,vehicles:t,onDone:r}){let i=a(),c=S(),u=E(),[d,m]=o(``),[h,y]=o(!1),[b,x]=o(null),C=e!==null&&e.length>0,w=e?.length??0;function D(){y(!1),m(``),x(null)}function O(){D(),r()}function k(t){!e||e.length===0||c.mutate({plateIds:[...e],vehicleId:t},{onSettled:()=>{i.invalidateQueries({queryKey:xe}),O()}})}function j(){!e||!d.trim()||u.mutate({name:d.trim()},{onSuccess:e=>{e?.id&&k(e.id)},onError:()=>{i.invalidateQueries({queryKey:xe}),O()}})}let M=c.isPending||u.isPending;return s(A,{open:C,onOpenChange:e=>!e&&O(),children:n(p,{children:[n(T,{children:[s(l,{children:w>1?`Assign ${String(w)} plates to vehicle`:`Assign plate to vehicle`}),s(f,{children:`Select an existing vehicle or create a new one.`})]}),s(`div`,{className:`space-y-1 max-h-56 overflow-y-auto`,children:t.map(e=>n(`button`,{type:`button`,onClick:()=>x(e.id),className:`w-full rounded-md px-3 py-2 text-left text-xs transition-colors ${b===e.id?`bg-primary/12 text-primary`:`hover:bg-surface-hover text-foreground`}`,children:[s(`span`,{className:`font-medium`,children:e.name}),n(`span`,{className:`ml-2 text-foreground-subtle`,children:[e.sampleCount,` plates`]})]},e.id))}),h?s(`div`,{className:`flex items-center gap-2 pt-2 border-t border-border`,children:s(v,{placeholder:`New vehicle name…`,value:d,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&j()},autoFocus:!0,className:`flex-1`})}):s(`button`,{type:`button`,onClick:()=>{x(null),y(!0)},className:`mt-2 w-full rounded-md border border-dashed border-border px-3 py-2 text-left text-xs text-foreground-subtle hover:border-primary hover:text-primary transition-colors`,children:`+ New vehicle…`}),n(_,{children:[s(g,{variant:`secondary`,onClick:O,disabled:M,children:`Cancel`}),h?n(g,{variant:`primary`,onClick:j,disabled:M||!d.trim(),children:[M&&s(Y,{className:`h-3.5 w-3.5 animate-spin`}),`Create & assign`]}):n(g,{variant:`primary`,onClick:()=>b&&k(b),disabled:M||!b,children:[M&&s(Y,{className:`h-3.5 w-3.5 animate-spin`}),`Assign`,w>1?` ${String(w)}`:``]})]})]})})}t();var Ce=[[`plateGallery`]];function we(e){let[t,n]=o(null),[r,i]=o(null),[a,s]=o(!1);return c(()=>{if(n(null),i(null),s(!1),!e)return;let t=!1,r=null;return(async()=>{try{let i=await pe(`${me}/${encodeURIComponent(e)}`);if(t)return;r=URL.createObjectURL(i),n(r)}catch{t||s(!0)}})(),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[e]),c(()=>{if(!t)return;let e=new Image;return e.onload=()=>i({width:e.naturalWidth,height:e.naturalHeight}),e.onerror=()=>s(!0),e.src=t,()=>{e.onload=null,e.onerror=null}},[t]),{frameSrc:t,naturalWidth:r?.width??null,naturalHeight:r?.height??null,failed:a}}function Te(e){let t=e.filter(e=>e.base64.length>0);return t.length===0?null:t.find(e=>/crop|plate/i.test(e.kind))??t[0]}function $({label:e,value:t,mono:r}){return n(`div`,{className:`flex items-baseline justify-between gap-3 py-1.5 border-b border-border/60 last:border-0`,children:[s(`span`,{className:`shrink-0 text-[11px] uppercase tracking-wide text-foreground-subtle`,children:e}),s(`span`,{className:`min-w-0 truncate text-right text-xs font-medium text-foreground ${r?`font-mono`:``}`,title:t,children:t})]})}function Ee({box:e}){return s(`div`,{className:`pointer-events-none absolute rounded-[3px] border-2 border-primary shadow-[0_0_0_9999px_rgba(0,0,0,0.28)]`,style:{left:`${String(e.x*100)}%`,top:`${String(e.y*100)}%`,width:`${String(e.width*100)}%`,height:`${String(e.height*100)}%`},children:s(`span`,{className:`absolute -top-4 left-0 rounded bg-primary px-1 text-[9px] font-semibold uppercase tracking-wide text-white`,children:`Plate`})})}function De({plate:e,cameraName:t,onClose:i,onAssign:l,onUnassign:u,onDelete:d,actionsPending:f}){let m=a(),{data:h,isFetching:_}=b({plateId:e?.plateId??``},{enabled:e!==null}),y=D(),[x,S]=o(`frame`),[C,w]=o(!1),[T,E]=o(``),{frameSrc:O,naturalWidth:k,naturalHeight:j,failed:M}=we(e?.keyFrameMediaKey);c(()=>{w(!1),E(``),S(`frame`)},[e?.plateId]);let N=r(()=>{let t=Te(h??[]);return t?`data:image/jpeg;base64,${t.base64}`:be(e)},[h,e]),R=r(()=>!e?.plateBbox||k===null||j===null?null:L(e.plateBbox,k,j),[e?.plateBbox,k,j]);if(e===null)return null;let z=typeof e.keyFrameMediaKey==`string`&&e.keyFrameMediaKey.length>0&&!M,B=z&&x===`frame`,te=e.assigned?e.vehicleName??`Assigned`:e.recognizedVehicleId?`${e.vehicleName??`Recognized`} (suggested)`:`Unassigned`,ne=`${String(Math.round(e.score*100))}%${e.corrected?` · corrected`:``}`;function re(){e&&(E(e.text),w(!0))}function U(){if(!e)return;let t=T.trim().toUpperCase();if(!t||t===e.text){w(!1);return}y.mutate({plateId:e.plateId,text:t},{onSettled:()=>{m.invalidateQueries({queryKey:Ce}),w(!1)}})}return s(A,{open:!0,onOpenChange:e=>!e&&i(),children:n(p,{width:`lg`,placement:`sheet-on-mobile`,"aria-label":`Plate detail`,className:`flex h-[92dvh] flex-col gap-0 overflow-hidden p-0 bottom-0 left-0 right-0 top-auto w-full max-w-full translate-x-0 translate-y-0 rounded-b-none md:bottom-auto md:left-1/2 md:right-auto md:top-1/2 md:h-auto md:w-[calc(100vw-2rem)] md:max-w-xl md:-translate-x-1/2 md:-translate-y-1/2 md:rounded-lg md:max-h-[calc(100dvh-2rem)]`,children:[n(`header`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-border px-4 py-3`,children:[n(`div`,{className:`min-w-0`,children:[s(`div`,{className:`truncate font-mono text-sm font-semibold tracking-wide text-foreground`,children:e.text||`Plate detail`}),s(`div`,{className:`mt-0.5 truncate text-[11px] text-foreground-subtle`,children:t})]}),s(`button`,{type:`button`,onClick:i,className:`rounded p-1 text-foreground-subtle hover:bg-surface-hover hover:text-foreground`,"aria-label":`Close`,children:s(X,{className:`h-4 w-4`})})]}),n(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto overscroll-contain px-4 py-3`,children:[z&&n(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5 text-xs`,children:[n(`button`,{type:`button`,onClick:()=>S(`frame`),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 transition-colors ${x===`frame`?`bg-primary/12 font-medium text-primary`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[s(ee,{className:`h-3.5 w-3.5`}),` Full frame`]}),n(`button`,{type:`button`,onClick:()=>S(`crop`),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 transition-colors ${x===`crop`?`bg-primary/12 font-medium text-primary`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[s(P,{className:`h-3.5 w-3.5`}),` Crop`]})]}),B&&O?s(`div`,{className:`overflow-hidden rounded-lg border border-border bg-background`,children:s(H,{src:O,alt:`Full frame with detected plate`,fit:`natural`,className:`w-full`,overlay:R?s(Ee,{box:R}):void 0})}):N?n(`div`,{className:`relative aspect-[2/1] w-full overflow-hidden rounded-lg border border-border bg-background`,children:[s(H,{src:N,alt:`Detected plate`,className:`h-full w-full`}),_&&s(`div`,{className:`absolute right-2 top-2 rounded-full bg-black/50 p-1 text-white`,children:s(Y,{className:`h-3.5 w-3.5 animate-spin`})})]}):n(`div`,{className:`flex aspect-[2/1] w-full flex-col items-center justify-center gap-1.5 rounded-lg border border-border bg-warning/5 text-foreground-subtle`,children:[s(V,{className:`h-8 w-8 text-warning/70`}),s(`span`,{className:`text-[11px] font-medium uppercase tracking-wide text-warning/80`,children:`No image`}),s(`span`,{className:`px-6 text-center text-[10px] text-foreground-subtle`,children:`The crop media for this plate could not be resolved. Safe to delete.`})]}),s(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-2`,children:n(`div`,{className:`flex items-center justify-between gap-3`,children:[s(`span`,{className:`shrink-0 text-[11px] uppercase tracking-wide text-foreground-subtle`,children:`Plate text`}),C?n(`div`,{className:`flex min-w-0 flex-1 items-center justify-end gap-1.5`,children:[s(v,{value:T,onChange:e=>E(e.target.value),onKeyDown:e=>{e.key===`Enter`&&U(),e.key===`Escape`&&w(!1)},className:`h-7 max-w-[10rem] text-right font-mono text-xs uppercase`,autoFocus:!0}),s(`button`,{type:`button`,onClick:U,disabled:y.isPending,className:`text-success hover:text-success/80 disabled:opacity-50`,"aria-label":`Save corrected text`,children:y.isPending?s(Y,{className:`h-3.5 w-3.5 animate-spin`}):s(de,{className:`h-3.5 w-3.5`})}),s(`button`,{type:`button`,onClick:()=>w(!1),className:`text-foreground-subtle hover:text-foreground`,"aria-label":`Cancel`,children:s(X,{className:`h-3.5 w-3.5`})})]}):n(`button`,{type:`button`,onClick:re,className:`group flex min-w-0 items-center gap-1.5`,title:`Correct the OCR reading`,children:[s(`span`,{className:`truncate font-mono text-sm font-semibold tracking-wide text-foreground`,children:e.text||`—`}),s(G,{className:`h-3 w-3 shrink-0 text-foreground-subtle group-hover:text-foreground`})]})]})}),n(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-1`,children:[s($,{label:`Camera`,value:t}),s($,{label:`Captured`,value:ie(e.timestamp)}),s($,{label:`Confidence`,value:ne}),s($,{label:`Vehicle`,value:te}),s($,{label:`Track`,value:e.trackId,mono:!0})]})]}),n(`footer`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-border px-4 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]`,children:[e.assigned?n(g,{variant:`secondary`,onClick:()=>u(e.plateId),disabled:f,children:[s(F,{className:`h-3.5 w-3.5`}),` Detach`]}):n(g,{variant:`primary`,onClick:()=>l(e.plateId),disabled:f,children:[s(I,{className:`h-3.5 w-3.5`}),` Assign`]}),n(g,{variant:`secondary`,onClick:()=>d(e.plateId),disabled:f,children:[s(Z,{className:`h-3.5 w-3.5`}),` Delete`]})]})]})})}t();var Oe=[[`plateGallery`]],ke=500,Ae=120;function je({plate:e,cameraName:t,nowMs:r,selected:i,onToggleSelect:o,onAssign:c,onOpenDetail:l}){let u=a(),f=d(),p=w(),m=()=>{u.invalidateQueries({queryKey:Oe})},h=()=>l(e.plateId),g=be(e);return n(`div`,{className:`relative flex flex-col overflow-hidden rounded-md border bg-surface ${i?`border-primary ring-1 ring-primary`:`border-border`}`,children:[n(`div`,{className:`relative aspect-[2/1] overflow-hidden bg-surface-hover`,children:[g===null?n(`button`,{type:`button`,onClick:h,className:`flex h-full w-full flex-col items-center justify-center gap-1 bg-warning/5 text-foreground-subtle`,title:`No crop image — the plate's crop media is missing. Safe to delete.`,children:[s(V,{className:`h-7 w-7 text-warning/70`}),s(`span`,{className:`text-[9px] font-medium uppercase tracking-wide text-warning/80`,children:`No crop`})]}):s(`img`,{src:g,alt:`Plate ${e.text} from ${t}`,onClick:h,className:`h-full w-full cursor-zoom-in object-cover`}),s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),o(e.plateId)},className:`absolute left-0 top-0 z-10 rounded-br-md bg-black/50 p-1.5 text-white hover:bg-black/70`,"aria-label":i?`Deselect`:`Select`,children:i?s(se,{className:`h-4 w-4 text-primary`}):s(q,{className:`h-4 w-4`})}),e.corrected&&n(`span`,{className:`absolute right-0 top-0 z-10 flex items-center gap-0.5 rounded-bl-md bg-primary/80 px-1 py-0.5 text-[8px] font-semibold uppercase tracking-wide text-white`,title:`Manually corrected`,children:[s(he,{className:`h-3 w-3`}),` Fixed`]})]}),n(`div`,{className:`min-w-0 px-2 pt-1.5 space-y-0.5`,children:[s(`p`,{className:`truncate font-mono text-xs font-bold tracking-wide text-foreground`,title:e.text,children:e.text||`—`}),s(`p`,{className:`truncate text-[10px] text-foreground-subtle`,title:t,children:t}),s(`p`,{className:`truncate text-[10px] text-foreground-subtle`,children:B(e.timestamp,r)}),e.vehicleName&&s(`p`,{className:`truncate text-[10px] font-medium text-primary`,title:e.vehicleName,children:e.vehicleName})]}),n(`div`,{className:`mt-1 flex items-center gap-0.5 border-t border-border/60 px-1 py-0.5`,children:[e.assigned?s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),f.mutate({plateId:e.plateId},{onSettled:m})},disabled:f.isPending,className:`rounded p-1.5 text-foreground-subtle transition-colors hover:bg-warning/10 hover:text-warning disabled:opacity-40`,"aria-label":`Detach plate`,title:`Detach`,children:f.isPending?s(Y,{className:`h-4 w-4 animate-spin`}):s(F,{className:`h-4 w-4`})}):s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),c(e.plateId)},className:`rounded p-1.5 text-foreground-subtle transition-colors hover:bg-primary/10 hover:text-primary`,"aria-label":`Assign plate to vehicle`,title:`Assign to vehicle`,children:s(I,{className:`h-4 w-4`})}),s(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),p.mutate({plateId:e.plateId},{onSettled:m})},disabled:p.isPending,className:`ml-auto rounded p-1.5 text-foreground-subtle transition-colors hover:bg-danger/10 hover:text-danger disabled:opacity-40`,"aria-label":`Delete plate`,title:`Delete plate`,children:p.isPending?s(Y,{className:`h-4 w-4 animate-spin`}):s(Z,{className:`h-4 w-4`})})]})]})}var Me=[{label:`All`,value:`all`},{label:`Unassigned`,value:`unassigned`},{label:`Assigned`,value:`assigned`}];function Ne(e,t){return t===`unassigned`?e.filter(e=>!e.assigned):t===`assigned`?e.filter(e=>e.assigned):e}function Pe(){let e=a(),[t,c]=o(`all`),[l,f]=o(ae),[p,m]=o(new Set),[h,_]=o(new Set),[v,y]=o(null),[b,S]=o(null),{data:C,isLoading:T}=O({limit:ke,includeCrops:!1},{refetchInterval:3e4}),{data:E=[]}=x(),{data:D}=u({}),A=d(),j=k(),M=w(),N=Date.now(),P=C??[],ee=r(()=>{let e=new Map;for(let t of D??[])e.set(t.id,t.name);return e},[D]),L=e=>ee.get(e)??`Camera #${String(e)}`,B=r(()=>z(P).map(e=>({id:e,name:L(e)})).sort((e,t)=>e.name.localeCompare(t.name)),[P,ee]),V=r(()=>ne(oe(Ne(P,t),l),p),[P,t,l,p]),H=re(V,Ae,r(()=>JSON.stringify([t,l.fromMs,l.toMs,[...p].sort((e,t)=>e-t)]),[t,l.fromMs,l.toMs,p])),ie=r(()=>new Map(P.map(e=>[e.plateId,e])),[P]),W=b===null?null:ie.get(b)??null,G=()=>{e.invalidateQueries({queryKey:Oe})},K=()=>_(new Set);function se(e){_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}let q=[...h],J=j.isPending||M.isPending,ce=A.isPending||M.isPending;function le(){q.length!==0&&j.mutate({plateIds:q},{onSettled:()=>{G(),K()}})}function ue(){q.length!==0&&Promise.allSettled(q.map(e=>M.mutateAsync({plateId:e}))).then(()=>{G(),K()})}function de(e){S(null),y([e])}function fe(e){A.mutate({plateId:e},{onSettled:G}),S(null)}function pe(e){M.mutate({plateId:e},{onSettled:G}),S(null)}let me=V.length!==P.length;return n(`div`,{className:`relative space-y-3`,children:[n(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[s(`div`,{className:`flex items-center gap-1`,children:Me.map(e=>s(`button`,{type:`button`,onClick:()=>c(e.value),className:`rounded-md px-2.5 py-1 text-xs transition-colors ${t===e.value?`bg-primary/12 text-primary font-medium`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:e.label},e.value))}),s(U,{onChange:f}),s(te,{cameras:B,selected:p,onChange:m}),!T&&s(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:me?`${String(V.length)} of ${String(P.length)} plates`:`${String(V.length)} plate${V.length===1?``:`s`}`})]}),h.size>0&&n(`div`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-primary/40 bg-primary/8 px-3 py-2`,children:[n(`span`,{className:`text-xs font-medium text-foreground`,children:[h.size,` selected`]}),n(`div`,{className:`ml-auto flex flex-wrap items-center gap-1.5`,children:[n(g,{variant:`primary`,onClick:()=>y(q),disabled:J,children:[s(I,{className:`h-3.5 w-3.5`}),` Assign`]}),n(g,{variant:`secondary`,onClick:le,disabled:J,children:[j.isPending?s(Y,{className:`h-3.5 w-3.5 animate-spin`}):s(F,{className:`h-3.5 w-3.5`}),` `,`Detach`]}),n(g,{variant:`secondary`,onClick:ue,disabled:J,children:[s(Z,{className:`h-3.5 w-3.5`}),` Delete`]}),s(g,{variant:`ghost`,onClick:K,disabled:J,children:s(X,{className:`h-3.5 w-3.5`})})]})]}),T&&n(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[s(Y,{className:`h-4 w-4 animate-spin`}),` Loading plates…`]}),!T&&V.length===0&&s(`p`,{className:`py-4 text-xs text-foreground-subtle`,children:P.length>0?`No plates match the current filters.`:`No plates recognized yet.`}),!T&&V.length>0&&n(i,{children:[s(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(9rem,1fr))] gap-2`,children:H.pageItems.map(e=>s(je,{plate:e,cameraName:L(e.deviceId),nowMs:N,selected:h.has(e.plateId),onToggleSelect:se,onAssign:e=>y([e]),onOpenDetail:S},e.plateId))}),s(R,{currentPage:H.page,totalItems:H.totalItems,pageSize:H.pageSize,onPageChange:H.setPage,itemNoun:`plates`})]}),s(De,{plate:W,cameraName:W?L(W.deviceId):``,onClose:()=>S(null),onAssign:de,onUnassign:fe,onDelete:pe,actionsPending:ce}),s(Se,{plateIds:v,vehicles:E,onDone:()=>{y(null),K()}})]})}t();var Fe=[[`plateGallery`]],Ie=2e3;function Le(){let t=a(),n=e(t);n.current=t;let r=e(void 0);r.current||=W({delayMs:Ie,invalidate:()=>{n.current.invalidateQueries({queryKey:Fe})}}),c(()=>()=>r.current?.cancel(),[]),m(N.PipelineAnalyticsPlateGalleryChanged,()=>{r.current?.trigger()})}function Re(){return Le(),s(fe,{icon:J,title:`Plates`,subtitle:`Manage enrolled vehicles and assign recognized license plates to them.`,children:n(`section`,{className:`space-y-3`,children:[n(`div`,{children:[s(`h2`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Vehicles`}),s(`p`,{className:`text-xs text-foreground-subtle mb-3`,children:`Enrolled vehicle identities used for plate recognition. Expand a row to view or remove plate samples.`}),s(ye,{})]}),n(`div`,{className:`pt-4 border-t border-border`,children:[s(`h2`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Recent recognized plates`}),s(`p`,{className:`text-xs text-foreground-subtle mb-3`,children:`License plates read by the detection pipeline. Assign them to a vehicle, correct the OCR text, or delete.`}),s(Pe,{})]})]})})}export{Re as PlatesPage};
@@ -1 +0,0 @@
1
- import{I as e,Q as t,S as n,W as r,o as i,q as a,x as o,z as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Z as c,q as l}from"./player-overlays-DLbOIwJR.js";import{Ao as u,Bo as d,Br as f,Do as p,Eo as m,Ga as h,Go as g,Ho as _,Jo as v,Ko as y,Mo as b,No as x,Oo as S,Po as C,Ps as w,Sa as T,Vo as E,Wo as D,Xt as O,Ya as k,_a as A,an as j,ca as M,et as N,fa as P,gn as F,ko as ee,ln as I,qo as te,ra as L,vn as R}from"./src-UiaZA05p.js";import{Rt as z,mt as B}from"./src-CQrwlltP.js";import{t as ne}from"./circle-x-y_k7wCKw.js";import{t as re}from"./download-DPw0c0lm.js";import{a as V,i as H,n as ie,r as ae,t as oe}from"./AddLocationWizard-BH8qzKUS.js";import{C as U,G as W,K as G,M as K,O as q,V as J,i as Y,s as X}from"./index-iNi1Y7nh.js";import{t as se}from"./AdminPage-CCD07UMs.js";import{r as ce}from"./authed-media-BPd_L9jr.js";import{t as le}from"./DeviceAggregateSection-BSMvAqDX.js";import{t as ue}from"./AdminTabs-Dk1eLBgE.js";import{t as Z}from"./format-size-DIxKXxtj.js";var Q=G(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),de=G(`scissors`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M8.12 8.12 12 12`,key:`1alkpv`}],[`path`,{d:`M20 4 8.12 15.88`,key:`xgtan2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M14.8 14.8 20 20`,key:`ptml3r`}]]),fe=G(`settings-2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]);t();function pe(){let e=f({}),t=r(()=>(e.data??[]).filter(e=>e.type===B.Camera).sort((e,t)=>e.name.localeCompare(t.name)),[e.data]),[i,s]=a(null),c=i??t[0]?.id??null;return!e.isLoading&&t.length===0?o(O,{icon:J,title:`No cameras`,description:`Add a camera first.`}):n(`div`,{className:`space-y-3`,children:[n(`div`,{className:`flex items-center gap-2`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Camera`}),o(`select`,{value:c??``,onChange:e=>s(Number(e.target.value)),className:`rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:t.map(e=>o(`option`,{value:e.id,children:e.name},e.id))})]}),c!==null&&o(j,{deviceId:c,children:o(le,{deviceId:c,sectionFilter:e=>e.location===`top-tab`&&e.tab===`recording`})},c)]})}t();var me=[`high`,`mid`,`low`],he=[{value:1,label:`Real time (1×)`},{value:2,label:`2×`},{value:4,label:`4×`},{value:8,label:`8×`},{value:16,label:`16×`}],ge=10080*60*1e3;function _e(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 ve({onClose:e,onCreated:t}){let i=f({}),s=r(()=>(i.data??[]).filter(e=>e.type===B.Camera).sort((e,t)=>e.name.localeCompare(t.name)),[i.data]),[c,l]=a(``),[u,d]=a(`high`),[p,m]=a(_e(60)),[h,g]=a(_e(0)),[_,v]=a(1),[y,b]=a(!0),[x,C]=a(``),[w,T]=a(null),E=c===``?s[0]?.id??null:c,D=new Date(p).getTime(),O=new Date(h).getTime(),k=Number.isFinite(D)&&Number.isFinite(O)&&D<O,A=S({onSuccess:()=>{t(),e()},onError:e=>T(e instanceof Error?e.message:String(e))});return o(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:e,children:n(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[n(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[n(`h2`,{className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[o(q,{className:`h-3.5 w-3.5`}),`New export`]}),o(`button`,{onClick:e,className:`text-foreground-subtle hover:text-foreground`,children:o(Y,{className:`h-4 w-4`})})]}),n(`div`,{className:`p-4 space-y-3`,children:[n(`div`,{className:`grid grid-cols-2 gap-3`,children:[n(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Camera`}),o(`select`,{value:E??``,onChange:e=>l(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:s.map(e=>o(`option`,{value:e.id,children:e.name},e.id))})]}),n(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Profile`}),o(`select`,{value:u,onChange:e=>d(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:me.map(e=>o(`option`,{value:e,children:e},e))})]})]}),n(`div`,{className:`grid grid-cols-2 gap-3`,children:[n(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`From`}),o(`input`,{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`})]}),n(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`To`}),o(`input`,{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`})]})]}),n(`div`,{className:`grid grid-cols-2 gap-3`,children:[n(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Speed`}),o(`select`,{value:_,onChange:e=>v(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:he.map(e=>o(`option`,{value:e.value,children:e.label},e.value))})]}),n(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Title (optional)`}),o(`input`,{type:`text`,value:x,onChange:e=>C(e.target.value),placeholder:`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`})]})]}),n(`label`,{className:`flex items-center gap-2 text-xs text-foreground cursor-pointer`,children:[o(`input`,{type:`checkbox`,checked:y,disabled:_!==1,onChange:e=>b(e.target.checked),className:`accent-primary`}),`Include audio`,_===1?``:` (real-time only)`]}),!k&&o(`p`,{className:`text-[11px] text-danger`,children:`"From" must be before "To".`}),w&&o(`p`,{className:`text-[11px] text-danger`,children:w})]}),n(`div`,{className:`flex justify-end gap-2 border-t border-border px-4 py-3`,children:[o(`button`,{onClick:e,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground`,children:`Cancel`}),o(`button`,{onClick:()=>{if(E===null||!k)return;T(null);let e=x.trim();A.mutate({deviceId:E,profile:u,fromMs:D,toMs:O,options:{includeAudio:y,maxLifeMs:ge,deleteAfterDownload:!1,..._===1?{}:{speed:_},...e.length>0?{title:e}:{}}})},disabled:E===null||!k||A.isPending,className:`rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:A.isPending?`Queuing…`:`Create export`})]})]})})}function ye(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 be(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function xe(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`${be(e)} · ${o}`}function Se(e,t){let n=e-t;if(n<=0)return`expired`;let r=Math.floor(n/6e4);if(r<60)return`in ${String(r)}m`;let i=Math.floor(r/60);return i<24?`in ${String(i)}h`:`in ${String(Math.floor(i/24))}d`}function Ce(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})}t();var we=[[`recordingExport`]],Te={queued:{cls:`bg-muted text-foreground-subtle`,label:`queued`},rendering:{cls:`bg-primary/10 text-primary`,label:`rendering`,spin:!0},ready:{cls:`bg-success/10 text-success`,label:`ready`},failed:{cls:`bg-danger/10 text-danger`,label:`failed`},expired:{cls:`bg-muted text-foreground-subtle`,label:`expired`},deleted:{cls:`bg-muted text-foreground-subtle`,label:`deleted`}};function Ee(){let{data:e,isLoading:t}=u({},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`queued`||e.state===`rendering`)?3e3:!1}),{map:n}=w(z.RecordingExportProgress,e=>e.exportId),{map:i}=w(z.RecordingExportCompleted,e=>e.exportId),{map:a}=w(z.RecordingExportFailed,e=>e.exportId);return{rows:r(()=>Ce(e??[],n,i,a),[e,n,i,a]),isLoading:t}}function De(e){let[t,n]=a(()=>Date.now());return s(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function Oe(){let t=i(),[s,l]=a(!1),u=()=>{t.invalidateQueries({queryKey:[[`recordingExport`,`listExports`]]})},d=I(),m=c().trpcClient,h=De(6e4),{rows:g,isLoading:_}=Ee(),{data:v}=f({}),y=r(()=>{let e=new Map;for(let t of v??[])e.set(t.id,t.name);return e},[v]),b=e(()=>{t.invalidateQueries({queryKey:we})},[t]),x=p({onSuccess:b}),S=ee({onSuccess:b}),[C,w]=a(null),T=e(async e=>{w(e.id);try{let{url:t}=await m.recordingExport.getDownloadUrl.query({exportId:e.id}),n=await ce(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),b()}finally{w(null)}},[m,b]),E=e(async e=>{await d({title:`Cancel this export?`,message:`Stops the render. The partial file is discarded.`,confirmLabel:`Cancel export`,variant:`danger`})&&x.mutate({exportId:e.id})},[d,x]),D=e(async e=>{await d({title:`Delete this export?`,message:`Permanently removes the rendered file and its history row.`,confirmLabel:`Delete`,variant:`danger`})&&S.mutate({exportId:e.id})},[d,S]),k=r(()=>[{key:`camera`,header:`Camera`,render:e=>o(`span`,{className:`text-foreground`,children:y.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`range`,header:`Range`,nowrap:!0,render:e=>o(`span`,{className:`tabular-nums`,children:xe(e.fromMs,e.toMs)})},{key:`variant`,header:`Variant`,render:e=>o(`span`,{className:`text-foreground-subtle`,children:ye(e.options)})},{key:`state`,header:`State`,render:e=>{let t=Te[e.state];return n(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium ${t.cls}`,children:[t.spin&&o(U,{className:`h-2.5 w-2.5 animate-spin`}),t.label,e.state===`rendering`&&e.progressPct!==null&&n(`span`,{className:`tabular-nums`,children:[e.progressPct,`%`]})]})}},{key:`expiry`,header:`Expires`,nowrap:!0,render:e=>e.state===`deleted`?o(`span`,{className:`text-foreground-subtle`,children:`—`}):o(`span`,{className:`text-foreground-subtle tabular-nums`,children:Se(e.expiresAt,h)})},{key:`size`,header:`Size`,align:`right`,nowrap:!0,render:e=>o(`span`,{className:`tabular-nums`,children:e.fileBytes===null?`—`:Z(e.fileBytes)})},{key:`actions`,header:``,align:`right`,render:e=>{let t=e.state===`ready`,r=e.state===`queued`||e.state===`rendering`,i=e.state!==`deleted`;return n(`div`,{className:`flex items-center justify-end gap-1`,children:[t&&n(`button`,{onClick:()=>{T(e)},disabled:C===e.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:`Download MP4`,children:[C===e.id?o(U,{className:`h-3 w-3 animate-spin`}):o(re,{className:`h-3 w-3`}),`Download`]}),r&&n(`button`,{onClick:()=>{E(e)},disabled:x.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:`Cancel render`,children:[o(ne,{className:`h-3 w-3`}),`Cancel`]}),i&&o(`button`,{onClick:()=>{D(e)},disabled:S.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:`Delete export`,children:o(X,{className:`h-3 w-3`})})]})}}],[y,h,C,x.isPending,S.isPending,T,E,D]);return _&&g.length===0?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[o(U,{className:`h-4 w-4 animate-spin`}),`Loading exports…`]}):n(`div`,{className:`space-y-3`,children:[o(`div`,{className:`flex justify-end`,children:n(`button`,{onClick:()=>l(!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:[o(q,{className:`h-3.5 w-3.5`}),`New export`]})}),g.length===0?o(O,{icon:q,title:`No exports yet`,description:`Create one here (New export) or from a camera's timeline in the viewer. Rendered clips show up here to download or manage.`}):o(N,{columns:k,rows:g,rowKey:e=>e.id,minWidthPx:720}),s&&o(ve,{onClose:()=>l(!1),onCreated:u})]})}function ke(e){return e.locationIds!==void 0&&e.locationIds.length>0?e.locationIds:e.locationId===null?[]:[e.locationId]}function Ae(e,t){let n=ke(e);return n.length===0?`default root`:n.map(e=>t.get(e)??e).join(` + `)}function je(e,t,n){if(e.length===0)return null;let r=e[0];if(e.length===1&&r!==void 0)return{label:Ae(r,t),exact:!0};if(n===null)return null;let i=e.find(e=>ke(e).includes(n));return i===void 0?null:{label:Ae(i,t),exact:!1}}var Me=[`ok`,`warn`,`critical`];function Ne(e){return e>=.95?`critical`:e>=.85?`warn`:`ok`}function Pe(e){return Math.min(1,Math.max(0,e))}function Fe(e){let{availableBytes:t,totalBytes:n}=e;if(n===null||n<=0||t===null)return null;let r=Pe((n-t)/n);return{fraction:r,severity:Ne(r),recordingsFraction:Pe(e.usedBytes/n),freeBytes:t,totalBytes:n}}function Ie(e){if(e.length===0)return null;let t=0,n=0,r=0,i=0,a=null;for(let o of e){let e=Fe(o);if(e===null){n+=1;continue}t+=1,r+=e.totalBytes,i+=e.freeBytes,(a===null||Me.indexOf(e.severity)>Me.indexOf(a))&&(a=e.severity)}return{knownVolumes:t,unknownVolumes:n,totalBytes:r,freeBytes:i,severity:a}}t();var Le=[[`recording`]],Re=[{value:`retention`,label:`Retention policy`},{value:`quota`,label:`Quota / disk pressure`},{value:`operator`,label:`Operator`}],ze={ok:`bg-primary`,warn:`bg-amber-500`,critical:`bg-danger`},Be={ok:`text-foreground-subtle`,warn:`text-amber-500`,critical:`text-danger`};function $(e){return`${String(Math.round(e*100))}%`}function Ve(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(` + `):`default root`:e.root}function He(){let t=i(),s=I(),[c,u]=a(`retention`),{data:d,isLoading:p}=b({},{refetchOnWindowFocus:!1}),{data:h}=f({}),{data:g}=_({}),v=r(()=>{let e=new Map;for(let t of h??[])e.set(t.id,t.name);return e},[h]),y=r(()=>{let e=new Map;for(let t of g??[])e.set(t.id,t.displayName);return e},[g]),x=r(()=>(g??[]).find(e=>e.type===`recordings`&&e.isDefault)?.id??null,[g]),S=r(()=>d?.locations??[],[d?.locations]),w=r(()=>je(S,y,x),[S,y,x]),T=r(()=>Ie(S),[S]),E=e(()=>{t.invalidateQueries({queryKey:Le})},[t]),D=C({onSuccess:E}),k=m({onSuccess:E}),A=e(async e=>{await s({title:`Prune ${v.get(e.deviceId)??`#${String(e.deviceId)}`}?`,message:`Applies the retention policy now (reason: ${c}). Footage beyond the policy is permanently deleted.`,confirmLabel:`Prune now`,variant:`danger`})&&D.mutate({deviceId:e.deviceId,reason:c})},[s,D,c,v]),j=e(async e=>{await s({title:`Delete all footage for ${v.get(e.deviceId)??`#${String(e.deviceId)}`}?`,message:`Permanently deletes ${Z(e.usedBytes)} of recorded footage for this camera. This cannot be undone.`,confirmLabel:`Delete ${Z(e.usedBytes)}`,variant:`danger`})&&k.mutate({deviceId:e.deviceId})},[s,k,v]),M=r(()=>[{key:`camera`,header:`Camera`,render:e=>o(`span`,{className:`text-foreground`,children:v.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`disk`,header:`Disk`,nowrap:!0,render:()=>w===null?o(`span`,{className:`text-foreground-subtle`,children:`—`}):n(`span`,{className:w.exact?`text-foreground`:`text-foreground-subtle`,title:w.exact?`The only recordings volume on this node — this camera can only be here.`:`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:[w.label,!w.exact&&o(`span`,{className:`ml-1 text-foreground-subtle`,children:`(default)`})]})},{key:`used`,header:`Used`,align:`right`,nowrap:!0,render:e=>o(`span`,{className:`tabular-nums`,children:Z(e.usedBytes)})},{key:`actions`,header:``,align:`right`,render:e=>n(`div`,{className:`flex items-center justify-end gap-1`,children:[n(`button`,{onClick:()=>{A(e)},disabled:D.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:`Apply retention policy now`,children:[o(de,{className:`h-3 w-3`}),`Prune`]}),n(`button`,{onClick:()=>{j(e)},disabled:k.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:`Delete all footage`,children:[o(X,{className:`h-3 w-3`}),`Delete`]})]})}],[v,w,A,j,D.isPending,k.isPending]);if(p&&!d)return n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[o(U,{className:`h-4 w-4 animate-spin`}),`Loading storage usage…`]});if(!d)return o(O,{icon:V,title:`No storage data`,description:`The recording node has not reported any storage usage yet.`});let P=d.devices.length;return n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[o(l,{label:`Total used`,icon:o(V,{className:`h-3 w-3`}),footer:`${String(P)} camera${P===1?``:`s`} on ${d.nodeId}`,children:Z(d.totalUsedBytes)}),T!==null&&T.severity!==null&&o(l,{label:`Free on recordings volumes`,icon:o(V,{className:`h-3 w-3`}),footer:`across ${String(T.knownVolumes)} volume${T.knownVolumes===1?``:`s`} of ${Z(T.totalBytes)}`+(T.unknownVolumes>0?` · ${String(T.unknownVolumes)} did not report capacity`:``),children:o(`span`,{className:`tabular-nums ${Be[T.severity]}`,children:Z(T.freeBytes)})}),S.map(e=>{let t=Fe(e),r=e.locationId??e.root??`default`;return o(l,{label:`Disk: ${Ve(e,y)}`,footer:t===null?`${Z(e.usedBytes)} of recordings · volume capacity unknown`:`${Z(t.freeBytes)} free of ${Z(t.totalBytes)} · ${Z(e.usedBytes)} recordings (${$(t.recordingsFraction)})`,children:t===null?o(`span`,{className:`tabular-nums`,children:Z(e.usedBytes)}):n(`div`,{className:`flex items-center gap-2`,title:`Volume fill — everything on the disk, not only recordings. Warn at 85%, critical at 95%.`,children:[o(`div`,{className:`h-2 flex-1 overflow-hidden rounded bg-muted`,children:o(`div`,{className:`h-full rounded ${ze[t.severity]}`,style:{width:$(t.fraction)}})}),o(`span`,{className:`tabular-nums text-xs ${Be[t.severity]}`,children:$(t.fraction)})]})},r)})]}),n(`section`,{className:`flex items-center gap-2 text-xs`,children:[o(`label`,{htmlFor:`prune-reason`,className:`text-foreground-subtle`,children:`Prune reason`}),o(`select`,{id:`prune-reason`,value:c,onChange:e=>{let t=Re.find(t=>t.value===e.target.value);t&&u(t.value)},className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:Re.map(e=>o(`option`,{value:e.value,children:e.label},e.value))})]}),P===0?o(O,{icon:V,title:`No recorded footage`,description:`No camera has recorded footage on this node yet.`}):o(N,{columns:M,rows:[...d.devices],rowKey:e=>e.deviceId,minWidthPx:480})]})}t();var Ue=[{value:`all`,label:`All`},{value:`recording`,label:`Recordings`},{value:`events`,label:`Events`}],We={recording:`bg-primary/10 text-primary`,events:`bg-violet-500/10 text-violet-400`};function Ge(e){return new Date(e).toLocaleString()}function Ke(){let[e,t]=a(`all`),{data:i,isLoading:s}=x({},{refetchOnWindowFocus:!1}),{data:c,isLoading:l}=A({},{refetchOnWindowFocus:!1}),{data:u}=f({}),d=r(()=>{let e=new Map;for(let t of u??[])e.set(t.id,t.name);return e},[u]),p=r(()=>{let t=[...i??[],...c??[]];return(e===`all`?t:t.filter(t=>t.domain===e)).toSorted((e,t)=>t.at-e.at)},[i,c,e]),m=r(()=>[{key:`at`,header:`When`,nowrap:!0,render:e=>o(`span`,{className:`text-foreground-subtle tabular-nums`,children:Ge(e.at)})},{key:`domain`,header:`Domain`,render:e=>o(`span`,{className:`inline-flex rounded px-1.5 py-0.5 text-[10px] font-medium ${We[e.domain]}`,children:e.domain})},{key:`op`,header:`Operation`,render:e=>o(`span`,{className:`text-foreground`,children:e.op})},{key:`reason`,header:`Reason`,render:e=>o(`span`,{className:`text-foreground-subtle`,children:e.reason})},{key:`device`,header:`Camera`,render:e=>e.deviceId===null?o(`span`,{className:`text-foreground-subtle`,children:`cluster`}):o(`span`,{className:`text-foreground`,children:d.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`items`,header:`Items`,align:`right`,nowrap:!0,render:e=>o(`span`,{className:`tabular-nums`,children:e.itemsAffected.toLocaleString()})},{key:`bytes`,header:`Reclaimed`,align:`right`,nowrap:!0,render:e=>o(`span`,{className:`tabular-nums`,children:e.bytesReclaimed>0?Z(e.bytesReclaimed):`—`})}],[d]),h=s||l;return n(`div`,{className:`flex flex-col gap-4`,children:[o(`div`,{className:`flex items-center gap-1`,children:Ue.map(n=>o(`button`,{onClick:()=>t(n.value),className:`rounded px-2 py-1 text-xs font-medium ${e===n.value?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-muted`}`,children:n.label},n.value))}),h&&p.length===0?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[o(U,{className:`h-4 w-4 animate-spin`}),`Loading activity…`]}):p.length===0?o(O,{icon:W,title:`No activity yet`,description:`Prune, delete and rescan operations across recordings and events show up here.`}):o(N,{columns:m,rows:p,rowKey:e=>e.id,minWidthPx:720})]})}t();function qe({types:e}){let t=i(),s=I(),{data:c}=_({}),l=E(),u=r(()=>l.data??[],[l.data]),[f,p]=a(null),[m,h]=a(null),g=()=>{t.invalidateQueries({queryKey:[[`storage`,`listLocations`]]})},y=v({onSuccess:g}),b=d({onSuccess:g}),x=r(()=>{let e=new Map;for(let t of c??[]){let n=e.get(t.type);n?n.push(t):e.set(t.type,[t])}return e},[c]),S=e=>{e.isDefault||y.mutate(H(e,{isDefault:!0}))},C=(e,t)=>{y.mutate(H(e,{enabled:t}))},w=async e=>{if(e.isDefault){await s({title:`Cannot delete default location`,message:`"${e.displayName}" is the default for type "${e.type}". Mark another as default first.`,confirmLabel:`OK`,variant:`warning`});return}await s({title:`Delete location "${e.displayName}"?`,message:`Removes the record; files on disk are untouched.`,confirmLabel:`Delete`,variant:`danger`})&&b.mutate({id:e.id})},T=e.map(e=>u.find(t=>t.id===e)).filter(e=>e!==void 0);return n(`div`,{className:`space-y-3`,children:[T.length===0?o(`p`,{className:`text-[11px] text-foreground-subtle italic`,children:`No storage locations declared for this purpose.`}):T.map(e=>o(ae,{type:e.id,displayName:e.displayName,description:e.description,cardinality:e.cardinality,locations:x.get(e.id)??[],onAdd:e=>p(e),onEdit:e=>h(e),onDelete:e=>{w(e)},onSetDefault:e=>S(e),onToggleEnabled:(e,t)=>C(e,t)},e.id)),f!==null&&o(oe,{initialType:f,onClose:()=>p(null),onCreated:()=>{g(),p(null)}}),m!==null&&o(ie,{location:m,onClose:()=>h(null),onSaved:()=>{g(),h(null)}})]})}t();var Je=`pipeline-analytics`;function Ye(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 Xe(){let e=i(),{data:t}=L(void 0),{data:a,isLoading:s}=F({addonId:Je}),c=Ye(a),l=R({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),u=r(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,c,...e])].filter(Boolean)},[t,c]);return n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[o(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Post-processing node`}),o(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that runs detection post-processing (events, media, audio & motion). Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`}),n(`div`,{className:`mt-3 flex items-center gap-2`,children:[s?o(U,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):o(`select`,{value:c,onChange:e=>{e.target.value!==c&&l.mutate({addonId:Je,patch:{postProcessingNodeId:e.target.value}})},disabled:l.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:u.map(e=>o(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),l.isPending&&o(U,{className:`h-4 w-4 animate-spin text-primary`})]})]}),n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[o(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Events folder`}),o(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where event crops / full frames are stored. A single folder — no collection / equal-splitting.`}),o(qe,{types:[`eventMedia`]})]})]})}t();var Ze=`recorder`;function Qe(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 $e(){let e=i(),{data:t}=L(void 0),{data:a,isLoading:s}=F({addonId:Ze}),c=Qe(a,`recordingNodeId`,`hub`),l=R({onSuccess:()=>{e.invalidateQueries({queryKey:[[`addonSettings`,`getGlobalSettings`]]})}}),u=r(()=>{let e=(t??[]).filter(e=>e.isOnline).map(e=>e.id);return[...new Set([`hub`,c,...e])].filter(Boolean)},[t,c]);return n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[o(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Recording node`}),o(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The single node that records (continuous & events) and serves playback. Every other node stays inert — no multi-node balancing. Takes effect on addon restart.`}),n(`div`,{className:`mt-3 flex items-center gap-2`,children:[s?o(U,{className:`h-4 w-4 animate-spin text-foreground-subtle`}):o(`select`,{value:c,onChange:e=>{e.target.value!==c&&l.mutate({addonId:Ze,patch:{recordingNodeId:e.target.value}})},disabled:l.isPending,className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:u.map(e=>o(`option`,{value:e,children:e===`hub`?`hub (default)`:e},e))}),l.isPending&&o(U,{className:`h-4 w-4 animate-spin text-primary`})]}),c!==`hub`&&n(`p`,{className:`mt-2 text-[11px] text-amber-500`,children:[`The stream-broker is hub-only — an agent recorder pulls streams from the hub over the network. The hub's RTSP restream port must be reachable from`,` `,o(`span`,{className:`font-medium`,children:c}),`. If the auto-derived host doesn't work, set the recorder's`,o(`span`,{className:`font-medium`,children:` recordingHubHostname`}),` global setting.`]})]}),n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[o(`h3`,{className:`mb-1 text-sm font-semibold text-foreground`,children:`Recordings folders`}),o(`p`,{className:`mb-3 text-[11px] text-foreground-subtle`,children:`Where recordings are stored. Multi-location collections — segments are split across the locations of a type. Add a location to grow capacity; mark one default per type.`}),o(qe,{types:[`recordings`,`recordingsLow`]})]})]})}t();var et=2e3;function tt(){let e=I(),t=i(),r=k(),a=h(void 0,{refetchInterval:e=>e.state.data?.state===`running`?et:!1}),c=a.data,l=c?.state===`running`,u=l||r.isPending;s(()=>{c?.state!==`done`||c.finishedAtMs===null||(t.invalidateQueries({queryKey:[[`recording`]]}),t.invalidateQueries({queryKey:[[`pipelineAnalytics`]]}))},[c?.state,c?.finishedAtMs,t]);let d=async()=>{await e({title:`Reconcile storage from disk?`,message:`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:`Reconcile`,variant:`warning`})&&(await r.mutateAsync(),await a.refetch())},f=l?c.total>0?`Reconciling ${String(c.completed)}/${String(c.total)}…`:`Reconciling…`:r.isPending?`Reconciling…`:`Reconcile from disk`;return n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[o(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Disk reconcile`}),o(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`Makes the database match the filesystem for recordings, tracks, events and media. Rows whose files are gone are deleted, including snapshot-less motion events. Enrolled identities stay. The walk runs on the hub; you can leave this page.`}),n(`div`,{className:`mt-3 flex flex-col gap-2`,children:[n(`button`,{type:`button`,onClick:()=>void d(),disabled:u,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:[u?o(U,{className:`h-3.5 w-3.5 animate-spin`}):o(V,{className:`h-3.5 w-3.5`}),f]}),c?.state===`done`?n(`p`,{className:`text-[11px] text-foreground-subtle`,children:[`Last run: `,String(c.completed),` camera(s) — dropped `,String(c.tracks),` tracks,`,` `,String(c.events),` events, `,String(c.mediaDropped),` media`,c.failed.length>0?`, ${String(c.failed.length)} failed (${c.failed.join(`, `)})`:``,`.`]}):null,c?.state===`error`&&c.error!==null?n(`p`,{className:`text-[11px] text-destructive`,children:[`Reconcile failed: `,c.error]}):null]})]})}t();var nt=[[`pipelineAnalytics`]],rt=1440*60*1e3,it=[{days:1,label:`1 day`},{days:7,label:`7 days`},{days:30,label:`30 days`},{days:90,label:`90 days`}];function at(){let t=i(),s=I(),[c,u]=a(30),{data:d,isLoading:p}=P({},{refetchOnWindowFocus:!1}),{data:m}=f({}),h=r(()=>{let e=new Map;for(let t of m??[])e.set(t.id,t.name);return e},[m]),g=e(()=>{t.invalidateQueries({queryKey:nt})},[t]),_=T({onSuccess:g}),v=M({onSuccess:g}),y=e(async()=>{await s({title:`Prune events older than ${String(c)} day${c===1?``:`s`}?`,message:`Permanently deletes every event (motion / object / audio) older than the cutoff across all cameras, and their media. This cannot be undone.`,confirmLabel:`Prune events`,variant:`danger`})&&_.mutate({olderThanMs:Date.now()-c*rt,reason:`retention`})},[s,_,c]),b=e(async e=>{await s({title:`Delete all events for ${h.get(e.deviceId)??`#${String(e.deviceId)}`}?`,message:`Permanently deletes ${String(e.rows)} event${e.rows===1?``:`s`} (${Z(e.bytes)} of media) for this camera. This cannot be undone.`,confirmLabel:`Delete events`,variant:`danger`})&&v.mutate({deviceId:e.deviceId})},[s,v,h]),x=r(()=>[{key:`camera`,header:`Camera`,render:e=>o(`span`,{className:`text-foreground`,children:h.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`rows`,header:`Events`,align:`right`,nowrap:!0,render:e=>o(`span`,{className:`tabular-nums`,children:e.rows.toLocaleString()})},{key:`bytes`,header:`Media`,align:`right`,nowrap:!0,render:e=>o(`span`,{className:`tabular-nums`,children:Z(e.bytes)})},{key:`actions`,header:``,align:`right`,render:e=>n(`button`,{onClick:()=>{b(e)},disabled:v.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:`Delete all events for this camera`,children:[o(X,{className:`h-3 w-3`}),`Delete`]})}],[h,b,v.isPending]);return p&&!d?n(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[o(U,{className:`h-4 w-4 animate-spin`}),`Loading event-store footprint…`]}):d?n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[o(l,{label:`Total events`,icon:o(K,{className:`h-3 w-3`}),footer:`across ${String(d.devices.length)} camera${d.devices.length===1?``:`s`}`,children:d.totalRows.toLocaleString()}),o(l,{label:`Event media on disk`,children:Z(d.totalBytes)})]}),n(`section`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[o(`span`,{className:`text-foreground-subtle`,children:`Prune events older than`}),o(`select`,{value:c,onChange:e=>u(Number(e.target.value)),className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:it.map(e=>o(`option`,{value:e.days,children:e.label},e.days))}),n(`button`,{onClick:()=>{y()},disabled:_.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-amber-500/10 hover:text-amber-500 disabled:opacity-50`,children:[_.isPending?o(U,{className:`h-3 w-3 animate-spin`}):o(de,{className:`h-3 w-3`}),`Prune now`]})]}),d.devices.length===0?o(O,{icon:K,title:`No stored events`,description:`No camera has persisted events yet.`}):o(N,{columns:x,rows:[...d.devices],rowKey:e=>e.deviceId,minWidthPx:480})]}):o(O,{icon:K,title:`No event data`,description:`Pipeline analytics has not reported any event-store footprint yet.`})}t();var ot=`storage-migration`;function st(){let{data:e}=L(void 0);return(e??[]).some(e=>e.addons.some(e=>e.capabilities.includes(ot)))}var ct=[{id:`recordings`,label:`Recordings`,locationType:`recordings`},{id:`recordingsLow`,label:`Low-res recordings`,locationType:`recordingsLow`},{id:`eventMedia`,label:`Event media`,locationType:`eventMedia`}],lt=new Set([`planning`,`pausing`,`moving`,`verifying`,`repointing`,`refreshing`,`resuming`]);function ut(){return st()?o(dt,{}):o(O,{icon:Q,title:`Storage migration not installed`,description:`This system doesn't advertise the storage-migration capability yet. Once it's deployed, this panel moves recordings, low-res recordings and event media to new storage locations in one coordinated, verified operation.`})}function dt(){let e=I(),{data:t}=_({}),[i,s]=a({}),[c,l]=a(null),[u,d]=a(null),f=r(()=>{let e=new Map;for(let n of t??[]){let t=e.get(n.type);t?t.push(n):e.set(n.type,[n])}return e},[t]),p=te({},{refetchInterval:2e3}),m=p.data??null,h=m!==null&&lt.has(m.phase),v=r(()=>{let e={};for(let t of ct){let n=i[t.id];n&&(e[t.id]=n)}return Object.keys(e).length>0?e:void 0},[i]),b=g({destinations:v??{}},{enabled:!1,retry:!1}),x=y(),S=D(),C=async()=>{if(!v)return;d(null);let e=await b.refetch();if(e.error){d(e.error instanceof Error?e.error.message:String(e.error));return}l(e.data??null)},w=async()=>{if(v&&await e({title:`Start storage migration?`,message:`Pauses the affected writers, copies the data to the new locations, verifies it, then repoints the defaults. Safe to re-run if interrupted.`,confirmLabel:`Start migration`,variant:`danger`})){d(null);try{await x.mutateAsync({destinations:v}),l(null),await p.refetch()}catch(e){d(e instanceof Error?e.message:String(e))}}},T=async()=>{if(m&&await e({title:`Cancel migration?`,message:`Stops the in-progress migration. Data already moved and verified stays at the destination; anything already repointed is not reverted.`,confirmLabel:`Cancel migration`,variant:`danger`}))try{await S.mutateAsync({jobId:m.jobId}),await p.refetch()}catch{}};return n(`div`,{className:`flex flex-col gap-6`,children:[n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[n(`h3`,{className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[o(Q,{className:`h-3.5 w-3.5`}),`Storage migration`]}),o(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`Move recordings, low-res recordings and/or event media to new storage locations in one coordinated operation: pauses the writers, copies via the recorder / pipeline-analytics movers, verifies, then repoints the defaults. Always applies to every camera — destinations are global defaults per storage class, so migration can't be scoped to a subset of cameras. This is the only supported way to move a storage location's data — the Storage tab no longer offers a per-location "Relocate" action.`}),o(`div`,{className:`mt-3 grid grid-cols-1 gap-3 sm:grid-cols-3`,children:ct.map(e=>{let t=f.get(e.locationType)??[];return n(`div`,{className:`space-y-1`,children:[o(`label`,{htmlFor:`migration-dest-${e.id}`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:e.label}),n(`select`,{id:`migration-dest-${e.id}`,value:i[e.id]??``,onChange:t=>{let n=t.target.value;s(t=>({...t,[e.id]:n}))},disabled:h,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground disabled:opacity-50`,children:[o(`option`,{value:``,children:`— unchanged —`}),t.map(e=>o(`option`,{value:e.id,children:e.displayName},e.id))]})]},e.id)})}),u&&o(`p`,{className:`mt-2 text-[11px] text-danger`,children:u}),n(`div`,{className:`mt-3 flex items-center gap-2`,children:[n(`button`,{type:`button`,onClick:()=>{C()},disabled:!v||b.isFetching||h,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:[b.isFetching&&o(U,{className:`h-3 w-3 animate-spin`}),`Plan`]}),n(`button`,{type:`button`,onClick:()=>{w()},disabled:!v||x.isPending||h,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:[x.isPending&&o(U,{className:`h-3 w-3 animate-spin`}),`Start migration`]})]}),c&&o(`div`,{className:`mt-3 divide-y divide-border rounded-md border border-border`,children:c.moves.length===0?o(`p`,{className:`px-2.5 py-1.5 text-[11px] text-foreground-subtle`,children:`Nothing to move — selected destinations match the current defaults.`}):c.moves.map(e=>n(`div`,{className:`px-2.5 py-1.5 text-[11px] text-foreground`,children:[e.storageClass,`: `,e.fromLocationId,` → `,e.toLocationId]},`${e.storageClass}-${e.toLocationId}`))})]}),m&&n(`section`,{className:`rounded-md border border-border bg-surface p-4`,children:[n(`div`,{className:`flex items-center justify-between`,children:[o(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Migration status`}),h&&n(`button`,{type:`button`,onClick:()=>{T()},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:[o(Y,{className:`h-3 w-3`}),`Cancel`]})]}),n(`p`,{className:`mt-1 text-xs text-foreground`,children:[`Phase: `,o(`span`,{className:`font-medium`,children:m.phase}),h&&o(U,{className:`ml-2 inline h-3 w-3 animate-spin text-primary`})]}),m.error&&o(`p`,{className:`mt-1 text-[11px] text-danger`,children:m.error}),m.pausedParticipants.length>0&&n(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:[`Paused: `,m.pausedParticipants.join(`, `)]}),o(`div`,{className:`mt-2 divide-y divide-border rounded-md border border-border`,children:m.moves.map(e=>n(`div`,{className:`flex items-center justify-between px-2.5 py-1.5 text-[11px]`,children:[n(`span`,{className:`text-foreground`,children:[e.storageClass,`: `,e.fromLocationId,` → `,e.toLocationId]}),n(`span`,{className:`text-foreground-subtle`,children:[e.state??`pending`,e.error?` (${e.error})`:``]})]},e.storageClass))})]})]})}function ft(){return n(`div`,{className:`flex flex-col gap-8`,children:[n(`div`,{children:[o(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Recording`}),o(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The cluster recording node and recordings folders.`}),n(`div`,{className:`mt-3 flex flex-col gap-6`,children:[o($e,{}),o(tt,{})]})]}),n(`div`,{children:[o(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Events`}),o(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:`The cluster post-processing node, the events folder, and the durable event-store footprint with retention and per-camera deletion.`}),n(`div`,{className:`mt-3 flex flex-col gap-6`,children:[o(Xe,{}),o(at,{})]})]}),n(`div`,{children:[o(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Migration`}),o(`div`,{className:`mt-3`,children:o(ut,{})})]})]})}function pt(){return o(se,{icon:q,title:`Recordings`,subtitle:`Recording node & storage, event-store management, exported clips, and an activity log.`,children:o(ue,{tabs:[{id:`storage`,label:`Storage`,icon:V,content:o(He,{})},{id:`cameras`,label:`Cameras`,icon:J,content:o(pe,{})},{id:`exports`,label:`Export`,icon:q,content:o(Oe,{})},{id:`activity`,label:`Activity`,icon:W,content:o(Ke,{})},{id:`management`,label:`Management`,icon:fe,content:o(ft,{})}]})})}export{pt as RecordingsPage};
@@ -1 +0,0 @@
1
- import{K as e}from"./index-iNi1Y7nh.js";var t=e(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]);export{t};
@@ -1 +0,0 @@
1
- import{K as e}from"./index-iNi1Y7nh.js";var t=e(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]);export{t};