@camstack/addon-admin-ui 1.2.713 → 1.2.715

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 (112) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/assets/{AccessSection-DMlnCJaD.js → AccessSection-B1BfkMDz.js} +1 -1
  3. package/dist/assets/Addons-Dv9LRaAL.js +5 -0
  4. package/dist/assets/{AdminPage-8-6dNnx0.js → AdminPage-DQBsgdFn.js} +1 -1
  5. package/dist/assets/{AdminSectionedPage-Bc9tE_NE.js → AdminSectionedPage-BdR-A8pw.js} +1 -1
  6. package/dist/assets/AiProfiles-BIUbf1To.js +3 -0
  7. package/dist/assets/Archive-DwCEVzXV.js +1 -0
  8. package/dist/assets/{BootstrapSettingsForm-CFHKDuYp.js → BootstrapSettingsForm-DaDxP4zR.js} +1 -1
  9. package/dist/assets/Build-DFbs35_G.js +40 -0
  10. package/dist/assets/{Calendars-BTUlZcsW.js → Calendars-BPPhRYSG.js} +1 -1
  11. package/dist/assets/Cluster-sNEBdxEP.js +1 -0
  12. package/dist/assets/CompositionBlockEditor-b8XYOe89.js +2 -0
  13. package/dist/assets/{CompositionEditorPage-BdsByEK9.js → CompositionEditorPage-CYEZxyyP.js} +1 -1
  14. package/dist/assets/Data-C8Pny907.js +2 -0
  15. package/dist/assets/DeviceDetail-Cw3X3rAi.js +1 -0
  16. package/dist/assets/{Devices-Bb51NqP0.js → Devices-C1Oes27W.js} +1 -1
  17. package/dist/assets/{EmbedDevicePage-DXTWTihl.js → EmbedDevicePage-D7Zxjunl.js} +1 -1
  18. package/dist/assets/{EmbedPlayerPage-gsbc_Rkr.js → EmbedPlayerPage-CwRKFgBB.js} +1 -1
  19. package/dist/assets/History-DT10QW1K.js +1 -0
  20. package/dist/assets/Identity-C-0nZhvC.js +1 -0
  21. package/dist/assets/InstancesTable-CRS9o890.js +1 -0
  22. package/dist/assets/IntegrationDetail-CVOVtLTY.js +1 -0
  23. package/dist/assets/{Integrations-CIimzwiu.js → Integrations-DbMKxMMV.js} +1 -1
  24. package/dist/assets/{Integrations-DUSSZk3p.js → Integrations-tm5hm5FG.js} +2 -2
  25. package/dist/assets/Library-Cf2tZBEW.js +1 -0
  26. package/dist/assets/Locations-_trr2tSA.js +3 -0
  27. package/dist/assets/Logs-Bk7G195j.js +1 -0
  28. package/dist/assets/{MaskShapeCanvas-Bmd5rX6m.js → MaskShapeCanvas-D51LM6pj.js} +1 -1
  29. package/dist/assets/{MotionZonesSettings-Bc-IUQnN.js → MotionZonesSettings-BzvkBBkX.js} +1 -1
  30. package/dist/assets/MyAccess-cTVBA4xh.js +2 -0
  31. package/dist/assets/{Network-CYtAsDNO.js → Network-BL--864t.js} +1 -1
  32. package/dist/assets/NewExportModal-kPU5QouZ.js +1 -0
  33. package/dist/assets/{NodeAddonsSettingsPanel-Js9qPWiM.js → NodeAddonsSettingsPanel-BSUTB4kR.js} +1 -1
  34. package/dist/assets/Notifications-YVX22_6u.js +1 -0
  35. package/dist/assets/{PanelContent-CNHlAipY.js → PanelContent-kLQFQ8Kp.js} +1 -1
  36. package/dist/assets/{Pipeline-BuJZoyc4.js → Pipeline-DGpqu3Ur.js} +1 -1
  37. package/dist/assets/{PrivacyMaskSettings-i0gjTOZB.js → PrivacyMaskSettings-BU4PhJiq.js} +1 -1
  38. package/dist/assets/{SceneMonitorEditor-BajKF0ye.js → SceneMonitorEditor-B1jBM-SU.js} +1 -1
  39. package/dist/assets/SessionsList-BNele6DJ.js +2 -0
  40. package/dist/assets/{Showroom-DXEGBQYv.js → Showroom-D7RJ_JK9.js} +1 -1
  41. package/dist/assets/{StorageLocationsTable-rJpCEWx1.js → StorageLocationsTable-DhYK-irg.js} +1 -1
  42. package/dist/assets/System-2jT0AonI.js +2 -0
  43. package/dist/assets/TemplateEditorDialog-BhHxD2eZ.js +1 -0
  44. package/dist/assets/{Terminal-CimKlMi2.js → Terminal-ClKj1REr.js} +5 -5
  45. package/dist/assets/{TrainingProviders-DCxdm08Q.js → TrainingProviders-dXFan2hV.js} +1 -1
  46. package/dist/assets/{Viewer-CciQJVnE.js → Viewer-dhPMeZxo.js} +1 -1
  47. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-zMYS02y7.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-B1LOmMHB.js} +1 -1
  48. package/dist/assets/{action-draft-C38qwTBj.js → action-draft-BpuoK0oe.js} +1 -1
  49. package/dist/assets/{ai-page.helpers-CLlDuzDp.js → ai-page.helpers-lwRx7Lnb.js} +1 -1
  50. package/dist/assets/{assignment-candidates-_xckn3A9.js → assignment-candidates-CWVn3I7Y.js} +1 -1
  51. package/dist/assets/{authed-media-CZiua_2N.js → authed-media-1xMDnPqm.js} +1 -1
  52. package/dist/assets/{board-model-DMER_H6K.js → board-model-CFblW8Cg.js} +1 -1
  53. package/dist/assets/{camera-block-model-M-R3gP5a.js → camera-block-model-Do3rbDU-.js} +1 -1
  54. package/dist/assets/client-CrYUIOQU.js +1125 -0
  55. package/dist/assets/{command-vocab-uit_6wYs.js → command-vocab-CbxUOm_5.js} +1 -1
  56. package/dist/assets/{device-integration-icon-CNd23z9-.js → device-integration-icon-c-mxLNH-.js} +1 -1
  57. package/dist/assets/device-picker-model-DZb7FA40.js +1 -0
  58. package/dist/assets/dist-B-PEwaGe.js +1125 -0
  59. package/dist/assets/{dist-p43duLuN.js → dist-DG_8VpJ1.js} +1 -1
  60. package/dist/assets/{format-d-FwC0wp.js → format-DIbqLtnB.js} +1 -1
  61. package/dist/assets/{hostInit-B_bNKTwm.js → hostInit-ButENnxK.js} +1 -1
  62. package/dist/assets/i18n-CwNNkLoL.js +1 -0
  63. package/dist/assets/{icons-B8-Y4XBC.js → icons-BTXCsetw.js} +1 -1
  64. package/dist/assets/{index-DN4KezHo.js → index-DfrR1IZM.js} +4 -4
  65. package/dist/assets/index-zqjSOnoV.css +2 -0
  66. package/dist/assets/{linked-devices-model-DZQS8cFd.js → linked-devices-model-DpvENMUd.js} +1 -1
  67. package/dist/assets/{mf-entry-bootstrap-0-80faa947.js → mf-entry-bootstrap-0-75807c8f.js} +2 -2
  68. package/dist/assets/mount-DZb7FA40.js +1 -0
  69. package/dist/assets/{notification-rule-status-C25Vfyst.js → notification-rule-status-CoL96K9f.js} +1 -1
  70. package/dist/assets/{player-overlays-CEIvxNnK.js → player-overlays-CK2iyWs6.js} +1 -1
  71. package/dist/assets/remoteEntry-D3DjnVYE.js +1 -0
  72. package/dist/assets/src-CHMj_WHN.js +279 -0
  73. package/dist/assets/{sso-popup-BLjuW0Se.js → sso-popup-DNXqJN2k.js} +1 -1
  74. package/dist/assets/{step-inspector-model-Dj6mawpH.js → step-inspector-model-nWOaYuSV.js} +1 -1
  75. package/dist/assets/{use-scenes-feed--TYeaOeV.js → use-scenes-feed-CNRgEKKu.js} +1 -1
  76. package/dist/assets/{useAdminDeviceRemoval-DF8z0V4L.js → useAdminDeviceRemoval-DQ3h_PZz.js} +1 -1
  77. package/dist/assets/useEventInvalidation-DZb7FA40.js +1 -0
  78. package/dist/assets/{useNodeUrlSelection-BpaifS3C.js → useNodeUrlSelection-B25NS2N_.js} +1 -1
  79. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BbE_PTHL.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DzNd5mFR.js} +2 -2
  80. package/dist/index.html +9 -9
  81. package/dist/server/addon.js +16 -3
  82. package/package.json +2 -2
  83. package/dist/assets/Addons-C9-s1LRZ.js +0 -5
  84. package/dist/assets/AiProfiles-3BWdcIdS.js +0 -3
  85. package/dist/assets/Archive-BnYXD1Zd.js +0 -1
  86. package/dist/assets/Build-Upp6j2gH.js +0 -40
  87. package/dist/assets/Cluster-7rosTxcS.js +0 -1
  88. package/dist/assets/CompositionBlockEditor-CHnwOGE1.js +0 -2
  89. package/dist/assets/Data-Bzn3LZ7n.js +0 -2
  90. package/dist/assets/DeviceDetail-Dm4EquQf.js +0 -1
  91. package/dist/assets/History--r9ufCc3.js +0 -1
  92. package/dist/assets/Identity-hhwJkS37.js +0 -1
  93. package/dist/assets/InstancesTable-6KYkti9L.js +0 -1
  94. package/dist/assets/IntegrationDetail-DrfgpIHp.js +0 -1
  95. package/dist/assets/Library-DFlo7Z5C.js +0 -1
  96. package/dist/assets/Locations-BQA-nBia.js +0 -3
  97. package/dist/assets/Logs-BDnGxIyS.js +0 -1
  98. package/dist/assets/MyAccess-pX-8HrhI.js +0 -2
  99. package/dist/assets/NewExportModal-DPqVCwI6.js +0 -1
  100. package/dist/assets/Notifications-C31_hxb-.js +0 -1
  101. package/dist/assets/SessionsList-C71ZAY0g.js +0 -2
  102. package/dist/assets/System-BJMF3Ixf.js +0 -2
  103. package/dist/assets/TemplateEditorDialog-CCT5046d.js +0 -1
  104. package/dist/assets/client-BZDnTMae.js +0 -1125
  105. package/dist/assets/device-picker-model-DeaB_A8L.js +0 -1
  106. package/dist/assets/dist-Db0fFZZj.js +0 -1125
  107. package/dist/assets/i18n-BiKPfXFe.js +0 -1
  108. package/dist/assets/index-CaKMKRxP.css +0 -2
  109. package/dist/assets/mount-DeaB_A8L.js +0 -1
  110. package/dist/assets/remoteEntry-BZqFn2se.js +0 -1
  111. package/dist/assets/src-DUAdvcBH.js +0 -279
  112. package/dist/assets/useEventInvalidation-DeaB_A8L.js +0 -1
