@camstack/addon-admin-ui 1.2.35 → 1.2.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AddLocationWizard-BpkZ7g8M.js → AddLocationWizard-ruAb2ySj.js} +1 -1
- package/dist/assets/AddonCollectionPage-y9PlVqw3.js +1 -0
- package/dist/assets/Addons-cAsBu2OQ.js +1 -0
- package/dist/assets/{AdminTabs-BzqgdZo8.js → AdminTabs-BVHcviOJ.js} +1 -1
- package/dist/assets/{AiProfiles-Du2Gut1p.js → AiProfiles-B6EskvNu.js} +1 -1
- package/dist/assets/{BrokerForm-en5xEKn5.js → BrokerForm-DIw2g_KM.js} +1 -1
- package/dist/assets/Build-sVmfeGFf.js +29 -0
- package/dist/assets/Capabilities-CTlKJVid.js +1 -0
- package/dist/assets/{CapabilityBadges-2-jFnJcJ.js → CapabilityBadges-B_ZC7k04.js} +1 -1
- package/dist/assets/Cluster-DkXZdWpm.js +1 -0
- package/dist/assets/{ClusterRecordingTab-BdEH4zMe.js → ClusterRecordingTab-U0cdF9UF.js} +1 -1
- package/dist/assets/{Dashboard-Bi7LNLdP.js → Dashboard-BCNcg--7.js} +1 -1
- package/dist/assets/Data-ZtVnR1Fe.js +1 -0
- package/dist/assets/DetectionIntelligence-BlZl9E8S.js +1 -0
- package/dist/assets/{DeviceAggregateSection-D8oQ4avR.js → DeviceAggregateSection-UxtJHE5B.js} +1 -1
- package/dist/assets/DeviceDetail-BbYvgUSY.js +2 -0
- package/dist/assets/{Devices-BmmGXj4K.js → Devices-DzLVWcFg.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-CRkfP_Ng.js → EmbedPlayerPage-C5yT7D0W.js} +1 -1
- package/dist/assets/Events-BGJ5su4V.js +1 -0
- package/dist/assets/FormBuilder-C0N6NRfe.js +1 -0
- package/dist/assets/Identity-FI4f8ox5.js +1 -0
- package/dist/assets/IntegrationDetail-DxAOxN6t.js +1 -0
- package/dist/assets/Integrations-D5S4Yf1A.js +1 -0
- package/dist/assets/{Integrations-CsuR-wnp.js → Integrations-w3RuUxDV.js} +1 -1
- package/dist/assets/{Logs-D-v1pY1C.js → Logs-BfDIf7QZ.js} +1 -1
- package/dist/assets/{MotionZonesSettings-DSAuUczY.js → MotionZonesSettings-CHyWV5lm.js} +1 -1
- package/dist/assets/{MyAccess-CSduDxGh.js → MyAccess-76Y7QhMu.js} +1 -1
- package/dist/assets/Network-BAUdETHi.js +1 -0
- package/dist/assets/{NodeAddonsSettingsPanel-0BTA46bg.js → NodeAddonsSettingsPanel-CeWEr-Zg.js} +1 -1
- package/dist/assets/NodeInferenceDevices-CUinkSSN.js +1 -0
- package/dist/assets/Notifications-CK3PuxFQ.js +1 -0
- package/dist/assets/Pipeline-CTSS1aGu.js +1 -0
- package/dist/assets/Plates-Cns09Gg2.js +1 -0
- package/dist/assets/{PrivacyMaskSettings-CfGREDOs.js → PrivacyMaskSettings-C4ycA7Un.js} +1 -1
- package/dist/assets/{ProviderIcon-mSy1d917.js → ProviderIcon-DyK-gNEs.js} +1 -1
- package/dist/assets/Recordings-UAlZznSu.js +1 -0
- package/dist/assets/{ScanNetworkModal-DsEiGH4q.js → ScanNetworkModal-h3WtjMhA.js} +1 -1
- package/dist/assets/{Settings-_QzMAEQz.js → Settings-oupU5GDf.js} +1 -1
- package/dist/assets/{Showroom-BrqmuRQr.js → Showroom-HqqCUr23.js} +1 -1
- package/dist/assets/{Terminal-D6ADzUw6.js → Terminal-7B0qx8ho.js} +2 -2
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-D6JCOoeB.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BnceOEA8.js} +1 -1
- package/dist/assets/authed-media-B8T1dsFh.js +1 -0
- package/dist/assets/{rotate-ccw-RsWJHCWz.js → boxes-BS6UzXs9.js} +1 -1
- package/dist/assets/{build-cluster-graph-DK8tHUpQ.js → build-cluster-graph-CO-MCBmD.js} +2 -2
- package/dist/assets/circle-check-big-DKZCFZff.js +1 -0
- package/dist/assets/clock-DqPUDB1Y.js +1 -0
- package/dist/assets/{copy-CiHOHvWK.js → copy-bKWchDUS.js} +1 -1
- package/dist/assets/debounced-invalidate-CoCA-chF.js +1 -0
- package/dist/assets/dist-B66gZe27.js +7 -0
- package/dist/assets/{dist-CD_UFqu_.js → dist-CXHmz2j1.js} +1 -1
- package/dist/assets/{download-BbJFh_GP.js → download-C3-lXLSJ.js} +1 -1
- package/dist/assets/{face-bbox-DFwfVPg5.js → face-bbox-Cb2eJK0t.js} +1 -1
- package/dist/assets/{hostInit-Gt7MZSrm.js → hostInit-DtkE57IB.js} +1 -1
- package/dist/assets/index-Bke_0boK.js +4 -0
- package/dist/assets/index-mdJi1UIz.css +2 -0
- package/dist/assets/{key-round-wDYpv-03.js → key-round-CSNhr2jN.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-eafb02b4.js → mf-entry-bootstrap-0-e0821d3f.js} +2 -2
- package/dist/assets/{pencil-CGcp1H_S.js → pencil-Dbscj0iB.js} +1 -1
- package/dist/assets/{player-overlays-DnLMvF2y.js → player-overlays-CCOENCr_.js} +1 -1
- package/dist/assets/plus-kjGKne3v.js +1 -0
- package/dist/assets/{radio-DejuKcx3.js → radio-BCrXf-T5.js} +1 -1
- package/dist/assets/{refresh-cw-CW_Ljqdp.js → refresh-cw-B50UNH29.js} +1 -1
- package/dist/assets/remoteEntry-DSjWOwlm.js +1 -0
- package/dist/assets/rotate-ccw-CnFi79eH.js +1 -0
- package/dist/assets/rotate-cw-BMi2-EKp.js +1 -0
- package/dist/assets/search-Cqbwip0Z.js +1 -0
- package/dist/assets/{send-CJWIa1yB.js → send-vIA2Sg01.js} +1 -1
- package/dist/assets/{server-DLCgy7fU.js → server-CVgGKwKo.js} +1 -1
- package/dist/assets/square-NIJNDIvZ.js +1 -0
- package/dist/assets/{square-check-big-C1eD-s2U.js → square-check-big-DTiBKI6p.js} +1 -1
- package/dist/assets/src-C3IwZqep.js +7 -0
- package/dist/assets/src-DiF3p-RR.js +67 -0
- package/dist/assets/{undo-2-B2bADvVZ.js → undo-2-buMXiXDJ.js} +1 -1
- package/dist/assets/{upload-DeJAhsSx.js → upload-YICZuTHD.js} +1 -1
- package/dist/assets/{useEventInvalidation-BuTU98fj.js → useEventInvalidation-CGT7WKQk.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CwEvP83T.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CbdC118i.js} +2 -2
- package/dist/assets/{wifi-BuwizIJA.js → wifi-B6uMvniy.js} +1 -1
- package/dist/assets/{zap-CWuo4dzD.js → zap-O3h5iXhW.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/server/addon.js +1361 -1283
- package/package.json +1 -1
- package/dist/assets/AddonCollectionPage-CqEMePgW.js +0 -1
- package/dist/assets/Addons-cCLSqWfM.js +0 -1
- package/dist/assets/Automation-CryfmheY.js +0 -29
- package/dist/assets/Capabilities-DOVICQ71.js +0 -1
- package/dist/assets/Cluster-DSXKolnm.js +0 -1
- package/dist/assets/Data-CTCmNwJC.js +0 -1
- package/dist/assets/DetectionIntelligence-3cLwl4I3.js +0 -1
- package/dist/assets/DeviceDetail-BcRXDqYg.js +0 -2
- package/dist/assets/Events-CRvWzt-T.js +0 -1
- package/dist/assets/FormBuilder-D36jBkTY.js +0 -1
- package/dist/assets/Identity-D6X1Vx5c.js +0 -1
- package/dist/assets/IntegrationDetail-Kd39JHzv.js +0 -1
- package/dist/assets/Integrations-BUaA-BHV.js +0 -1
- package/dist/assets/Network-D2GsfRiT.js +0 -1
- package/dist/assets/NodeInferenceDevices-FEzIpBGg.js +0 -1
- package/dist/assets/Notifications-C2xW5T2d.js +0 -1
- package/dist/assets/Pipeline-BAy-OSuJ.js +0 -1
- package/dist/assets/Plates-B-enbHRO.js +0 -1
- package/dist/assets/Recordings-CVuEjle9.js +0 -1
- package/dist/assets/Retrain-B38fDPkv.js +0 -1
- package/dist/assets/authed-media-XfBD4Ma-.js +0 -1
- package/dist/assets/circle-check-big-CmRUug-s.js +0 -1
- package/dist/assets/clock-CbQ_m2UA.js +0 -1
- package/dist/assets/debounced-invalidate-CS1Zql4g.js +0 -1
- package/dist/assets/dist-DyDQKWiO.js +0 -7
- package/dist/assets/image-off-CePvOw2Z.js +0 -1
- package/dist/assets/index-D4VDD87s.css +0 -2
- package/dist/assets/index-DzefosH4.js +0 -4
- package/dist/assets/plus-CWclgqCc.js +0 -1
- package/dist/assets/remoteEntry-DNdwEnrY.js +0 -1
- package/dist/assets/rotate-cw-Bj3NywrT.js +0 -1
- package/dist/assets/search-kZ6MJ1BT.js +0 -1
- package/dist/assets/square-I9BIO4a-.js +0 -1
- package/dist/assets/src-C2KiI31z.js +0 -67
- package/dist/assets/src-DREH726E.js +0 -7
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Fo as e,Io as t,Lo as n,Mn as r,No as i,Po as a,Ro as o,Uo as s,Vo as c,Wo as l,aa as u,ca as d,da as f,ea as p,fa as m,fo as h,ia as g,la as _,na as v,oa as y,ra as b,sa as x,ta as S,ua as C}from"./src-C2KiI31z.js";import{K as w,Q as T,S as E,W as D,b as O,o as k,q as A,x as j,z as M}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{Q as N}from"./src-DREH726E.js";import{a as P,i as F,n as I,r as L,t as R}from"./face-bbox-DFwfVPg5.js";import{t as z}from"./image-off-CePvOw2Z.js";import{t as B}from"./pencil-CGcp1H_S.js";import{t as V}from"./plus-CWclgqCc.js";import{t as H}from"./square-check-big-C1eD-s2U.js";import{t as U}from"./square-I9BIO4a-.js";import{B as W,C as G,I as K,K as q,R as J,c as Y,i as X,z as Z}from"./index-DzefosH4.js";import{t as ee}from"./AdminPage-Dq33XE9j.js";import{a as te,c as ne,f as re,i as ie,l as ae,n as oe,o as se,p as ce,r as le,s as ue,t as de,u as fe}from"./debounced-invalidate-CS1Zql4g.js";import{n as pe,t as me}from"./authed-media-XfBD4Ma-.js";var he=q(`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=k(),{data:n,isLoading:r}=x({vehicleId:e}),i=_();function a(n){i.mutate({vehicleId:e,sampleId:n.id},{onSettled:()=>{t.invalidateQueries({queryKey:Q})}})}return r?E(`div`,{className:`flex items-center gap-2 py-3 text-xs text-foreground-subtle`,children:[j(G,{className:`h-3.5 w-3.5 animate-spin`}),`Loading plates…`]}):!n||n.length===0?j(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:`No plates yet.`}):j(`div`,{className:`mt-2 grid grid-cols-3 gap-2 sm:grid-cols-4 md:grid-cols-6`,children:n.map(e=>E(`div`,{className:`group relative overflow-hidden rounded-md border border-border bg-surface`,children:[E(`div`,{className:`relative aspect-[2/1] overflow-hidden bg-surface-hover`,children:[e.base64?j(`img`,{src:`data:image/jpeg;base64,${e.base64}`,alt:e.text,className:`h-full w-full object-cover`}):j(`div`,{className:`flex h-full w-full items-center justify-center text-foreground-subtle`,children:j(W,{className:`h-6 w-6`})}),j(`button`,{type:`button`,onClick:()=>a(e),disabled:i.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:j(X,{className:`h-4 w-4 text-white`})})]}),j(`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:r,expanded:u,onToggle:d}){let f=k(),[p,m]=A(``),[h,_]=A(!1),[v,y]=A(!1),b=C(),x=g();function S(){m(r.name),_(!0)}function w(){_(!1),m(``)}function T(){let e=p.trim();if(!e||e===r.name){w();return}b.mutate({id:r.id,name:e},{onSettled:()=>{f.invalidateQueries({queryKey:Q}),w()}})}function D(){x.mutate({id:r.id},{onSettled:()=>{f.invalidateQueries({queryKey:Q}),y(!1)}})}return E(`div`,{className:`rounded-md border border-border bg-surface`,children:[E(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[j(`div`,{className:`h-8 w-12 shrink-0 overflow-hidden rounded border border-border bg-surface-hover`,children:r.coverBase64?j(`img`,{src:`data:image/jpeg;base64,${r.coverBase64}`,alt:r.name,className:`h-full w-full object-cover`}):j(`div`,{className:`flex h-full w-full items-center justify-center`,children:j(W,{className:`h-4 w-4 text-foreground-subtle`})})}),j(`div`,{className:`flex flex-1 min-w-0 items-center gap-2`,children:h?E(O,{children:[j(c,{value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&T(),e.key===`Escape`&&w()},className:`h-6 text-xs`,autoFocus:!0}),j(`button`,{type:`button`,onClick:T,disabled:b.isPending,className:`text-success hover:text-success/80 disabled:opacity-50`,"aria-label":`Confirm rename`,children:j(Z,{className:`h-3.5 w-3.5`})}),j(`button`,{type:`button`,onClick:w,className:`text-foreground-subtle hover:text-foreground`,"aria-label":`Cancel rename`,children:j(X,{className:`h-3.5 w-3.5`})})]}):j(`span`,{className:`truncate text-sm font-medium text-foreground`,children:r.name})}),j(s,{variant:`default`,className:`text-[10px]`,children:r.sampleCount}),!h&&E(`div`,{className:`flex items-center gap-1`,children:[j(`button`,{type:`button`,onClick:S,className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle hover:text-foreground`,"aria-label":`Rename`,children:j(B,{className:`h-3.5 w-3.5`})}),j(`button`,{type:`button`,onClick:()=>y(!0),className:`p-1 rounded hover:bg-danger/10 text-foreground-subtle hover:text-danger`,"aria-label":`Delete`,children:j(Y,{className:`h-3.5 w-3.5`})})]}),j(`button`,{type:`button`,onClick:d,className:`p-1 rounded hover:bg-surface-hover text-foreground-subtle`,"aria-label":u?`Collapse`:`Expand`,children:j(u?J:K,{className:`h-3.5 w-3.5`})})]}),u&&j(`div`,{className:`border-t border-border px-3 pb-3 pt-2`,children:j(ge,{vehicleId:r.id})}),j(i,{open:v,onOpenChange:e=>!e&&y(!1),children:E(a,{children:[E(n,{children:[j(o,{children:`Delete vehicle`}),E(e,{children:[`Delete `,j(`strong`,{children:r.name}),` and all its plate samples? This cannot be undone.`]})]}),E(t,{children:[j(l,{variant:`secondary`,onClick:()=>y(!1),children:`Cancel`}),E(l,{variant:`danger`,onClick:D,disabled:x.isPending,children:[x.isPending?j(G,{className:`h-3.5 w-3.5 animate-spin`}):null,`Delete`]})]})]})})]})}function ve(){let e=k(),[t,n]=A(``),r=v();function i(){let i=t.trim();i&&r.mutate({name:i},{onSettled:()=>{e.invalidateQueries({queryKey:Q}),n(``)}})}return E(`div`,{className:`flex items-center gap-2 pt-2`,children:[j(c,{placeholder:`New vehicle name…`,value:t,onChange:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i()},className:`h-7 text-xs flex-1`}),E(l,{variant:`primary`,size:`sm`,onClick:i,disabled:r.isPending||!t.trim(),children:[r.isPending?j(G,{className:`h-3.5 w-3.5 animate-spin`}):j(V,{className:`h-3.5 w-3.5`}),`Add`]})]})}function ye(){let{data:e,isLoading:t}=d(),[n,r]=A(null);function i(e){r(t=>t===e?null:e)}return t?E(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[j(G,{className:`h-4 w-4 animate-spin`}),`Loading vehicles…`]}):E(`div`,{className:`space-y-2`,children:[(!e||e.length===0)&&j(`p`,{className:`py-2 text-xs text-foreground-subtle`,children:`No vehicles enrolled yet. Add one below.`}),e?.map(e=>j(_e,{vehicle:e,expanded:n===e.id,onToggle:()=>i(e.id)},e.id)),j(ve,{})]})}T();var be=[[`plateGallery`]];function xe(e){let[t,n]=A(null),[r,i]=A(null),[a,o]=A(!1);return M(()=>{if(n(null),i(null),o(!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||o(!0)}})(),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[e]),M(()=>{if(!t)return;let e=new Image;return e.onload=()=>i({width:e.naturalWidth,height:e.naturalHeight}),e.onerror=()=>o(!0),e.src=t,()=>{e.onload=null,e.onerror=null}},[t]),{frameSrc:t,naturalWidth:r?.width??null,naturalHeight:r?.height??null,failed:a}}function Se(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:n}){return E(`div`,{className:`flex items-baseline justify-between gap-3 py-1.5 border-b border-border/60 last:border-0`,children:[j(`span`,{className:`shrink-0 text-[11px] uppercase tracking-wide text-foreground-subtle`,children:e}),j(`span`,{className:`min-w-0 truncate text-right text-xs font-medium text-foreground ${n?`font-mono`:``}`,title:t,children:t})]})}function Ce({box:e}){return j(`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:j(`span`,{className:`absolute -top-4 left-0 rounded bg-primary px-1 text-[9px] font-semibold uppercase tracking-wide text-white`,children:`Plate`})})}function we({plate:e,cameraName:t,onClose:n,onAssign:r,onUnassign:o,onDelete:s,actionsPending:d}){let f=k(),{data:p,isFetching:m}=u({plateId:e?.plateId??``},{enabled:e!==null}),h=S(),[g,_]=A(`frame`),[v,y]=A(!1),[b,x]=A(``),{frameSrc:C,naturalWidth:w,naturalHeight:T,failed:O}=xe(e?.keyFrameMediaKey);M(()=>{y(!1),x(``),_(`frame`)},[e?.plateId]);let N=D(()=>{let t=Se(p??[]);return t?`data:image/jpeg;base64,${t.base64}`:e?.base64?`data:image/jpeg;base64,${e.base64}`:null},[p,e]),V=D(()=>!e?.plateBbox||w===null||T===null?null:R(e.plateBbox,w,T),[e?.plateBbox,w,T]);if(e===null)return null;let H=typeof e.keyFrameMediaKey==`string`&&e.keyFrameMediaKey.length>0&&!O,U=H&&g===`frame`,W=e.assigned?e.vehicleName??`Assigned`:e.recognizedVehicleId?`${e.vehicleName??`Recognized`} (suggested)`:`Unassigned`,K=`${String(Math.round(e.score*100))}%${e.corrected?` · corrected`:``}`;function q(){e&&(x(e.text),y(!0))}function J(){if(!e)return;let t=b.trim().toUpperCase();if(!t||t===e.text){y(!1);return}h.mutate({plateId:e.plateId,text:t},{onSettled:()=>{f.invalidateQueries({queryKey:be}),y(!1)}})}return j(i,{open:!0,onOpenChange:e=>!e&&n(),children:E(a,{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:[E(`header`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-border px-4 py-3`,children:[E(`div`,{className:`min-w-0`,children:[j(`div`,{className:`truncate font-mono text-sm font-semibold tracking-wide text-foreground`,children:e.text||`Plate detail`}),j(`div`,{className:`mt-0.5 truncate text-[11px] text-foreground-subtle`,children:t})]}),j(`button`,{type:`button`,onClick:n,className:`rounded p-1 text-foreground-subtle hover:bg-surface-hover hover:text-foreground`,"aria-label":`Close`,children:j(X,{className:`h-4 w-4`})})]}),E(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto overscroll-contain px-4 py-3`,children:[H&&E(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5 text-xs`,children:[E(`button`,{type:`button`,onClick:()=>_(`frame`),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 transition-colors ${g===`frame`?`bg-primary/12 font-medium text-primary`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[j(F,{className:`h-3.5 w-3.5`}),` Full frame`]}),E(`button`,{type:`button`,onClick:()=>_(`crop`),className:`flex flex-1 items-center justify-center gap-1 rounded px-2 py-1 transition-colors ${g===`crop`?`bg-primary/12 font-medium text-primary`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[j(P,{className:`h-3.5 w-3.5`}),` Crop`]})]}),U&&C?j(`div`,{className:`overflow-hidden rounded-lg border border-border bg-background`,children:j(ie,{src:C,alt:`Full frame with detected plate`,fit:`natural`,className:`w-full`,overlay:V?j(Ce,{box:V}):void 0})}):N?E(`div`,{className:`relative aspect-[2/1] w-full overflow-hidden rounded-lg border border-border bg-background`,children:[j(ie,{src:N,alt:`Detected plate`,className:`h-full w-full`}),m&&j(`div`,{className:`absolute right-2 top-2 rounded-full bg-black/50 p-1 text-white`,children:j(G,{className:`h-3.5 w-3.5 animate-spin`})})]}):E(`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:[j(z,{className:`h-8 w-8 text-warning/70`}),j(`span`,{className:`text-[11px] font-medium uppercase tracking-wide text-warning/80`,children:`No image`}),j(`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.`})]}),j(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-2`,children:E(`div`,{className:`flex items-center justify-between gap-3`,children:[j(`span`,{className:`shrink-0 text-[11px] uppercase tracking-wide text-foreground-subtle`,children:`Plate text`}),v?E(`div`,{className:`flex min-w-0 flex-1 items-center justify-end gap-1.5`,children:[j(c,{value:b,onChange:e=>x(e.target.value),onKeyDown:e=>{e.key===`Enter`&&J(),e.key===`Escape`&&y(!1)},className:`h-7 max-w-[10rem] text-right font-mono text-xs uppercase`,autoFocus:!0}),j(`button`,{type:`button`,onClick:J,disabled:h.isPending,className:`text-success hover:text-success/80 disabled:opacity-50`,"aria-label":`Save corrected text`,children:h.isPending?j(G,{className:`h-3.5 w-3.5 animate-spin`}):j(Z,{className:`h-3.5 w-3.5`})}),j(`button`,{type:`button`,onClick:()=>y(!1),className:`text-foreground-subtle hover:text-foreground`,"aria-label":`Cancel`,children:j(X,{className:`h-3.5 w-3.5`})})]}):E(`button`,{type:`button`,onClick:q,className:`group flex min-w-0 items-center gap-1.5`,title:`Correct the OCR reading`,children:[j(`span`,{className:`truncate font-mono text-sm font-semibold tracking-wide text-foreground`,children:e.text||`—`}),j(B,{className:`h-3 w-3 shrink-0 text-foreground-subtle group-hover:text-foreground`})]})]})}),E(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-1`,children:[j($,{label:`Camera`,value:t}),j($,{label:`Captured`,value:ce(e.timestamp)}),j($,{label:`Confidence`,value:K}),j($,{label:`Vehicle`,value:W}),j($,{label:`Track`,value:e.trackId,mono:!0})]})]}),E(`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?E(l,{variant:`secondary`,onClick:()=>o(e.plateId),disabled:d,children:[j(I,{className:`h-3.5 w-3.5`}),` Detach`]}):E(l,{variant:`primary`,onClick:()=>r(e.plateId),disabled:d,children:[j(L,{className:`h-3.5 w-3.5`}),` Assign`]}),E(l,{variant:`secondary`,onClick:()=>s(e.plateId),disabled:d,children:[j(Y,{className:`h-3.5 w-3.5`}),` Delete`]})]})]})})}T();var Te=[[`plateGallery`]];function Ee({plateIds:r,vehicles:s,onDone:u}){let d=k(),f=p(),m=v(),[h,g]=A(``),[_,y]=A(!1),[b,x]=A(null),S=r!==null&&r.length>0,C=r?.length??0;function w(){y(!1),g(``),x(null)}function T(){w(),u()}function D(e){!r||r.length===0||f.mutate({plateIds:[...r],vehicleId:e},{onSettled:()=>{d.invalidateQueries({queryKey:Te}),T()}})}function O(){!r||!h.trim()||m.mutate({name:h.trim()},{onSuccess:e=>{e?.id&&D(e.id)},onError:()=>{d.invalidateQueries({queryKey:Te}),T()}})}let M=f.isPending||m.isPending;return j(i,{open:S,onOpenChange:e=>!e&&T(),children:E(a,{children:[E(n,{children:[j(o,{children:C>1?`Assign ${String(C)} plates to vehicle`:`Assign plate to vehicle`}),j(e,{children:`Select an existing vehicle or create a new one.`})]}),j(`div`,{className:`space-y-1 max-h-56 overflow-y-auto`,children:s.map(e=>E(`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:[j(`span`,{className:`font-medium`,children:e.name}),E(`span`,{className:`ml-2 text-foreground-subtle`,children:[e.sampleCount,` plates`]})]},e.id))}),_?j(`div`,{className:`flex items-center gap-2 pt-2 border-t border-border`,children:j(c,{placeholder:`New vehicle name…`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`&&O()},autoFocus:!0,className:`flex-1`})}):j(`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…`}),E(t,{children:[j(l,{variant:`secondary`,onClick:T,disabled:M,children:`Cancel`}),_?E(l,{variant:`primary`,onClick:O,disabled:M||!h.trim(),children:[M&&j(G,{className:`h-3.5 w-3.5 animate-spin`}),`Create & assign`]}):E(l,{variant:`primary`,onClick:()=>b&&D(b),disabled:M||!b,children:[M&&j(G,{className:`h-3.5 w-3.5 animate-spin`}),`Assign`,C>1?` ${String(C)}`:``]})]})]})})}T();var De=[[`plateGallery`]],Oe=500,ke=120;function Ae({plate:e,cameraName:t,nowMs:n,selected:r,onToggleSelect:i,onAssign:a,onOpenDetail:o}){let s=k(),c=f(),l=b(),u=()=>{s.invalidateQueries({queryKey:De})},d=()=>o(e.plateId);return E(`div`,{className:`relative flex flex-col overflow-hidden rounded-md border bg-surface ${r?`border-primary ring-1 ring-primary`:`border-border`}`,children:[E(`div`,{className:`relative aspect-[2/1] overflow-hidden bg-surface-hover`,children:[e.base64?j(`img`,{src:`data:image/jpeg;base64,${e.base64}`,alt:`Plate ${e.text} from ${t}`,onClick:d,className:`h-full w-full cursor-zoom-in object-cover`}):E(`button`,{type:`button`,onClick:d,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:[j(z,{className:`h-7 w-7 text-warning/70`}),j(`span`,{className:`text-[9px] font-medium uppercase tracking-wide text-warning/80`,children:`No crop`})]}),j(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),i(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":r?`Deselect`:`Select`,children:r?j(H,{className:`h-4 w-4 text-primary`}):j(U,{className:`h-4 w-4`})}),e.corrected&&E(`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:[j(he,{className:`h-3 w-3`}),` Fixed`]})]}),E(`div`,{className:`min-w-0 px-2 pt-1.5 space-y-0.5`,children:[j(`p`,{className:`truncate font-mono text-xs font-bold tracking-wide text-foreground`,title:e.text,children:e.text||`—`}),j(`p`,{className:`truncate text-[10px] text-foreground-subtle`,title:t,children:t}),j(`p`,{className:`truncate text-[10px] text-foreground-subtle`,children:re(e.timestamp,n)}),e.vehicleName&&j(`p`,{className:`truncate text-[10px] font-medium text-primary`,title:e.vehicleName,children:e.vehicleName})]}),E(`div`,{className:`mt-1 flex items-center gap-0.5 border-t border-border/60 px-1 py-0.5`,children:[e.assigned?j(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),c.mutate({plateId:e.plateId},{onSettled:u})},disabled:c.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:c.isPending?j(G,{className:`h-4 w-4 animate-spin`}):j(I,{className:`h-4 w-4`})}):j(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),a(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:j(L,{className:`h-4 w-4`})}),j(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),l.mutate({plateId:e.plateId},{onSettled:u})},disabled:l.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:l.isPending?j(G,{className:`h-4 w-4 animate-spin`}):j(Y,{className:`h-4 w-4`})})]})]})}var je=[{label:`All`,value:`all`},{label:`Unassigned`,value:`unassigned`},{label:`Assigned`,value:`assigned`}];function Me(e,t){return t===`unassigned`?e.filter(e=>!e.assigned):t===`assigned`?e.filter(e=>e.assigned):e}function Ne(){let e=k(),[t,n]=A(`all`),[i,a]=A(ue),[o,s]=A(new Set),[c,u]=A(new Set),[p,h]=A(null),[g,_]=A(null),{data:v,isLoading:x}=y({limit:Oe},{refetchInterval:3e4}),{data:S=[]}=d(),{data:C}=r({}),w=f(),T=m(),M=b(),N=Date.now(),P=v??[],F=D(()=>{let e=new Map;for(let t of C??[])e.set(t.id,t.name);return e},[C]),R=e=>F.get(e)??`Camera #${String(e)}`,z=D(()=>ne(P).map(e=>({id:e,name:R(e)})).sort((e,t)=>e.name.localeCompare(t.name)),[P,F]),B=D(()=>ae(fe(Me(P,t),i),o),[P,t,i,o]),V=oe(B,ke,D(()=>JSON.stringify([t,i.fromMs,i.toMs,[...o].sort((e,t)=>e-t)]),[t,i.fromMs,i.toMs,o])),H=D(()=>new Map(P.map(e=>[e.plateId,e])),[P]),U=g===null?null:H.get(g)??null,W=()=>{e.invalidateQueries({queryKey:De})},K=()=>u(new Set);function q(e){u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}let J=[...c],Z=T.isPending||M.isPending,ee=w.isPending||M.isPending;function re(){J.length!==0&&T.mutate({plateIds:J},{onSettled:()=>{W(),K()}})}function ie(){J.length!==0&&Promise.allSettled(J.map(e=>M.mutateAsync({plateId:e}))).then(()=>{W(),K()})}function ce(e){_(null),h([e])}function de(e){w.mutate({plateId:e},{onSettled:W}),_(null)}function pe(e){M.mutate({plateId:e},{onSettled:W}),_(null)}let me=B.length!==P.length;return E(`div`,{className:`relative space-y-3`,children:[E(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[j(`div`,{className:`flex items-center gap-1`,children:je.map(e=>j(`button`,{type:`button`,onClick:()=>n(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))}),j(te,{onChange:a}),j(se,{cameras:z,selected:o,onChange:s}),!x&&j(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:me?`${String(B.length)} of ${String(P.length)} plates`:`${String(B.length)} plate${B.length===1?``:`s`}`})]}),c.size>0&&E(`div`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-primary/40 bg-primary/8 px-3 py-2`,children:[E(`span`,{className:`text-xs font-medium text-foreground`,children:[c.size,` selected`]}),E(`div`,{className:`ml-auto flex flex-wrap items-center gap-1.5`,children:[E(l,{variant:`primary`,onClick:()=>h(J),disabled:Z,children:[j(L,{className:`h-3.5 w-3.5`}),` Assign`]}),E(l,{variant:`secondary`,onClick:re,disabled:Z,children:[T.isPending?j(G,{className:`h-3.5 w-3.5 animate-spin`}):j(I,{className:`h-3.5 w-3.5`}),` `,`Detach`]}),E(l,{variant:`secondary`,onClick:ie,disabled:Z,children:[j(Y,{className:`h-3.5 w-3.5`}),` Delete`]}),j(l,{variant:`ghost`,onClick:K,disabled:Z,children:j(X,{className:`h-3.5 w-3.5`})})]})]}),x&&E(`div`,{className:`flex items-center gap-2 py-4 text-xs text-foreground-subtle`,children:[j(G,{className:`h-4 w-4 animate-spin`}),` Loading plates…`]}),!x&&B.length===0&&j(`p`,{className:`py-4 text-xs text-foreground-subtle`,children:P.length>0?`No plates match the current filters.`:`No plates recognized yet.`}),!x&&B.length>0&&E(O,{children:[j(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(9rem,1fr))] gap-2`,children:V.pageItems.map(e=>j(Ae,{plate:e,cameraName:R(e.deviceId),nowMs:N,selected:c.has(e.plateId),onToggleSelect:q,onAssign:e=>h([e]),onOpenDetail:_},e.plateId))}),j(le,{currentPage:V.page,totalItems:V.totalItems,pageSize:V.pageSize,onPageChange:V.setPage,itemNoun:`plates`})]}),j(we,{plate:U,cameraName:U?R(U.deviceId):``,onClose:()=>_(null),onAssign:ce,onUnassign:de,onDelete:pe,actionsPending:ee}),j(Ee,{plateIds:p,vehicles:S,onDone:()=>{h(null),K()}})]})}T();var Pe=[[`plateGallery`]],Fe=2e3;function Ie(){let e=k(),t=w(e);t.current=e;let n=w(void 0);n.current||=de({delayMs:Fe,invalidate:()=>{t.current.invalidateQueries({queryKey:Pe})}}),M(()=>()=>n.current?.cancel(),[]),h(N.PipelineAnalyticsPlateGalleryChanged,()=>{n.current?.trigger()})}function Le(){return Ie(),j(ee,{icon:W,title:`Plates`,subtitle:`Manage enrolled vehicles and assign recognized license plates to them.`,children:E(`section`,{className:`space-y-3`,children:[E(`div`,{children:[j(`h2`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Vehicles`}),j(`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.`}),j(ye,{})]}),E(`div`,{className:`pt-4 border-t border-border`,children:[j(`h2`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Recent recognized plates`}),j(`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.`}),j(Ne,{})]})]})})}export{Le as PlatesPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Mn as e,N as t,Zr as n,_a as r,ao as i,ba as a,bo as o,do as s,ga as c,ha as l,ma as u,ni as d,qr as f,si as p,so as m,va as h,xa as g,ya as _}from"./src-C2KiI31z.js";import{I as v,Q as y,S as b,W as x,o as S,q as C,x as w,z as T}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{Q as E,z as D}from"./src-DREH726E.js";import{o as O,p as k}from"./player-overlays-DnLMvF2y.js";import{i as A}from"./AddLocationWizard-BpkZ7g8M.js";import{t as j}from"./download-BbJFh_GP.js";import{C as M,G as N,K as P,M as F,O as I,V as L,c as R,i as z}from"./index-DzefosH4.js";import{t as ee}from"./AdminPage-Dq33XE9j.js";import{n as te}from"./authed-media-XfBD4Ma-.js";import{t as B}from"./DeviceAggregateSection-D8oQ4avR.js";import{t as V}from"./format-size-CO9d3C3-.js";import{t as ne}from"./ClusterRecordingTab-BdEH4zMe.js";import{t as H}from"./AdminTabs-BzqgdZo8.js";var U=P(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),W=P(`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`}]]);y();function G(){let n=e({}),r=x(()=>(n.data??[]).filter(e=>e.type===D.Camera).sort((e,t)=>e.name.localeCompare(t.name)),[n.data]),[i,a]=C(null),o=i??r[0]?.id??null;return!n.isLoading&&r.length===0?w(m,{icon:L,title:`No cameras`,description:`Add a camera first.`}):b(`div`,{className:`space-y-3`,children:[b(`div`,{className:`flex items-center gap-2`,children:[w(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Camera`}),w(`select`,{value:o??``,onChange:e=>a(Number(e.target.value)),className:`rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:r.map(e=>w(`option`,{value:e.id,children:e.name},e.id))})]}),o!==null&&w(t,{deviceId:o,children:w(B,{deviceId:o,sectionFilter:e=>e.location===`top-tab`&&e.tab===`recording`})},o)]})}y();var K=[`high`,`mid`,`low`],q=[{value:1,label:`Real time (1×)`},{value:2,label:`2×`},{value:4,label:`4×`},{value:8,label:`8×`},{value:16,label:`16×`}],J=10080*60*1e3;function Y(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 X({onClose:t,onCreated:n}){let r=e({}),i=x(()=>(r.data??[]).filter(e=>e.type===D.Camera).sort((e,t)=>e.name.localeCompare(t.name)),[r.data]),[a,o]=C(``),[s,l]=C(`high`),[u,d]=C(Y(60)),[f,p]=C(Y(0)),[m,h]=C(1),[g,_]=C(!0),[v,y]=C(``),[S,T]=C(null),E=a===``?i[0]?.id??null:a,O=new Date(u).getTime(),k=new Date(f).getTime(),A=Number.isFinite(O)&&Number.isFinite(k)&&O<k,j=c({onSuccess:()=>{n(),t()},onError:e=>T(e instanceof Error?e.message:String(e))});return w(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:t,children:b(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[b(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[b(`h2`,{className:`flex items-center gap-1.5 text-sm font-semibold text-foreground`,children:[w(I,{className:`h-3.5 w-3.5`}),`New export`]}),w(`button`,{onClick:t,className:`text-foreground-subtle hover:text-foreground`,children:w(z,{className:`h-4 w-4`})})]}),b(`div`,{className:`p-4 space-y-3`,children:[b(`div`,{className:`grid grid-cols-2 gap-3`,children:[b(`div`,{className:`space-y-1`,children:[w(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Camera`}),w(`select`,{value:E??``,onChange:e=>o(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:i.map(e=>w(`option`,{value:e.id,children:e.name},e.id))})]}),b(`div`,{className:`space-y-1`,children:[w(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Profile`}),w(`select`,{value:s,onChange:e=>l(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:K.map(e=>w(`option`,{value:e,children:e},e))})]})]}),b(`div`,{className:`grid grid-cols-2 gap-3`,children:[b(`div`,{className:`space-y-1`,children:[w(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`From`}),w(`input`,{type:`datetime-local`,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`})]}),b(`div`,{className:`space-y-1`,children:[w(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`To`}),w(`input`,{type:`datetime-local`,value:f,onChange:e=>p(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`})]})]}),b(`div`,{className:`grid grid-cols-2 gap-3`,children:[b(`div`,{className:`space-y-1`,children:[w(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Speed`}),w(`select`,{value:m,onChange:e=>h(Number(e.target.value)),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`,children:q.map(e=>w(`option`,{value:e.value,children:e.label},e.value))})]}),b(`div`,{className:`space-y-1`,children:[w(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Title (optional)`}),w(`input`,{type:`text`,value:v,onChange:e=>y(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`})]})]}),b(`label`,{className:`flex items-center gap-2 text-xs text-foreground cursor-pointer`,children:[w(`input`,{type:`checkbox`,checked:g,disabled:m!==1,onChange:e=>_(e.target.checked),className:`accent-primary`}),`Include audio`,m===1?``:` (real-time only)`]}),!A&&w(`p`,{className:`text-[11px] text-danger`,children:`"From" must be before "To".`}),S&&w(`p`,{className:`text-[11px] text-danger`,children:S})]}),b(`div`,{className:`flex justify-end gap-2 border-t border-border px-4 py-3`,children:[w(`button`,{onClick:t,className:`rounded border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground`,children:`Cancel`}),w(`button`,{onClick:()=>{if(E===null||!A)return;T(null);let e=v.trim();j.mutate({deviceId:E,profile:s,fromMs:O,toMs:k,options:{includeAudio:g,maxLifeMs:J,deleteAfterDownload:!1,...m===1?{}:{speed:m},...e.length>0?{title:e}:{}}})},disabled:E===null||!A||j.isPending,className:`rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:j.isPending?`Queuing…`:`Create export`})]})]})})}function Z(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 re(e){return new Date(e).toLocaleString(void 0,{day:`2-digit`,month:`short`,hour:`2-digit`,minute:`2-digit`})}function Q(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`${re(e)} · ${o}`}function ie(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 ae(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})}y();var oe=[[`recordingExport`]],se={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 ce(){let{data:e,isLoading:t}=h({},{refetchOnWindowFocus:!1,refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`queued`||e.state===`rendering`)?3e3:!1}),{map:n}=s(E.RecordingExportProgress,e=>e.exportId),{map:r}=s(E.RecordingExportCompleted,e=>e.exportId),{map:i}=s(E.RecordingExportFailed,e=>e.exportId);return{rows:x(()=>ae(e??[],n,r,i),[e,n,r,i]),isLoading:t}}function le(e){let[t,n]=C(()=>Date.now());return T(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}function ue(){let t=S(),[n,a]=C(!1),s=()=>{t.invalidateQueries({queryKey:[[`recordingExport`,`listExports`]]})},c=i(),u=k().trpcClient,d=le(6e4),{rows:f,isLoading:p}=ce(),{data:h}=e({}),g=x(()=>{let e=new Map;for(let t of h??[])e.set(t.id,t.name);return e},[h]),_=v(()=>{t.invalidateQueries({queryKey:oe})},[t]),y=l({onSuccess:_}),T=r({onSuccess:_}),[E,D]=C(null),O=v(async e=>{D(e.id);try{let{url:t}=await u.recordingExport.getDownloadUrl.query({exportId:e.id}),n=await te(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),_()}finally{D(null)}},[u,_]),A=v(async e=>{await c({title:`Cancel this export?`,message:`Stops the render. The partial file is discarded.`,confirmLabel:`Cancel export`,variant:`danger`})&&y.mutate({exportId:e.id})},[c,y]),N=v(async e=>{await c({title:`Delete this export?`,message:`Permanently removes the rendered file and its history row.`,confirmLabel:`Delete`,variant:`danger`})&&T.mutate({exportId:e.id})},[c,T]),P=x(()=>[{key:`camera`,header:`Camera`,render:e=>w(`span`,{className:`text-foreground`,children:g.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`range`,header:`Range`,nowrap:!0,render:e=>w(`span`,{className:`tabular-nums`,children:Q(e.fromMs,e.toMs)})},{key:`variant`,header:`Variant`,render:e=>w(`span`,{className:`text-foreground-subtle`,children:Z(e.options)})},{key:`state`,header:`State`,render:e=>{let t=se[e.state];return b(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium ${t.cls}`,children:[t.spin&&w(M,{className:`h-2.5 w-2.5 animate-spin`}),t.label,e.state===`rendering`&&e.progressPct!==null&&b(`span`,{className:`tabular-nums`,children:[e.progressPct,`%`]})]})}},{key:`expiry`,header:`Expires`,nowrap:!0,render:e=>e.state===`deleted`?w(`span`,{className:`text-foreground-subtle`,children:`—`}):w(`span`,{className:`text-foreground-subtle tabular-nums`,children:ie(e.expiresAt,d)})},{key:`size`,header:`Size`,align:`right`,nowrap:!0,render:e=>w(`span`,{className:`tabular-nums`,children:e.fileBytes===null?`—`:V(e.fileBytes)})},{key:`actions`,header:``,align:`right`,render:e=>{let t=e.state===`ready`,n=e.state===`queued`||e.state===`rendering`,r=e.state!==`deleted`;return b(`div`,{className:`flex items-center justify-end gap-1`,children:[t&&b(`button`,{onClick:()=>{O(e)},disabled:E===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:[E===e.id?w(M,{className:`h-3 w-3 animate-spin`}):w(j,{className:`h-3 w-3`}),`Download`]}),n&&b(`button`,{onClick:()=>{A(e)},disabled:y.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:[w(U,{className:`h-3 w-3`}),`Cancel`]}),r&&w(`button`,{onClick:()=>{N(e)},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:`Delete export`,children:w(R,{className:`h-3 w-3`})})]})}}],[g,d,E,y.isPending,T.isPending,O,A,N]);return p&&f.length===0?b(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[w(M,{className:`h-4 w-4 animate-spin`}),`Loading exports…`]}):b(`div`,{className:`space-y-3`,children:[w(`div`,{className:`flex justify-end`,children:b(`button`,{onClick:()=>a(!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:[w(I,{className:`h-3.5 w-3.5`}),`New export`]})}),f.length===0?w(m,{icon:I,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.`}):w(o,{columns:P,rows:f,rowKey:e=>e.id,minWidthPx:720}),n&&w(X,{onClose:()=>a(!1),onCreated:s})]})}y();var de=[[`recording`]],$=[{value:`retention`,label:`Retention policy`},{value:`quota`,label:`Quota / disk pressure`},{value:`operator`,label:`Operator`}];function fe(e){return e.totalBytes===null||e.totalBytes<=0?null:Math.min(1,Math.max(0,e.usedBytes/e.totalBytes))}function pe(){let t=S(),n=i(),[r,a]=C(`retention`),{data:s,isLoading:c}=_({},{refetchOnWindowFocus:!1}),{data:l}=e({}),d=x(()=>{let e=new Map;for(let t of l??[])e.set(t.id,t.name);return e},[l]),f=v(()=>{t.invalidateQueries({queryKey:de})},[t]),p=g({onSuccess:f}),h=u({onSuccess:f}),y=v(async e=>{await n({title:`Prune ${d.get(e.deviceId)??`#${String(e.deviceId)}`}?`,message:`Applies the retention policy now (reason: ${r}). Footage beyond the policy is permanently deleted.`,confirmLabel:`Prune now`,variant:`danger`})&&p.mutate({deviceId:e.deviceId,reason:r})},[n,p,r,d]),T=v(async e=>{await n({title:`Delete all footage for ${d.get(e.deviceId)??`#${String(e.deviceId)}`}?`,message:`Permanently deletes ${V(e.usedBytes)} of recorded footage for this camera. This cannot be undone.`,confirmLabel:`Delete ${V(e.usedBytes)}`,variant:`danger`})&&h.mutate({deviceId:e.deviceId})},[n,h,d]),E=x(()=>[{key:`camera`,header:`Camera`,render:e=>w(`span`,{className:`text-foreground`,children:d.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`used`,header:`Used`,align:`right`,nowrap:!0,render:e=>w(`span`,{className:`tabular-nums`,children:V(e.usedBytes)})},{key:`actions`,header:``,align:`right`,render:e=>b(`div`,{className:`flex items-center justify-end gap-1`,children:[b(`button`,{onClick:()=>{y(e)},disabled:p.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:[w(W,{className:`h-3 w-3`}),`Prune`]}),b(`button`,{onClick:()=>{T(e)},disabled:h.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:[w(R,{className:`h-3 w-3`}),`Delete`]})]})}],[d,y,T,p.isPending,h.isPending]);if(c&&!s)return b(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[w(M,{className:`h-4 w-4 animate-spin`}),`Loading storage usage…`]});if(!s)return w(m,{icon:A,title:`No storage data`,description:`The recording node has not reported any storage usage yet.`});let D=s.devices.length;return b(`div`,{className:`flex flex-col gap-6`,children:[b(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:[w(O,{label:`Total used`,icon:w(A,{className:`h-3 w-3`}),footer:`${String(D)} camera${D===1?``:`s`} on ${s.nodeId}`,children:V(s.totalUsedBytes)}),s.locations.map(e=>{let t=fe(e),n=e.locationId??`default`;return w(O,{label:`Disk: ${(e.locationIds??[n]).join(` + `)}`,footer:e.availableBytes===null?`${V(e.usedBytes)} used (capacity unknown)`:`${V(e.availableBytes)} free${e.totalBytes===null?``:` of ${V(e.totalBytes)}`}`,children:t===null?w(`span`,{className:`tabular-nums`,children:V(e.usedBytes)}):b(`div`,{className:`flex items-center gap-2`,children:[w(`div`,{className:`h-2 flex-1 overflow-hidden rounded bg-muted`,children:w(`div`,{className:`h-full rounded ${t>.9?`bg-danger`:t>.75?`bg-amber-500`:`bg-primary`}`,style:{width:`${String(Math.round(t*100))}%`}})}),b(`span`,{className:`tabular-nums text-xs`,children:[Math.round(t*100),`%`]})]})},n)})]}),b(`section`,{className:`flex items-center gap-2 text-xs`,children:[w(`label`,{htmlFor:`prune-reason`,className:`text-foreground-subtle`,children:`Prune reason`}),w(`select`,{id:`prune-reason`,value:r,onChange:e=>{let t=$.find(t=>t.value===e.target.value);t&&a(t.value)},className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:$.map(e=>w(`option`,{value:e.value,children:e.label},e.value))})]}),D===0?w(m,{icon:A,title:`No recorded footage`,description:`No camera has recorded footage on this node yet.`}):w(o,{columns:E,rows:[...s.devices],rowKey:e=>e.deviceId,minWidthPx:480})]})}y();var me=[[`pipelineAnalytics`]],he=1440*60*1e3,ge=[{days:1,label:`1 day`},{days:7,label:`7 days`},{days:30,label:`30 days`},{days:90,label:`90 days`}];function _e(){let t=S(),r=i(),[a,s]=C(30),{data:c,isLoading:l}=n({},{refetchOnWindowFocus:!1}),{data:u}=e({}),d=x(()=>{let e=new Map;for(let t of u??[])e.set(t.id,t.name);return e},[u]),h=v(()=>{t.invalidateQueries({queryKey:me})},[t]),g=p({onSuccess:h}),_=f({onSuccess:h}),y=v(async()=>{await r({title:`Prune events older than ${String(a)} day${a===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`})&&g.mutate({olderThanMs:Date.now()-a*he,reason:`retention`})},[r,g,a]),T=v(async e=>{await r({title:`Delete all events for ${d.get(e.deviceId)??`#${String(e.deviceId)}`}?`,message:`Permanently deletes ${String(e.rows)} event${e.rows===1?``:`s`} (${V(e.bytes)} of media) for this camera. This cannot be undone.`,confirmLabel:`Delete events`,variant:`danger`})&&_.mutate({deviceId:e.deviceId})},[r,_,d]),E=x(()=>[{key:`camera`,header:`Camera`,render:e=>w(`span`,{className:`text-foreground`,children:d.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`rows`,header:`Events`,align:`right`,nowrap:!0,render:e=>w(`span`,{className:`tabular-nums`,children:e.rows.toLocaleString()})},{key:`bytes`,header:`Media`,align:`right`,nowrap:!0,render:e=>w(`span`,{className:`tabular-nums`,children:V(e.bytes)})},{key:`actions`,header:``,align:`right`,render:e=>b(`button`,{onClick:()=>{T(e)},disabled:_.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:[w(R,{className:`h-3 w-3`}),`Delete`]})}],[d,T,_.isPending]);return l&&!c?b(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[w(M,{className:`h-4 w-4 animate-spin`}),`Loading event-store footprint…`]}):c?b(`div`,{className:`flex flex-col gap-6`,children:[b(`section`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[w(O,{label:`Total events`,icon:w(F,{className:`h-3 w-3`}),footer:`across ${String(c.devices.length)} camera${c.devices.length===1?``:`s`}`,children:c.totalRows.toLocaleString()}),w(O,{label:`Event media on disk`,children:V(c.totalBytes)})]}),b(`section`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[w(`span`,{className:`text-foreground-subtle`,children:`Prune events older than`}),w(`select`,{value:a,onChange:e=>s(Number(e.target.value)),className:`rounded-md border border-border bg-surface px-2 py-1 text-xs text-foreground`,children:ge.map(e=>w(`option`,{value:e.days,children:e.label},e.days))}),b(`button`,{onClick:()=>{y()},disabled:g.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:[g.isPending?w(M,{className:`h-3 w-3 animate-spin`}):w(W,{className:`h-3 w-3`}),`Prune now`]})]}),c.devices.length===0?w(m,{icon:F,title:`No stored events`,description:`No camera has persisted events yet.`}):w(o,{columns:E,rows:[...c.devices],rowKey:e=>e.deviceId,minWidthPx:480})]}):w(m,{icon:F,title:`No event data`,description:`Pipeline analytics has not reported any event-store footprint yet.`})}y();var ve=[{value:`all`,label:`All`},{value:`recording`,label:`Recordings`},{value:`events`,label:`Events`}],ye={recording:`bg-primary/10 text-primary`,events:`bg-violet-500/10 text-violet-400`};function be(e){return new Date(e).toLocaleString()}function xe(){let[t,n]=C(`all`),{data:r,isLoading:i}=a({},{refetchOnWindowFocus:!1}),{data:s,isLoading:c}=d({},{refetchOnWindowFocus:!1}),{data:l}=e({}),u=x(()=>{let e=new Map;for(let t of l??[])e.set(t.id,t.name);return e},[l]),f=x(()=>{let e=[...r??[],...s??[]];return(t===`all`?e:e.filter(e=>e.domain===t)).toSorted((e,t)=>t.at-e.at)},[r,s,t]),p=x(()=>[{key:`at`,header:`When`,nowrap:!0,render:e=>w(`span`,{className:`text-foreground-subtle tabular-nums`,children:be(e.at)})},{key:`domain`,header:`Domain`,render:e=>w(`span`,{className:`inline-flex rounded px-1.5 py-0.5 text-[10px] font-medium ${ye[e.domain]}`,children:e.domain})},{key:`op`,header:`Operation`,render:e=>w(`span`,{className:`text-foreground`,children:e.op})},{key:`reason`,header:`Reason`,render:e=>w(`span`,{className:`text-foreground-subtle`,children:e.reason})},{key:`device`,header:`Camera`,render:e=>e.deviceId===null?w(`span`,{className:`text-foreground-subtle`,children:`cluster`}):w(`span`,{className:`text-foreground`,children:u.get(e.deviceId)??`#${String(e.deviceId)}`})},{key:`items`,header:`Items`,align:`right`,nowrap:!0,render:e=>w(`span`,{className:`tabular-nums`,children:e.itemsAffected.toLocaleString()})},{key:`bytes`,header:`Reclaimed`,align:`right`,nowrap:!0,render:e=>w(`span`,{className:`tabular-nums`,children:e.bytesReclaimed>0?V(e.bytesReclaimed):`—`})}],[u]),h=i||c;return b(`div`,{className:`flex flex-col gap-4`,children:[w(`div`,{className:`flex items-center gap-1`,children:ve.map(e=>w(`button`,{onClick:()=>n(e.value),className:`rounded px-2 py-1 text-xs font-medium ${t===e.value?`bg-primary/10 text-primary`:`text-foreground-subtle hover:bg-muted`}`,children:e.label},e.value))}),h&&f.length===0?b(`div`,{className:`flex items-center gap-2 py-8 text-xs text-foreground-subtle`,children:[w(M,{className:`h-4 w-4 animate-spin`}),`Loading activity…`]}):f.length===0?w(m,{icon:N,title:`No activity yet`,description:`Prune, delete and rescan operations across recordings and events show up here.`}):w(o,{columns:p,rows:f,rowKey:e=>e.id,minWidthPx:720})]})}function Se(){return w(ee,{icon:I,title:`Recordings`,subtitle:`Recording node & storage, event-store management, exported clips, and an activity log.`,children:w(H,{tabs:[{id:`recordings`,label:`Recordings`,icon:A,content:w(ne,{})},{id:`cameras`,label:`Cameras`,icon:L,content:w(G,{})},{id:`storage`,label:`Storage`,icon:A,content:w(pe,{})},{id:`events`,label:`Events`,icon:F,content:w(_e,{})},{id:`exports`,label:`Exports`,icon:I,content:w(ue,{})},{id:`activity`,label:`Activity`,icon:N,content:w(xe,{})}]})})}export{Se as RecordingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Bo as e,Kr as t,Mn as n,Qr as r,Uo as i,Vo as a,Wo as o,Yr as s,ai as c,ci as l,di as u,ii as d,li as f,oi as p,ri as ee}from"./src-C2KiI31z.js";import{I as m,K as h,Q as g,S as _,U as v,W as y,b as te,q as b,x,z as S}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{t as C}from"./image-off-CePvOw2Z.js";import{t as ne}from"./undo-2-B2bADvVZ.js";import{C as w,E as T,K as E,P as D,c as O,u as k,z as A}from"./index-DzefosH4.js";import{t as j}from"./AdminPage-Dq33XE9j.js";var M=E(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),N=E(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),P=E(`copy-plus`,[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]);g();var F=[`person`,`vehicle`,`animal`,`package`,`face`,`plate`],I=new Set(F);function L(e){let t=e?.trim().toLowerCase();return t===void 0||t===``?null:I.has(t)?`"${t}" is a macro class, not a label — person / postman / Marco are three different tiers`:null}function R({annotations:t,selectedIndex:n,onSelect:r,onChange:s,onDelete:c}){return t.length===0?_(`p`,{className:`text-[11px] text-foreground-subtle p-3`,children:[`No subject on this frame yet. Drag on the image to draw one, or ask the pipeline for a proposal. Annotate `,x(`strong`,{children:`every`}),` subject — a frame with one box and three unlabelled people teaches the model that two thirds of the people in it are background.`]}):x(`ul`,{className:`divide-y divide-border`,children:t.map((t,l)=>{let u=l===n,d=L(t.label),f=L(t.subLabel);return _(`li`,{className:`p-2.5 space-y-1.5 ${u?`bg-surface-hover`:``}`,onFocus:()=>{r(l)},children:[_(`div`,{className:`flex items-center gap-2`,children:[x(e,{className:`w-28`,value:t.macroClass,options:F.map(e=>({value:e,label:e})),onChange:e=>{let t=F.find(t=>t===e.target.value);t!==void 0&&s(l,{macroClass:t})}}),x(e,{className:`w-32`,value:t.kind,options:[{value:`subject`,label:`subject`},{value:`model_error`,label:`model error`}],onChange:e=>{s(l,{kind:e.target.value===`model_error`?`model_error`:`subject`})}}),t.source===`assist`&&_(i,{variant:`info`,children:[t.assistModelId??`assist`,t.assistScore===void 0?``:` ${t.assistScore.toFixed(2)}`]}),x(o,{variant:`ghost`,size:`sm`,"aria-label":`Delete this subject`,onClick:()=>{c(l)},children:x(O,{className:`h-3 w-3`})})]}),_(`div`,{className:`flex items-center gap-2`,children:[x(a,{className:`flex-1`,placeholder:`label (postman, van, cat…)`,value:t.label??``,onChange:e=>{s(l,{label:e.target.value})}}),x(a,{className:`flex-1`,placeholder:`sub-label (a name, a plate…)`,value:t.subLabel??``,onChange:e=>{s(l,{subLabel:e.target.value})}})]}),d!==null&&x(`p`,{className:`text-[11px] text-danger`,children:d}),f!==null&&x(`p`,{className:`text-[11px] text-danger`,children:f})]},`${String(l)}-${String(t.bbox.x)}`)})})}function re(e){return e.every(e=>L(e.label)===null&&L(e.subLabel)===null&&I.has(e.macroClass))}function z(e){return e<0?0:e>1?1:e}function B(e,t,n,r){if(!(e>0)||!(t>0)||!(n>0)||!(r>0))return null;let i=Math.min(e/n,t/r),a=n*i,o=r*i;return{left:(e-a)/2,top:(t-o)/2,width:a,height:o}}function V(e,t,n){return{x:z((e-n.left)/n.width),y:z((t-n.top)/n.height)}}function H(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),w:Math.abs(t.x-e.x),h:Math.abs(t.y-e.y)}}function U(e){return e.w>=.01&&e.h>=.01}function W(e,t){return{left:t.left+e.x*t.width,top:t.top+e.y*t.height,width:e.w*t.width,height:e.h*t.height}}function G(e,t){let n=-1,r=1/0;return e.forEach((e,i)=>{if(!(t.x>=e.x&&t.x<=e.x+e.w&&t.y>=e.y&&t.y<=e.y+e.h))return;let a=e.w*e.h;a<r&&(n=i,r=a)}),n}function ie({imageSrc:e,imageWidth:t,imageHeight:n,boxes:r,selectedIndex:i,onSelect:a,onDraw:o}){let s=h(null),[c,l]=b({w:0,h:0}),[u,d]=b(null);v(()=>{let e=s.current;if(e===null)return;let t=new ResizeObserver(()=>{l({w:e.clientWidth,h:e.clientHeight})});return t.observe(e),l({w:e.clientWidth,h:e.clientHeight}),()=>{t.disconnect()}},[]);let f=B(c.w,c.h,t,n),p=m(e=>{let t=s.current;if(t===null||f===null)return null;let n=t.getBoundingClientRect();return V(e.clientX-n.left,e.clientY-n.top,f)},[f]);return _(`div`,{ref:s,className:`relative w-full h-full min-h-[280px] bg-surface-sunken select-none touch-none`,onPointerDown:e=>{let t=p(e);t!==null&&(e.currentTarget.setPointerCapture(e.pointerId),d({start:t,current:H(t,t)}))},onPointerMove:e=>{if(u===null)return;let t=p(e);t!==null&&d({start:u.start,current:H(u.start,t)})},onPointerUp:()=>{if(u===null)return;let e=u.current;d(null),U(e)?o(e):a(G(r.map(e=>e.bbox),u.start))},children:[x(`img`,{src:e,alt:`Frame being annotated`,className:`absolute inset-0 w-full h-full object-contain pointer-events-none`}),f!==null&&r.map((e,t)=>{let n=W(e.bbox,f),r=e.kind===`model_error`,a=t===i,o=r?`#ef4444`:a?`#22c55e`:`#3b82f6`;return x(`div`,{className:`absolute pointer-events-none`,style:{left:n.left,top:n.top,width:n.width,height:n.height,border:`${a?`2px`:`1px`} ${r?`dashed`:`solid`} ${o}`,opacity:e.source===`assist`&&!a?.65:1},children:_(`span`,{className:`absolute -top-4 left-0 text-[10px] px-1 rounded`,style:{background:o,color:`#08121f`},children:[e.label??e.macroClass,r?` ✕`:``]})},`${String(t)}-${String(e.bbox.x)}-${String(e.bbox.y)}`)}),u!==null&&f!==null&&x(`div`,{className:`absolute border border-dashed border-primary pointer-events-none`,style:W(u.current,f)})]})}function K(e){return e>=1e6?`${(e/1e6).toFixed(1)} MB`:`${Math.round(e/1e3)} KB`}function q({candidates:e,copies:t,activeFrameId:n,refusals:r,isSelecting:a,onSelectCandidate:s,onOpenCopy:c,onRemoveCopy:l}){let u=new Set(t.map(e=>e.sourceMediaKey)),d=e.filter(e=>!u.has(e.mediaKey));return _(`div`,{className:`space-y-3`,children:[_(`section`,{children:[_(`h3`,{className:`text-xs font-semibold text-foreground mb-1.5`,children:[`In the dataset (`,t.length,`)`]}),t.length===0?x(`p`,{className:`text-[11px] text-foreground-subtle`,children:`No frame copied yet. Selecting a frame copies it into retrain storage immediately — the dataset stops depending on the track's own media from that moment.`}):x(`ul`,{className:`flex flex-wrap gap-2`,children:t.map(e=>x(`li`,{children:_(`div`,{className:`rounded-md border px-2 py-1.5 text-[11px] ${e.frameId===n?`border-primary bg-surface-hover`:`border-border`}`,children:[_(`button`,{type:`button`,className:`flex items-center gap-1.5 text-left`,onClick:()=>{c(e.frameId)},children:[x(A,{className:`h-3 w-3 text-success`}),x(`span`,{className:`font-medium text-foreground`,children:e.sourceKind}),_(`span`,{className:`text-foreground-subtle`,children:[e.width,`×`,e.height,` · `,K(e.sizeBytes)]})]}),_(`button`,{type:`button`,"aria-label":`Remove this frame from the dataset`,className:`mt-1 flex items-center gap-1 text-foreground-muted hover:text-danger`,onClick:()=>{l(e.frameId)},children:[x(O,{className:`h-3 w-3`}),`remove`]})]})},e.frameId))})]}),_(`section`,{children:[_(`h3`,{className:`text-xs font-semibold text-foreground mb-1.5`,children:[`Available frames (`,d.length,`)`]}),d.length===0?x(`p`,{className:`text-[11px] text-foreground-subtle`,children:e.length===0?`This track has no whole, unannotated frame left — its media aged out before it was marked. Anything already copied above is still usable.`:`Every available frame is already in the dataset.`}):x(`ul`,{className:`flex flex-wrap gap-2`,children:d.map(e=>{let t=r.get(e.mediaKey);return _(`li`,{children:[_(o,{variant:`secondary`,size:`sm`,disabled:a||t!==void 0,onClick:()=>{s(e.mediaKey)},children:[a?x(w,{className:`h-3 w-3 animate-spin`}):x(t===void 0?P:C,{className:`h-3 w-3`}),x(`span`,{className:`ml-1`,children:e.kind}),x(`span`,{className:`ml-1 text-foreground-subtle`,children:K(e.sizeBytes)})]}),t!==void 0&&x(i,{variant:`danger`,className:`ml-1`,children:t})]},e.mediaKey)})})]})]})}function J(e){return e.frameCount===0?`untouched`:e.annotationCount===0?`started`:`ready`}var Y={untouched:{icon:N,label:`to do`,variant:`default`},started:{icon:M,label:`frames only`,variant:`info`},ready:{icon:D,label:`annotated`,variant:`success`}};function X(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function ae({tracks:e,isLoading:t,selectedTrackId:n,deviceNames:r,onSelect:a}){return t?_(`div`,{className:`flex items-center gap-2 p-4 text-xs text-foreground-subtle`,children:[x(w,{className:`h-3.5 w-3.5 animate-spin`}),`Loading staging tracks…`]}):e.length===0?x(`div`,{className:`p-4 text-xs text-foreground-subtle`,children:`Nothing in staging. Mark a track for training from the viewer or the Events grid and it appears here.`}):x(`ul`,{className:`divide-y divide-border`,children:e.map(e=>{let t=Y[J(e)],o=t.icon;return x(`li`,{children:_(`button`,{type:`button`,onClick:()=>{a(e)},className:`w-full text-left px-3 py-2 flex items-start gap-2 hover:bg-surface-hover ${e.trackId===n?`bg-surface-hover`:``}`,children:[x(o,{className:`h-3.5 w-3.5 mt-0.5 shrink-0 text-foreground-subtle`}),_(`span`,{className:`min-w-0 flex-1`,children:[_(`span`,{className:`flex items-center gap-2`,children:[x(`span`,{className:`text-xs font-medium text-foreground truncate`,children:e.label??e.className}),x(i,{variant:t.variant,children:t.label})]}),_(`span`,{className:`block text-[11px] text-foreground-subtle truncate`,children:[r.get(e.deviceId)??`Camera ${String(e.deviceId)}`,` ·`,` `,X(e.lastSeen)]}),_(`span`,{className:`block text-[11px] text-foreground-muted`,children:[e.frameCount,` frame`,e.frameCount===1?``:`s`,` ·`,` `,e.annotationCount,` subject`,e.annotationCount===1?``:`s`]})]})]})},e.trackId)})})}g();var oe=`person`;function Z(){let[e,a]=b(null),[h,g]=b(null),[v,C]=b([]),[E,D]=b(-1),[O,A]=b(new Map),[M,N]=b(null),P=n({projection:`slim`,isCamera:!0}),F=y(()=>{let e=new Map;for(let t of P.data??[])e.set(t.id,t.name);return e},[P.data]),I=c({}),L=d({trackId:e?.trackId??``},{enabled:e!==null}),z=ee({trackId:e?.trackId??``},{enabled:e!==null}),B=r({frameId:h??``},{enabled:h!==null}),V=u(),H=s(),U=p(),W=f(),G=t(),K=l();S(()=>{if(h===null){C([]);return}C((z.data??[]).filter(e=>e.mediaKey===h).map(e=>({bbox:e.bbox,macroClass:e.macroClass,...e.label===void 0?{}:{label:e.label},...e.subLabel===void 0?{}:{subLabel:e.subLabel},kind:e.kind,source:e.source,...e.assistModelId===void 0?{}:{assistModelId:e.assistModelId},...e.assistScore===void 0?{}:{assistScore:e.assistScore}}))),D(-1)},[h,z.data]),S(()=>{let e=L.data?.copies??[];h===null&&e.length>0&&g(e[0].frameId)},[L.data,h]);let J=m(e=>{a(e),g(null),C([]),A(new Map),N(null)},[]),Y=m(async t=>{if(e===null)return;let n=await V.mutateAsync({deviceId:e.deviceId,trackId:e.trackId,mediaKeys:[t]});if(n.refused.length>0){let e=new Map(O);for(let t of n.refused)e.set(t.sourceMediaKey,t.reason);A(e)}n.copied.length>0&&g(n.copied[0].frameId),await L.refetch(),await I.refetch()},[e,V,O,L,I]),X=m(async t=>{e!==null&&(await H.mutateAsync({deviceId:e.deviceId,trackId:e.trackId,frameId:t}),h===t&&g(null),await L.refetch(),await z.refetch(),await I.refetch())},[e,H,h,L,z,I]),Z=m(async t=>{if(e===null||h===null)return;N(null);let n=await U.mutateAsync({deviceId:e.deviceId,trackId:e.trackId,frameId:h,subject:t===`package`?{kind:`package`}:{kind:`objects`,modelId:`yolo26n`,minScore:.3}});if(n.kind===`refused`){N(n.reason===`no-zone`?`A package proposal runs on the zone crop only — this camera has no zone, and running the detector on the whole frame at 0.35 proposes furniture.`:`The pipeline refused: ${n.reason}${n.detail===void 0?``:` — ${n.detail}`}`);return}C(e=>[...e,...n.proposals.map(e=>({bbox:e.bbox,macroClass:e.macroClass,...e.label===void 0?{}:{label:e.label},kind:e.kind,source:e.source,...e.assistModelId===void 0?{}:{assistModelId:e.assistModelId},...e.assistScore===void 0?{}:{assistScore:e.assistScore}}))]),N(`${n.proposals.length} proposal${n.proposals.length===1?``:`s`} from ${n.modelId}`+(n.belowThreshold>0?` — ${n.belowThreshold} more were below ${n.minScore.toFixed(2)}`:``))},[e,h,U]),se=m(e=>{C(t=>[...t,{bbox:e,macroClass:oe,kind:`subject`,source:`operator`}]),D(v.length)},[v.length]),ce=m((e,t)=>{C(n=>n.map((n,r)=>r===e?{...n,...t}:n))},[]),Q=m(e=>{C(t=>t.filter((t,n)=>n!==e)),D(-1)},[]),le=m(async()=>{e===null||h===null||(await W.mutateAsync({deviceId:e.deviceId,trackId:e.trackId,frameId:h,annotations:v.map(e=>({bbox:e.bbox,macroClass:e.macroClass,...e.label!==void 0&&e.label!==``?{label:e.label}:{},...e.subLabel!==void 0&&e.subLabel!==``?{subLabel:e.subLabel}:{},kind:e.kind,source:e.source,...e.assistModelId===void 0?{}:{assistModelId:e.assistModelId},...e.assistScore===void 0?{}:{assistScore:e.assistScore}}))}),await z.refetch(),await I.refetch(),N(`Annotations saved.`))},[e,h,v,W,z,I]),ue=m(async()=>{if(e===null)return;let t=await G.mutateAsync({deviceId:e.deviceId,trackId:e.trackId});N(t.changed?`Track completed — it is now trained, and its own media is evictable again.`:t.reason===`no-frames-copied`?`Refused: no frame was ever copied into the dataset. Completing would let retention delete material nothing was extracted from.`:`Refused: ${t.reason??`unknown`}`),await I.refetch(),t.changed&&a(null)},[e,G,I]),de=m(async()=>{if(e===null)return;let t=await K.mutateAsync({deviceId:e.deviceId,trackId:e.trackId});N(t.changed?`Track returned to staging. Its copies and annotations were left alone.`:`Refused: ${t.reason??`unknown`}`),await I.refetch()},[e,K,I]),$=B.data,fe=re(v)&&h!==null;return _(j,{icon:T,title:`Retrain`,subtitle:`Turn the tracks you marked for training into an annotated dataset. Selecting a frame copies it — the dataset never depends on media that can be swept.`,actions:e===null?null:_(`div`,{className:`flex items-center gap-2`,children:[_(o,{variant:`secondary`,size:`sm`,onClick:()=>void de(),children:[x(ne,{className:`h-3 w-3`}),x(`span`,{className:`ml-1`,children:`Back to staging`})]}),_(o,{size:`sm`,onClick:()=>void ue(),children:[x(T,{className:`h-3 w-3`}),x(`span`,{className:`ml-1`,children:`Complete track`})]})]}),children:[M!==null&&x(`div`,{className:`rounded-md border border-border bg-surface px-3 py-2 text-xs text-foreground`,children:M}),_(`div`,{className:`grid grid-cols-1 lg:grid-cols-[minmax(0,260px)_minmax(0,1fr)] gap-4`,children:[_(`aside`,{className:`rounded-md border border-border bg-surface overflow-hidden`,children:[_(`div`,{className:`px-3 py-2 border-b border-border flex items-center justify-between`,children:[x(`h2`,{className:`text-xs font-semibold text-foreground`,children:`Staging`}),x(i,{children:I.data?.length??0})]}),x(ae,{tracks:I.data??[],isLoading:I.isLoading,selectedTrackId:e?.trackId??null,deviceNames:F,onSelect:J})]}),x(`section`,{className:`space-y-3 min-w-0`,children:e===null?x(`p`,{className:`text-xs text-foreground-subtle`,children:`Pick a track from the staging list to start annotating it.`}):_(te,{children:[x(`div`,{className:`rounded-md border border-border bg-surface p-3`,children:x(q,{candidates:L.data?.candidates??[],copies:L.data?.copies??[],activeFrameId:h,refusals:O,isSelecting:V.isPending,onSelectCandidate:e=>void Y(e),onOpenCopy:g,onRemoveCopy:e=>void X(e)})}),h!==null&&_(`div`,{className:`grid grid-cols-1 xl:grid-cols-[minmax(0,1fr)_minmax(0,380px)] gap-3`,children:[x(`div`,{className:`rounded-md border border-border overflow-hidden`,children:$===void 0?_(`div`,{className:`flex items-center gap-2 p-6 text-xs text-foreground-subtle`,children:[x(w,{className:`h-3.5 w-3.5 animate-spin`}),`Loading the frame…`]}):x(ie,{imageSrc:`data:image/jpeg;base64,${$.base64}`,imageWidth:$.width,imageHeight:$.height,boxes:v,selectedIndex:E,onSelect:D,onDraw:se})}),_(`div`,{className:`rounded-md border border-border bg-surface flex flex-col min-h-0`,children:[_(`div`,{className:`px-3 py-2 border-b border-border flex items-center gap-2`,children:[x(`h2`,{className:`text-xs font-semibold text-foreground flex-1`,children:`Subjects`}),_(o,{variant:`secondary`,size:`sm`,disabled:U.isPending,onClick:()=>void Z(`objects`),children:[x(k,{className:`h-3 w-3`}),x(`span`,{className:`ml-1`,children:`Propose`})]}),_(o,{variant:`secondary`,size:`sm`,disabled:U.isPending,onClick:()=>void Z(`package`),children:[x(k,{className:`h-3 w-3`}),x(`span`,{className:`ml-1`,children:`Packages`})]})]}),x(`div`,{className:`flex-1 overflow-y-auto`,children:x(R,{annotations:v,selectedIndex:E,onSelect:D,onChange:ce,onDelete:Q})}),_(`div`,{className:`px-3 py-2 border-t border-border flex items-center justify-between`,children:[_(`span`,{className:`text-[11px] text-foreground-subtle`,children:[v.filter(e=>e.kind===`model_error`).length,` marked as model errors`]}),x(o,{size:`sm`,disabled:!fe||W.isPending,onClick:()=>void le(),children:`Save frame`})]})]})]})]})})]})]})}export{Z as RetrainPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Q as e,q as t,z as n}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";e();var r=`/addon/pipeline-analytics/event-media`,i=`camstack_admin_token`;async function a(e){let t=localStorage.getItem(i),n={};t&&(n.Authorization=`Bearer ${t}`);let r=await fetch(e,{headers:n});if(!r.ok)throw Error(`media fetch failed: ${String(r.status)}`);return r.blob()}function o(e){let[r,i]=t(null),[o,s]=t(!1);return n(()=>{if(i(null),s(!1),!e)return;let t=!1,n=null;return(async()=>{try{let r=await a(e);if(t)return;n=URL.createObjectURL(r),i(n)}catch{t||s(!0)}})(),()=>{t=!0,n&&URL.revokeObjectURL(n)}},[e]),{src:r,failed:o}}export{a as n,o as r,r as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{K as e}from"./index-DzefosH4.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-DzefosH4.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{K as e,Q as t,S as n,W as r,q as i,x as a,z as o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DTufy7Ue.js";import{I as s,L as c,R as l,V as u,z as d}from"./index-DzefosH4.js";t();var f={fromMs:null,toMs:null},p=36e5,m=24*p;function h(e,t){switch(e){case`24h`:return{fromMs:t-m,toMs:null};case`7d`:return{fromMs:t-7*m,toMs:null};case`30d`:return{fromMs:t-30*m,toMs:null};case`all`:return f}}function g(e){return e.fromMs!==null||e.toMs!==null}function _(e,t){return g(t)?e.filter(e=>!(t.fromMs!==null&&e.timestamp<t.fromMs||t.toMs!==null&&e.timestamp>t.toMs)):[...e]}function v(e,t){return t.size===0?[...e]:e.filter(e=>t.has(e.deviceId))}function y(e){let t=new Set,n=[];for(let r of e)t.has(r.deviceId)||(t.add(r.deviceId),n.push(r.deviceId));return n}function b(e){if(!e)return null;let t=Date.parse(`${e}T00:00:00`);return Number.isNaN(t)?null:t}function x(e){if(!e)return null;let t=Date.parse(`${e}T23:59:59.999`);return Number.isNaN(t)?null:t}function S(e,t){if(!Number.isFinite(e)||e<=0)return`—`;let n=t-e;return n<6e4?`just now`:n<p?`${String(Math.floor(n/6e4))}m ago`:n<m?`${String(Math.floor(n/p))}h ago`:n<7*m?`${String(Math.floor(n/m))}d ago`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function C(e){return!Number.isFinite(e)||e<=0?`—`:new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function w(e){return!Number.isFinite(e)||e<=0?`—`:new Date(e).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function T({cameras:t,selected:r,onChange:s}){let[c,f]=i(!1),p=e(null);o(()=>{if(!c)return;function e(e){p.current&&e.target instanceof Node&&!p.current.contains(e.target)&&f(!1)}function t(e){e.key===`Escape`&&f(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[c]);function m(e){let t=new Set(r);t.has(e)?t.delete(e):t.add(e),s(t)}let h=r.size,g=h===0?`All cameras`:h===1?t.find(e=>r.has(e.id))?.name??`1 camera`:`${String(h)} cameras`;return n(`div`,{ref:p,className:`relative`,children:[n(`button`,{type:`button`,onClick:()=>f(e=>!e),disabled:t.length===0,className:`flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs transition-colors disabled:opacity-40 ${h>0?`border-primary/40 bg-primary/8 text-primary`:`border-border text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[a(u,{className:`h-3.5 w-3.5`}),a(`span`,{className:`max-w-[10rem] truncate`,children:g}),a(l,{className:`h-3 w-3 opacity-70`})]}),c&&n(`div`,{className:`absolute left-0 z-30 mt-1 max-h-64 w-[min(15rem,calc(100vw-1.5rem))] overflow-y-auto rounded-md border border-border bg-surface p-1 shadow-lg shadow-black/30`,children:[h>0&&a(`button`,{type:`button`,onClick:()=>s(new Set),className:`mb-1 w-full rounded px-2 py-1 text-left text-[11px] text-foreground-subtle hover:bg-surface-hover hover:text-foreground`,children:`Clear selection`}),t.map(e=>{let t=r.has(e.id);return n(`button`,{type:`button`,onClick:()=>m(e.id),className:`flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs transition-colors ${t?`bg-primary/10 text-primary`:`text-foreground hover:bg-surface-hover`}`,children:[a(`span`,{className:`flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-sm border ${t?`border-primary bg-primary text-white`:`border-border`}`,children:t&&a(d,{className:`h-2.5 w-2.5`})}),a(`span`,{className:`truncate`,children:e.name})]},e.id)})]})]})}t();var E=[{label:`24h`,value:`24h`},{label:`7d`,value:`7d`},{label:`30d`,value:`30d`},{label:`All`,value:`all`}];function D({onChange:e}){let[t,r]=i(`all`),[o,s]=i(``),[c,l]=i(``);function u(t){r(t),s(``),l(``),e(h(t,Date.now()))}function d(t,n){r(`custom`),s(t),l(n),e({fromMs:b(t),toMs:x(n)})}let f=`rounded-md border border-border bg-surface px-2 py-1.5 text-[11px] text-foreground outline-none focus:border-primary [color-scheme:light] dark:[color-scheme:dark]`;return n(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[a(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:E.map(e=>a(`button`,{type:`button`,onClick:()=>u(e.value),className:`rounded px-2.5 py-1 text-[11px] 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))}),n(`div`,{className:`flex items-center gap-1`,children:[a(`input`,{type:`date`,"aria-label":`From date`,value:o,max:c||void 0,onChange:e=>d(e.target.value,c),className:`${f} ${t===`custom`&&o?`border-primary/50`:``}`}),a(`span`,{className:`text-[11px] text-foreground-subtle`,children:`→`}),a(`input`,{type:`date`,"aria-label":`To date`,value:c,min:o||void 0,onChange:e=>d(o,e.target.value),className:`${f} ${t===`custom`&&c?`border-primary/50`:``}`})]})]})}t();var O=2.6;function k({src:e,alt:t,className:r,overlay:s,fit:c=`contain`}){let[l,u]=i(!1),[d,f]=i(`50% 50%`);o(()=>{u(!1),f(`50% 50%`)},[e]);function p(e){if(!l){let t=e.currentTarget.getBoundingClientRect(),n=(e.clientX-t.left)/t.width*100,r=(e.clientY-t.top)/t.height*100;f(`${String(n)}% ${String(r)}%`)}u(e=>!e)}let m=c===`natural`;return a(`div`,{className:`relative overflow-hidden bg-background ${r??``}`,onClick:p,children:n(`div`,{className:`relative select-none transition-transform duration-200 ease-out ${m?`w-full`:`h-full w-full`} ${l?`cursor-zoom-out`:`cursor-zoom-in`}`,style:{transformOrigin:d,transform:l?`scale(${String(O)})`:`scale(1)`},children:[a(`img`,{src:e,alt:t,draggable:!1,className:m?`block h-auto w-full object-contain`:`h-full w-full object-contain`}),s]})})}var A=2;function j(e,t){if(t<=1)return[{kind:`page`,n:1}];if(t<=7){let e=[];for(let n=1;n<=t;n++)e.push({kind:`page`,n});return e}let n=[],r=Math.max(2,e-A),i=Math.min(t-1,e+A);n.push({kind:`page`,n:1}),r>2&&n.push({kind:`ellipsis`,side:`left`});for(let e=r;e<=i;e++)n.push({kind:`page`,n:e});return i<t-1&&n.push({kind:`ellipsis`,side:`right`}),n.push({kind:`page`,n:t}),n}function M({currentPage:e,totalItems:t,pageSize:r,onPageChange:i,itemNoun:o=`items`}){if(t<=r)return null;let l=Math.ceil(t/r),u=(e-1)*r+1,d=Math.min(e*r,t),f=j(e,l),p=`inline-flex h-7 min-w-7 items-center justify-center rounded-md px-2 text-[11px] transition-colors disabled:opacity-40`;return n(`div`,{className:`flex items-center justify-between gap-4 flex-wrap pt-2 text-[11px] text-foreground-subtle`,children:[n(`span`,{children:[`Showing `,u,`–`,d,` of `,t,` `,o]}),n(`div`,{className:`flex items-center gap-1`,children:[a(`button`,{type:`button`,className:`${p} hover:bg-surface-hover`,onClick:()=>i(e-1),disabled:e<=1,"aria-label":`Previous page`,children:a(c,{className:`h-3.5 w-3.5`})}),f.map(t=>t.kind===`ellipsis`?a(`span`,{className:`px-1 opacity-60`,children:`…`},`ellipsis-${t.side}`):a(`button`,{type:`button`,className:`${p} ${t.n===e?`bg-primary/12 text-primary font-medium`:`hover:bg-surface-hover hover:text-foreground`}`,onClick:()=>i(t.n),"aria-current":t.n===e?`page`:void 0,children:t.n},t.n)),a(`button`,{type:`button`,className:`${p} hover:bg-surface-hover`,onClick:()=>i(e+1),disabled:e>=l,"aria-label":`Next page`,children:a(s,{className:`h-3.5 w-3.5`})})]})]})}t();function N(e,t,n){let[a,s]=i(1);o(()=>{s(1)},[n]);let c=e.length,l=Math.max(1,Math.ceil(c/t)),u=Math.min(a,l);return o(()=>{u!==a&&s(u)},[u,a]),{page:u,setPage:s,pageItems:r(()=>{let n=(u-1)*t;return e.slice(n,n+t)},[e,u,t]),totalPages:l,totalItems:c,pageSize:t}}function P(e){let{delayMs:t,invalidate:n,setTimeoutFn:r=setTimeout,clearTimeoutFn:i=clearTimeout}=e,a;function o(){a===void 0&&(a=r(()=>{a=void 0,n()},t))}function s(){a!==void 0&&(i(a),a=void 0)}return{trigger:o,cancel:s}}export{D as a,y as c,C as d,S as f,k as i,v as l,N as n,T as o,w as p,M as r,f as s,P as t,_ as u};
|