@@ -1,3 +0,0 @@
1
- import{C as e,K as t,S as n,V as r,Y as i,et as a,o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{$a as c,Hr as l,Ia as u,Nr as d,O as f,Tt as p,V as m,Yn as h,aa as g,ct as _,ft as v,ir as y,k as b,tn as x,ur as S,z as C}from"./player-overlays-CEIvxNnK.js";import{Bn as w,Bs as T,hc as E}from"./client-BZDnTMae.js";import{t as D}from"./chevron-down-CBb-F8DT.js";import{Aa as O,An as k,Br as A,Dp as j,Ec as ee,Er as M,Gi as N,Ia as P,Ji as F,Ki as I,La as L,M as R,Op as te,Or as z,Qs as ne,Sa as B,Ss as V,Ts as re,Ua as ie,Wi as H,Xi as ae,Yi as oe,_i as U,ac as se,bc as ce,bs as W,fa as G,fc as le,gi as ue,hc as de,ic as fe,kp as pe,mc as me,pc as he,qp as ge,rc as _e,sc as ve,vc as ye,xc as be,xs as xe,yc as Se,yp as K,za as Ce}from"./src-DUAdvcBH.js";import{t as q}from"./i18n-BiKPfXFe.js";import{t as J}from"./useTranslation-BJr-n0es.js";import{Ci as we,J as Te,vi as Y,xi as X}from"./index-DN4KezHo.js";import{t as Ee}from"./AdminSectionedPage-Bc9tE_NE.js";import{c as De,n as Oe,r as ke}from"./linked-devices-model-DZQS8cFd.js";a();function Z(e){return{id:e.id,name:e.name,type:e.type,stableId:e.stableId??``,parentDeviceId:e.parentDeviceId,location:e.location,...e.role!==void 0&&e.role!==null?{role:e.role}:{},...e.primaryChildEntityId!==void 0&&e.primaryChildEntityId!==null?{primaryChildEntityId:e.primaryChildEntityId}:{},...e.primaryChildPreference!==void 0&&e.primaryChildPreference!==null?{primaryChildPreference:e.primaryChildPreference}:{}}}function Q(e){if(e==null)return null;let t=e.trim();return t.length===0?null:t.toLowerCase()}function Ae(e,t){let n=Q(t);return n===null?[]:e.filter(e=>Q(e.location)===n)}function je(e,t){let n=Ae(e,t),r=new Set(n.map(e=>e.id));return n.filter(e=>e.parentDeviceId===null||!r.has(e.parentDeviceId))}function Me(e,t){let n=Q(e.location);return n===null||new Set(t.map(e=>Q(e))).has(n)?null:e.location?.trim()??null}function Ne(e,t){let n=Q(e.location);return n!==null&&t.has(n)}function Pe(e,t){let n=new Set(t.map(e=>Q(e))),r=new Set(e.filter(e=>Ne(e,n)).map(e=>e.id));return e.filter(e=>!(Ne(e,n)||e.parentDeviceId!==null&&r.has(e.parentDeviceId)))}function Fe(e,t){return Pe(e,t).filter(e=>e.parentDeviceId===null)}function Ie(e,t){let n=new Map;for(let t of e){if(t.parentDeviceId===null)continue;let e=n.get(t.parentDeviceId);e?e.push(t):n.set(t.parentDeviceId,[t])}let r=[],i=new Set([t]),a=[t];for(;a.length>0;){let e=[];for(let t of a)for(let a of n.get(t)??[])i.has(a.id)||(i.add(a.id),r.push(a),e.push(a.id));a=e}return r}function Le(e,t){return Ie(e,t).length}function Re(e,t){return e.filter(e=>!e.isCamera&&e.parentDeviceId===t)}function ze(e,t){return t.map(t=>({name:t,members:je(e,t)}))}function $({type:e,role:t,className:r}){return n(ge(e,t),{"aria-hidden":`true`,className:r??`h-3.5 w-3.5 shrink-0 text-foreground-subtle`})}function Be({device:t}){let r=L(Z(t),`compact`);if(t.online)return n(`span`,{"aria-hidden":`true`,className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-success`,"data-status":`online`});let i=q.t(`common.offline`);return e(`span`,{className:`flex items-center gap-1.5`,children:[n(`span`,{className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full border border-foreground-subtle`,"data-status":`offline`,role:`img`,"aria-label":q.t(`locations.deviceGlyphs.aria`,{name:r,state:i}),title:i}),n(`span`,{className:`text-xs text-foreground-muted`,children:i})]})}function Ve({open:t,title:a,items:o,listState:s,lockedIds:c,lockedNote:l,suggestions:u=null,busy:d=!1,onConfirm:f,onClose:p}){let{t:m}=J(),[h,g]=i([]);r(()=>{t||g([])},[t]);let _=new Map(o.map(e=>[e.id,e.name])),v=(u?.ids??[]).filter(e=>_.has(e)&&!c.includes(e)),y=e=>g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return n(H,{open:t,onOpenChange:e=>e?void 0:p(),children:e(I,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,"aria-label":a,children:[n(oe,{children:n(ae,{children:a})}),e(N,{className:`flex flex-col gap-3 p-2 sm:p-4`,children:[t&&u!==null&&v.length>0&&e(`section`,{"aria-label":u.heading,className:`flex flex-col gap-1`,children:[n(`h3`,{className:`text-[10px] sm:text-[11px] font-semibold text-foreground uppercase tracking-wider`,children:u.heading}),n(`div`,{className:`flex flex-wrap gap-1`,children:v.map(e=>n(`button`,{type:`button`,"aria-pressed":h.includes(e),className:`inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium transition-colors ${h.includes(e)?`border-primary/50 bg-primary/15 text-primary`:`border-border bg-surface text-foreground-subtle hover:bg-surface-hover`}`,onClick:()=>y(e),children:_.get(e)},e))})]}),t&&n(R,{devices:o,listState:s,value:h,onChange:e=>g(e),noun:`device`,emptyLabel:m(`locations.addDialog.nonePicked`),showAll:!0,lockedIds:c,lockedNote:l,testId:`quick-add-picker`})]}),e(F,{children:[n(K,{variant:`ghost`,onClick:p,children:m(`locations.addDialog.cancel`)}),n(K,{disabled:h.length===0||d,onClick:()=>f(h),children:m(`locations.addDialog.confirm`,{count:h.length})})]})]})})}a();function He({room:e,cameras:r,fleet:i}){let{t:a}=J(),o=t(()=>new Map(i.map(e=>[e.id,e])),[i]);return e===null?n(`p`,{className:`text-xs text-foreground-subtle`,children:a(`locations.links.noRoom`)}):n(`div`,{className:`flex flex-col gap-3`,"data-testid":`camera-links-section`,children:r.length===0?n(`p`,{className:`text-xs text-foreground-subtle`,"data-testid":`camera-links-empty`,children:a(`locations.links.noCameras`,{room:e})}):r.map(e=>n(We,{camera:e,byId:o},e.id))})}function Ue(e){return{id:e.deviceId,name:e.name,type:e.type,location:e.location}}function We({camera:t,byId:r}){let{t:a}=J(),s=L(Z(t),`full`),c=o(),u=X(),[d,p]=i(!1),[m,h]=i(null),g=xe({deviceId:t.id}),_=ke({status:g.status,data:g.data,error:g.error===null||g.error===void 0?null:g.error}),v=V(),y=_.kind===`present`?_:null,x=W({deviceId:t.id,slotRef:y?.slot.slotRef??``},{enabled:d&&y!==null}),S=y===null?[]:Oe(y.slot,y.value),C=S.map(e=>e.deviceId),w=(x.data?.candidates??[]).map(Ue),T=new Set(w.map(e=>e.id)),E=C.filter(e=>!T.has(e)).map(e=>{let t=r.get(e);return{id:e,name:t?.name??`#${String(e)}`,...t===void 0?{}:{type:t.type,location:t.location}}}),D=[...w,...E],O=(x.data?.candidates??[]).filter(e=>e.suggested).map(e=>e.deviceId),k=async e=>{if(y!==null){h(null);try{await v.mutateAsync({deviceId:t.id,slotRef:y.slot.slotRef,value:De(y.value,e)}),await g.refetch(),await c.invalidateQueries({queryKey:[[`deviceManager`]]}),p(!1)}catch(e){h(e instanceof Error?e.message:String(e))}}},j=[{key:`device`,header:a(`locations.columns.device`),notSortableReason:a(`locations.columns.noSort`),render:t=>{let i=r.get(t.deviceId),o=t.name??i?.name??`#${String(t.deviceId)}`;return e(`span`,{className:`flex items-center gap-1.5`,children:[i!==void 0&&n($,{type:i.type,role:i.role}),n(Y,{to:`/devices/${String(t.deviceId)}`,className:`min-w-0 truncate text-xs text-foreground hover:underline`,children:i===void 0?o:n(G,{device:Z(i),form:`compact`})}),t.implied&&n(`span`,{className:`text-[10px] text-foreground-subtle`,children:a(`locations.links.implied`)})]})}},{key:`type`,header:a(`locations.columns.type`),notSortableReason:a(`locations.columns.noSort`),render:e=>n(`span`,{className:`text-xs text-foreground-muted`,children:r.get(e.deviceId)?.type??`—`})},{key:`status`,header:a(`locations.columns.status`),notSortableReason:a(`locations.columns.noSort`),render:e=>{let t=r.get(e.deviceId);return t===void 0?n(`span`,{className:`text-xs text-foreground-subtle`,children:`—`}):n(Be,{device:t})}}];return e(`section`,{className:`min-w-0 ${f}`,"data-testid":`camera-links-${String(t.id)}`,children:[e(`header`,{className:`${b} flex min-h-9 items-center gap-1.5`,children:[n($,{type:t.type,role:t.role}),n(`h2`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-foreground`,children:n(G,{device:Z(t),form:`full`})}),e(K,{variant:`ghost`,size:`sm`,onClick:()=>u(Te(t.id)),children:[n(l,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),a(`locations.links.edit`)]}),n(K,{variant:`outline`,size:`sm`,disabled:y===null,onClick:()=>p(!0),"aria-label":a(`locations.links.addNamed`,{camera:s}),children:a(`locations.room.add`)})]}),_.kind===`pending`&&n(`p`,{role:`status`,className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:a(`locations.links.loading`)}),_.kind===`unknown`&&n(`p`,{role:`alert`,className:`px-3 py-3 text-xs text-warning sm:px-4`,children:a(`locations.links.unreadable`,{reason:_.reason})}),_.kind===`absent`&&n(`p`,{className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:a(`locations.links.unsupported`)}),m!==null&&n(`p`,{role:`alert`,className:`px-3 pt-2 text-xs text-danger break-words sm:px-4`,children:m}),y!==null&&(S.length===0?n(`p`,{className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:a(`locations.links.none`)}):n(A,{columns:j,rows:S,rowKey:e=>String(e.deviceId),bordered:!1,minWidthPx:360})),n(Ve,{open:d,title:a(`locations.links.pickTitle`,{camera:s}),items:D,listState:x.status===`error`?`failed`:x.data===void 0?`pending`:`answered`,lockedIds:C,lockedNote:a(`locations.links.alreadyLinked`),suggestions:t.location===null?null:{heading:a(`locations.links.suggested`,{room:t.location}),ids:O},busy:v.isPending,onConfirm:e=>void k(e),onClose:()=>p(!1)})]})}a();function Ge({name:t,description:a,busy:o,onSave:s}){let{t:c}=J(),[l,u]=i(a??``);return r(()=>{u(a??``)},[a]),e(`div`,{className:`border-t border-border px-3 py-2 sm:px-4`,children:[n(U,{htmlFor:`location-description-${t}`,className:`block`,children:c(`locations.locationDescriptionField.whatIsThere`,`What is there`)}),n(ue,{id:`location-description-${t}`,value:l,onChange:e=>u(e.target.value),onBlur:()=>{let e=l.trim();e!==(a??``)&&s(e.length===0?null:e)},disabled:o,rows:2,maxLength:400,placeholder:c(`locations.locationDescriptionField.surfacesBoundariesWhatIsNormally`,`Surfaces, boundaries, what is normally parked or stored here.`),className:`mt-1 w-full resize-y rounded-md border border-border bg-surface px-2.5 py-1.5 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-inset focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50`}),n(`p`,{className:`mt-1 ${C}`,children:c(`locations.locationDescriptionField.givenToTheAiWith`,`Given to the AI with the pictures, so it knows what it is looking at. Describe the PLACE, not what happens in it — events change, the ground does not.`)})]})}function Ke(e,t){let n=e?.find(e=>e.locationKey===t);return n===void 0||n.description.length===0?null:n.description}var qe=` none`;function Je({name:t,zones:r,zoneKey:i,busy:a,onChange:o}){let{t:s}=J();if(r.length===0)return null;let c=[{value:qe,label:s(`locations.locationZoneField.none`,`— none —`)},...r.map(e=>({value:e.zoneKey,label:e.label}))];return e(`div`,{className:`flex items-center gap-2 border-t border-border px-3 py-1.5 sm:px-4 sm:py-2`,children:[n(U,{htmlFor:`location-zone-${t}`,children:s(`locations.locationZoneField.zone`,`Zone`)}),n(v,{id:`location-zone-${t}`,value:i??qe,disabled:a,onChange:e=>{let t=e.target.value;if(t===qe){o(null);return}let n=r.find(e=>e.zoneKey===t);n!==void 0&&o(n.label)},options:c})]})}function Ye(e,t){return e.find(e=>e.locationKeys.includes(t))?.zoneKey??null}function Xe({name:e,icon:t,busy:r,onPick:i}){return n(pe,{value:t,onPick:i,fallbackGlyph:d,clearGlyph:u,labels:{trigger:`Change the icon of ${e}`,panel:`Icon for ${e}`,searchPlaceholder:`Search icons`,clear:`No icon`,noMatches:`No icon matches that`},disabled:r})}function Ze(e,t){let n=e?.find(e=>e.locationKey===t);return n===void 0?null:E(n.icon)??`map-pin`}function Qe(e){return`${e.kind}:${String(e.device.id)}`}function $e(e,t,n){return e.flatMap(e=>{let r=Re(t,e.id),i=n.has(e.id),a={kind:`member`,device:e,accessories:r,open:i};return!i||r.length===0?[a]:[a,...r.map(t=>({kind:`accessory`,device:t,parent:e}))]})}a();function et({name:r,members:a,devices:o,busy:c,icon:l,description:u,onRename:d,onDelete:m,onRebuildLinks:g,onAddDevices:_,onPickIcon:v,onSaveDescription:y,zones:C,zoneKey:w,onChangeZone:T}){let{t:E}=J(),[D,O]=i(!1),[ee,N]=i(r),P=M(a,t(()=>({searchText:e=>[e.name,...Re(o,e.id).map(e=>e.name)],facetValue:e=>e.type}),[o])),[F,I]=i(()=>new Set),L=e=>I(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),R=t(()=>$e(P.rows,o,F),[P.rows,o,F]),ne=[{key:`name`,header:E(`locations.columns.device`),notSortableReason:E(`locations.columns.noSort`),render:e=>e.kind===`member`?n(tt,{row:e,onToggle:()=>L(e.device.id)}):n(nt,{row:e})},{key:`type`,header:E(`locations.columns.type`),notSortableReason:E(`locations.columns.noSort`),render:e=>n(`span`,{className:`text-xs text-foreground-muted`,children:e.device.type})},{key:`status`,header:E(`locations.columns.status`),notSortableReason:E(`locations.columns.noSort`),render:e=>n(Be,{device:e.device})}],B=()=>{N(r),O(!1)},V=async()=>{let e=ee.trim();if(e.length===0||e===r){B();return}await d(e),O(!1)},re=[{id:`rename`,label:E(`locations.locationCard.rename`,`Rename`),icon:S,disabled:c,onClick:()=>{N(r),O(!0)}},{id:`rebuild-links`,label:E(`locations.locationCard.rebuildLinkedDevices`,`Rebuild linked devices`),icon:h,separatorBefore:!0,disabled:c,onClick:()=>void g()},{id:`delete`,label:E(`common.delete`,`Delete`),icon:x,danger:!0,separatorBefore:!0,disabled:c,onClick:()=>void m()}];return e(`section`,{className:`min-w-0 ${f}`,children:[e(`header`,{className:`${b} flex min-h-9 items-center gap-1.5`,children:[n(Xe,{name:r,icon:l,busy:c,onPick:v}),D?e(s,{children:[n(j,{value:ee,onChange:e=>N(e.target.value),onKeyDown:e=>{e.key===`Enter`&&V(),e.key===`Escape`&&B()},"aria-label":E(`locations.locationCard.rename2`,`Rename {{name}}`,{name:r}),className:`min-w-0 flex-1`,autoFocus:!0}),n(K,{type:`button`,size:`sm`,onClick:()=>void V(),children:E(`common.save`,`Save`)}),n(te,{type:`button`,variant:`ghost`,icon:p,onClick:B,"aria-label":E(`locations.locationCard.cancelRename`,`Cancel rename`)})]}):e(s,{children:[n(`h2`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-foreground`,children:r}),n(K,{type:`button`,variant:`outline`,size:`sm`,disabled:c,onClick:_,"aria-label":E(`locations.room.addTo`,{room:r}),children:E(`locations.room.add`)}),n(k,{items:re,title:E(`locations.locationCard.actionsFor`,`Actions for {{name}}`,{name:r}),triggerClassName:`p-1`})]})]}),n(Je,{name:r,zones:C,zoneKey:w,busy:c,onChange:T}),n(Ge,{name:r,description:u,busy:c,onSave:y}),a.length>0&&n(`div`,{className:`border-b border-border px-3 py-1.5 sm:px-4 sm:py-2`,children:n(z,{state:P.state,facets:P.facets,labels:{searchPlaceholder:E(`locations.filter.searchPlaceholder`),searchLabel:E(`locations.room.searchLabel`,{room:r}),facetsLabel:E(`locations.filter.typesLabel`),clearLabel:E(`locations.filter.clear`)},onSearch:P.setSearch,onToggleFacet:P.toggleFacet,onClear:P.clear})}),a.length===0?n(`p`,{className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:E(`locations.locationCard.nothingHereYetAssignA`,`Nothing here yet — assign a device from the table below.`)}):n(A,{columns:ne,rows:R,rowKey:Qe,bordered:!1,minWidthPx:360,emptyMessage:E(`locations.filter.noMatch`)})]})}function tt({row:t,onToggle:r}){let{t:i}=J(),{device:a,accessories:o,open:s}=t,c=L(Z(a),`compact`),l=s?D:g;return e(`span`,{className:`flex items-center gap-1.5`,children:[o.length>0?e(K,{type:`button`,variant:`ghost`,onClick:r,"aria-expanded":s,"aria-label":i(s?`locations.locationCard.collapseAccessories`:`locations.locationCard.expandAccessories`,{count:o.length,name:c}),className:`h-auto shrink-0 gap-0.5 p-0.5 text-foreground-subtle hover:text-foreground`,children:[n(l,{className:`h-3 w-3`}),n(`span`,{className:`text-[10px] tabular-nums`,children:o.length})]}):n(`span`,{"aria-hidden":`true`,className:`w-[1.35rem] shrink-0`}),n($,{type:a.type,role:a.role}),n(Y,{to:`/devices/${String(a.id)}`,className:`min-w-0 truncate text-xs text-foreground hover:underline`,children:n(G,{device:Z(a),form:`compact`})})]})}function nt({row:t}){let{device:r,parent:i}=t;return e(`span`,{className:`flex items-center gap-1.5 pl-6`,children:[n(`span`,{"aria-hidden":`true`,className:`text-[10px] text-foreground-subtle`,children:`└`}),n($,{type:r.type,role:r.role,className:`h-3 w-3 shrink-0 text-foreground-subtle`}),n(Y,{to:`/devices/${String(r.id)}`,className:`min-w-0 truncate text-xs text-foreground-muted hover:underline`,children:n(G,{device:Z(r),form:`nested`,parent:Z(i)})})]})}a();function rt({zones:e,busy:t,onRename:r,onDelete:a,onPickIcon:o}){let{t:s}=J(),[c,l]=i(null),[u,d]=i(``),f=async e=>{let t=u.trim();l(null),!(t.length===0||t===e)&&await r(e,t)};return n(A,{columns:[{key:`icon`,header:s(`locations.siteZonesPanel.icon`,`Icon`),width:`w-12`,notSortableReason:`An icon has no order`,render:e=>n(Xe,{name:e.label,icon:e.icon,busy:t,onPick:t=>o(e.label,t)})},{key:`name`,header:s(`locations.siteZonesPanel.zone`,`Zone`),sortValue:e=>e.label.toLowerCase(),render:e=>c===e.label?n(j,{value:u,onChange:e=>d(e.target.value),onKeyDown:t=>{t.key===`Enter`&&f(e.label),t.key===`Escape`&&l(null)},onBlur:()=>void f(e.label),"aria-label":s(`locations.siteZonesPanel.rename`,`Rename {{label}}`,{label:e.label}),autoFocus:!0}):n(K,{type:`button`,variant:`ghost`,size:`sm`,className:`px-0`,onClick:()=>{d(e.label),l(e.label)},disabled:t,title:s(`locations.siteZonesPanel.renameTheZone`,`Rename the zone`),children:e.label})},{key:`rooms`,header:s(`locations.siteZonesPanel.rooms`,`Rooms`),align:`right`,sortValue:e=>e.locationKeys.length,render:e=>n(`span`,{className:`tabular-nums text-foreground-subtle`,children:e.locationKeys.length===0?s(`common.empty`):s(`common.rooms`,{count:e.locationKeys.length})})},{key:`actions`,header:s(`locations.siteZonesPanel.actions`,`Actions`),align:`right`,notSortableReason:`Actions have no order`,render:e=>n(K,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void a(e.label),disabled:t,"aria-label":s(`locations.siteZonesPanel.delete`,`Delete {{label}}`,{label:e.label}),title:s(`locations.siteZonesPanel.deleteTheZoneTheRooms`,`Delete the zone — the rooms in it are kept`),children:n(x,{className:`h-3.5 w-3.5`})})}],rows:e,rowKey:e=>e.zoneKey,emptyMessage:s(`locations.siteZonesPanel.noZonesYetAZone`,`No zones yet. A zone groups rooms — “Night zone” for the bedrooms — and shows up before them in the app’s camera filter.`)})}a();function it({busy:t,onCreate:r}){let{t:a}=J(),[o,s]=i(!1),[c,l]=i(``),u=()=>{l(``),s(!1)},d=async()=>{let e=c.trim();e.length!==0&&(await r(e),u())};return o?e(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),d()},children:[n(j,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Escape`&&u()},placeholder:a(`locations.newLocationButton.frontDoorHallKitchen`,`Front door, Hall, Kitchen…`),"aria-label":a(`locations.newLocationButton.newLocationName`,`New location name`),className:`min-w-[12rem] flex-1`,autoFocus:!0}),e(K,{size:`sm`,type:`submit`,disabled:c.trim().length===0||t,children:[n(y,{className:`h-3.5 w-3.5`}),a(`common.add`,`Add`)]}),n(K,{size:`sm`,variant:`ghost`,type:`button`,onClick:u,"aria-label":a(`locations.newLocationButton.cancelNewLocation`,`Cancel new location`),children:n(p,{className:`h-3.5 w-3.5`})})]}):e(K,{size:`sm`,type:`button`,onClick:()=>s(!0),"data-testid":`new-location-button`,children:[n(y,{className:`h-3.5 w-3.5`}),a(`locations.newLocationButton.newLocation`,`New location`)]})}a();function at({busy:t,onCreate:r}){let{t:a}=J(),[o,s]=i(!1),[c,l]=i(``),u=()=>{l(``),s(!1)},d=async()=>{let e=c.trim();e.length!==0&&(await r(e),u())};return o?e(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),d()},children:[n(j,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Escape`&&u()},placeholder:a(`locations.newZoneButton.zonaGiornoZonaNotte`,`Zona giorno, Night zone…`),"aria-label":a(`locations.newZoneButton.newZoneName`,`New zone name`),className:`min-w-[12rem] flex-1`,autoFocus:!0}),e(K,{size:`sm`,type:`submit`,disabled:c.trim().length===0||t,children:[n(y,{className:`h-3.5 w-3.5`}),a(`common.add`,`Add`)]}),n(K,{size:`sm`,variant:`ghost`,type:`button`,onClick:u,"aria-label":a(`locations.newZoneButton.cancelNewZone`,`Cancel new zone`),children:n(p,{className:`h-3.5 w-3.5`})})]}):e(K,{size:`sm`,type:`button`,onClick:()=>s(!0),"data-testid":`new-zone-button`,children:[n(y,{className:`h-3.5 w-3.5`}),a(`locations.newZoneButton.newZone`,`New zone`)]})}a();function ot(e,t,n,r){let i=e.map(e=>({value:e.name,label:`${e.name} · ${String(e.count)}`}));return t===void 0?i:[...i,{value:n,label:`${r} · ${String(t)}`}]}function st({rooms:e,unassignedCount:r,value:i,unassignedValue:a,onChange:o}){let{t:s}=J(),c=t(()=>ot(e,r,a,s(`locations.roomPicker.unassigned`)),[e,r,a,s]);return n(`div`,{className:`max-w-sm`,"data-testid":`room-select`,children:n(B,{mode:`single`,singleDisplay:`field`,label:s(`locations.roomPicker.label`),placeholder:s(`locations.roomPicker.placeholder`),options:c,value:i,onChange:o,searchable:!0,testId:`room-select-control`,optionTestIdPrefix:`room-option`})})}a();var ct={searchText:e=>[e.name],facetValue:e=>e.type};function lt({rows:r,fleet:a,locations:o,busy:s,emptyMessage:l,onAssign:u}){let{t:d}=J(),f=ie(),p=Ce(),h=e=>f===null?e.name:P(Z(e),`compact`,f,p),[g,_]=i([]),[y,b]=i(``),x=M(r,ct),S=x.rows,w=t(()=>S.map(e=>e.id),[S]),T=t(()=>g.filter(e=>w.includes(e)),[g,w]),E=S.length>0&&T.length===S.length,D=t(()=>{let e=new Map;for(let t of r)e.set(t.id,Le(a,t.id));return e},[r,a]),k=T.reduce((e,t)=>e+(D.get(t)??0),0),j=e=>_(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),ee=()=>_(E?[]:w),N=()=>{y.length===0||T.length===0||(u(T,y),_([]),b(``))},F=o.map(e=>({value:e,label:e})),I=[{key:`select`,width:`w-8`,headerRender:()=>n(c,{checked:E,onChange:ee,"aria-label":E?d(`locations.unassignedTable.clearSelection`,`Clear selection`):d(`locations.unassignedTable.selectAllUnassignedDevices`,`Select all unassigned devices`)}),render:e=>n(c,{checked:T.includes(e.id),onChange:()=>j(e.id),"aria-label":d(`locations.unassignedTable.select`,`Select {{name}}`,{name:h(e)})})},{key:`name`,header:d(`locations.unassignedTable.device`,`Device`),sortValue:e=>e.name.toLowerCase(),render:t=>{let r=Me(t,o);return e(`span`,{className:`flex items-center gap-1.5`,children:[n($,{type:t.type,role:t.role}),n(Y,{to:`/devices/${String(t.id)}`,className:`truncate text-xs text-foreground hover:underline`,children:n(G,{device:Z(t),form:`compact`})}),r!==null&&n(O,{variant:`warning`,children:d(`locations.unassignedTable.unknownRoom`,{room:r})})]})}},{key:`type`,header:d(`locations.unassignedTable.type`,`Type`),sortValue:e=>e.type,render:e=>n(`span`,{className:`text-xs text-foreground-muted`,children:e.type})},{key:`status`,header:d(`locations.unassignedTable.status`,`Status`),sortValue:e=>+!!e.online,render:e=>n(Be,{device:e})},{key:`followers`,header:d(`locations.unassignedTable.accessoriesInTowCount`,`Accessories in tow`),align:`right`,sortValue:e=>D.get(e.id)??0,render:e=>n(`span`,{className:`tabular-nums text-xs text-foreground-muted`,children:D.get(e.id)??0})},{key:`assign`,header:d(`locations.unassignedTable.assignTo`,`Assign to`),align:`right`,notSortableReason:`This column is a control, not a value.`,render:e=>n(v,{"aria-label":d(`locations.unassignedTable.locationFor`,`Location for {{name}}`,{name:h(e)}),value:``,disabled:s||o.length===0,onChange:t=>{let n=t.target.value;n.length!==0&&u([e.id],n)},className:`max-w-[11rem]`,options:[{value:``,label:`—`},...F]})}];return e(`section`,{className:`space-y-2`,children:[e(`header`,{className:`flex flex-wrap items-baseline gap-2`,children:[n(`h2`,{className:m,children:d(`locations.unassignedTable.notInARoom`,`Not in a room`)}),n(`p`,{className:C,children:d(`locations.unassignedTable.topLevelDevicesOnlyAccessories`,`Top-level devices only — accessories move with their parent.`)})]}),r.length>0&&n(z,{state:x.state,facets:x.facets,labels:{searchPlaceholder:d(`locations.filter.searchPlaceholder`),searchLabel:d(`locations.unassigned.searchLabel`),facetsLabel:d(`locations.filter.typesLabel`),clearLabel:d(`locations.filter.clear`)},onSearch:x.setSearch,onToggleFacet:x.toggleFacet,onClear:x.clear}),T.length>0&&e(`div`,{role:`group`,"aria-label":d(`locations.unassignedTable.bulkAssignment`,`Bulk assignment`),className:`flex flex-wrap items-center gap-2 rounded border border-primary/40 bg-primary/5 px-2 py-1.5`,children:[e(`span`,{className:`text-xs text-foreground`,children:[d(`locations.unassignedTable.selected`,{count:T.length}),k>0&&` · ${d(`locations.unassignedTable.accessoriesInTowCount`,{count:k})}`]}),n(v,{"aria-label":d(`locations.unassignedTable.assignSelectedDevicesTo`,`Assign selected devices to`),value:y,onChange:e=>b(e.target.value),className:`w-auto min-w-[10rem]`,options:[{value:``,label:d(`locations.unassignedTable.assignTo2`,`Assign to…`)},...F]}),n(K,{type:`button`,size:`sm`,onClick:N,disabled:s||y.length===0,children:d(`locations.unassignedTable.assign`,`Assign`)}),n(K,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>_([]),children:d(`locations.unassignedTable.clear`,`Clear`)})]}),n(A,{columns:I,rows:S,rowKey:e=>e.id,minWidthPx:720,emptyMessage:x.active?d(`locations.filter.noMatch`):l})]})}function ut(e){return{id:e.id,parentDeviceId:e.parentDeviceId,location:e.location,type:e.type,stableId:e.stableId??``,...e.primaryChildEntityId===void 0?{}:{primaryChildEntityId:e.primaryChildEntityId},...e.primaryChildPreference===void 0?{}:{primaryChildPreference:e.primaryChildPreference},...e.role!==void 0&&e.role!==null?{role:e.role}:{},name:e.name}}function dt(e,t){let n=t.map(ut),r=[];for(let i of t)i.isCamera&&i.location===e&&r.push({deviceId:i.id,name:i.name,ids:w({selfId:i.id,selfLocation:i.location,candidates:n})});return{entries:r}}var ft=`device-manager:linked-devices`;function pt(e){return{deviceId:e.deviceId,slotRef:ft,value:{slot:`linked-devices`,deviceIds:[...e.ids]}}}a();var mt=`__unassigned__`;function ht(){let{t:r}=J(),a=o(),s=_(),{data:c,isLoading:l}=se(),{data:u}=fe(),{data:f}=_e(),{data:p}=ve(),{data:m,isLoading:h}=ne({projection:`slim`}),g=()=>{a.invalidateQueries({queryKey:[[`deviceManager`,`listLocations`]]}),a.invalidateQueries({queryKey:[[`deviceManager`,`listAll`]]}),a.invalidateQueries({queryKey:[[`deviceManager`,`listLocationIcons`]]}),a.invalidateQueries({queryKey:[[`deviceManager`,`listLocationDescriptions`]]}),a.invalidateQueries({queryKey:[[`deviceManager`,`listSiteZones`]]})},v=re({onSuccess:g}),y=le({onSuccess:g}),b=ye({onSuccess:g}),x=me({onSuccess:g}),S=ce({onSuccess:g}),C=Se({onSuccess:g}),w=ee({onSuccess:g}),E=he({onSuccess:g}),D=de({onSuccess:g}),O=be({onSuccess:g}),k=V(),A=t(()=>(m??[]).map(e=>({id:e.id,name:e.name,location:e.location??null,type:String(e.type),isCamera:e.isCamera,parentDeviceId:e.parentDeviceId,online:e.online,role:e.role??null,stableId:e.stableId,primaryChildEntityId:e.primaryChildEntityId??null,primaryChildPreference:e.primaryChildPreference??null})),[m]),j=c??[],M=t(()=>ze(A,j),[A,j]),[N,P]=we(),F=N.get(`tab`),I=F===`zones`||F===`camera-links`?F:`locations`,L=N.get(`room`),R=t(()=>Fe(A,j),[A,j]),te=L===mt,z=te?null:L!==null&&M.some(e=>e.name===L)?L:M[0]?.name??null,B=z===null?null:M.find(e=>e.name===z)??null,ie=te?mt:z??`__unassigned__`,H=z??M[0]?.name??null,ae=t(()=>M.map(e=>({name:e.name,count:e.members.length})),[M]),oe=e=>{P(t=>{let n=new URLSearchParams(t);return n.set(`room`,e),n},{replace:!0})},U=l||h,W=b.isPending||y.isPending||v.isPending||S.isPending,G=async e=>{await v.mutateAsync({name:e})},ue=async(e,t)=>{let n=t.trim();n.length===0||n===e||await x.mutateAsync({from:e,to:n})},pe=async e=>{let t=dt(e,A);if(t.entries.length===0){await s({title:r(`locations.rebuildLinkedDevices`,`Rebuild linked devices`),message:r(`locations.noCameraIsAssignedTo`,`No camera is assigned to “{{room}}”.`,{room:e}),confirmLabel:`OK`});return}let n=t.entries.map(e=>r(`locations.rebuildEntry`,{name:e.name,count:e.ids.length})).join(`
2
- `);if(!await s({title:r(`locations.rebuildLinkedDevices`,`Rebuild linked devices`),message:r(`locations.replaceTheLinkedDeviceList`,`Replace the linked-device list of every camera in “{{room}}” with what the room contains? {{lines}} Anything linked by hand that is not in this room is lost.`,{room:e,lines:n}),confirmLabel:r(`locations.rebuild`,`Rebuild`),variant:`danger`}))return;let i=[];for(let e of t.entries)try{await k.mutateAsync(pt(e))}catch(t){i.push(`• ${e.name}: ${t instanceof Error?t.message:String(t)}`)}g(),i.length>0&&await s({title:r(`locations.rebuildLinkedDevices`,`Rebuild linked devices`),message:r(`locations.notRebuilt`,`Not rebuilt: {{value1}}`,{value1:i.join(`
3
- `)}),confirmLabel:`OK`})},ge=async(e,t)=>{let n=t>0?` ${String(t)} device(s) will become unassigned.`:``;await s({title:r(`locations.deleteLocation`,`Delete location`),message:r(`locations.deleteTheLocation`,`Delete the location “{{name}}”?{{extra}}`,{name:e,extra:n}),confirmLabel:r(`common.delete`,`Delete`),variant:`danger`})&&await y.mutateAsync({name:e,cascade:!0})},xe=async e=>{await s({title:r(`locations.deleteZone`,`Delete zone`),message:r(`locations.deleteTheZoneTheRooms`,`Delete the zone “{{name}}”? The rooms in it are kept.`,{name:e}),confirmLabel:r(`common.delete`,`Delete`),variant:`danger`})&&await E.mutateAsync({name:e})},K=async(e,t)=>{await S.mutateAsync({location:e,icon:t})},Ce=async(e,t)=>{await C.mutateAsync({location:e,description:t})},q=p??[],Te=async(e,t)=>{await O.mutateAsync({location:e,zone:t})},Y=(e,t)=>{for(let n of e)b.mutate({deviceId:n,location:t})},[X,De]=i(null),Oe=t(()=>A.filter(e=>e.parentDeviceId===null).map(e=>({id:e.id,name:e.name,type:e.type,location:e.location})),[A]),ke=n(st,{rooms:ae,...I===`locations`?{unassignedCount:R.length}:{},value:I===`locations`?ie:H??``,unassignedValue:mt,onChange:oe}),Z=e(`div`,{className:`flex flex-col gap-3`,"data-testid":`locations-section`,children:[U&&n(`p`,{className:`text-xs text-foreground-subtle`,children:r(`locations.loadingLocationsAndDevices`,`Loading locations and devices…`)}),ke,te||B===null?n(lt,{rows:R,fleet:A,locations:j,busy:W,emptyMessage:U?r(`common.loading`,`Loading…`):r(`locations.everyTopLevelDeviceHas`,`Every top-level device has a room.`),onAssign:Y}):n(et,{name:B.name,members:B.members,devices:A,busy:W,icon:Ze(u,T(B.name)),onPickIcon:e=>K(B.name,e),description:Ke(f,T(B.name)),onSaveDescription:e=>Ce(B.name,e),zones:q,zoneKey:Ye(q,T(B.name)),onChangeZone:e=>Te(B.name,e),onRename:e=>ue(B.name,e),onDelete:()=>ge(B.name,Ae(A,B.name).length),onRebuildLinks:()=>pe(B.name),onAddDevices:()=>De(B.name)},B.name),j.length===0&&!U&&n(`p`,{className:`text-xs text-foreground-subtle`,children:r(`locations.noLocationsYetAddFrontDoor`,`No locations yet. Add Front door, Hall, Kitchen…`)}),n(Ve,{open:X!==null,title:r(`locations.room.addDialogTitle`,{room:X??``}),items:Oe,listState:h?`pending`:`answered`,lockedIds:X===null?[]:(M.find(e=>e.name===X)?.members??[]).map(e=>e.id),lockedNote:r(`locations.room.alreadyHere`),suggestions:{heading:r(`locations.room.suggestedUnassigned`),ids:R.map(e=>e.id)},busy:b.isPending,onConfirm:e=>{X!==null&&Y(e,X),De(null)},onClose:()=>De(null)})]}),Q=e(`div`,{className:`flex flex-col gap-3`,"data-testid":`camera-links-tab`,children:[ke,n(He,{room:H,cameras:H===null?[]:Ae(A,H).filter(e=>e.isCamera),fleet:A})]});return n(Ee,{icon:d,title:r(`locations.locations`,`Locations`),subtitle:r(`locations.roomsAndAreasOfThe`,`Rooms and areas of the site. Assign any device here — storage disks are under Data → Storage.`),defaultSection:`locations`,sectionsLabel:`Locations sections`,actions:I===`zones`?n(at,{busy:w.isPending,onCreate:e=>w.mutateAsync({name:e})}):n(it,{busy:v.isPending,onCreate:G}),sections:[{id:`locations`,label:r(`locations.locations`,`Locations`),content:Z},{id:`camera-links`,label:r(`locations.cameraLinks`,`Camera links`),content:Q},{id:`zones`,label:r(`locations.zones`,`Zones`),content:n(rt,{zones:q,busy:W,onRename:(e,t)=>D.mutateAsync({from:e,to:t}),onDelete:xe,onPickIcon:(e,t)=>w.mutateAsync({name:e,icon:t})})}]})}export{ht as LocationsPage};
@@ -1 +0,0 @@
1
- import{C as e,K as t,R as n,S as r,V as i,Y as a,et as o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Qa as s,Vn as c,fa as l,ft as u,mn as d,sa as f,zr as p}from"./player-overlays-CEIvxNnK.js";import{Dc as m,Zs as h}from"./client-BZDnTMae.js";import{t as g}from"./layers-BH9u1mrE.js";import{t as _}from"./timer-reset-5221y6Jb.js";import{$i as v,Dp as y,Ff as b,Lr as x,Mf as S,Qi as C,Qp as w,Rf as T,Ta as E,hr as D,yp as O}from"./src-DUAdvcBH.js";import{t as k}from"./useTranslation-BJr-n0es.js";import{Ci as A,a as j,b as M,i as N}from"./index-DN4KezHo.js";import{t as P}from"./AdminSectionedPage-Bc9tE_NE.js";import{t as F}from"./InstancesTable-6KYkti9L.js";import{t as I}from"./AdminPage-8-6dNnx0.js";o();function L(e){let t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/60),r=t%60;return n===0?`${r}s`:r===0?`${n}m`:`${n}m ${r}s`}function R(e,t){return{windowMs:Math.max(0,e.untilMs-t),capMs:Math.max(0,e.capAtMs-t)}}function z(e,t){let n=new Set(e.map(e=>e.channel));return t.filter(e=>n.has(e))}function B(e){let t=e.indexOf(`.`);return t===-1?e:e.slice(0,t)}function V(e){let t=new Map;for(let n of e){let e=B(n.name);t.set(e,[...t.get(e)??[],n])}return[...t.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({addon:e,channels:[...t].sort((e,t)=>e.name.localeCompare(t.name))}))}var H=[12e4,3e5,6e5,18e5],U=[h.Camera],W=8,G=`rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground-subtle`,K=`inline-flex items-center gap-1 rounded bg-warning/10 px-1.5 py-0.5 text-[10px] font-semibold text-warning`,q=`rounded border border-border px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground disabled:opacity-50`;function J(t){let{channel:n,armed:i,watch:o,nowMs:s,busy:c}=t,{t:u}=k(),[f,p]=a([]),m=n.kind===`debug`,h=i?.armed===!0,g=o===void 0?void 0:R(o,s);return e(`div`,{className:`flex flex-col gap-2 p-3 lg:flex-row lg:items-center lg:justify-between`,children:[e(`div`,{className:`min-w-0`,children:[e(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(`span`,{className:`text-sm font-medium text-foreground`,children:n.name}),r(`span`,{className:G,children:u(`logging.diagnostics.kind.${n.kind}`,n.kind)}),m&&g!==void 0&&e(`span`,{className:K,children:[r(_,{className:`h-3 w-3`}),u(`logging.diagnostics.endsIn`,{left:L(g.windowMs)})]}),!m&&h&&e(`span`,{className:K,children:[r(_,{className:`h-3 w-3`}),u(`logging.diagnostics.expiresIn`,{left:L(i?.remainingMs??0)})]}),!m&&!h&&r(`span`,{className:G,children:u(`logging.diagnostics.disarmed`,`disarmed`)}),!m&&h&&i?.deviceIds!=null&&e(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary`,children:[r(l,{className:`h-3 w-3`}),i.deviceIds.join(`, `)]}),m&&o!==void 0&&e(`span`,{className:`text-[11px] text-foreground-subtle`,children:[`#`,o.deviceIds.join(`, #`),g!==void 0&&` · ${u(`logging.diagnostics.capIn`,{left:L(g.capMs)})}`]}),!n.perDevice&&r(`span`,{className:G,children:u(`logging.diagnostics.notPerCamera`,`not filterable per camera`)})]}),r(`p`,{className:`mt-0.5 max-w-2xl text-[11px] text-foreground-subtle`,children:n.description})]}),e(`div`,{className:`flex shrink-0 flex-col gap-1 lg:items-end`,children:[n.perDevice&&r(`div`,{className:`w-full lg:w-72`,children:r(E,{multiple:!0,pick:`device`,noun:`camera`,fixedTypes:U,maxItems:W,recentKey:`log-channel-cameras`,testId:`log-channel-cameras-${n.name}`,value:v(f),onChange:e=>p(C(e))})}),m?e(`div`,{className:`flex flex-wrap items-center gap-1`,children:[r(O,{type:`button`,disabled:c||f.length===0,title:f.length===0?u(`logging.diagnostics.pickCamerasToWatch`,`Pick at least one camera to start a watch.`):void 0,onClick:()=>t.onStartWatch(f),children:u(`logging.diagnostics.watchStart`,`Start watching`)}),e(O,{type:`button`,variant:`secondary`,disabled:c||o===void 0,onClick:t.onStopWatch,children:[r(d,{className:`mr-1 h-3.5 w-3.5`}),u(`logging.diagnostics.watchStop`,`Stop`)]})]}):e(`div`,{className:`flex flex-wrap items-center gap-1`,children:[H.map(e=>r(O,{variant:`unstyled`,type:`button`,disabled:c,onClick:()=>t.onArm(e,f.length>0?f:null),className:q,children:L(e)},e)),r(O,{variant:`unstyled`,type:`button`,disabled:c||!h,onClick:()=>t.onArm(0,null),className:`rounded bg-primary px-2 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-40`,children:u(`logging.diagnostics.disarm`,`Disarm`)})]})]})]})}o();var Y=1e3,X=15e3;function Z(){let{t:o}=k(),c=b({},{refetchInterval:5e3}),l=T(),u=S(),[d,f]=a(null),[h,g]=a([]),[_,v]=a([]),[y,C]=a([]),[w,E]=a(()=>Date.now()),O=(e,t)=>{f(e),l.mutate({patch:{diagnostics:[{id:e,armMs:t}]}},{onSettled:()=>{f(null),c.refetch()}})},A=(e,t,n)=>{f(e),l.mutate({patch:{channels:[{channel:e,armMs:t,deviceIds:n}]}},{onSettled:()=>{f(null),c.refetch()}})},j=n((e,t,n)=>{u.mutate({action:e,channels:t,deviceIds:n},{onSuccess:e=>{g(e.watches),C(e.lapsed)}})},[]);i(()=>{let e=setInterval(()=>E(Date.now()),Y);return()=>clearInterval(e)},[]),i(()=>{j(`list`,[],[]);let e=setInterval(()=>j(`list`,[],[]),X);return()=>clearInterval(e)},[j]);let M=z(h,_).join(`|`);i(()=>{if(M===``)return;let e=setInterval(()=>j(`rearm`,M.split(`|`),[]),m);return()=>clearInterval(e)},[M,j]);let N=(e,t)=>{v(t=>t.includes(e)?t:[...t,e]),j(`start`,[e],t)},P=e=>{v(t=>t.filter(t=>t!==e)),j(`stop`,[e],[])},F=c.data?.activeWindows??[],L=c.data?.activeChannels??[],R=t(()=>V(c.data?.channels??[]),[c.data]),B=[...new Set(h.flatMap(e=>e.deviceIds))];return e(I,{embedded:!0,icon:s,title:o(`logging.diagnostics.title`,`Diagnostics`),subtitle:o(`logging.diagnostics.subtitle`,`Windows and channels are armed for a limited time, never switched on. Each carries a deadline and expires by itself — one left running is an incident of its own.`),children:[c.isLoading?e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(p,{className:`h-3.5 w-3.5 animate-spin`}),o(`common.loading`,`Loading…`)]}):r(`div`,{className:`rounded-lg border border-border bg-surface divide-y divide-border`,children:F.map(e=>r(ee,{window:e,busy:d===e.id,onArm:t=>O(e.id,t)},e.id))}),r(`h3`,{className:`mt-6 text-sm font-medium text-foreground`,children:o(`logging.diagnostics.channels`,`Log channels`)}),r(`p`,{className:`mb-2 max-w-3xl text-[11px] text-foreground-subtle`,children:o(`logging.diagnostics.channelsSubtitle`,`Declared by the addons that own them, grouped by addon. A diagnostic channel opens a window with a deadline; a debug channel starts a live watch that this page keeps renewed while it stays open.`)}),R.length===0?r(`p`,{className:`text-[11px] text-foreground-subtle`,children:o(`logging.diagnostics.noChannels`,`No addon on this cluster declares a log channel, or none could be reached right now.`)}):r(`div`,{className:`space-y-4`,children:R.map(t=>e(`section`,{"aria-label":t.addon,children:[r(`h4`,{className:`mb-1 text-xs font-medium text-foreground-muted`,children:t.addon}),r(`div`,{className:`rounded-lg border border-border bg-surface divide-y divide-border`,children:t.channels.map(e=>r(J,{channel:e,armed:L.find(t=>t.channel===e.name),watch:h.find(t=>t.channel===e.name),nowMs:w,busy:d===e.name||u.isPending,onArm:(t,n)=>A(e.name,t,n),onStartWatch:t=>N(e.name,t),onStopWatch:()=>P(e.name)},e.name))})]},t.addon))}),u.isError&&r(`p`,{className:`mt-2 text-[11px] text-danger`,children:u.error.message}),y.length>0&&r(`p`,{className:`mt-2 text-[11px] text-warning`,children:o(`logging.diagnostics.lapsed`,`Already ended, not renewed: {{names}}. Start again to continue.`,{names:y.join(`, `)})}),B.length>0&&r(x,{headingId:`log-diagnostics-live`,title:o(`logging.diagnostics.live`,`Live`),children:B.map(e=>r(`div`,{className:`border-t border-border first:border-t-0`,children:r(D,{deviceId:e,limit:200,maxHeight:`max-h-80`,showScope:!0,showFilters:!1})},e))})]})}function ee({window:t,busy:n,onArm:i}){let{t:a}=k();return e(`div`,{className:`flex flex-col gap-2 p-3 lg:flex-row lg:items-center lg:justify-between`,children:[e(`div`,{className:`min-w-0`,children:[e(`div`,{className:`flex items-center gap-2`,children:[r(`span`,{className:`text-sm font-medium text-foreground`,children:t.id}),t.armed?e(`span`,{className:`inline-flex items-center gap-1 rounded bg-warning/10 px-1.5 py-0.5 text-[10px] font-semibold text-warning`,children:[r(_,{className:`h-3 w-3`}),a(`logging.diagnostics.expiresIn`,`expires in {{left}}`,{left:L(t.remainingMs)})]}):r(`span`,{className:`rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground-subtle`,children:a(`logging.diagnostics.disarmed`,`disarmed`)}),t.armed&&!t.persisted&&r(`span`,{className:`text-[10px] text-warning`,children:a(`logging.diagnostics.notPersisted`,`not persisted — will not survive a restart`)})]}),r(`p`,{className:`mt-0.5 max-w-2xl text-[11px] text-foreground-subtle`,children:a(`logging.diagnostics.caption.${t.id}`,{defaultValue:``})})]}),e(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1`,children:[H.map(e=>r(O,{variant:`unstyled`,type:`button`,disabled:n,onClick:()=>i(e),className:q,children:L(e)},e)),r(O,{variant:`unstyled`,type:`button`,disabled:n||!t.armed,onClick:()=>i(0),className:`rounded bg-primary px-2 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-40`,children:a(`logging.diagnostics.disarm`,`Disarm`)})]})]})}function te(){let{t:e}=k();return r(F,{functionCap:`log-destination`,icon:c,title:e(`system.logging.destinations`,`Destinations`),subtitle:e(`system.logging.everyRegisteredLogDestinationEntries`,`Every registered log destination. Entries are fanned to all enabled destinations at once — enabling one does not disable another.`),emptyTitle:e(`system.logging.noLogDestinationsRegistered`,`No log destinations registered`),emptyDescription:e(`system.logging.thisShouldNotHappenThe`,`This should not happen — the console and rotated-file destinations are builtins. If the list is empty, the node is still booting.`),defaultKindLabel:e(`system.logging.kindDestination`,`Log destination`),addLabel:e(`system.logging.addDestination`,`Add destination`),install:{capability:`log-destination`,label:e(`system.logging.installDestination`,`Install a destination`)}})}o();var ne=[`debug`,`info`,`warn`,`error`],Q=``,$=``;function re(){let{t:n}=k(),[i,o]=a(Q),[s,c]=a($),{nodes:l}=w(),d=t(()=>l.map(e=>({id:e.id,label:e.name||e.id})),[l]),f=b({...i===Q?{}:{scopeNodeId:i},...s===$?{}:{scopeComponent:s}},{refetchInterval:15e3}),m=T(),h=f.data,_=m.isPending||f.isFetching,v=(h?.channels??[]).filter(e=>e.kind!==`debug`),y=(e,t)=>{m.mutate({...e.nodeId===null?{}:{scopeNodeId:e.nodeId},...e.component===null?{}:{scopeComponent:e.component},patch:{level:t}},{onSuccess:()=>void f.refetch()})};return r(I,{embedded:!0,icon:g,title:n(`logging.levels.title`,`Levels`),subtitle:n(`logging.levels.subtitle`,`Cluster → node, most specific wins. The floor gates what reaches the log destinations; the in-memory viewer keeps every line either way.`),actions:e(`div`,{className:`flex flex-wrap items-center gap-3`,children:[e(`label`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[n(`logging.levels.scope`,`Scope`),e(u,{wrapperClassName:`inline-block w-auto`,value:i,disabled:s!==$,onChange:e=>o(e.target.value),children:[r(`option`,{value:Q,children:n(`logging.levels.cluster`,`Cluster`)}),d.map(e=>r(`option`,{value:e.id,children:e.label},e.id))]})]}),e(`label`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[n(`logging.levels.component`,`Component`),e(u,{wrapperClassName:`inline-block w-auto`,value:s,onChange:e=>c(e.target.value),children:[r(`option`,{value:$,children:n(`logging.levels.noComponent`,`None`)}),v.map(e=>r(`option`,{value:e.name,children:e.name},e.name))]})]})]}),children:f.isLoading||h===void 0?e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(p,{className:`h-3.5 w-3.5 animate-spin`}),n(`common.loading`,`Loading…`)]}):e(`div`,{className:`space-y-3`,children:[r(ae,{level:h.effective.level,source:h.effective.levelSource,persisted:h.persisted}),r(`div`,{className:`rounded-lg border border-border bg-surface divide-y divide-border`,children:h.explicit.layers.map(e=>r(oe,{layer:e,inForce:e.scope===h.effective.levelSource,busy:_,onSet:t=>y(e,t),onClear:()=>y(e,null)},`${e.scope}:${e.nodeId??e.component??`cluster`}`))}),s!==$&&r(`p`,{className:`text-[11px] text-foreground-subtle`,children:v.find(e=>e.name===s)?.description??``}),r(`p`,{className:`text-[11px] text-foreground-subtle`,children:n(`logging.levels.componentNote`,`A component is a log channel an addon declared. Its level is cluster-wide and beats both the node and the cluster layer.`)}),r(ie,{days:h.opsLogRetentionDays,busy:_,onSet:e=>m.mutate({patch:{opsLogRetentionDays:e}},{onSuccess:()=>void f.refetch()})})]})})}function ie({days:t,busy:n,onSet:i}){let{t:a}=k();return e(`div`,{className:`rounded-lg border border-border bg-surface p-3 space-y-1`,children:[e(`label`,{className:`flex items-center justify-between gap-3`,children:[r(`span`,{className:`text-xs font-medium`,children:a(`logging.levels.opsLogRetention`,`Retention audit trail`)}),e(`span`,{className:`flex items-center gap-1.5`,children:[r(y,{type:`number`,min:0,max:3650,step:1,defaultValue:t,disabled:n,onBlur:e=>{let n=Number.parseInt(e.target.value,10);Number.isFinite(n)&&n!==t&&i(n)},className:`w-20 rounded border border-border bg-surface px-2 py-1 text-xs`}),r(`span`,{className:`text-[11px] text-foreground-subtle`,children:a(`common.days`,`days`)})]})]}),r(`p`,{className:`text-[11px] text-foreground-subtle`,children:a(`logging.levels.opsLogRetentionNote`,`How long the record of what retention deleted is kept. Cluster-wide, and deliberately longer than any camera window — it is the history of the sweep, not of the camera, and it is what makes a storage leak explainable after the fact. 0 keeps it forever.`)})]})}function ae({level:t,source:n,persisted:i}){let{t:a}=k();return e(`div`,{className:`rounded-lg border border-border bg-surface p-3`,children:[e(`div`,{className:`flex items-center gap-2`,children:[r(`span`,{className:`text-xs text-foreground-subtle`,children:a(`logging.levels.effective`,`In force here`)}),r(`span`,{className:`rounded bg-primary/10 px-2 py-0.5 text-xs font-semibold text-primary`,children:t}),r(`span`,{className:`text-[11px] text-foreground-subtle`,children:n==="default"?a(`logging.levels.fromDefault`,`nothing is set anywhere — this is the default`):a(`logging.levels.fromLayer`,`decided by the {{source}} layer`,{source:n})})]}),!i&&r(`p`,{className:`mt-1 text-[11px] text-warning`,children:a(`logging.levels.notPersisted`,`The settings store could not be read or written — what you see is live, but it would not survive a restart.`)})]})}function oe({layer:t,inForce:n,busy:i,onSet:a,onClear:o}){let{t:s}=k();return e(`div`,{className:`flex flex-col gap-2 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[e(`div`,{className:`min-w-0`,children:[e(`div`,{className:`flex items-center gap-2`,children:[r(`span`,{className:`text-sm font-medium text-foreground`,children:t.scope===`cluster`?s(`logging.levels.cluster`,`Cluster`):t.scope===`component`?t.component??``:t.nodeId??``}),n&&e(`span`,{className:`inline-flex items-center gap-1 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary`,children:[r(f,{className:`h-3 w-3`}),s(`logging.levels.inForce`,`in force`)]})]}),r(`p`,{className:`mt-0.5 text-[11px] text-foreground-subtle`,children:t.level===null?s(`logging.levels.inherits`,`inherits — nothing set at this layer`):s(`logging.levels.setHere`,`set here: {{level}}`,{level:t.level})})]}),e(`div`,{className:`flex shrink-0 items-center gap-1`,children:[ne.map(e=>r(O,{variant:`unstyled`,type:`button`,disabled:i,onClick:()=>a(e),className:`rounded px-2 py-1 text-[11px] font-medium transition-colors disabled:opacity-50 ${t.level===e?`bg-primary text-primary-foreground`:`border border-border text-foreground-subtle hover:text-foreground`}`,children:e},e)),r(O,{variant:`unstyled`,type:`button`,disabled:i||t.level===null,onClick:o,className:`rounded border border-border px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground disabled:opacity-40`,children:s(`logging.levels.clear`,`Clear`)})]})]})}function se(){let[e]=A(),t=e.get(`deviceId`),n=t===null?void 0:Number(t);return r(I,{embedded:!0,children:r(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:r(D,{deviceId:n!==void 0&&Number.isFinite(n)?n:void 0,limit:500,maxHeight:`max-h-[calc(100vh-310px)]`,showFilters:!0,showOriginFilter:!0,columns:{available:[`integration`,`device`],defaultVisible:[`integration`,`device`]}})})})}function ce(){let{t:e}=k(),t=M(`/system/logs`,{t:e,isAdmin:!0})??{icon:c,title:e(`system.logs`,`Logs`)};return r(P,{icon:t.icon,title:t.title,defaultSection:`viewer`,sectionsLabel:`${t.title} sections`,sections:[{id:`viewer`,label:e(`admin.system.logs.viewer`,`Viewer`),content:r(se,{})},{id:j.logging.tab,label:e(`admin.system.logs.destinations`,`Destinations`),content:r(te,{}),ownedParams:N},{id:`levels`,label:e(`admin.system.logs.levels`,`Levels`),content:r(re,{})},{id:`diagnostics`,label:e(`admin.system.logs.diagnostics`,`Diagnostics`),content:r(Z,{})}]})}export{ce as LogsPage};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./browser-BHo8W_uH.js","./rolldown-runtime-Cyuzqnbw.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{t}from"./vite-preload-helper-kNaey6uv.js";import{C as n,J as r,K as i,S as a,V as o,Y as s,a as c,et as l,t as u,x as d}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{$i as f,Cn as p,Hr as m,Ia as h,Ir as g,Mi as _,Nn as v,Q as y,Zi as b,Zt as x,_i as S,ct as C,ft as w,qr as T,so as E,tn as D,ur as O,yt as k,zr as A}from"./player-overlays-CEIvxNnK.js";import{Di as j,Ei as M}from"./client-BZDnTMae.js";import{a as N,l as ee}from"./terminal-DZ5OZpgC.js";import{t as te}from"./monitor-smartphone-DPI9EQus.js";import{t as ne}from"./unlink-D3-IGpS8.js";import{Dp as P,Hi as re,Vi as ie,ha as ae,ht as oe,jl as se,kl as F,kr as ce,rm as I,yp as L}from"./src-DUAdvcBH.js";import{t as le}from"./i18n-BiKPfXFe.js";import{t as R}from"./useTranslation-BJr-n0es.js";import"./mount-DeaB_A8L.js";import{c as ue,i as de,l as z,s as B}from"./sso-popup-BLjuW0Se.js";import{Ci as V,R as H,_i as U,n as W,yi as G}from"./index-DN4KezHo.js";import{t as fe}from"./AdminSectionedPage-Bc9tE_NE.js";import{t as pe}from"./AdminPage-8-6dNnx0.js";import{n as me,t as he}from"./AccessSection-DMlnCJaD.js";import{_ as ge,a as _e,h as ve,r as ye,t as K,w as be}from"./SessionsList-C71ZAY0g.js";l();var xe=`${M}/connect`,q={public:0,mesh:1,lan:2,"lan-ipv6":3};function Se(e){switch(e.kind){case`public`:return e.interfaceKind===`vpn`?`mesh`:`public`;case`lan-ipv4`:return`lan`;case`lan-ipv6`:return`lan-ipv6`;case`custom`:return`public`;case`loopback`:case`app-link`:return null}}function J(e){return j(e)}function Ce(e){return e.startsWith(`https://`)}function we(e){let t=e.flatMap(e=>{let t=Se(e),n=J(e.baseUrl);return t===null||n===null?[]:[{endpoint:e,tier:t,origin:n}]}).toSorted((e,t)=>q[e.tier]-q[t.tier]||Number(t.endpoint.plausible)-Number(e.endpoint.plausible)||e.endpoint.priority-t.endpoint.priority),n=new Set;return t.flatMap(({endpoint:e,tier:t,origin:r})=>n.has(r)?[]:(n.add(r),[{origin:r,label:e.label,tier:t,secure:Ce(r),plausible:e.plausible}]))}function Te(e,t,n=null){for(let r of[t,n]){if(r===null)continue;let t=J(r),n=e.find(e=>e.origin===t);if(n!==void 0)return n}return e[0]??null}function Ee(e){let t=new URL(xe);return t.searchParams.set(`hub`,e),t.toString()}var De=176,Y={scheme:`https`};function Oe(){let{t:e}=R(),t=se(Y),r=F(Y).data?.roles.publicEndpoint.resolved??null;return n(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[n(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[a(p,{className:`h-3.5 w-3.5 text-foreground-subtle`}),a(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`connectPhone.title`)})]}),n(`div`,{className:`p-4 space-y-3`,children:[a(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`connectPhone.description`)}),t.isPending?n(`div`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[a(A,{className:`h-3.5 w-3.5 animate-spin`}),e(`connectPhone.loading`)]}):t.isError?n(`div`,{className:`flex items-start gap-2 text-[11px] text-danger`,children:[a(x,{className:`h-3.5 w-3.5 mt-0.5 shrink-0`}),n(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[a(`div`,{className:`break-words`,children:e(`connectPhone.error`,{message:t.error.message})}),a(L,{size:`sm`,variant:`ghost`,onClick:()=>void t.refetch(),children:e(`connectPhone.retry`)})]})]}):a(ke,{candidates:we(t.data.endpoints),preferredOrigin:r})]})]})}function ke({candidates:e,preferredOrigin:t}){let{t:r}=R(),[o,c]=s(null),l=Te(e,o,t),u=i(()=>l?Ee(l.origin):null,[l]);if(l===null||u===null)return a(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`connectPhone.empty`)});let d=e=>r(`connectPhone.tier.${e}`),f=e.map(e=>({value:e.origin,label:`${d(e.tier)} — ${e.origin}`}));return n(`div`,{className:`flex flex-col sm:flex-row gap-4`,children:[a(ie,{value:u,size:De,alt:r(`connectPhone.qrAlt`),className:`self-start`}),n(`div`,{className:`flex-1 min-w-0 space-y-3`,children:[n(`label`,{className:`block space-y-1`,children:[a(`span`,{className:`text-[11px] font-medium text-foreground`,children:r(`connectPhone.addressLabel`)}),a(w,{value:l.origin,options:f,onChange:e=>c(e.target.value)}),n(`span`,{className:`block text-[10px] text-foreground-subtle`,children:[d(l.tier),` · `,l.label]})]}),!l.secure&&a(X,{text:r(`connectPhone.insecure`)}),!l.plausible&&a(X,{text:r(`connectPhone.implausible`)}),n(`div`,{className:`space-y-1`,children:[a(`span`,{className:`text-[11px] font-medium text-foreground`,children:r(`connectPhone.linkLabel`)}),n(`div`,{className:`flex items-center gap-1 rounded-md border border-border bg-background px-2 py-1`,children:[a(`code`,{className:`flex-1 min-w-0 font-mono text-[11px] text-foreground break-all select-all`,children:u}),a(ce,{value:u,srLabel:r(`connectPhone.linkLabel`)})]})]}),a(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`connectPhone.signInHint`)})]})]})}function X({text:e}){return n(`div`,{className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-1.5 text-[11px] text-foreground`,children:[a(x,{className:`h-3.5 w-3.5 text-warning mt-0.5 shrink-0`}),a(`span`,{children:e})]})}l();function Ae(e){return new Date(e).toLocaleDateString()}function je(){let{t:e}=R(),t=C(),i=I.useUtils(),c=I.auth.listLinkableProviders.useQuery(),l=I.auth.listOwnExternalIdentities.useQuery(),[u,d]=s(null),[p,h]=s(()=>z(window.location.search)),g=r(null),_=W(`Linking a sign-in account`),v=r(null);o(()=>()=>v.current?.(),[]);let[x,S]=s(null);o(()=>{if(p===null)return;let e=new URL(window.location.href);e.searchParams.delete(`linked`),e.searchParams.delete(`linkError`),window.history.replaceState({},``,e.pathname+e.search+e.hash)},[p]);let w=I.auth.beginExternalLink.useMutation({onSuccess:({url:e})=>{let t=g.current;if(g.current=null,t===null||t.closed){window.location.assign(e);return}let n=e=>{S(null),h(z(`?${e}`)),i.auth.listOwnExternalIdentities.invalidate()};v.current?.(),v.current=B(t,{onReturn:e=>{e.target===`profile`&&n(e.query)},onDone:e=>{e.target===`profile`&&n(e.query)},onClosed:()=>{v.current?.(),v.current=null,i.auth.listOwnExternalIdentities.invalidate()}}),t.location.href=y(ue(e))},onError:e=>{g.current?.close(),g.current=null,S(null),d(e.message)}}),T=I.auth.unlinkOwnExternalIdentity.useMutation({onSuccess:()=>void i.auth.listOwnExternalIdentities.invalidate(),onError:e=>d(e.message)}),E=c.data??[],D=l.data??[],O=x!==null&&D.some(e=>e.provider===x);if(o(()=>{!O||x===null||(S(null),h({kind:`linked`,provider:x}))},[O,x]),E.length===0&&D.length===0)return null;let k=new Set(D.map(e=>e.provider)),j=e=>E.find(t=>t.provider===e)?.label??e,M=async(n,r)=>{await t({title:e(`users.linkedSignInsSection.unlinkSignInAccount`,`Unlink sign-in account`),message:e(`users.linkedSignInsSection.stopSigningInWithThis`,`Stop signing in with this {{label}} account?`,{label:r}),confirmLabel:e(`users.linkedSignInsSection.unlink`,`Unlink`),variant:`danger`})&&(d(null),T.mutate({provider:n.provider,subject:n.subject}))};return n(`div`,{"data-testid":`linked-sign-ins`,className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[_.dialog,n(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[a(m,{className:`h-3.5 w-3.5 text-foreground-subtle`}),a(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`users.linkedSignInsSection.linkedSignInAccounts`,`Linked sign-in accounts`)})]}),n(`div`,{className:`p-4 space-y-3`,children:[a(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`users.linkedSignInsSection.signInWithAnExternal`,`Sign in with an external account instead of your password. Only accounts you link here can sign you in; your two-factor authentication still applies.`)}),p?.kind===`linked`&&n(`div`,{className:`flex items-center gap-2 rounded-md border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 text-xs text-foreground`,children:[a(b,{className:`h-3.5 w-3.5 text-emerald-500 shrink-0`}),e(`users.linkedSignIns.linkedNotice`,{provider:j(p.provider)})]}),(p?.kind===`error`||u)&&n(`div`,{className:`flex items-center gap-2 rounded-md border border-danger/20 bg-danger/10 px-3 py-2 text-xs text-danger`,children:[a(f,{className:`h-3.5 w-3.5 shrink-0`}),u??(p?.kind===`error`?p.message:``)]}),D.length>0&&a(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:D.map(t=>{let r=t.providerLabel??t.provider;return n(`li`,{className:`flex items-center gap-3 px-3 py-2 text-xs`,children:[n(`div`,{className:`flex-1 min-w-0`,children:[n(`div`,{className:`font-medium text-foreground truncate`,children:[r,!t.available&&a(`span`,{className:`ml-2 rounded bg-foreground-subtle/15 px-1.5 py-0.5 text-[10px] font-normal text-foreground-subtle`,children:e(`users.linkedSignInsSection.providerUnavailable`,`provider unavailable`)})]}),a(`div`,{className:`text-[11px] text-foreground-subtle truncate`,children:e(`users.linkedSignIns.linkedOn`,{label:t.label??t.subject,date:Ae(t.linkedAt)})})]}),n(L,{variant:`unstyled`,onClick:()=>void M(t,r),disabled:T.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] text-danger hover:bg-danger/10 disabled:opacity-50`,children:[a(ne,{className:`h-3 w-3`}),e(`users.linkedSignInsSection.unlink`,`Unlink`)]})]},`${t.provider}|${t.subject}`)})}),a(`div`,{className:`flex flex-wrap gap-2`,children:E.filter(e=>!k.has(e.provider)).map(t=>n(L,{variant:`unstyled`,onClick:()=>{d(null),h(null),_.requestProof().then(e=>{e!==null&&(g.current=de(null),S(g.current===null?null:t.provider),w.mutate({provider:t.provider,reauthToken:e}))})},disabled:w.isPending,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1 text-[11px] font-medium text-foreground hover:bg-surface-hover disabled:opacity-50`,children:[w.isPending&&w.variables?.provider===t.provider?a(A,{className:`h-3 w-3 animate-spin`}):a(m,{className:`h-3 w-3`}),e(`users.linkedSignIns.link`,{provider:t.label})]},t.provider))})]})]})}l();function Me({value:r,size:i=192}){let{t:c}=R(),[l,u]=s(null),[d,f]=s(null);if(o(()=>{let n=!1;return t(()=>import(`./browser-BHo8W_uH.js`).then(t=>e(t.default,1)).then(async e=>{if(n)return;let t=e.create;if(typeof t!=`function`){f(`qrcode.create() unavailable in installed version`);return}try{let e=t(r,{errorCorrectionLevel:`M`});n||u(e)}catch(e){n||f(e instanceof Error?e.message:`QR generation failed`)}}),__vite__mapDeps([0,1]),import.meta.url).catch(()=>{n||f(`qrcode library not installed`)}),()=>{n=!0}},[r]),d)return a(`div`,{className:`flex items-center justify-center text-[10px] text-foreground-subtle text-center p-4`,style:{width:i,height:i},children:c(`users.totpQrCode.qrRenderingUnavailableUseThe`,`QR rendering unavailable — use the secret below.`)});if(!l)return a(`div`,{className:`flex items-center justify-center text-[10px] text-foreground-subtle animate-pulse`,style:{width:i,height:i},children:c(`users.totpQrCode.generating`,`Generating…`)});let p=l.modules.size,m=i/p,h=[];for(let e=0;e<p;e++)for(let t=0;t<p;t++)l.modules.data[e*p+t]&&h.push(a(`rect`,{x:t*m,y:e*m,width:m,height:m,fill:`currentColor`},`${t}-${e}`));return n(`svg`,{width:i,height:i,viewBox:`0 0 ${i} ${i}`,className:`text-black`,children:[a(`rect`,{x:0,y:0,width:i,height:i,fill:`white`}),h]})}l();function Ne(){let{t:e}=R(),t=k(),[r,i]=s(``),[o,c]=s(``),[l,d]=s(``),[p,m]=s(null),h=u({mutationFn:e=>t.changeOwnPassword(e),onSuccess:()=>{m({kind:`success`,msg:`Password updated.`}),i(``),c(``),d(``)},onError:e=>{m({kind:`error`,msg:e instanceof Error?e.message:`Update failed`})}}),_=o.length>0&&l.length>0&&o!==l,v=o.length>0&&o.length<8,y=r.length>=1&&o.length>=8&&o===l;return n(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[n(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[a(ee,{className:`h-3.5 w-3.5 text-foreground-subtle`}),a(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`systemPage.myAccess.changePassword`,`Change password`)})]}),n(`div`,{className:`p-4 space-y-3`,children:[a(Z,{label:e(`systemPage.myAccess.currentPassword`,`Current password`),value:r,onChange:i,autoComplete:`current-password`}),a(Z,{label:e(`systemPage.myAccess.newPassword`,`New password`),value:o,onChange:c,autoComplete:`new-password`,hint:e(`systemPage.myAccess.atLeast8Characters`,`At least 8 characters.`)}),a(Z,{label:e(`systemPage.myAccess.confirmNewPassword`,`Confirm new password`),value:l,onChange:d,autoComplete:`new-password`}),(_||v)&&a(`div`,{className:`text-[11px] text-danger`,children:_?e(`systemPage.myAccess.passwordsDoNotMatch`,`Passwords do not match.`):e(`systemPage.myAccess.newPasswordMustBeAt`,`New password must be at least 8 characters.`)}),p&&n(`div`,{className:`text-[11px] flex items-center gap-1 ${p.kind===`success`?`text-success`:`text-danger`}`,children:[p.kind===`success`?a(b,{className:`h-3 w-3`}):a(f,{className:`h-3 w-3`}),p.msg]}),a(`div`,{className:`flex justify-end`,children:n(L,{onClick:()=>{m(null),h.mutate({currentPassword:r,newPassword:o})},disabled:!y||h.isPending,children:[h.isPending?a(A,{className:`h-3 w-3 animate-spin`}):a(g,{className:`h-3 w-3`}),e(`systemPage.myAccess.updatePassword`,`Update password`)]})})]})]})}function Z({label:e,value:t,onChange:r,autoComplete:i,hint:o}){return n(`div`,{className:`space-y-1`,children:[a(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:e}),a(P,{type:`password`,value:t,onChange:e=>r(e.target.value),autoComplete:i,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`}),o&&a(`div`,{className:`text-[10px] text-foreground-subtle`,children:o})]})}function Pe({username:e}){let{t}=R(),r=k(),l=c({queryKey:[`auth`,`getOwnTotpStatus`],queryFn:()=>r.getOwnTotpStatus()}),m=l.data,[h,g]=s(null),[v,y]=s(``),[x,S]=s(null),[C,w]=s(!1),T=u({mutationFn:()=>r.setupOwnTotp(),onSuccess:e=>{g({secret:e.secret,otpauthUrl:e.otpauthUrl}),y(``),S(null)},onError:e=>S(e instanceof Error?e.message:`Setup failed`)}),E=u({mutationFn:e=>r.confirmOwnTotp(e),onSuccess:()=>{g(null),y(``),S(null),l.refetch()},onError:e=>S(e instanceof Error?e.message:`Confirmation failed — code did not match`)}),D=W(`Turning off two-factor authentication`),O=u({mutationFn:async()=>{let e=await D.requestProof();return e===null?null:r.disableOwnTotp({reauthToken:e})},onSuccess:()=>{S(null),l.refetch()},onError:e=>S(e instanceof Error?e.message:`Disable failed`)});o(()=>{if(!C)return;let e=setTimeout(()=>w(!1),1500);return()=>clearTimeout(e)},[C]);let j=i(()=>l.isLoading?`loading`:h?`setup_in_progress`:m?.enabled?`enrolled`:`not_enrolled`,[l.isLoading,m?.enabled,h]);return n(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[D.dialog,n(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[a(p,{className:`h-3.5 w-3.5 text-foreground-subtle`}),a(`div`,{className:`text-xs font-semibold text-foreground`,children:t(`systemPage.myAccess.twoFactorAuthentication`,`Two-factor authentication`)})]}),n(`div`,{className:`p-4 space-y-3`,children:[j===`loading`&&n(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[a(A,{className:`h-3.5 w-3.5 animate-spin`}),t(`systemPage.myAccess.checkingStatus`,`Checking status…`)]}),j===`not_enrolled`&&n(d,{children:[a(`div`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.myAccess.2faIsnTActiveOn`,`2FA isn't active on your account. Enable it to require a 6-digit code from your authenticator app at every login.`)}),a(`div`,{className:`flex justify-end`,children:n(L,{onClick:()=>{S(null),T.mutate()},disabled:T.isPending,children:[T.isPending?a(A,{className:`h-3 w-3 animate-spin`}):a(p,{className:`h-3 w-3`}),t(`systemPage.myAccess.enable2fa`,`Enable 2FA`)]})})]}),j===`setup_in_progress`&&h&&n(d,{children:[a(`div`,{className:`text-[11px] text-foreground-subtle`,children:a(U,{i18nKey:`systemPage.myAccess.scanQr`,values:{username:e},components:{mono:a(`span`,{className:`font-mono`})}})}),n(`div`,{className:`flex flex-col items-center gap-3`,children:[a(`div`,{className:`rounded-lg border border-border bg-white p-3`,children:a(Me,{value:h.otpauthUrl,size:180})}),n(`div`,{className:`w-full`,children:[a(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle mb-1`,children:t(`systemPage.myAccess.secretManualEntry`,`Secret (manual entry)`)}),n(`div`,{className:`flex items-center gap-2 rounded border border-border bg-surface-hover/30 px-2 py-1.5`,children:[a(`code`,{className:`text-[11px] font-mono text-foreground break-all flex-1`,children:h.secret}),n(L,{variant:`ghost`,onClick:()=>{h&&navigator.clipboard.writeText(h.secret).then(()=>w(!0))},children:[C?a(b,{className:`h-3 w-3 text-success`}):a(_,{className:`h-3 w-3`}),C?t(`systemPage.myAccess.copied`,`Copied`):t(`common.copy`,`Copy`)]})]})]})]}),n(`div`,{className:`space-y-1`,children:[a(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`6-digit code`}),a(P,{type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,placeholder:`123456`,value:v,onChange:e=>y(e.target.value.replace(/\D/g,``).slice(0,6)),className:`w-full rounded-md border border-border bg-surface px-3 py-2 text-center text-lg font-mono tracking-widest text-foreground focus:outline-none focus:ring-2 focus:ring-primary`})]}),x&&n(`div`,{className:`text-[11px] text-danger flex items-center gap-1`,children:[a(f,{className:`h-3 w-3`}),x]}),n(`div`,{className:`flex justify-end gap-2`,children:[a(L,{variant:`outline`,onClick:()=>{g(null),S(null),y(``)},children:t(`common.cancel`,`Cancel`)}),n(L,{onClick:()=>{S(null),E.mutate({code:v})},disabled:E.isPending||v.length!==6,children:[E.isPending?a(A,{className:`h-3 w-3 animate-spin`}):a(b,{className:`h-3 w-3`}),t(`common.confirm`,`Confirm`)]})]})]}),j===`enrolled`&&m&&n(d,{children:[n(`div`,{className:`rounded-md border border-success/30 bg-success/5 px-3 py-2.5 flex items-start gap-2.5`,children:[a(b,{className:`h-4 w-4 mt-0.5 text-success shrink-0`}),n(`div`,{className:`text-xs text-foreground space-y-0.5`,children:[a(`div`,{className:`font-medium`,children:t(`systemPage.myAccess.2faIsActive`,`2FA is active`)}),a(`div`,{className:`text-foreground-subtle`,children:t(`common.enrolledOn`,{when:m.confirmedAt?new Date(m.confirmedAt).toLocaleString():`—`})})]})]}),x&&n(`div`,{className:`text-[11px] text-danger flex items-center gap-1`,children:[a(f,{className:`h-3 w-3`}),x]}),a(`div`,{className:`flex justify-end`,children:n(L,{variant:`danger`,onClick:()=>{S(null),O.mutate()},disabled:O.isPending,children:[O.isPending?a(A,{className:`h-3 w-3 animate-spin`}):a(p,{className:`h-3 w-3`}),t(`systemPage.myAccess.disable2fa`,`Disable 2FA`)]})})]})]})]})}function Fe(){return ae(`auth-webauthn/passkey-enrollment`)?a(re,{widgetId:`auth-webauthn/passkey-enrollment`,host:`dashboard`}):null}l();function Q(e){return e.message.length>0?e.message:le.t(`auth.authAuditSection.requestFailed`)}function Ie(){let{t:e}=R(),{logout:t}=H(),r=C(),i=I.useUtils(),o=I.auth.listOwnSessions.useQuery(),[c,l]=s(null),u=I.auth.revokeOwnSession.useMutation({onSuccess:()=>void i.auth.listOwnSessions.invalidate(),onError:e=>l(`Sign out failed: ${Q(e)}`)}),d=I.auth.logout.useMutation({onSuccess:()=>t(),onError:e=>l(`Sign out failed: ${Q(e)}`)}),f=async t=>{await r({title:e(`auth.mySessionsSection.signOutThisSession`,`Sign out this session`),message:e(`auth.mySessionsSection.willHaveToSignIn`,`{{label}} will have to sign in again.`,{label:ge(t.client).label}),confirmLabel:e(`auth.mySessionsSection.signOut`,`Sign out`),variant:`danger`})&&(l(null),u.mutate({id:t.id}))},p=async()=>{await r({title:e(`auth.mySessionsSection.signOutEverywhere`,`Sign out everywhere`),message:e(`auth.mySessionsSection.everySessionOfYourAccount`,`Every session of your account ends, this browser included: you will be signed out here too and every device has to sign in again.`),confirmLabel:e(`auth.mySessionsSection.signOutEverywhere`,`Sign out everywhere`),variant:`danger`})&&(l(null),d.mutate({everywhere:!0}))};return n(`div`,{"data-testid":`my-sessions`,className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[n(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[a(te,{className:`h-3.5 w-3.5 text-foreground-subtle`}),a(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`auth.mySessionsSection.activeSessions`,`Active sessions`)})]}),n(`div`,{className:`p-4 space-y-3`,children:[a(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`auth.mySessionsSection.theBrowsersAndAppsSigned`,`The browsers and apps signed in to your account. Signing one out ends it at once.`)}),c!==null&&a(`div`,{className:`text-[11px] text-danger`,children:c}),a(K,{sessions:o.data??[],isLoading:o.isLoading,loadError:o.isError?o.error?.message??e(`auth.authAuditSection.requestFailed`):null,emptyText:`No active sessions.`,onRevoke:e=>void f(e),revokingId:u.isPending?u.variables?.id??null:null}),a(`div`,{className:`flex justify-end`,children:n(L,{variant:`unstyled`,onClick:()=>void p(),disabled:d.isPending,className:`inline-flex items-center gap-1.5 rounded border border-danger/40 px-2.5 py-1 text-[11px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,children:[d.isPending?a(A,{className:`h-3 w-3 animate-spin`}):a(N,{className:`h-3 w-3`}),e(`auth.mySessionsSection.signOutEverywhere`,`Sign out everywhere`)]})})]})]})}l();var Le=`You`;function Re(){let{t:e}=R(),t=C(),n=I.useUtils(),r=I.auth.listOwnDeviceCredentials.useQuery(),[o,c]=s(null),l=I.auth.revokeOwnDeviceCredential.useMutation({onSuccess:e=>{e.revoked||c(`That device could not be revoked - it may already be gone.`),n.auth.listOwnDeviceCredentials.invalidate()},onError:e=>c(`Revoke failed: ${e.message}`)}),u=i(()=>(r.data??[]).map(e=>ye(e,Le)),[r.data]),d=async n=>{await t({title:e(`certificates.myDevicesSection.revoke`,`Revoke "{{name}}"?`,{name:n.name}),message:e(`certificates.myDevicesSection.theDeviceStopsSigningIn`,`The device stops signing in at once and its open sessions end. To use it again you have to pair it anew. This cannot be undone.`),confirmLabel:e(`certificates.myDevicesSection.revoke2`,`Revoke`),variant:`danger`})&&(c(null),l.mutate({id:n.id}))},f={label:e(`certificates.myDevicesSection.revoke2`,`Revoke`),icon:h,isAvailable:_e,onRun:e=>void d(e),busyId:l.isPending?l.variables?.id??null:null,disabled:l.isPending};return a(he,{id:`my-devices`,title:e(`certificates.myDevicesSection.myDevices`,`My devices`),icon:p,description:e(`certificates.myDevicesSection.phonesThatStaySignedIn`,`Phones that stay signed in to your account with a certificate. If one is lost, revoke it here and it is signed out at once.`),notice:me(o),onDismissNotice:()=>c(null),children:a(be,{rows:u,label:e(`certificates.devicesCard.label`),isLoading:r.isPending,loadError:r.error===null?null:r.error.message||`Request failed`,emptyText:`No devices are signed in with a certificate.`,hideOwner:!0,expiresNone:`—`,action:f})})}var $={profile:`profile`,signIn:`sign-in`,sessions:`sessions`,tokens:`tokens`},ze=[`linked`,`linkError`],Be={view:{icon:S,cls:`bg-foreground-subtle/15 text-foreground-subtle`},create:{icon:O,cls:`bg-primary/15 text-primary`},delete:{icon:D,cls:`bg-danger/15 text-danger`}};function Ve(){let{t:e}=R(),{user:t,logout:r}=H(),[i]=V(),o=e(`system.myAccess`,`My access`);if(!t)return a(pe,{icon:v,title:o,children:a(`div`,{className:`text-xs text-foreground-subtle`,children:e(`systemPage.myAccess.notSignedIn`,`Not signed in.`)})});if(i.get(`tab`)===`preferences`)return a(G,{to:`/system/settings`,replace:!0});if(ze.some(e=>i.has(e))&&!i.has(`tab`)){let e=new URLSearchParams(i);return e.set(`tab`,$.signIn),a(G,{to:`?${e.toString()}`,replace:!0})}return a(fe,{icon:v,title:o,subtitle:e(`systemPage.myAccess.subtitle`,`Your account, how you sign in, where you are signed in, and your tokens.`),sectionsLabel:e(`systemPage.myAccess.sectionsLabel`,`My access sections`),defaultSection:$.profile,actions:n(L,{variant:`outline`,onClick:r,children:[a(N,{className:`h-3 w-3`}),e(`systemPage.myAccess.signOut`,`Sign out`)]}),sections:[{id:$.profile,label:e(`systemPage.myAccess.sections.profile`,`Profile`),content:a(He,{user:t})},{id:$.signIn,label:e(`systemPage.myAccess.sections.signIn`,`Sign-in & security`),content:n(`div`,{className:`space-y-4`,children:[a(Ne,{}),a(Pe,{username:t.username}),a(Fe,{}),a(je,{})]})},{id:$.sessions,label:e(`systemPage.myAccess.sections.sessions`,`Sessions & devices`),content:n(`div`,{className:`space-y-4`,children:[a(Ie,{}),a(Re,{}),a(Oe,{})]})},{id:$.tokens,label:e(`systemPage.myAccess.sections.tokens`,`Tokens`),content:a(ve,{ownOnly:!0})}]})}function He({user:e}){let{t}=R(),r=e.isAdmin,i=e.scopes??[];return n(`div`,{className:`space-y-4`,children:[n(`div`,{className:`rounded-lg border border-border bg-surface px-4 py-3 flex items-center gap-3`,children:[a(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-full bg-primary/10 text-primary font-semibold text-base`,children:e.username.slice(0,1).toUpperCase()}),n(`div`,{className:`flex-1 min-w-0`,children:[a(`div`,{className:`text-sm font-semibold text-foreground truncate`,children:e.username}),n(`div`,{className:`text-[11px] text-foreground-subtle`,children:[r?t(`systemPage.myAccess.administrator`,`Administrator`):t(`systemPage.myAccess.user`,`User`),` `,a(U,{i18nKey:`systemPage.myAccess.sessionId`,values:{id:e.id.slice(0,8)},components:{mono:a(`span`,{className:`font-mono`})}})]})]})]}),r&&n(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 px-4 py-3 text-xs text-foreground flex items-start gap-2.5`,children:[a(T,{className:`h-4 w-4 text-primary mt-0.5 shrink-0`}),n(`div`,{children:[a(`div`,{className:`font-semibold text-foreground`,children:t(`systemPage.myAccess.unrestrictedAccess`,`Unrestricted access`)}),a(`p`,{className:`text-foreground-subtle mt-0.5`,children:t(`systemPage.myAccess.adminSessionsBypassThePer`,`Admin sessions bypass the per-call scope check. Every protected endpoint is reachable regardless of the list below.`)})]})]}),i.length>0&&a(Ue,{scopes:i})]})}function Ue({scopes:e}){let{t}=R(),r=E();return n(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[n(`div`,{className:`px-4 py-2 border-b border-border`,children:[a(`div`,{className:`text-xs font-semibold text-foreground`,children:t(`systemPage.myAccess.grantedScopes`,`Granted scopes`)}),a(`div`,{className:`text-[10px] text-foreground-subtle`,children:t(`systemPage.myAccess.bakedIntoYourSessionToken`,`Baked into your session token at login; sign out + back in to refresh after changes.`)})]}),n(`div`,{className:`grid grid-cols-[100px_1fr_240px] gap-3 px-4 py-2 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[a(`div`,{children:t(`systemPage.myAccess.type`,`Type`)}),a(`div`,{children:t(`systemPage.myAccess.target`,`Target`)}),a(`div`,{children:t(`systemPage.myAccess.access`,`Access`)})]}),a(`ul`,{className:`divide-y divide-border`,children:e.map((e,i)=>n(`li`,{className:`grid grid-cols-[100px_1fr_240px] gap-3 px-4 py-2.5 items-center text-xs`,children:[a(`span`,{className:`font-mono text-foreground-subtle`,children:e.type}),a(`span`,{className:`font-mono text-foreground`,children:e.type===`device`?oe(e.selector,r):e.target}),a(`div`,{className:`flex items-center gap-1`,children:[`view`,`create`,`delete`].map(r=>{let i=e.access.includes(r),{icon:o,cls:s}=Be[r];return n(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium ${i?s:`bg-transparent text-foreground-subtle/40 line-through`}`,title:i?t(`systemPage.myAccess.can`,`Can {{a}}`,{a:r}):t(`systemPage.myAccess.cannot`,`Cannot {{a}}`,{a:r}),children:[a(o,{className:`h-3 w-3`}),r]},r)})})]},i))})]})}export{Ve as MyAccessPage};
@@ -1 +0,0 @@
1
- import{C as e,J as t,K as n,S as r,V as i,Y as a,et as o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{$a as s,aa as c,fa as l,ft as u,hi as d,oa as f,sa as p}from"./player-overlays-CEIvxNnK.js";import{t as m}from"./chevron-down-CBb-F8DT.js";import{Dp as h,Gi as g,Ji as _,Kd as v,Ki as ee,Qs as y,Wi as b,Xi as x,Yi as S,yp as C}from"./src-DUAdvcBH.js";import{t as w}from"./i18n-BiKPfXFe.js";import{t as T}from"./useTranslation-BJr-n0es.js";function E(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}}o();function D({cameras:n,selected:o,onChange:s}){let{t:c}=T(),[u,d]=a(!1),f=t(null);i(()=>{if(!u)return;function e(e){f.current&&e.target instanceof Node&&!f.current.contains(e.target)&&d(!1)}function t(e){e.key===`Escape`&&d(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[u]);function h(e){let t=new Set(o);t.has(e)?t.delete(e):t.add(e),s(t)}let g=o.size,_=g===0?`All cameras`:g===1?n.find(e=>o.has(e.id))?.name??`1 camera`:`${String(g)} cameras`;return e(`div`,{ref:f,className:`relative`,children:[e(C,{variant:`unstyled`,type:`button`,onClick:()=>d(e=>!e),disabled:n.length===0,className:`flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs transition-colors disabled:opacity-40 ${g>0?`border-primary/40 bg-primary/8 text-primary`:`border-border text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:[r(l,{className:`h-3.5 w-3.5`}),r(`span`,{className:`max-w-[10rem] truncate`,children:_}),r(m,{className:`h-3 w-3 opacity-70`})]}),u&&e(`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:[g>0&&r(C,{variant:`unstyled`,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:c(`detectionIntelligence.cameraMultiSelect.clearSelection`,`Clear selection`)}),n.map(t=>{let n=o.has(t.id);return e(C,{variant:`unstyled`,type:`button`,onClick:()=>h(t.id),className:`flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs transition-colors ${n?`bg-primary/10 text-primary`:`text-foreground hover:bg-surface-hover`}`,children:[r(`span`,{className:`flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-sm border ${n?`border-primary bg-primary text-white`:`border-border`}`,children:n&&r(p,{className:`h-2.5 w-2.5`})}),r(`span`,{className:`truncate`,children:t.name})]},t.id)})]})]})}var O={fromMs:null,toMs:null},k=36e5,A=24*k;function j(e,t){switch(e){case`24h`:return{fromMs:t-A,toMs:null};case`7d`:return{fromMs:t-7*A,toMs:null};case`30d`:return{fromMs:t-30*A,toMs:null};case`all`:return O}}function M(e){return e.fromMs!==null||e.toMs!==null}function N(e,t){return M(t)?e.filter(e=>!(t.fromMs!==null&&e.timestamp<t.fromMs||t.toMs!==null&&e.timestamp>t.toMs)):[...e]}function P(e,t){return t.size===0?[...e]:e.filter(e=>t.has(e.deviceId))}function F(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 I(e){if(!e)return null;let t=Date.parse(`${e}T00:00:00`);return Number.isNaN(t)?null:t}function L(e){if(!e)return null;let t=Date.parse(`${e}T23:59:59.999`);return Number.isNaN(t)?null:t}function R(e,t){if(!Number.isFinite(e)||e<=0)return`—`;let n=t-e;return n<6e4?w.t(`helpers.relativeTime.justNow`):n<k?w.t(`helpers.relativeTime.minutesAgo`,{count:Math.floor(n/6e4)}):n<A?w.t(`helpers.relativeTime.hoursAgo`,{count:Math.floor(n/k)}):n<7*A?w.t(`helpers.relativeTime.daysAgo`,{count:Math.floor(n/A)}):new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function z(e){return!Number.isFinite(e)||e<=0?`—`:new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function B(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`})}o();var V=[{label:`24h`,value:`24h`},{label:`7d`,value:`7d`},{label:`30d`,value:`30d`},{labelKey:`common.all`,value:`all`}];function H({onChange:t}){let{t:n}=T(),[i,o]=a(`all`),[s,c]=a(``),[l,u]=a(``);function d(e){o(e),c(``),u(``),t(j(e,Date.now()))}function f(e,n){o(`custom`),c(e),u(n),t({fromMs:I(e),toMs:L(n)})}let p=`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 e(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[r(`div`,{className:`flex items-center gap-1 rounded-md border border-border p-0.5`,children:V.map(e=>r(C,{variant:`unstyled`,type:`button`,onClick:()=>d(e.value),className:`rounded px-2.5 py-1 text-[11px] transition-colors ${i===e.value?`bg-primary/12 text-primary font-medium`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,children:e.labelKey===void 0?e.label:n(e.labelKey)},e.value))}),e(`div`,{className:`flex items-center gap-1`,children:[r(h,{type:`date`,"aria-label":n(`detectionIntelligence.dateRangeFilter.fromDate`,`From date`),value:s,max:l||void 0,onChange:e=>f(e.target.value,l),className:`${p} ${i===`custom`&&s?`border-primary/50`:``}`}),r(`span`,{className:`text-[11px] text-foreground-subtle`,children:`→`}),r(h,{type:`date`,"aria-label":n(`detectionIntelligence.dateRangeFilter.toDate`,`To date`),value:l,min:s||void 0,onChange:e=>f(s,e.target.value),className:`${p} ${i===`custom`&&l?`border-primary/50`:``}`})]})]})}o();var U=2.6;function W({src:t,alt:n,className:o,overlay:s,fit:c=`contain`}){let[l,u]=a(!1),[d,f]=a(`50% 50%`);i(()=>{u(!1),f(`50% 50%`)},[t]);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 r(`div`,{className:`relative overflow-hidden bg-background ${o??``}`,onClick:p,children:e(`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(U)})`:`scale(1)`},children:[r(`img`,{src:t,alt:n,draggable:!1,className:m?`block h-auto w-full object-contain`:`h-full w-full object-contain`}),s]})})}var G=2;function K(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-G),i=Math.min(t-1,e+G);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 q({currentPage:t,totalItems:n,pageSize:i,onPageChange:a,itemNoun:o=`items`}){let{t:s}=T();if(n<=i)return null;let l=Math.ceil(n/i),u=(t-1)*i+1,d=Math.min(t*i,n),p=K(t,l),m=`inline-flex h-7 min-w-7 items-center justify-center rounded-md px-2 text-[11px] transition-colors disabled:opacity-40`;return e(`div`,{className:`flex items-center justify-between gap-4 flex-wrap pt-2 text-[11px] text-foreground-subtle`,children:[r(`span`,{children:s(`galleryPager.showing`,{from:u,to:d,total:n,noun:o})}),e(`div`,{className:`flex items-center gap-1`,children:[r(C,{variant:`unstyled`,type:`button`,className:`${m} hover:bg-surface-hover`,onClick:()=>a(t-1),disabled:t<=1,"aria-label":s(`galleryPager.previousPage`,`Previous page`),children:r(f,{className:`h-3.5 w-3.5`})}),p.map(e=>e.kind===`ellipsis`?r(`span`,{className:`px-1 opacity-60`,children:`…`},`ellipsis-${e.side}`):r(C,{variant:`unstyled`,type:`button`,className:`${m} ${e.n===t?`bg-primary/12 text-primary font-medium`:`hover:bg-surface-hover hover:text-foreground`}`,onClick:()=>a(e.n),"aria-current":e.n===t?`page`:void 0,children:e.n},e.n)),r(C,{variant:`unstyled`,type:`button`,className:`${m} hover:bg-surface-hover`,onClick:()=>a(t+1),disabled:t>=l,"aria-label":s(`galleryPager.nextPage`,`Next page`),children:r(c,{className:`h-3.5 w-3.5`})})]})]})}o();function J(e,t,r){let[o,s]=a(1);i(()=>{s(1)},[r]);let c=e.length,l=Math.max(1,Math.ceil(c/t)),u=Math.min(o,l);return i(()=>{u!==o&&s(u)},[u,o]),{page:u,setPage:s,pageItems:n(()=>{let n=(u-1)*t;return e.slice(n,n+t)},[e,u,t]),totalPages:l,totalItems:c,pageSize:t}}o();var Y=[`high`,`mid`,`low`],X=[{value:1,labelKey:`recordings.newExportModal.speedRealTime`},{value:2,labelKey:null},{value:4,labelKey:null},{value:8,labelKey:null},{value:16,labelKey:null}],Z=10080*60*1e3;function Q(e){return $(Date.now()-e*6e4)}function $(e){let t=new Date(e),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 te({onClose:t,onCreated:i,initialDeviceId:o,initialRange:c}){let{t:l}=T(),f=y({isCamera:!0,projection:`slim`}),p=n(()=>(f.data??[]).toSorted((e,t)=>e.name.localeCompare(t.name)),[f.data]),[m,w]=a(o??``),[E,D]=a(`high`),[O,k]=a(c===void 0?Q(60):$(c.fromMs)),[A,j]=a(c===void 0?Q(0):$(c.toMs)),[M,N]=a(1),[P,F]=a(!0),[I,L]=a(``),[R,z]=a(null),B=m===``?p[0]?.id??null:m,V=new Date(O).getTime(),H=new Date(A).getTime(),U=Number.isFinite(V)&&Number.isFinite(H)&&V<H,W=v({onSuccess:()=>{i(),t()},onError:e=>z(e instanceof Error?e.message:String(e))});return r(b,{open:!0,onOpenChange:e=>!e&&t(),children:e(ee,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[r(S,{children:e(x,{className:`flex items-center gap-1.5`,children:[r(d,{className:`h-3.5 w-3.5`}),l(`recordings.newExportModal.newExport`,`New export`)]})}),e(g,{className:`space-y-3`,children:[e(`div`,{className:`grid grid-cols-2 gap-3`,children:[e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:l(`recordings.newExportModal.camera`,`Camera`)}),r(u,{value:B??``,onChange:e=>w(Number(e.target.value)),className:`w-full`,children:p.map(e=>r(`option`,{value:e.id,children:e.name},e.id))})]}),e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:l(`recordings.newExportModal.profile`,`Profile`)}),r(u,{value:E,onChange:e=>D(e.target.value),className:`w-full`,children:Y.map(e=>r(`option`,{value:e,children:e},e))})]})]}),e(`div`,{className:`grid grid-cols-2 gap-3`,children:[e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:l(`recordings.newExportModal.from`,`From`)}),r(h,{type:`datetime-local`,value:O,onChange:e=>k(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`})]}),e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:l(`recordings.newExportModal.to`,`To`)}),r(h,{type:`datetime-local`,value:A,onChange:e=>j(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground`})]})]}),e(`div`,{className:`grid grid-cols-2 gap-3`,children:[e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:l(`recordings.newExportModal.speed`,`Speed`)}),r(u,{value:M,onChange:e=>N(Number(e.target.value)),className:`w-full`,children:X.map(e=>r(`option`,{value:e.value,children:e.labelKey===null?`${e.value}×`:l(e.labelKey)},e.value))})]}),e(`div`,{className:`space-y-1`,children:[r(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:l(`recordings.newExportModal.titleOptional`,`Title (optional)`)}),r(h,{type:`text`,value:I,onChange:e=>L(e.target.value),placeholder:l(`recordings.newExportModal.eGCourierAtThe`,`e.g. courier at the gate`),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground placeholder:text-foreground-subtle`})]})]}),e(`label`,{className:`flex items-center gap-2 text-xs text-foreground cursor-pointer`,children:[r(s,{checked:P,disabled:M!==1,onChange:e=>F(e.target.checked),className:`accent-primary`}),l(M===1?`recordings.newExportModal.includeAudio`:`recordings.newExportModal.includeAudioRealtimeOnly`)]}),!U&&r(`p`,{className:`text-[11px] text-danger`,children:l(`recordings.newExportModal.fromMustBeBeforeTo`,`"From" must be before "To".`)}),R&&r(`p`,{className:`text-[11px] text-danger`,children:R})]}),e(_,{children:[r(C,{variant:`outline`,size:`sm`,onClick:t,children:l(`common.cancel`,`Cancel`)}),r(C,{size:`sm`,onClick:()=>{if(B===null||!U)return;z(null);let e=I.trim();W.mutate({deviceId:B,profile:E,fromMs:V,toMs:H,options:{includeAudio:P,maxLifeMs:Z,deleteAfterDownload:!1,...M===1?{}:{speed:M},...e.length>0?{title:e}:{}}})},disabled:B===null||!U||W.isPending,children:W.isPending?l(`recordings.newExportModal.queuing`,`Queuing…`):l(`recordings.newExportModal.createExport`,`Create export`)})]})]})})}export{H as a,P as c,R as d,B as f,W as i,N as l,E as m,J as n,O as o,D as p,q as r,F as s,te as t,z as u};