@camstack/addon-admin-ui 1.2.471 → 1.2.473

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 (140) hide show
  1. package/dist/assets/{AddonAssetIcon-D4joXvAw.js → AddonAssetIcon-DmwaRNVP.js} +1 -1
  2. package/dist/assets/Addons-Ch5dCeth.js +4 -0
  3. package/dist/assets/{AdminPage-92KQDOBy.js → AdminPage-B-1YjUaD.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-B-MH77Vx.js → AdminSectionedPage-DCas2jUy.js} +1 -1
  5. package/dist/assets/AiProfiles-ChvfjsXv.js +3 -0
  6. package/dist/assets/{BrokerForm-HjHrcv-P.js → BrokerForm-x5UJk9ci.js} +1 -1
  7. package/dist/assets/Build-CUVwS9XA.js +40 -0
  8. package/dist/assets/Calendars-BMLzvBb6.js +1 -0
  9. package/dist/assets/Cluster-DaFXU71S.js +1 -0
  10. package/dist/assets/CompositionCreateForm-BxelZLtf.js +1 -0
  11. package/dist/assets/{CompositionEditorPage-CdJtfEi1.js → CompositionEditorPage-B_ERZESY.js} +1 -1
  12. package/dist/assets/Data-CMHfgMXt.js +2 -0
  13. package/dist/assets/DeviceDetail-CAtDRoZZ.js +2 -0
  14. package/dist/assets/{DeviceDoActionFields-B7UlBxQ0.js → DeviceDoActionFields-BETAvCYe.js} +1 -1
  15. package/dist/assets/{Devices-BAfbzc8b.js → Devices-C1DTPVnZ.js} +1 -1
  16. package/dist/assets/{EmbedPlayerPage-CZM7W_SR.js → EmbedPlayerPage-Bw6TIHbX.js} +1 -1
  17. package/dist/assets/History-BXTYUTxj.js +1 -0
  18. package/dist/assets/Identity-DTOixhZS.js +1 -0
  19. package/dist/assets/IntegrationDetail-CnINeomo.js +1 -0
  20. package/dist/assets/IntegrationHub-DahW4X5K.js +1 -0
  21. package/dist/assets/Integrations-Dex6zRMx.js +1 -0
  22. package/dist/assets/Integrations-HN2iCOqd.js +1 -0
  23. package/dist/assets/{Library-X3g7Mvql.js → Library-gaMbp-Fr.js} +1 -1
  24. package/dist/assets/Locations-haT1EJbm.js +3 -0
  25. package/dist/assets/{Logs-C7Z3D9TY.js → Logs-CtH4NMql.js} +1 -1
  26. package/dist/assets/{MaskShapeCanvas-wRO0Yeyg.js → MaskShapeCanvas-Byp9XgNC.js} +1 -1
  27. package/dist/assets/{MotionZonesSettings-C8wTUqjQ.js → MotionZonesSettings-C35beRsS.js} +1 -1
  28. package/dist/assets/{MyAccess-Di7tv0VI.js → MyAccess-Dj5hcaLN.js} +1 -1
  29. package/dist/assets/{Network-3FZdyZoe.js → Network-D-v-cA54.js} +1 -1
  30. package/dist/assets/{NodeAddonsSettingsPanel-ivhHs40k.js → NodeAddonsSettingsPanel-CW_M8Xge.js} +1 -1
  31. package/dist/assets/Notifications-r5w4Ne2O.js +1 -0
  32. package/dist/assets/Pipeline-C85hColk.js +1 -0
  33. package/dist/assets/{PrivacyMaskSettings-DTetXxIV.js → PrivacyMaskSettings-SPaH91xV.js} +1 -1
  34. package/dist/assets/Recordings-ZYwRaSrC.js +1 -0
  35. package/dist/assets/{ScanNetworkModal-DPHdPawS.js → ScanNetworkModal-ClvLQ-ol.js} +1 -1
  36. package/dist/assets/{SceneMonitorEditor-KPTdSp1h.js → SceneMonitorEditor-BvqnlZ2i.js} +1 -1
  37. package/dist/assets/SessionsList-BCDysQfs.js +2 -0
  38. package/dist/assets/{Showroom-2gQYW-h2.js → Showroom-jPZcBd6K.js} +1 -1
  39. package/dist/assets/{System-CDHw7Mcx.js → System-B5Ny1ozj.js} +1 -1
  40. package/dist/assets/{Terminal-UXpMvEO1.js → Terminal-DYLSrpsL.js} +5 -5
  41. package/dist/assets/{Viewer-ukAW_oJQ.js → Viewer-GqkHpMmf.js} +1 -1
  42. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-KG1b6CPN.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BlUFdak1.js} +1 -1
  43. package/dist/assets/{addon-icons-context-gPkLZQ_G.js → addon-icons-context-BUi2hqSA.js} +1 -1
  44. package/dist/assets/{archive-CxbMF2yZ.js → archive-Bs9ToeWK.js} +1 -1
  45. package/dist/assets/{assignment-candidates-CQGwwSSC.js → assignment-candidates-e6s6JtrJ.js} +1 -1
  46. package/dist/assets/{authed-media-DpHGiSZS.js → authed-media-BWhmwHt2.js} +1 -1
  47. package/dist/assets/{bell-off-CAN5HeZI.js → bell-off-CosUv2Rj.js} +1 -1
  48. package/dist/assets/{board-model-C6IplvmC.js → board-model-BtdRuNBI.js} +1 -1
  49. package/dist/assets/{boxes-BIYyTH0E.js → boxes-CA7Sh4JV.js} +1 -1
  50. package/dist/assets/circle-slash-0Ca1BMK0.js +1 -0
  51. package/dist/assets/client-DIBstlq5.js +358 -0
  52. package/dist/assets/{cloud-upload-DvGDSWZB.js → cloud-upload-olZ1M2tJ.js} +1 -1
  53. package/dist/assets/crop-BZM3UFyT.js +1 -0
  54. package/dist/assets/{device-integration-icon-CRiv1vER.js → device-integration-icon-656UPgnE.js} +1 -1
  55. package/dist/assets/device-picker-model-yjEyEWyS.js +1 -0
  56. package/dist/assets/dist-D6Fj77pb.js +358 -0
  57. package/dist/assets/{dist-BeSobRch.js → dist-G4Cxki3p.js} +1 -1
  58. package/dist/assets/{eraser-CvXO1d9P.js → eraser-CABcfjb2.js} +1 -1
  59. package/dist/assets/event-targets-CHOtaC2B.js +2 -0
  60. package/dist/assets/{format-Cz7vHmZ6.js → format-BYDOzxSv.js} +1 -1
  61. package/dist/assets/{hard-drive-download-xDn3u92n.js → hard-drive-download-ClcxzAVo.js} +1 -1
  62. package/dist/assets/{hostInit-Bcdd4neZ.js → hostInit-DXWqqcl-.js} +1 -1
  63. package/dist/assets/i18n-D3CF2V_j.js +1 -0
  64. package/dist/assets/{icons-Uf4a8HzM.js → icons-BmpL14Dq.js} +1 -1
  65. package/dist/assets/index-BvsP28fN.css +2 -0
  66. package/dist/assets/index-Cskol4XA.js +4 -0
  67. package/dist/assets/{key-D63R1Jty.js → key-CURebvKJ.js} +1 -1
  68. package/dist/assets/{key-round-BH39VAkM.js → key-round-BTmR8Ca5.js} +1 -1
  69. package/dist/assets/{layers-Cf6Xk9ts.js → layers-BCzFIxnd.js} +1 -1
  70. package/dist/assets/{linked-devices-model-DYRAb775.js → linked-devices-model-Uzvgx-iv.js} +1 -1
  71. package/dist/assets/{list-ordered-9heb6Myu.js → list-ordered-BpmnL-Ze.js} +1 -1
  72. package/dist/assets/{location-owned-usage-DPBYs4L0.js → location-owned-usage-ChLz8liX.js} +1 -1
  73. package/dist/assets/{log-in-D6jMFDmP.js → log-in-hW2oGppQ.js} +1 -1
  74. package/dist/assets/{memory-stick-thjjQqgp.js → memory-stick-DJEnjf6G.js} +1 -1
  75. package/dist/assets/{message-square-plus-RcviJHk6.js → message-square-plus-CZ2oQ3Vr.js} +1 -1
  76. package/dist/assets/{mf-entry-bootstrap-0-cbb0c272.js → mf-entry-bootstrap-0-0c9682e8.js} +2 -2
  77. package/dist/assets/{mic-off-DvjWBZuR.js → mic-off-KFKpp3gz.js} +1 -1
  78. package/dist/assets/{monitor-off-DEBUzb17.js → monitor-off-Cn5TAK6N.js} +1 -1
  79. package/dist/assets/{monitor-smartphone-rIimQM0r.js → monitor-smartphone-Jvu4UJGi.js} +1 -1
  80. package/dist/assets/mount-yjEyEWyS.js +1 -0
  81. package/dist/assets/{player-overlays-DDFLUcm1.js → player-overlays-B_ZfVBiA.js} +1 -1
  82. package/dist/assets/{recycle-CaQYaqJP.js → recycle-BDm5DJUQ.js} +1 -1
  83. package/dist/assets/remoteEntry-7WZh94sn.js +1 -0
  84. package/dist/assets/{scan-eye-BxF3-BiI.js → scan-eye-C7MTwcP4.js} +1 -1
  85. package/dist/assets/{scissors-DecmVZUv.js → scissors-BQnPBcjw.js} +1 -1
  86. package/dist/assets/{search-x-CiS8b7vy.js → search-x-DEyDFvNT.js} +1 -1
  87. package/dist/assets/{send-9ZOtM3uh.js → send-B3qo7thK.js} +1 -1
  88. package/dist/assets/{settings-2-DVEGaYSK.js → settings-2-C0X8oPpn.js} +1 -1
  89. package/dist/assets/{speaker-BLIN7g-W.js → speaker-pcRBhz9y.js} +1 -1
  90. package/dist/assets/src-BVr0SnD-.js +67 -0
  91. package/dist/assets/step-inspector-model-DjRSZkVO.js +1 -0
  92. package/dist/assets/{timer-reset-ESt9DRwd.js → timer-reset-CCky8ePa.js} +1 -1
  93. package/dist/assets/{ungroup-uBZnvhmn.js → ungroup-iaoDNnXe.js} +1 -1
  94. package/dist/assets/{unlink-BK0Zya0K.js → unlink-8OutaYJL.js} +1 -1
  95. package/dist/assets/{usb--Z_ViOoE.js → usb-DL2I9kcC.js} +1 -1
  96. package/dist/assets/{use-scenes-feed-Dpe5Lc_e.js → use-scenes-feed-4lpCQaI1.js} +1 -1
  97. package/dist/assets/{use-stationary-objects-D9diuPzc.js → use-stationary-objects-P_tT9TQq.js} +1 -1
  98. package/dist/assets/useEventInvalidation-yjEyEWyS.js +1 -0
  99. package/dist/assets/{useNodeUrlSelection-B-NA_JqT.js → useNodeUrlSelection-CiraZrDp.js} +1 -1
  100. package/dist/assets/user-round-4ZziAKb6.js +1 -0
  101. package/dist/assets/{user-x-HmMRNIMy.js → user-x-DYn__Nok.js} +1 -1
  102. package/dist/assets/{video-BISLfAY2.js → video-BcVXMTle.js} +1 -1
  103. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-w3oA3S6D.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CXWzeD1i.js} +2 -2
  104. package/dist/index.html +10 -10
  105. package/dist/server/addon.js +447 -11
  106. package/package.json +1 -1
  107. package/dist/assets/Addons-BNo3Y3g8.js +0 -4
  108. package/dist/assets/AiProfiles-CTHbBMUB.js +0 -3
  109. package/dist/assets/Build-Dlf7sJhk.js +0 -40
  110. package/dist/assets/Calendars-YnCFbUE7.js +0 -1
  111. package/dist/assets/Cluster-C4BsKola.js +0 -1
  112. package/dist/assets/CompositionCreateForm-D_Nmi2nG.js +0 -1
  113. package/dist/assets/Data-DkPbjXNV.js +0 -2
  114. package/dist/assets/DeviceDetail-BSWf6l6J.js +0 -2
  115. package/dist/assets/History-BfD8lMf9.js +0 -1
  116. package/dist/assets/Identity-6QdzCJrT.js +0 -1
  117. package/dist/assets/IntegrationDetail-B4X-8vcl.js +0 -1
  118. package/dist/assets/IntegrationHub-DCSIyXBI.js +0 -1
  119. package/dist/assets/Integrations-JcvhEroF.js +0 -1
  120. package/dist/assets/Integrations-XcsYTI2I.js +0 -1
  121. package/dist/assets/Locations-C--r0_cW.js +0 -3
  122. package/dist/assets/Notifications-D4LJlejx.js +0 -1
  123. package/dist/assets/Pipeline-BMhn1YbR.js +0 -1
  124. package/dist/assets/Recordings-Ct8JWW27.js +0 -1
  125. package/dist/assets/SessionsList-DrklEq9Z.js +0 -2
  126. package/dist/assets/circle-slash-BWtbQj2T.js +0 -1
  127. package/dist/assets/client-BnEPcD6s.js +0 -358
  128. package/dist/assets/crop-CDWciXWB.js +0 -1
  129. package/dist/assets/device-picker-model-DPfjZqVB.js +0 -1
  130. package/dist/assets/dist-CMwJjIGP.js +0 -358
  131. package/dist/assets/event-targets-CIffOoYs.js +0 -2
  132. package/dist/assets/i18n-DsGcRtAk.js +0 -1
  133. package/dist/assets/index-BMUVtgYi.css +0 -2
  134. package/dist/assets/index-CgxpaFwe.js +0 -4
  135. package/dist/assets/mount-DPfjZqVB.js +0 -1
  136. package/dist/assets/remoteEntry-DqDbkZhO.js +0 -1
  137. package/dist/assets/src-CWZRb0ia.js +0 -67
  138. package/dist/assets/step-inspector-model-B6Fs3NZo.js +0 -1
  139. package/dist/assets/useEventInvalidation-DPfjZqVB.js +0 -1
  140. package/dist/assets/user-round-D2ADHRLF.js +0 -1
@@ -1,4 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Devices-BAfbzc8b.js","./src-CWZRb0ia.js","./player-overlays-DDFLUcm1.js","./client-BnEPcD6s.js","./__vite-browser-external-BlMfPwfH.js","./useTranslation-D3Is_4B6.js","./AdminPage-92KQDOBy.js","./device-integration-icon-CRiv1vER.js","./useEventInvalidation-DPfjZqVB.js","./Integrations-XcsYTI2I.js","./i18n-DsGcRtAk.js","./ScanNetworkModal-DPHdPawS.js","./BrokerForm-HjHrcv-P.js","./mount-DPfjZqVB.js","./IntegrationDetail-B4X-8vcl.js","./search-x-CiS8b7vy.js","./NodeAddonsSettingsPanel-ivhHs40k.js","./addon-icons-context-gPkLZQ_G.js","./Pipeline-BMhn1YbR.js","./video-BISLfAY2.js","./usb--Z_ViOoE.js","./crop-CDWciXWB.js","./layers-Cf6Xk9ts.js","./step-inspector-model-B6Fs3NZo.js","./board-model-C6IplvmC.js","./DeviceDetail-BSWf6l6J.js","./archive-CxbMF2yZ.js","./scan-eye-BxF3-BiI.js","./bell-off-CAN5HeZI.js","./boxes-BIYyTH0E.js","./circle-slash-BWtbQj2T.js","./event-targets-CIffOoYs.js","./assignment-candidates-CQGwwSSC.js","./device-picker-model-DPfjZqVB.js","./use-stationary-objects-D9diuPzc.js","./linked-devices-model-DYRAb775.js","./format-Cz7vHmZ6.js","./authed-media-DpHGiSZS.js","./Showroom-2gQYW-h2.js","./EmbedPlayerPage-CZM7W_SR.js","./Library-X3g7Mvql.js","./user-x-HmMRNIMy.js","./user-round-D2ADHRLF.js","./AdminSectionedPage-B-MH77Vx.js","./use-scenes-feed-Dpe5Lc_e.js","./Recordings-Ct8JWW27.js","./scissors-DecmVZUv.js","./location-owned-usage-DPBYs4L0.js","./eraser-CvXO1d9P.js","./hard-drive-download-xDn3u92n.js","./format-size-DIxKXxtj.js","./Viewer-ukAW_oJQ.js","./monitor-off-DEBUzb17.js","./Build-Dlf7sJhk.js","./ungroup-uBZnvhmn.js","./CompositionCreateForm-D_Nmi2nG.js","./DeviceDoActionFields-B7UlBxQ0.js","./CompositionEditorPage-CdJtfEi1.js","./Locations-C--r0_cW.js","./speaker-BLIN7g-W.js","./Addons-BNo3Y3g8.js","./useNodeUrlSelection-B-NA_JqT.js","./AiProfiles-CTHbBMUB.js","./send-9ZOtM3uh.js","./message-square-plus-RcviJHk6.js","./MyAccess-Di7tv0VI.js","./key-round-BH39VAkM.js","./monitor-smartphone-rIimQM0r.js","./unlink-BK0Zya0K.js","./SessionsList-DrklEq9Z.js","./Logs-C7Z3D9TY.js","./timer-reset-ESt9DRwd.js","./IntegrationHub-DCSIyXBI.js","./settings-2-DVEGaYSK.js","./AddonAssetIcon-D4joXvAw.js","./addon-display-names-BkwMrExv.js","./Identity-6QdzCJrT.js","./key-D63R1Jty.js","./Network-3FZdyZoe.js","./log-in-D6jMFDmP.js","./Integrations-JcvhEroF.js","./recycle-CaQYaqJP.js","./Data-DkPbjXNV.js","./cloud-upload-DvGDSWZB.js","./System-CDHw7Mcx.js","./Cluster-C4BsKola.js","./memory-stick-thjjQqgp.js","./Terminal-UXpMvEO1.js","./Terminal-kHJ-D0s7.css","./Notifications-D4LJlejx.js","./list-ordered-9heb6Myu.js","./History-BfD8lMf9.js","./Calendars-YnCFbUE7.js"])))=>i.map(i=>d[i]);
2
- import{a as e,t}from"./rolldown-runtime-Cyuzqnbw.js";import"./virtual_mf-exposes___mfe_internal__admin_ui_host__remoteEntry-_hash_-DnnXQRkG.js";import{a as n,o as r}from"./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-w3oA3S6D.js";import{t as i}from"./vite-preload-helper-kNaey6uv.js";import{$ as a,A as o,B as s,D as c,E as l,F as u,G as d,J as f,L as p,M as m,N as h,O as g,P as _,R as v,S as y,V as b,W as x,X as S,Y as C,Z as w,a as T,b as E,d as D,i as O,j as k,k as A,o as j,q as M,u as N,x as P}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{$t as F,Br as I,Ci as ee,Di as L,Dr as te,Er as R,Fn as ne,Fr as re,It as ie,Jr as ae,Kn as z,Kt as oe,Li as se,Mi as ce,Nt as le,On as ue,Or as de,Q as B,Qn as fe,Rr as pe,Si as me,T as he,Tn as ge,Ui as _e,Xi as ve,Xn as ye,Xr as be,Z as xe,Zt as Se,_t as Ce,an as we,bi as Te,bn as Ee,dn as De,dt as Oe,fi as ke,fn as Ae,ft as je,hi as Me,ht as Ne,it as Pe,ji as Fe,kn as Ie,mr as Le,or as Re,ot as ze,pi as Be,pn as Ve,ra as He,rr as Ue,rt as We,sa as Ge,si as Ke,sn as qe,ta as Je,tr as Ye,un as Xe,ut as Ze,vr as Qe,wr as $e,xn as et,yi as tt,zn as nt,zr as rt}from"./player-overlays-DDFLUcm1.js";import{A as it,At as at,Bt as ot,Ct as st,Dt as ct,Et as lt,F as ut,Fi as dt,Ft as ft,G as pt,Gn as mt,Ht as ht,I as gt,It as _t,L as vt,Lt as yt,M as bt,N as xt,Nt as St,Oi as Ct,Pr as wt,Pt as Tt,Rt as Et,St as Dt,T as Ot,Ti as kt,Un as At,Vr as jt,Vt as Mt,W as Nt,a as Pt,bt as Ft,ct as It,dt as Lt,ft as Rt,gr as zt,hr as Bt,ht as Vt,i as Ht,j as Ut,k as Wt,kt as Gt,lt as Kt,mt as qt,n as Jt,oa as Yt,pt as Xt,ra as Zt,t as Qt,ut as $t,vt as en,wt as tn,yt as nn,zt as rn}from"./client-BnEPcD6s.js";import{a as an,c as on,d as sn,f as cn,h as ln,i as un,l as dn,m as fn,n as pn,o as mn,p as hn,r as gn,s as _n,t as vn,u as yn}from"./video-BISLfAY2.js";import{Br as bn,Bt as xn,Co as Sn,Cr as Cn,Er as wn,F as Tn,Fi as En,Fn as Dn,Fo as On,Fr as kn,Gr as An,Hr as jn,Ht as Mn,Hu as Nn,Ii as Pn,Ir as Fn,Jt as In,Ju as Ln,Ko as Rn,Kr as zn,L as Bn,Li as Vn,Lr as Hn,Lt as Un,Mr as Wn,Ni as Gn,Nr as Kn,Oo as qn,Ot as Jn,Pi as Yn,Po as Xn,Pr as Zn,Pt as Qn,Ro as $n,Rr as er,So as tr,Tu as nr,Ur as rr,Uu as ir,Xu as ar,Yu as or,an as sr,ao as cr,ar as lr,as as ur,bl as dr,bs as fr,cd as pr,ci as mr,cr as hr,cu as gr,do as _r,dr as vr,ed as yr,en as br,eo as xr,er as Sr,fr as Cr,hr as wr,id as Tr,in as Er,io as Dr,jo as Or,jr as kr,ko as Ar,l as jr,ld as Mr,ln as Nr,lr as Pr,md as Fr,mi as Ir,mr as Lr,mt as Rr,n as zr,nn as Br,nu as Vr,od as Hr,or as Ur,p as Wr,pd as Gr,pr as Kr,rd as qr,ri as Jr,rn as Yr,ro as Xr,ru as Zr,sd as Qr,sn as $r,so as ei,td as ti,tn as ni,to as ri,ur as ii,vl as ai,wo as oi,xi as si,y as ci,yt as li}from"./src-CWZRb0ia.js";import{r as ui,t as di}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-DPkvGqVU.js";import{t as fi}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-Cb2QlpvS.js";import{n as pi,t as V}from"./i18n-DsGcRtAk.js";import{a as mi,c as hi,i as gi,l as _i,n as vi,o as yi,s as bi,t as H,u as xi}from"./useTranslation-D3Is_4B6.js";import"./mount-DPfjZqVB.js";import{n as Si,t as Ci}from"./addon-icons-context-gPkLZQ_G.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})(),a();var wi=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Ti=/^[\\/]{2}/;function Ei(e,t){return t+e.replace(/\\/g,`/`)}var Di=`popstate`;function Oi(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function ki(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Mi(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:Ni(t)}return Fi(t,n,null,e)}function U(e,t){if(e===!1||e==null)throw Error(t)}function W(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Ai(){return Math.random().toString(36).substring(2,10)}function ji(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Mi(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Pi(t):t,state:n,key:t&&t.key||r||Ai(),mask:i}}function Ni({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function Pi(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Fi(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=Oi(e)?e:Mi(h.location,e,t);n&&n(r,e),l=u()+1;let d=ji(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=Oi(e)?e:Mi(h.location,e,t);n&&n(r,e),l=u();let i=ji(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Ii(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Di,d),c=e,()=>{i.removeEventListener(Di,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Ii(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),U(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:Ni(t);return i=i.replace(/ $/,`%20`),!n&&Ti.test(i)&&(i=r+i),new URL(i,r)}function Li(e,t,n=`/`){return Ri(e,t,n,!1)}function Ri(e,t,n,r,i){let a=ia((typeof t==`string`?Pi(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Bi(e),s=null,c=ra(a);for(let e=0;s==null&&e<o.length;++e)s=$i(o[e],c,r);return s}function zi(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function Bi(e){let t=Vi(e);return Ui(t),t}function Vi(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;U(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=fa([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(U(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Vi(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Zi(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=na(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Hi(e.path))a(e,t,!0,n)}),t}function Hi(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Hi(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Ui(e){e.sort((e,t)=>e.score===t.score?Qi(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Wi=/^:[\w-]+$/,Gi=3,Ki=2,qi=1,Ji=10,Yi=-2,Xi=e=>e===`*`;function Zi(e,t){let n=e.split(`/`),r=n.length;return n.some(Xi)&&(r+=Yi),t&&(r+=Ki),n.filter(e=>!Xi(e)).reduce((e,t)=>e+(Wi.test(t)?Gi:t===``?qi:Ji),r)}function Qi(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function $i(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?ta(u,l,s.matcher,s.compiledParams):ea(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=ea({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:fa([a,d.pathname]),pathnameBase:ma(fa([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=fa([a,d.pathnameBase]))}return o}function ea(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=na(e.path,e.caseSensitive,e.end);return ta(e,t,n,r)}function ta(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function na(e,t=!1,n=!0){W(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function ra(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return W(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function ia(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function aa(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Pi(e):e,a;return n?(n=da(n),a=n.startsWith(`/`)?oa(n.substring(1),`/`):oa(n,t)):a=t,{pathname:a,search:ha(r),hash:ga(i)}}function oa(e,t){let n=pa(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function sa(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ca(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function la(e){let t=ca(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function ua(e,t,n,r=!1){let i;typeof e==`string`?i=Pi(e):(i={...e},U(!i.pathname||!i.pathname.includes(`?`),sa(`?`,`pathname`,`search`,i)),U(!i.pathname||!i.pathname.includes(`#`),sa(`#`,`pathname`,`hash`,i)),U(!i.search||!i.search.includes(`#`),sa(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=aa(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var da=e=>e.replace(/[\\/]{2,}/g,`/`),fa=e=>da(e.join(`/`)),pa=e=>e.replace(/\/+$/,``),ma=e=>pa(e).replace(/^\/*/,`/`),ha=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,ga=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,_a=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function va(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function ya(e){return fa(e.map(e=>e.route.path).filter(Boolean))||`/`}var ba=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function xa(e,t){let n=e;if(typeof n!=`string`||!wi.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(ba)try{let e=new URL(window.location.href),r=Ti.test(n)?new URL(Ei(n,e.protocol)):new URL(n),a=ia(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{W(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Sa=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Sa);var Ca=[`GET`,...Sa];new Set(Ca);var wa=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Ta(e){try{return wa.includes(new URL(e).protocol)}catch{return!1}}var Ea=g(null);Ea.displayName=`DataRouter`;var Da=g(null);Da.displayName=`DataRouterState`;var Oa=g(!1);function ka(){return v(Oa)}var Aa=g({isTransitioning:!1});Aa.displayName=`ViewTransition`;var ja=g(new Map);ja.displayName=`Fetchers`;var Ma=g(null);Ma.displayName=`Await`;var G=g(null);G.displayName=`Navigation`;var Na=g(null);Na.displayName=`Location`;var K=g({outlet:null,matches:[],isDataRoute:!1});K.displayName=`Route`;var Pa=g(null);Pa.displayName=`RouteError`;var Fa=`REACT_ROUTER_ERROR`,Ia=`REDIRECT`,La=`ROUTE_ERROR_RESPONSE`;function Ra(e){if(e.startsWith(`${Fa}:${Ia}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function za(e){if(e.startsWith(`${Fa}:${La}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new _a(t.status,t.statusText,t.data)}catch{}}function Ba(e,{relative:t}={}){U(Va(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=v(G),{hash:i,pathname:a,search:o}=Xa(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:fa([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Va(){return v(Na)!=null}function q(){return U(Va(),`useLocation() may be used only in the context of a <Router> component.`),v(Na).location}function Ha(){return v(Na).navigationType}var Ua=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Wa(e){v(G).static||x(e)}function Ga(){let{isDataRoute:e}=v(K);return e?go():Ka()}function Ka(){U(Va(),`useNavigate() may be used only in the context of a <Router> component.`);let e=v(Ea),{basename:t,navigator:n}=v(G),{matches:r}=v(K),{pathname:i}=q(),a=JSON.stringify(la(r)),o=M(!1);return Wa(()=>{o.current=!0}),p((r,s={})=>{if(W(o.current,Ua),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=ua(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:fa([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var qa=g(null);function Ja(e){let t=v(K).outlet;return d(()=>t&&A(qa.Provider,{value:e},t),[t,e])}function Ya(){let{matches:e}=v(K);return e[e.length-1]?.params??{}}function Xa(e,{relative:t}={}){let{matches:n}=v(K),{pathname:r}=q(),i=JSON.stringify(la(n));return d(()=>ua(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Za(e,t){return Qa(e,t)}function Qa(e,t,n){U(Va(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=v(G),{matches:i}=v(K),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;vo(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
3
-
4
- Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=q(),d;if(t){let e=typeof t==`string`?Pi(t):t;U(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):Li(e,{pathname:p});W(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),W(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=ao(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:fa([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:fa([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?A(Na.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function $a(){let e=ho(),t=va(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=A(b,null,A(`p`,null,`💿 Hey developer 👋`),A(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,A(`code`,{style:a},`ErrorBoundary`),` or`,` `,A(`code`,{style:a},`errorElement`),` prop on your route.`)),A(b,null,A(`h2`,null,`Unexpected Application Error!`),A(`h3`,{style:{fontStyle:`italic`}},t),n?A(`pre`,{style:i},n):null,o)}var eo=A($a,null),to=class extends _{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=za(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:A(K.Provider,{value:this.props.routeContext},A(Pa.Provider,{value:e,children:this.props.component}));return this.context?A(ro,{error:e},t):t}};to.contextType=Oa;var no=new WeakMap;function ro({children:e,error:t}){let{basename:n}=v(G);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Ra(t.digest);if(e){let r=no.get(t);if(r)throw r;let i=xa(e.location,n),a=i.absoluteURL||i.to;if(Ta(a))throw Error(`Invalid redirect location`);if(ba&&!no.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw no.set(t,n),n}return A(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function io({routeContext:e,match:t,children:n}){let r=v(Ea);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),A(K.Provider,{value:e},n)}function ao(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);U(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:ya(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||eo,o&&(s<0&&c===0?(vo(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?A(n.route.Component,null):n.route.element?n.route.element:e,A(io,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?A(to,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function oo(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function so(e){let t=v(Ea);return U(t,oo(e)),t}function co(e){let t=v(Da);return U(t,oo(e)),t}function lo(e){let t=v(K);return U(t,oo(e)),t}function uo(e){let t=lo(e),n=t.matches[t.matches.length-1];return U(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function fo(){return uo(`useRouteId`)}function po(){let e=co(`useNavigation`);return d(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function mo(){let{matches:e,loaderData:t}=co(`useMatches`);return d(()=>e.map(e=>zi(e,t)),[e,t])}function ho(){let e=v(Pa),t=co(`useRouteError`),n=uo(`useRouteError`);return e===void 0?t.errors?.[n]:e}function go(){let{router:e}=so(`useNavigate`),t=uo(`useNavigate`),n=M(!1);return Wa(()=>{n.current=!0}),p(async(r,i={})=>{W(n.current,Ua),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var _o={};function vo(e,t,n){!t&&!_o[e]&&(_o[e]=!0,W(!1,n))}h(yo);function yo({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Qa(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function J({to:e,replace:t,state:n,relative:r}){U(Va(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=v(G);W(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=v(K),{pathname:o}=q(),c=Ga(),l=ua(e,la(a),o,r===`path`),u=JSON.stringify(l);return s(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function Y(e){U(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function bo({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){U(!Va(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=d(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=Pi(n));let{pathname:l=`/`,search:u=``,hash:f=``,state:p=null,key:m=`default`,mask:h}=n,g=d(()=>{let e=ia(l,s);return e==null?null:{location:{pathname:e,search:u,hash:f,state:p,key:m,mask:h},navigationType:r}},[s,l,u,f,p,m,r,h]);return W(g!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${f}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:A(G.Provider,{value:c},A(Na.Provider,{children:t,value:g}))}function xo({children:e,location:t}){return Za(So(e),t)}function So(e,t=[]){let n=[];return l.forEach(e,(e,r)=>{if(!k(e))return;let i=[...t,r];if(e.type===b){n.push.apply(n,So(e.props.children,i));return}U(e.type===Y,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),U(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=So(e.props.children,i)),n.push(a)}),n}var Co=`get`,wo=`application/x-www-form-urlencoded`;function To(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Eo(e){return To(e)&&e.tagName.toLowerCase()===`button`}function Do(e){return To(e)&&e.tagName.toLowerCase()===`form`}function Oo(e){return To(e)&&e.tagName.toLowerCase()===`input`}function ko(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ao(e,t){return e.button===0&&(!t||t===`_self`)&&!ko(e)}function jo(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Mo(e,t){let n=jo(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var No=null;function Po(){if(No===null)try{new FormData(document.createElement(`form`),0),No=!1}catch{No=!0}return No}var Fo=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Io(e){return e!=null&&!Fo.has(e)?(W(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${wo}"`),null):e}function Lo(e,t){let n,r,i,a,o;if(Do(e)){let o=e.getAttribute(`action`);r=o?ia(o,t):null,n=e.getAttribute(`method`)||Co,i=Io(e.getAttribute(`enctype`))||wo,a=new FormData(e)}else if(Eo(e)||Oo(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?ia(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Co,i=Io(e.getAttribute(`formenctype`))||Io(o.getAttribute(`enctype`))||wo,a=new FormData(o,e),!Po()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(To(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Co,r=null,i=wo,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Ro={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},zo=/[&><\u2028\u2029]/g;function Bo(e){return e.replace(zo,e=>Ro[e])}function Vo(e,t){if(e===!1||e==null)throw Error(t)}function Ho(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&ia(i.pathname,t)===`/`?i.pathname=`${pa(t)}/_root.${r}`:i.pathname=`${pa(i.pathname)}.${r}`,i}async function Uo(e,t){if(e.id in t)return t[e.id];try{let n=await i(()=>import(e.module),[],import.meta.url);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Wo(e){return e!=null&&typeof e.page==`string`}function Go(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Ko(e,t,n){return Zo((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Uo(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Go).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function qo(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Jo(e,t,{includeHydrateFallback:n}={}){return Yo(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Yo(e){return[...new Set(e)]}function Xo(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Zo(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Wo(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Xo(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Qo(){let e=v(Ea);return Vo(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function $o(){let e=v(Da);return Vo(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var es=g(void 0);es.displayName=`FrameworkContext`;function ts(){let e=v(es);return Vo(e,`You must render this element inside a <HydratedRouter> element`),e}function ns(e,t){let n=v(es),[r,i]=f(!1),[a,o]=f(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:p}=t,m=M(null);s(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return m.current&&e.observe(m.current),()=>{e.disconnect()}}},[e]),s(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let h=()=>{i(!0)},g=()=>{i(!1),o(!1)};return n?e===`intent`?[a,m,{onFocus:rs(c,h),onBlur:rs(l,g),onMouseEnter:rs(u,h),onMouseLeave:rs(d,g),onTouchStart:rs(p,h)}]:[a,m,{}]:[!1,m,{}]}function rs(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function is({page:e,...t}){let n=ka(),{nonce:r}=ts(),{router:i}=Qo(),a=d(()=>Li(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),A(n?os:ss,{page:e,matches:a,...t})):null}function as(e){let{manifest:t,routeModules:n}=ts(),[r,i]=f([]);return s(()=>{let r=!1;return Ko(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function os({page:e,matches:t,...n}){let r=q(),{future:i}=ts(),{basename:a}=Qo();return A(b,null,d(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Ho(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]).map(e=>A(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function ss({page:e,matches:t,...n}){let r=q(),{future:i,manifest:a,routeModules:o}=ts(),{basename:s}=Qo(),{loaderData:c,matches:l}=$o(),u=d(()=>qo(e,t,l,a,r,`data`),[e,t,l,a,r]),f=d(()=>qo(e,t,l,a,r,`assets`),[e,t,l,a,r]),p=d(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Ho(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),m=d(()=>Jo(f,a),[f,a]),h=as(f);return A(b,null,p.map(e=>A(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>A(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>A(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function cs(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var ls=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{ls&&(window.__reactRouterVersion=`7.18.0`)}catch{}function us({basename:e,children:t,useTransitions:n,window:r}){let i=M();i.current??=ki({window:r,v5Compat:!0});let a=i.current,[o,s]=f({action:a.action,location:a.location}),c=p(e=>{n===!1?s(e):u(()=>s(e))},[n]);return x(()=>a.listen(c),[a,c]),A(bo,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function ds({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=f({action:n.action,location:n.location}),o=p(e=>{r===!1?a(e):u(()=>a(e))},[r]);return x(()=>n.listen(o),[n,o]),A(bo,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}ds.displayName=`unstable_HistoryRouter`;var fs=o(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=v(G),y=typeof l==`string`&&wi.test(l),x=xa(l,h);l=x.to;let S=Ba(l,{relative:r}),C=q(),w=null;if(o){let e=ua(o,[],C.mask?C.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:fa([h,e.pathname])),w=g.createHref(e)}let[T,E,D]=ns(n,p),O=ys(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function k(t){e&&e(t),t.defaultPrevented||O(t)}let j=!(x.isExternal||i),M=A(`a`,{...p,...D,href:(j?w:void 0)||x.absoluteURL||S,onClick:j?k:e,ref:cs(m,E),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return T&&!y?A(b,null,M,A(is,{page:S})):M});fs.displayName=`Link`;var ps=o(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Xa(a,{relative:c.relative}),d=q(),f=v(Da),{navigator:p,basename:m}=v(G),h=f!=null&&As(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,y=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),y=y?y.toLowerCase():null,g=g.toLowerCase()),y&&m&&(y=ia(y,m)||y);let b=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=_===g||!r&&_.startsWith(g)&&_.charAt(b)===`/`,S=y!=null&&(y===g||!r&&y.startsWith(g)&&y.charAt(g.length)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return A(fs,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});ps.displayName=`NavLink`;var ms=o(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Co,action:s,onSubmit:c,relative:l,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h)=>{let{useTransitions:g}=v(G),_=Cs(),y=ws(s,{relative:l}),b=o.toLowerCase()===`get`?`get`:`post`,x=typeof s==`string`&&wi.test(s);return A(`form`,{ref:h,method:b,action:y,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,m=()=>_(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p});g&&n!==!1?u(()=>m()):m()},...m,"data-discover":!x&&e===`render`?`true`:void 0})});ms.displayName=`Form`;function hs({getKey:e,storageKey:t,...n}){let r=v(es),{basename:i}=v(G),a=q(),o=mo();Os({getKey:e,storageKey:t});let s=d(()=>{if(!r||!e)return null;let t=Ds(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),A(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Bo(JSON.stringify(t||Ts))}, ${Bo(JSON.stringify(s))})`}})}hs.displayName=`ScrollRestoration`;function gs(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function _s(e){let t=v(Ea);return U(t,gs(e)),t}function vs(e){let t=v(Da);return U(t,gs(e)),t}function ys(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let d=Ga(),f=q(),m=Xa(e,{relative:o});return p(p=>{if(Ao(p,t)){p.preventDefault();let t=n===void 0?Ni(f)===Ni(m):n,h=()=>d(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?u(()=>h()):h()}},[f,d,m,n,r,i,t,e,a,o,s,c,l])}function bs(e){W(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=M(jo(e)),n=M(!1),r=q(),i=d(()=>Mo(r.search,n.current?null:t.current),[r.search]),a=Ga();return[i,p((e,t)=>{let r=jo(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var xs=0,Ss=()=>`__${String(++xs)}__`;function Cs(){let{router:e}=_s(`useSubmit`),{basename:t}=v(G),n=fo(),r=e.fetch,i=e.navigate;return p(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Lo(e,t);a.navigate===!1?await r(a.fetcherKey||Ss(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function ws(e,{relative:t}={}){let{basename:n}=v(G),r=v(K);U(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Xa(e||`.`,{relative:t})},o=q();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:fa([n,a.pathname])),Ni(a)}var Ts=`react-router-scroll-positions`,Es={};function Ds(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:ia(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Os({getKey:e,storageKey:t}={}){let{router:n}=_s(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=vs(`useScrollRestoration`),{basename:a}=v(G),o=q(),c=mo(),l=po();s(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),ks(p(()=>{if(l.state===`idle`){let t=Ds(o,c,a,e);Es[t]=window.scrollY}try{sessionStorage.setItem(t||Ts,JSON.stringify(Es))}catch(e){W(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[l.state,e,a,o,c,t])),typeof document<`u`&&(x(()=>{try{let e=sessionStorage.getItem(t||Ts);e&&(Es=JSON.parse(e))}catch{}},[t]),x(()=>{let t=n?.enableScrollRestoration(Es,()=>window.scrollY,e?(t,n)=>Ds(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),x(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{W(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function ks(e,t){let{capture:n}=t||{};s(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function As(e,{relative:t}={}){let n=v(Aa);U(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=_s(`useViewTransitionState`),i=Xa(e,{relative:t});if(!n.isTransitioning)return!1;let a=ia(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=ia(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ea(i.pathname,o)!=null||ea(i.pathname,a)!=null}var js=e(t(((e,t)=>{t.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}}))()),Ms=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function Ns(e){var t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(js.default[n[1]]||e.charAt(e.length-2)===`/`)&&(t.voidElement=!0),t.name.startsWith(`!--`))){var r=e.indexOf(`-->`);return{type:`comment`,comment:r===-1?``:e.slice(4,r)}}for(var i=new RegExp(Ms),a=null;(a=i.exec(e))!==null;)if(a[0].trim())if(a[1]){var o=a[1].trim(),s=[o,``];o.indexOf(`=`)>-1&&(s=o.split(`=`)),t.attrs[s[0]]=s[1],i.lastIndex--}else a[2]&&(t.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return t}var Ps=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,Fs=/^\s*$/,Is=Object.create(null);function Ls(e,t){switch(t.type){case`text`:return e+t.content;case`tag`:return e+=`<`+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+`="`+e[n]+`"`);return t.length?` `+t.join(` `):``}(t.attrs):``)+(t.voidElement?`/>`:`>`),t.voidElement?e:e+t.children.reduce(Ls,``)+`</`+t.name+`>`;case`comment`:return e+`<!--`+t.comment+`-->`}}var Rs={parse:function(e,t){t||={},t.components||=Is;var n,r=[],i=[],a=-1,o=!1;if(e.indexOf(`<`)!==0){var s=e.indexOf(`<`);r.push({type:`text`,content:s===-1?e:e.substring(0,s)})}return e.replace(Ps,function(s,c){if(o){if(s!==`</`+n.name+`>`)return;o=!1}var l,u=s.charAt(1)!==`/`,d=s.startsWith(`<!--`),f=c+s.length,p=e.charAt(f);if(d){var m=Ns(s);return a<0?(r.push(m),r):((l=i[a]).children.push(m),r)}if(u&&(a++,(n=Ns(s)).type===`tag`&&t.components[n.name]&&(n.type=`component`,o=!0),n.voidElement||o||!p||p===`<`||n.children.push({type:`text`,content:e.slice(f,e.indexOf(`<`,f))}),a===0&&r.push(n),(l=i[a-1])&&l.children.push(n),i[a]=n),(!u||n.voidElement)&&(a>-1&&(n.voidElement||n.name===s.slice(2,-1))&&(a--,n=a===-1?r:i[a]),!o&&p!==`<`&&p)){l=a===-1?r:i[a].children;var h=e.indexOf(`<`,f),g=e.slice(f,h===-1?void 0:h);Fs.test(g)&&(g=` `),(h>-1&&a+l.length>=0||g!==` `)&&l.push({type:`text`,content:g})}}),r},stringify:function(e){return e.reduce(function(e,t){return e+Ls(``,t)},``)}};a();var zs=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},Bs=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?Hs(t):t},Vs=e=>Array.isArray(e)&&e.every(k),Hs=e=>Array.isArray(e)?e:[e],Us=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},Ws=e=>{let t={};if(!e)return t;let n=e=>{Hs(e).forEach(e=>{hi(e)||(zs(e)?n(Bs(e)):bi(e)&&!k(e)&&Object.assign(t,e))})};return n(e),t},Gs=(e,t,n,r)=>{if(!e)return``;let i=``,a=Hs(e),o=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return a.forEach((e,a)=>{if(hi(e)){i+=`${e}`;return}if(k(e)){let{props:s,type:c}=e,l=Object.keys(s).length,u=o.indexOf(c)>-1,d=s.children;if(!d&&u&&!l){i+=`<${c}/>`;return}if(!d&&(!u||l)||s.i18nIsDynamicList){i+=`<${a}></${a}>`;return}if(u&&l<=1){let e=hi(d)?d:Gs(d,t,n,r);i+=`<${c}>${e}</${c}>`;return}let f=Gs(d,t,n,r);i+=`<${a}>${f}</${a}>`;return}if(e===null){_i(n,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:r});return}if(bi(e)){let{format:t,...a}=e,o=Object.keys(a);if(o.length===1){let e=t?`${o[0]}, ${t}`:o[0];i+=`{{${e}}}`;return}_i(n,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:r,child:e});return}_i(n,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:r,child:e})}),i},Ks=(e,t=[],n={})=>{if(!e)return e;let r=Object.keys(n),i=[...t,...r],a=``,o=0;for(;o<e.length;)if(e[o]===`<`){let t=!1,n=e.slice(o).match(/^<\/(\d+|[a-zA-Z][a-zA-Z0-9_-]*)>/);if(n){let e=n[1];(/^\d+$/.test(e)||i.includes(e))&&(t=!0,a+=n[0],o+=n[0].length)}if(!t){let n=e.slice(o).match(/^<(\d+|[a-zA-Z][a-zA-Z0-9_-]*)(\s+[\w-]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s*(\/)?>/);if(n){let e=n[1];(/^\d+$/.test(e)||i.includes(e))&&(t=!0,a+=n[0],o+=n[0].length)}}t||(a+=`&lt;`,o+=1)}else a+=e[o],o+=1;return a},qs=(e,t,n,r,i,a,o)=>{if(n===``)return[];let s=i.transKeepBasicHtmlNodesFor||[],u=n&&new RegExp(s.map(e=>`<${e}`).join(`|`)).test(n);if(!e&&!t&&!u&&!o)return[n];let d=t??{},f=e=>{Hs(e).forEach(e=>{hi(e)||(zs(e)?f(Bs(e)):bi(e)&&!k(e)&&Object.assign(d,e))})};f(e);let p=Ks(n,s,d),m=Rs.parse(`<0>${p}</0>`),h={...d,...a},g=(e,t,n)=>{let r=Bs(e),i=v(r,t.children,n);return Vs(r)&&i.length===0||e.props?.i18nIsDynamicList?r:i},_=(e,t,n,r,i)=>{e.dummy?(e.children=t,n.push(c(e,{key:r},i?void 0:t))):n.push(...l.map([e],e=>{if(e.type===b||e.props?.i18nIsDynamicList!==void 0){let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`children`||t===`i18nIsDynamicList`||(n[t]=e.props[t])}),A(e.type,n,i?null:t)}let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`ref`||t===`children`||(n[t]=e.props[t])}),c(e,n,i?null:t)}))},v=(e,n,a)=>{let c=Hs(e),l=Hs(n),d={};return l.reduce((e,n,l)=>{let f=n.children?.[0]?.content&&r.services.interpolator.interpolate(n.children[0].content,h,r.language);if(n.type===`tag`){let p=c[parseInt(n.name,10)];!p&&t&&(p=t[n.name]),a.length===1&&!p&&(p=a[0][n.name]),p||={};let m={...n.attrs};o&&Object.keys(m).forEach(e=>{let t=m[e];hi(t)&&(m[e]=yi(t))});let y=Object.keys(m).length===0?p:Us({props:m},p),b=k(y),x=b&&zs(n,!0)&&!n.voidElement,S=u&&bi(y)&&y.dummy&&!b,C=bi(t)&&Object.hasOwnProperty.call(t,n.name);if(hi(y)){let t=r.services.interpolator.interpolate(y,h,r.language);e.push(t)}else if(zs(y)||x)_(y,g(y,n,a),e,l);else if(S)_(y,v(c,n.children,a),e,l);else if(Number.isNaN(parseFloat(n.name)))if(C)_(y,g(y,n,a),e,l,n.voidElement);else if(i.transSupportBasicHtmlNodes&&s.indexOf(n.name)>-1)if(n.voidElement)e.push(A(n.name,{key:`${n.name}-${l}`}));else{let t=d[n.name]||0;d[n.name]=t+1;let r,i=0;for(let e=0;e<c.length;e+=1){let a=c[e];if(k(a)&&a.type===n.name){if(i===t){r=a;break}i+=1}}let o=v(r?Hs(Bs(r)):c,n.children,a);e.push(A(n.name,{key:`${n.name}-${l}`},o))}else if(n.voidElement)e.push(`<${n.name} />`);else{let t=v(c,n.children,a);e.push(`<${n.name}>${t}</${n.name}>`)}else if(bi(y)&&!b){let t=n.children[0]?f:null;t&&e.push(t)}else _(y,f,e,l,n.children.length!==1||!f)}else if(n.type===`text`){let t=i.transWrapTextNodes,a=typeof i.unescape==`function`?i.unescape:mi().unescape,s=o?a(r.services.interpolator.interpolate(n.content,h,r.language)):r.services.interpolator.interpolate(n.content,h,r.language);t?e.push(A(t,{key:`${n.name}-${l}`},s)):e.push(s)}return e},[])};return Bs(v([{dummy:!0,children:e||[]}],m,Hs(e||[]))[0])},Js=(e,t,n)=>{let r=e.key||t,i=c(e,{key:r});if(!i.props||!i.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return i;function a(){return A(b,null,i)}return A(a,{key:r})},Ys=(e,t)=>e.map((e,n)=>Js(e,n,t)),Xs=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:Js(e[r],r,t)})}),n},Zs=(e,t,n,r)=>e?Array.isArray(e)?Ys(e,t):bi(e)?Xs(e,t):(xi(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,Qs=e=>!bi(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function $s({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a={},values:o,defaults:s,components:c,ns:l,i18n:u,t:d,shouldUnescape:f,...p}){let m=u||gi();if(!m)return xi(m,`NO_I18NEXT_INSTANCE`,`Trans: You need to pass in an i18next instance using i18nextReactModule`,{i18nKey:r}),e;let h=d||m.t.bind(m)||(e=>e),g={...mi(),...m.options?.react},_=l||h.ns||m.options?.defaultNS;_=hi(_)?[_]:_||[`translation`];let{transDefaultProps:v}=g,y=v?.tOptions?{...v.tOptions,...a}:a,b=f??v?.shouldUnescape,x=v?.values?{...v.values,...o}:o,S=v?.components?{...v.components,...c}:c,C=Gs(e,g,m,r),w=s||y?.defaultValue||C||g.transEmptyNodeValue||(typeof r==`function`?pi(r):r),{hashTransKey:T}=g,E=r||(T?T(C||w):C||w);o=m.options?.interpolation?.defaultVariables?x&&Object.keys(x).length>0?{...x,...m.options.interpolation.defaultVariables}:{...m.options.interpolation.defaultVariables}:x;let D=Ws(e);D&&typeof D.count==`number`&&t===void 0&&(t=D.count);let O=o||t!==void 0&&!m.options?.interpolation?.alwaysFormat||!e?y.interpolation:{interpolation:{...y.interpolation,prefix:`#$?`,suffix:`?$#`}},k={...y,context:i||y.context,count:t,...o,...O,defaultValue:w,ns:_},j=E?h(E,k):w;j===E&&w&&(j=w);let M=Zs(S,j,m,r),N=M||e,P=null;Qs(M)&&(P=M,N=e);let F=qs(N,P,j,m,g,k,b),I=n??g.defaultTransParent;return I?A(I,p,F):F}a();function ec({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a={},values:o,defaults:s,components:c,ns:l,i18n:u,t:d,shouldUnescape:f,...p}){let{i18n:m,defaultNS:h}=v(vi)||{},g=u||m||gi(),_=d||g?.t.bind(g);return $s({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a,values:o,defaults:s,components:c,ns:l||_?.ns||h||g?.options?.defaultNS,i18n:g,t:d,shouldUnescape:f,...p})}function tc(e,t){return t.map(t=>({subject:{kind:`device`,deviceId:e},key:t.key,scope:t.scope}))}function nc({deviceId:e}){let{t}=H(),{presence:n,list:r}=Wr(e);return n===`absent`?null:n===`unknown`?P(Cn,{message:t(`deviceQuickDetail.historyUnknown`,`Could not tell whether this device has recorded history.`)}):n===`pending`||r.status===`pending`?P(wn,{className:`h-24 w-full`,"aria-busy":`true`}):r.status===`error`?P(Cn,{title:t(`deviceQuickDetail.historyUnknown`,`Could not tell whether this device has recorded history.`),message:r.error}):r.data.length===0?null:y(`section`,{className:`flex flex-col gap-2`,"aria-label":t(`deviceQuickDetail.tabHistory`,`History`),children:[P(`div`,{className:`flex justify-end`,children:P(fs,{to:ci(tc(e,r.data)),className:`text-xs text-primary hover:underline`,children:t(`deviceQuickDetail.openHistory`,`Open full history`)})}),P(jr,{deviceId:e})]})}function rc(e,t){return e===`present`&&t.status===`ok`&&(t.data?.length??0)>0}var ic={streaming:{icon:vn,labelKey:`capabilityBadges.streaming`},detection:{icon:pe,labelKey:`capabilityBadges.detection`},recording:{icon:ke,labelKey:`capabilityBadges.recording`},audio:{icon:ye,labelKey:`capabilityBadges.audio`},snapshot:{icon:L,labelKey:`capabilityBadges.snapshot`},motion:{icon:Ze,labelKey:`capabilityBadges.motion`},ptz:{icon:Xe,labelKey:`capabilityBadges.ptz`},webrtc:{icon:et,labelKey:`capabilityBadges.webrtc`},onvif:{icon:we,labelKey:`capabilityBadges.onvif`},analytics:{icon:be,labelKey:`capabilityBadges.analytics`},"battery-operated":{icon:_e,labelKey:`capabilityBadges.battery`},"native-snapshot":{icon:L,labelKey:`capabilityBadges.nativeSnapshot`},"pan-tilt-zoom":{icon:Xe,labelKey:`capabilityBadges.ptz`},"two-way-audio":{icon:ye,labelKey:`capabilityBadges.twoWayAudio`},"doorbell-button":{icon:se,labelKey:`capabilityBadges.doorbell`},rebootable:{icon:Ee,labelKey:`capabilityBadges.rebootable`},"vacuum-has-map":{icon:mn,labelKey:`capabilityBadges.map`},"vacuum-has-ai":{icon:Se,labelKey:`capabilityBadges.aiObstacle`},"mower-has-map":{icon:mn,labelKey:`capabilityBadges.map`},"mower-has-targeted-mowing":{icon:R,labelKey:`capabilityBadges.targetedMowing`}},ac=Fe;function oc({capabilities:e,showLabels:t=!1}){let{t:n}=H();return P(`div`,{className:`flex items-center gap-1 flex-wrap`,children:e.map(e=>{let r=ic[e],i=r?.icon??ac,a=r?n(r.labelKey):e;return y(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] text-foreground-subtle`,title:a,children:[P(i,{className:`h-3 w-3`}),t&&P(`span`,{children:a})]},e)})})}a();var sc={amcrest:{icon:fn,color:`#3b82f6`,label:`Amcrest`},hikvision:{icon:De,color:`#a855f7`,label:`Hikvision`},reolink:{icon:et,color:`#06b6d4`,label:`Reolink`},homeassistant:{icon:Qe,color:`#22d3ee`,label:`Home Assistant`},rtsp:{icon:Ne,color:`#78716c`,label:`RTSP`},onvif:{icon:Ne,color:`#78716c`,label:`ONVIF`}},cc={sm:`h-4 w-4`,md:`h-5 w-5`,lg:`h-6 w-6`},lc={sm:`h-7 w-7`,md:`h-8 w-8`,lg:`h-10 w-10`};function uc(e){let t=e.toLowerCase();return t.startsWith(`provider-`)?t.slice(9):t}function dc(e){return sc[uc(e)]??{icon:fn,color:`#78716c`,label:e}}function fc({type:e,size:t=`md`,showLabel:n}){let r=dc(e),i=r.icon,[a,o]=f(!1),s=Si(e);return y(`div`,{className:`flex items-center gap-2`,children:[P(`div`,{className:`flex items-center justify-center rounded-lg ${lc[t]}`,style:{backgroundColor:`${r.color}15`},children:a||!s?P(i,{className:cc[t],style:{color:r.color}}):P(`img`,{src:s,alt:r.label,className:cc[t],onError:()=>o(!0)})}),n&&P(`span`,{className:`text-xs font-medium text-foreground-subtle`,children:r.label})]})}function X({label:e,value:t,layout:n=`inline`}){return n===`stacked`?y(`div`,{className:`min-w-0 flex flex-col gap-0.5 px-0.5`,children:[P(`span`,{className:`text-[11px] text-foreground-subtle`,children:e}),P(`div`,{className:`min-w-0 text-[11px] text-foreground`,children:t})]}):y(`div`,{className:`${he} flex items-start gap-2 sm:gap-3`,children:[P(`span`,{className:`w-20 sm:w-28 flex-shrink-0 text-[11px] text-foreground-subtle`,children:e}),P(`div`,{className:`flex-1 min-w-0 text-[11px] text-foreground`,children:t})]})}function pc(e,t,n){return e===null||e.name===e.baseName&&e.location===e.baseLocation||e.name===t&&e.location===n?{name:t,location:n,baseName:t,baseLocation:n}:e}function mc(e){return e===null?!1:e.name!==e.baseName||e.location!==e.baseLocation}function hc(e){return e.name.trim().length===0?`name`:null}function gc(e){let t=e.map(e=>e.error).filter(e=>e!==null&&e.length>0);return{dirty:e.some(e=>e.dirty),saving:e.some(e=>e.saving),error:t.length===0?null:t.join(`; `)}}a();var _c=g(null);function vc(){return v(_c)}function yc({deviceId:e,deviceName:t,deviceLocation:n,deviceReady:r,onClose:i,children:a}){let[o,s]=f(null),[c,l]=f([]),u=M(new Map);if(r){let e=pc(o,t,n);(o===null||e.name!==o.name||e.location!==o.location||e.baseName!==o.baseName||e.baseLocation!==o.baseLocation)&&s(e)}let m=p(e=>(u.current.set(e.id,{save:e.save,discard:e.discard}),l(t=>{let n=t.find(t=>t.id===e.id);return n!==void 0&&n.dirty===e.dirty&&n.saving===e.saving&&n.error===e.error?t:[...t.filter(t=>t.id!==e.id),{...e,save:()=>u.current.get(e.id)?.save()??Promise.resolve(),discard:()=>{u.current.get(e.id)?.discard()}}]}),()=>{u.current.delete(e.id),l(t=>t.filter(t=>t.id!==e.id))}),[]),h=d(()=>({identity:o,setIdentityName:e=>{s(t=>t===null?t:{...t,name:e})},setIdentityLocation:e=>{s(t=>t===null?t:{...t,location:e})},register:m}),[o,m]);return P(_c.Provider,{value:h,children:P(bc,{deviceId:e,identity:o,contributions:c,onIdentitySaved:e=>s(e),onClose:i,children:a})})}function bc({deviceId:e,identity:t,contributions:n,onIdentitySaved:r,onClose:i,children:a}){return y(E,{children:[a,P(Sc,{deviceId:e,identity:t,contributions:n,onIdentitySaved:r,onClose:i})]})}function xc(e){return e instanceof Error?e.message:String(e)}function Sc({deviceId:e,identity:t,contributions:n,onIdentitySaved:r,onClose:i}){let{t:a}=H(),o=Ga(),s=bn(),c=j(),[l,u]=f(null),[d,p]=f(!1),m=qn(),h=oi(),g=gc([{dirty:mc(t),saving:d,error:l},...n]),_=()=>{c.invalidateQueries({queryKey:[[`deviceManager`]]})};return y(`div`,{className:`sticky bottom-0 z-10 mt-3 flex flex-col gap-2 border-t border-border bg-background px-1 pt-3`,children:[g.error!==null&&P(`p`,{className:`text-xs text-danger`,children:g.error}),y(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[P(jn,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{(async()=>{g.dirty&&!await s({title:a(`deviceQuickDetail.leaveTitle`,`Discard unsaved changes?`),message:a(`deviceQuickDetail.leaveMessage`,`Unsaved edits on this device will be discarded.`),confirmLabel:a(`deviceQuickDetail.discard`,`Discard`),variant:`warning`})||(o(`/devices/${String(e)}`),i())})()},children:a(`deviceQuickDetail.openFull`,`Open full detail`)}),y(`div`,{className:`flex items-center gap-2`,children:[P(jn,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{t!==null&&r({...t,name:t.baseName,location:t.baseLocation});for(let e of n)e.discard();u(null)},disabled:!g.dirty||g.saving,children:a(`deviceQuickDetail.discard`,`Discard`)}),P(jn,{type:`button`,size:`sm`,onClick:()=>{if(t!==null&&mc(t)&&hc(t)===`name`){u(a(`deviceQuickDetail.nameRequired`,`Name is required`));return}u(null),p(!0),(async()=>{try{if(t!==null&&t.name!==t.baseName&&await m.mutateAsync({deviceId:e,name:t.name.trim()}),t!==null&&t.location!==t.baseLocation){let n=t.location.trim();await h.mutateAsync({deviceId:e,location:n===``?null:n})}if(t!==null){let e=t.name.trim(),n=t.location.trim();r({name:e,location:n,baseName:e,baseLocation:n})}for(let e of n)e.dirty&&await e.save();_()}catch(e){u(xc(e))}finally{p(!1)}})()},disabled:!g.dirty||g.saving,children:g.saving?a(`deviceQuickDetail.saving`,`Saving…`):a(`deviceQuickDetail.save`,`Save`)})]})]})]})}a();function Cc({deviceId:e,initialName:t,label:n=`Name`,layout:r=`inline`,onError:i,onSaved:a,onCancel:o,bound:c}){let{t:l}=H(),u=j(),[d,p]=f(!1),[m,h]=f(t),[g,_]=f(!1),v=M(null);s(()=>{d||h(t)},[t,d]),s(()=>{d&&v.current?.focus()},[d]);let b=qn({onSuccess:()=>{u.invalidateQueries({queryKey:[[`deviceManager`,`getDevice`]]}),u.invalidateQueries({queryKey:[[`deviceManager`,`listAll`]]}),u.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]})}}),x=async()=>{let n=m.trim();if(n.length===0||n===t){p(!1),h(t),a?.();return}_(!0);try{await b.mutateAsync({deviceId:e,name:n}),p(!1),a?.()}catch(e){i?.(e instanceof Error?e.message:String(e))}finally{_(!1)}},S=()=>{h(t),p(!1),o?.()};return c===void 0?d?P(X,{label:n,layout:r,value:y(`div`,{className:`flex items-center gap-1`,children:[P(`input`,{ref:v,type:`text`,value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`?x():e.key===`Escape`&&S()},disabled:g,className:`flex-1 min-w-0 px-1.5 py-0.5 text-[11px] bg-background border border-border rounded focus:outline-none focus:border-primary`}),P(`button`,{type:`button`,onClick:()=>void x(),disabled:g,className:`p-0.5 rounded hover:bg-success/10 text-success disabled:opacity-50`,"aria-label":l(`inlineEdit.save`),children:P(me,{className:`h-3 w-3`})}),P(`button`,{type:`button`,onClick:S,disabled:g,className:`p-0.5 rounded hover:bg-danger/10 text-danger disabled:opacity-50`,"aria-label":l(`inlineEdit.cancel`),children:P(Oe,{className:`h-3 w-3`})})]})}):P(X,{label:n,layout:r,value:y(`div`,{className:`flex items-center gap-2 group`,children:[P(`span`,{className:`truncate`,children:t}),P(`button`,{type:`button`,onClick:()=>p(!0),className:`p-0.5 rounded text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,"aria-label":l(`inlineEdit.editName`),children:P(ne,{className:`h-3.5 w-3.5`})})]})}):P(X,{label:n,layout:r,value:P(`input`,{type:`text`,value:c.value,"aria-label":n,onChange:e=>c.onChange(e.target.value),className:`flex-1 min-w-0 w-full px-1.5 py-0.5 text-[11px] bg-background border border-border rounded focus:outline-none focus:border-primary`})})}a();function wc({deviceId:e,initialLocation:t,label:n=`Location`,layout:r=`inline`,onError:i,onSaved:a,onCancel:o,bound:c}){let{t:l}=H(),u=j(),[p,m]=f(!1),[h,g]=f(t??``),[_,v]=f(!1),b=M(null),{data:x}=_r(void 0,{enabled:p||c!==void 0}),S=x??[];s(()=>{p||g(t??``)},[t,p]),s(()=>{p&&b.current?.focus()},[p]);let C=oi({onSuccess:()=>{u.invalidateQueries({queryKey:[[`deviceManager`,`getDevice`]]}),u.invalidateQueries({queryKey:[[`deviceManager`,`listAll`]]}),u.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]}),u.invalidateQueries({queryKey:[[`deviceManager`,`listLocations`]]})}}),w=d(()=>{let e=h.trim().toLowerCase();return e.length===0?S:S.filter(t=>t.toLowerCase()!==e&&t.toLowerCase().includes(e))},[S,h]),T=h.trim().length>0&&!S.some(e=>e.toLowerCase()===h.trim().toLowerCase()),E=async n=>{let r=(n??h).trim(),o=r.length===0?null:r;if(o===(t??null)){m(!1),a?.();return}v(!0);try{await C.mutateAsync({deviceId:e,location:o}),m(!1),a?.()}catch(e){i?.(e instanceof Error?e.message:String(e))}finally{v(!1)}},D=()=>{g(t??``),m(!1),o?.()};if(c!==void 0){let e=c.value.trim().toLowerCase(),t=e.length===0?[]:S.filter(t=>t.toLowerCase()!==e&&t.toLowerCase().includes(e));return P(X,{label:n,layout:r,value:y(`div`,{className:`relative`,children:[P(`input`,{type:`text`,value:c.value,"aria-label":n,onChange:e=>c.onChange(e.target.value),placeholder:l(`shared.locationRow.roomAreaOrLeaveEmpty`,`Room / area (or leave empty to clear)`),className:`flex-1 min-w-0 w-full px-1.5 py-0.5 text-[11px] bg-background border border-border rounded focus:outline-none focus:border-primary`}),t.length>0&&P(`div`,{className:`absolute z-10 left-0 right-0 mt-0.5 max-h-40 overflow-y-auto rounded-md border border-border bg-surface shadow-md`,children:t.map(e=>y(`button`,{type:`button`,onClick:()=>c.onChange(e),className:`w-full flex items-center gap-2 px-2 py-1 text-left text-[11px] hover:bg-surface-hover`,children:[P(Ye,{className:`h-3 w-3 text-foreground-subtle flex-shrink-0`}),P(`span`,{className:`truncate`,children:e})]},e))})]})})}return p?P(X,{label:n,layout:r,value:y(`div`,{className:`relative`,children:[y(`div`,{className:`flex items-center gap-1`,children:[P(`input`,{ref:b,type:`text`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Enter`?E():e.key===`Escape`&&D()},disabled:_,placeholder:l(`shared.locationRow.roomAreaOrLeaveEmpty`,`Room / area (or leave empty to clear)`),className:`flex-1 min-w-0 px-1.5 py-0.5 text-[11px] bg-background border border-border rounded focus:outline-none focus:border-primary`}),P(`button`,{type:`button`,onClick:()=>void E(),disabled:_,className:`p-0.5 rounded hover:bg-success/10 text-success disabled:opacity-50`,"aria-label":l(`inlineEdit.save`),children:P(me,{className:`h-3 w-3`})}),P(`button`,{type:`button`,onClick:D,disabled:_,className:`p-0.5 rounded hover:bg-danger/10 text-danger disabled:opacity-50`,"aria-label":l(`inlineEdit.cancel`),children:P(Oe,{className:`h-3 w-3`})})]}),(w.length>0||T)&&y(`div`,{className:`absolute z-10 left-0 right-0 mt-0.5 max-h-40 overflow-y-auto rounded-md border border-border bg-surface shadow-md`,children:[w.map(e=>y(`button`,{type:`button`,onClick:()=>{g(e),E(e)},className:`w-full flex items-center gap-2 px-2 py-1 text-left text-[11px] hover:bg-surface-hover`,children:[P(Ye,{className:`h-3 w-3 text-foreground-subtle flex-shrink-0`}),P(`span`,{className:`truncate`,children:e})]},e)),T&&y(`button`,{type:`button`,onClick:()=>void E(),className:`w-full flex items-center gap-2 px-2 py-1 text-left text-[11px] hover:bg-surface-hover border-t border-border`,children:[P(`span`,{className:`text-foreground-subtle`,children:l(`shared.locationRow.create`,`Create`)}),y(`span`,{className:`font-medium truncate`,children:[`"`,h.trim(),`"`]})]})]})]})}):P(X,{label:n,layout:r,value:y(`div`,{className:`flex items-center gap-2 group`,children:[t?P(`span`,{className:`truncate`,children:t}):P(`span`,{className:`italic text-foreground-subtle`,children:l(`common.unset`)}),P(`button`,{type:`button`,onClick:()=>m(!0),className:`p-0.5 rounded text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,"aria-label":l(`inlineEdit.editLocation`),children:P(ne,{className:`h-3.5 w-3.5`})})]})})}a();function Tc(e){return ei({addonId:e,projection:`slim`})}function Ec(e){return Xr({deviceId:e},{enabled:Number.isFinite(e)})}var Dc=3e4,Oc=2e3;function kc(e){let t=M(0);return t.current===0&&(t.current=Date.now()),ri({parentDeviceId:e},{enabled:Number.isFinite(e),staleTime:0,refetchOnMount:`always`,refetchInterval:e=>{let n=e.state.data;return n&&n.length>0||Date.now()-t.current>=Dc?!1:Oc}})}a();function Ac({deviceId:e}){let{t}=H(),n=j(),{data:r}=Ec(e),{data:i}=kc(e),[a,o]=f(null),s=Ar({onSuccess:()=>{o(null),n.invalidateQueries({queryKey:[[`deviceManager`]]})},onError:e=>{o(`Could not change primary child: ${e.message}`)}});if(r==null||String(r.type??``)!==Ct.Container)return null;let c=(i??[]).map(e=>({id:e.id,stableId:e.stableId,type:e.type,name:e.name,...e.sourceInfo?{sourceInfo:{id:e.sourceInfo.id}}:{}}));if(c.length<=1)return null;let l=Mn(c,typeof r.linkDeviceId==`number`?r.linkDeviceId:null,typeof r.primaryChildEntityId==`string`?r.primaryChildEntityId:null),u=l===null?c[0].id:l.id;return y(E,{children:[P(X,{label:t(`shared.primaryChildRow.primaryChild`,`Primary child`),value:P(xn,{childrenList:c,selectedId:u,onSetPrimary:t=>s.mutate({deviceId:e,primaryChildEntityId:t}),disabled:s.isPending})}),a!==null&&P(`p`,{role:`alert`,className:`px-3 sm:px-4 py-1.5 text-[11px] text-danger`,children:a})]})}a();var jc=[`manufacturer`,`model`,`hardware`,`firmware`,`serialNumber`,`uid`,`mac`,`itemNo`];function Mc(e){return e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase())}function Nc(e){return e==null?`—`:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e)}function Pc(){let{t:e}=H(),t=Fn(),n=Hn(),{data:r}=Xr({deviceId:t??0},{enabled:t!==null}),{data:i}=xr({deviceId:t??0},{enabled:t!==null}),a=r??n??null,[o,s]=f(`identity`),c=vc(),l=c?.identity??null;if(t===null||!a)return null;let u=String(a.stableId??``),d=String(a.name??``),p=String(a.type??``),m=String(a.addonId??``),h=a.features??[],g=new Set([`device-status`,`feature-probe`,`device-ops`]),_=(i?.entries??[]).filter(e=>e.kind===`native`&&!g.has(e.capName)).map(e=>e.capName),v=h.length>0?h:_,b=a.location??null,x=a.metadata??null,S=x!==null&&Object.keys(x).length>0;return y(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[y(`div`,{className:`border-b border-border px-3 sm:px-4 py-2 flex items-center justify-between gap-3`,children:[P(`h2`,{className:`text-[11px] font-semibold text-foreground uppercase tracking-wider`,children:e(`overviewAdapters.deviceInfoAdapter.deviceInfo`,`Device Info`)}),S&&y(`div`,{className:`flex items-center gap-1 rounded-md bg-surface-hover p-0.5`,children:[P(Fc,{active:o===`identity`,onClick:()=>s(`identity`),label:e(`overviewAdapters.deviceInfoAdapter.identity`,`Identity`)}),P(Fc,{active:o===`hardware`,onClick:()=>s(`hardware`),label:e(`overviewAdapters.deviceInfoAdapter.hardware`,`Hardware`)})]})]}),(!S||o===`identity`)&&y(`div`,{className:`divide-y divide-border`,children:[P(X,{label:`ID`,value:y(`span`,{className:`font-mono text-[11px] text-foreground`,children:[`#${t}`,y(`span`,{className:`ml-1.5 text-foreground-subtle`,children:[`(`,u,`)`]})]})}),P(Cc,{deviceId:t,initialName:d,...l!==null&&c!==null?{bound:{value:l.name,onChange:c.setIdentityName}}:{}}),P(wc,{deviceId:t,initialLocation:b,...l!==null&&c!==null?{bound:{value:l.location,onChange:c.setIdentityLocation}}:{}}),P(Ac,{deviceId:t}),P(X,{label:e(`overviewAdapters.deviceInfoAdapter.type`,`Type`),value:p}),P(X,{label:e(`overviewAdapters.deviceInfoAdapter.provider`,`Provider`),value:P(fc,{type:m,size:`sm`,showLabel:!0})}),P(X,{label:e(`overviewAdapters.deviceInfoAdapter.capabilities`,`Capabilities`),value:v.length>0?P(oc,{capabilities:v,showLabels:!0}):P(`span`,{className:`text-[11px] text-foreground-subtle`,children:e(`overviewAdapters.deviceInfoAdapter.none`,`None`)})})]}),S&&o===`hardware`&&P(Ic,{metadata:x})]})}function Fc({active:e,onClick:t,label:n}){return P(`button`,{type:`button`,onClick:t,className:`px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${e?`bg-surface text-foreground shadow-sm`:`text-foreground-subtle hover:text-foreground`}`,children:n})}function Ic({metadata:e}){let{t}=H(),n=jc.filter(t=>t in e),r=Object.keys(e).filter(e=>!jc.includes(e)).toSorted(),i=[...n,...r];return y(`div`,{children:[P(`div`,{className:`px-3 sm:px-4 py-1.5 text-[10px] text-foreground-subtle border-b border-border bg-surface-subtle/40`,children:t(`overviewAdapters.deviceInfoAdapter.autoPopulatedByTheDriver`,`Auto-populated by the driver on every connect. Read-only.`)}),P(`div`,{className:`divide-y divide-border`,children:i.map(t=>P(X,{label:Mc(t),value:P(`span`,{className:`font-mono text-[11px] text-foreground break-all`,children:Nc(e[t])})},t))})]})}function Lc(e){return e.hubReachable?e.authOk===!1?{kind:`auth-expired`}:{kind:`cluster-degraded`,offlineAgents:e.offlineAgents,offlineAgentIds:e.offlineAgentIds}:{kind:`hub-unreachable`}}function Rc(e){switch(e.kind){case`connected`:return null;case`reconnecting`:return{severity:`warning`,message:V.t(`connection.reconnecting`),i18nKey:`connection.reconnecting`,showSpinner:!0};case`cluster-degraded`:{let t=e.offlineAgentIds??[];return t.length>0?{severity:`warning`,message:V.t(`connection.degradedNodes`,{nodes:t.join(`, `),count:t.length}),i18nKey:`connection.degradedNodes`,i18nParams:{nodes:t.join(`, `),count:t.length},showSpinner:!0}:e.offlineAgents!==null&&e.offlineAgents>0?{severity:`warning`,message:V.t(`connection.degradedCount`,{count:e.offlineAgents}),i18nKey:`connection.degradedCount`,i18nParams:{count:e.offlineAgents},showSpinner:!0}:{severity:`warning`,message:V.t(`connection.degraded`),i18nKey:`connection.degraded`,showSpinner:!0}}case`hub-unreachable`:return{severity:`danger`,message:V.t(`connection.disconnected`),i18nKey:`connection.disconnected`,showSpinner:!0};case`auth-expired`:return{severity:`danger`,message:V.t(`connection.sessionExpired`),i18nKey:`connection.sessionExpired`,showSpinner:!1,action:`sign-in`}}}var zc=4e3,Bc=5e3;function Vc(e){if(typeof e!=`object`||!e)return{offline:null,offlineIds:null,ok:null};let t={...e},n=typeof t.ok==`boolean`?t.ok:null,r=t.agents;if(typeof r!=`object`||!r)return{offline:null,offlineIds:null,ok:n};let i={...r},a=i.offline,o=typeof a==`number`?a:null,s=i.offlineIds;return{offline:o,offlineIds:Array.isArray(s)?s.filter(e=>typeof e==`string`):null,ok:n}}async function Hc(e,t,n,r){let i=new AbortController,a=setTimeout(()=>i.abort(),n);try{return await e(t,{method:`GET`,signal:i.signal,credentials:`omit`,...r===void 0?{}:{headers:r}})}finally{clearTimeout(a)}}async function Uc(e){let t=e.fetchFn??fetch,n=e.timeoutMs??zc,r=e.origin.replace(/\/+$/,``),i;try{i=await Hc(t,`${r}/health`,n)}catch{return{hubReachable:!1,authOk:`unknown`,offlineAgents:null,offlineAgentIds:null}}if(!i.ok)return{hubReachable:!1,authOk:`unknown`,offlineAgents:null,offlineAgentIds:null};let a=null,o=e.getToken();if(o!==null&&o!==``)try{let e=await Hc(t,`${r}/health/details`,n,{Authorization:`Bearer ${o}`});e.ok&&(a=await e.json())}catch{}let s;try{s=Vc(a??await i.json())}catch{s={offline:null,offlineIds:null,ok:null}}if(s.ok===!1)return{hubReachable:!1,authOk:`unknown`,offlineAgents:null,offlineAgentIds:null};let c=e.getToken(),l=`unknown`;if(c!==null&&c!==``)try{let e=await Hc(t,`${r}/trpc/auth.me`,n,{Authorization:`Bearer ${c}`});e.status===401||e.status===403?l=!1:e.ok&&(l=!0)}catch{l=`unknown`}return{hubReachable:!0,authOk:l,offlineAgents:s.offline,offlineAgentIds:s.offlineIds}}var Wc={kind:`connected`},Gc={kind:`reconnecting`};function Kc(e){let t=e.probeIntervalMs??Bc,n=new Set,r=Wc,i=0,a=!1,o=null;function s(e){if(r!==e){r=e;for(let e of n)e()}}function c(){a=!1,o!==null&&(clearTimeout(o),o=null)}function l(){let n=i;e.probe().then(e=>{n!==i||!a||(s(Lc(e)),o=setTimeout(l,t))},()=>{n!==i||!a||(s({kind:`hub-unreachable`}),o=setTimeout(l,t))})}function u(e){if(i+=1,e===`connected`){c(),s(Wc);return}if(e===`connecting`){c(),s(Gc);return}(r.kind===`connected`||r.kind===`reconnecting`)&&s(Gc),o!==null&&(clearTimeout(o),o=null),a=!0,l()}return{getSnapshot:()=>r,subscribe:e=>(n.add(e),()=>{n.delete(e)}),onSdkConnectionState:u,dispose:()=>{i+=1,c(),n.clear()}}}var qc=null;function Jc(){return qc===null&&(qc=Kc({probe:()=>Uc({origin:xe(),getToken:()=>localStorage.getItem(`camstack_admin_token`)})})),qc}function Yc(e){Jc().onSdkConnectionState(e)}var Xc=null,Zc=0;function Z(){if(!Xc){let e=Zc;Xc=Er({serverUrl:xe(),token:localStorage.getItem(`camstack_admin_token`)??void 0,getLanguage:()=>V.language,refreshCredential:async e=>{e===`rejected`?await ml().refreshNow():await ml().ensureFresh()},onConnectionChange:t=>{e===Zc&&Yc(t)}})}return Xc}function Qc(){let e=Xc;Xc=null,Zc+=1,e?.close()}var $c=`camstack_admin_token`,el=`camstack_admin_refresh`,tl=`camstack_admin_token_expires`;function nl(e){try{let t=localStorage.getItem(e);return t!==null&&t.length>0?t:null}catch{return null}}function rl(e,t){try{t===null?localStorage.removeItem(e):localStorage.setItem(e,t)}catch{}}function il(){let e=nl($c);if(e===null)return null;let t=nl(el),n=Number(nl(tl));return{token:e,...t===null?{}:{refreshToken:t},...Number.isFinite(n)&&n>0?{expiresAt:n}:{}}}function al(e){rl($c,e.token),rl(el,e.refreshToken??null),rl(tl,e.expiresAt===void 0?null:String(e.expiresAt))}function ol(){rl($c,null),rl(el,null),rl(tl,null)}function sl(e){let t=e.get(`token`);if(t===null||t.length===0)return null;let n=e.get(`refreshToken`),r=Number(e.get(`expiresAt`));return{token:t,...n!==null&&n.length>0?{refreshToken:n}:{},...Number.isFinite(r)&&r>0?{expiresAt:r}:{}}}async function cl(e){await fetch(B(`/api/auth/session`),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({token:e})}).catch(()=>{})}var ll=new Set;function ul(e){return ll.add(e),()=>ll.delete(e)}var dl=new Set;function fl(e){return dl.add(e),()=>dl.delete(e)}var pl=null;function ml(){return pl===null&&(pl=new sr({refresh:async e=>{let t=il();if(t?.refreshToken!==void 0&&t.refreshToken!==e&&(t.expiresAt??0)>Date.now()+6e4)return t;let n=await Z().refreshSession(e);return{token:n.token,refreshToken:n.refreshToken,expiresAt:n.expiresAt}},onTokens:e=>{al(e),Z().setToken(e.token),cl(e.token);for(let e of dl)e()},onExpired:()=>{ol();for(let e of ll)e()}})),pl}function hl(e){al(e),ml().adopt(e)}async function gl(e){try{await ml().ensureFresh()}catch(e){console.warn(`[admin-session] pre-reconnect refresh failed; reconnecting anyway`,e)}e()}async function _l(){return await ml().refreshNow()!==null}var vl=512;function yl(e){if(!e||e.length>vl)return null;let t=kt(e);return t===null?!e.startsWith(`/`)||e.startsWith(`//`)||e.includes(`\\`)||e.includes(`://`)||e.includes(`..`)||e===`/login`||e.startsWith(`/login?`)||e.startsWith(`/login/`)?null:{kind:`path`,path:e}:{kind:`app-callback`,url:t}}var bl=/^[A-Za-z0-9_-]{43,128}$/,xl=/^[A-Za-z0-9._~-]{1,256}$/;function Sl(e){let{codeChallenge:t,state:n}=e;return!t||!bl.test(t)||(e.codeChallengeMethod??`S256`)!==`S256`||!n||!xl.test(n)?null:{codeChallenge:t,state:n,purpose:e.purpose===`step-up`?`step-up`:`new-session`}}var Cl=`camstack:login-app-handoff`;function wl(e){if(!e)return null;try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=e=>{let n=Reflect.get(t,e);return typeof n==`string`?n:null};return Sl({codeChallenge:n(`codeChallenge`),state:n(`state`),purpose:n(`purpose`)})}catch{return null}}function Tl(e,t=Date.now()){e!==null&&Ll(Cl,JSON.stringify(e),wl,t)}function El(e=Date.now()){return Rl(Cl,wl,e)}function Dl(e,t,n){return`${e}?${`code=${encodeURIComponent(t)}`}${n===void 0?``:`&state=${encodeURIComponent(n)}`}`}function Ol(e,t=Date.now()){return Vl(t)??yl(e)}var kl=2048;function Al(e){return!e||e.length>kl||!e.startsWith(`/`)||e.startsWith(`//`)||e.includes(`\\`)||e.includes(`://`)||e.includes(`..`)||e===`/login`||e.startsWith(`/login?`)||e.startsWith(`/login/`)?null:e}function jl(e,t=Date.now()){Ll(Fl,e,Al,t)}function Ml(e=Date.now()){return Rl(Fl,Al,e)}function Nl(e,t=Date.now()){return Ml(t)??Al(e)}var Pl=`camstack:login-redirect`,Fl=`camstack:login-next`,Il=10*6e4;function Ll(e,t,n,r){let i=zl();if(!i||!n(t))return;let a={raw:t??``,at:r};try{i.setItem(e,JSON.stringify(a))}catch{}}function Rl(e,t,n){let r=zl();if(!r)return null;let i=null;try{i=r.getItem(e),r.removeItem(e)}catch{return null}if(!i)return null;try{let e=JSON.parse(i);if(typeof e!=`object`||!e)return null;let r=Reflect.get(e,`at`),a=Reflect.get(e,`raw`);return typeof r!=`number`||typeof a!=`string`||n-r>Il?null:t(a)}catch{return null}}function zl(){if(typeof window>`u`)return null;try{return window.sessionStorage}catch{return null}}function Bl(e,t=Date.now()){Ll(Pl,e,yl,t)}function Vl(e=Date.now()){return Rl(Pl,yl,e)}var Hl=`changeme`;function Ul(e){try{let t=e.split(`.`);if(t.length<2||!t[1])return null;let n=JSON.parse(atob(t[1]));return{id:String(n.userId??``),username:String(n.username??`unknown`),isAdmin:!!n.isAdmin,exp:Number(n.exp??0),scopes:Wl(n.scopes)}}catch{return null}}function Wl(e){return Ht(Pt(e))}function Gl(e){let t=Ul(e);return t?t.exp*1e3<Date.now():!0}a();var Kl=Hl;function ql(e){return{token:e.token,...e.refreshToken===void 0?{}:{refreshToken:e.refreshToken},...e.expiresAt===void 0?{}:{expiresAt:e.expiresAt}}}async function Jl(e,t){if(await cl(e),t.kind===`path`){window.location.replace(B(t.path));return}try{Qc();let e=El();if(e===null)throw Error(`The app sent no PKCE challenge and state`);let{code:n}=await Z().trpcClient.auth.createHandoffCode.mutate({purpose:e.purpose,codeChallenge:e.codeChallenge,state:e.state});window.location.replace(Dl(t.url,n,e.state))}catch{window.location.replace(B(`/`))}}async function Yl(e,t){await cl(e),window.location.replace(B(t))}var Xl=g(null);function Zl({children:e}){let[t,n]=f(null),[r,i]=f(!0),[a,o]=f(!1);s(()=>{if(typeof window<`u`&&window.location.hash.startsWith(`#token=`)){let e=new URLSearchParams(window.location.hash.slice(1)),t=sl(e),n=t?.token??null;if(t!==null&&n!==null){hl(t);let r=Vl();if(r){Jl(n,r);return}let i=Ml()??Al(e.get(`next`));if(i){Yl(n,i);return}window.history.replaceState({},``,B(`/`))}}c()},[]);let c=async()=>{let e=il();if(e===null){i(!1);return}let t=e.token;if(e.refreshToken!==void 0){let n=ml();n.adopt(e),await n.ensureFresh();let r=il();if(r===null){console.warn(`[auth] session restore: signed out — the hub refused the refresh token`),Qc(),i(!1);return}t=r.token}if(Gl(t)){console.warn(`[auth] session restore: signed out — access token expired and no refresh recovered it`),ol(),Qc(),i(!1);return}let r=Ul(t);if(!r){console.warn(`[auth] session restore: signed out — the stored access token is unreadable`),ol(),Qc(),i(!1);return}cl(t);let a=Z();a.trpcClient.system.info.query().then(()=>n(r)).catch(async e=>{let t=e?.data?.code;if(t===`UNAUTHORIZED`||t===`FORBIDDEN`){if(await _l()){a.reconnect();try{await Z().trpcClient.system.info.query();let e=il();n(e&&Ul(e.token)||r);return}catch{}}console.warn(`[auth] session restore: logout, probe UNAUTHORIZED and refresh did not recover it`),ml().stop(),ol(),Qc()}else n(r)}).finally(()=>i(!1))};s(()=>ul(()=>{Qc(),n(null),o(!1)}),[]);let l=p(async(e,t)=>{let r=await Z().login(e,t,{refreshable:!0}),i=r.secondFactors??(r.requiresTotp===!0?[`totp`]:[]);if(i.length>0)return{kind:`second-factor`,challengeToken:r.token,factors:i};let a=r.token;return hl(ql(r)),await cl(a),Qc(),n(Ul(a)),o(t===Kl),{kind:`ok`}},[]),u=p(async(e,t)=>{let r=await Z().loginVerifyTotp(e,t,{refreshable:!0}),i=r.token;hl(ql(r)),await cl(i),Qc(),n(Ul(i)),o(!1)},[]),d=p(async(e,t)=>{hl({token:e,...t}),await cl(e),Qc(),n(Ul(e)),o(!1)},[]),m=p(()=>{Z().logout().catch(()=>{}),ml().stop(),ol(),fetch(B(`/api/auth/session`),{method:`DELETE`}).catch(()=>{}),Qc(),n(null),o(!1)},[]),h=p(()=>{o(!1)},[]);return P(Xl.Provider,{value:{user:t,loading:r,mustChangePassword:a,login:l,verifyTotp:u,finalizePasskeyLogin:d,logout:m,clearMustChangePassword:h},children:e})}function Ql(){let e=v(Xl);if(!e)throw Error(`useAuth must be used within AuthProvider`);return e}a();function $l(e,t){for(let n of e)for(let e of n.fields){if(!(`key`in e)||e.key!==t)continue;if(e.type===`button`||e.type===`separator`||e.type===`info`)return!0;let r=e.immediate;return r===!0?!0:r===!1?!1:n.immediate===!0}return!1}function eu({schema:e,serverValues:t,onImmediateSave:n,onDeferredSave:r}){let[i,a]=f({}),[o,c]=f({}),[l,u]=f(!1),m=M(null),h=e?.sections??[],g=Object.keys(i).length>0,_=d(()=>({...t,...o,...i}),[t,o,i]);s(()=>{if(g||Object.keys(o).length>0){u(!0);return}m.current&&clearTimeout(m.current),m.current=setTimeout(()=>u(!1),500)},[g,o]),s(()=>()=>{m.current&&clearTimeout(m.current)},[]);let v=p(()=>{u(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>u(!1),2e3)},[]),y=p(e=>{v();let r={},o={},s={...t,...i};for(let[t,n]of Object.entries(e))s[t]!==n&&($l(h,t)?r[t]=n:o[t]=n);Object.keys(r).length>0&&n(r),a(e=>{let t={...e};for(let e of Object.keys(r))delete t[e];for(let[e,n]of Object.entries(o))t[e]=n;return t})},[v,t,i,h,n]),b=p(e=>{let t={},n={};for(let[r,a]of Object.entries(i))e.includes(r)?t[r]=a:n[r]=a;if(a(n),Object.keys(t).length===0)return;let o=Object.keys(t),s=r(t);if(s===void 0||typeof s.then!=`function`)return;c(e=>({...e,...t}));let l=()=>c(e=>{let t={...e};for(let e of o)delete t[e];return t});s.then(l,()=>{l(),a(e=>{let n={...e};for(let e of o)e in n||(n[e]=t[e]);return n})})},[i,r]),x=p(e=>{a(t=>{let n={...t};for(let t of e)delete n[t];return n})},[]),S=p(()=>{a({})},[]);return{values:_,pendingKeys:Object.keys(i),hasPendingEdits:g,editingPaused:l,handleChange:y,handleSave:b,handleDiscard:x,resetAll:S}}function Q(e){return t=>Object.prototype.hasOwnProperty.call(e,t)}var tu=Q({devices:!0}),nu=Q({classes:!0,classesExclude:!0,labelEquals:!0,identities:!0,identitiesExclude:!0,eventTypeTokens:!0,sensorKinds:!0}),ru=Q({minConfidence:!0,minImportance:!0,minLabelConfidence:!0}),iu=Q({minDwellSeconds:!0}),au=Q({source:!0}),ou=Q({crossing:!0}),su=Q({packagePhase:!0}),cu=Q({sensorTransition:!0}),lu=Q({plates:!0}),uu=Q({occupancy:!0}),du=Q({audio:!0}),fu=Q({systemEvent:!0}),pu=Q({deviceState:!0}),mu=Q({scene:!0});function hu(e,t){let n=e[t];return Array.isArray(n)?n:[]}function gu(e,t){let n=e[t];return typeof n==`number`?n:void 0}a();function _u(e,t){let n=ze().trpcClient,r=O({queries:e.map(e=>({queryKey:[[`nc-pickers`,`zones`],{deviceId:e}],staleTime:3e4,queryFn:async()=>({deviceId:e,zones:(await n.zones.listZones.query({deviceId:e})).map(e=>({id:e.id,name:e.name}))})}))});return d(()=>{let e=[],n=new Set;for(let i of r){if(!i.data)continue;let r=t.find(e=>e.id===i.data.deviceId)?.name;for(let t of i.data.zones)n.has(t.id)||(n.add(t.id),e.push({value:t.id,label:t.name,...r===void 0?{}:{hint:r}}))}return{options:e,loading:r.some(e=>e.isLoading),failed:r.some(e=>e.isError)}},[r,t])}function vu(e){let t=ze().trpcClient,n=O({queries:e.map(e=>({queryKey:[[`nc-pickers`,`event-kinds`],{deviceId:e}],staleTime:6e4,queryFn:async()=>(await t.pipelineAnalytics.listEventKinds.query({deviceId:e})).map(e=>({kind:e.kind,label:e.label}))}))});return d(()=>{let e=new Map;for(let t of n)for(let n of t.data??[])e.has(n.kind)||e.set(n.kind,n.label);let t=[...e.entries()].map(([e,t])=>({value:e,label:t}));return t.sort((e,t)=>e.label.localeCompare(t.label)),{options:t,loading:n.some(e=>e.isLoading)}},[n])}function yu(){let e=Rn();return d(()=>({options:(e.data??[]).map(e=>({value:e.id,label:e.name})),loading:e.isLoading,failed:e.isError===!0}),[e.data,e.isLoading,e.isError])}function bu(){let e=ai({limit:200}),t=dr();return d(()=>{let n=new Set;for(let e of t.data??[])e.name.trim().length>0&&n.add(e.name);let r=new Set;for(let t of e.data??[])t.text.trim().length>0&&r.add(t.text);return[...[...n].sort(),...[...r].sort()]},[e.data,t.data])}function xu({options:e,value:t,onChange:n,loading:r,emptyHint:i,placeholder:a,noFreeText:o=!1}){let{t:s}=H(),[c,l]=f(``),u=d(()=>new Set(e.map(e=>e.value)),[e]),p=d(()=>new Set(t),[t]),m=t.filter(e=>!u.has(e)),h=e=>{n(p.has(e)?t.filter(t=>t!==e):[...t,e])},g=()=>{let e=c.trim();e.length===0||t.includes(e)||(n([...t,e]),l(``))};return y(`div`,{className:`mt-1 space-y-1.5`,children:[m.length>0&&P(`div`,{className:`flex flex-wrap gap-1`,children:m.map(e=>y(`button`,{type:`button`,onClick:()=>n(t.filter(t=>t!==e)),className:`inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground hover:bg-surface-hover`,title:s(`system.notificationRulePickers.customValueClickToRemove`,`Custom value — click to remove`),children:[e,` ×`]},e))}),e.length>0?P(`div`,{className:`max-h-40 overflow-y-auto rounded-md border border-border divide-y divide-border`,children:e.map(e=>y(`label`,{className:`flex items-center gap-2.5 px-3 py-1.5 text-xs text-foreground cursor-pointer hover:bg-surface-hover`,children:[P(`input`,{type:`checkbox`,checked:p.has(e.value),onChange:()=>h(e.value),className:`accent-primary`}),P(`span`,{className:`flex-1 truncate`,children:e.label}),e.hint!==void 0&&P(`span`,{className:`text-[10px] text-foreground-subtle`,children:e.hint})]},e.value))}):P(`p`,{className:`text-[10px] text-foreground-subtle`,children:r===!0?s(`common.loading`,`Loading…`):i}),!o&&P(`input`,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),g())},placeholder:a,className:`w-full rounded-md border border-border bg-background px-2 py-1 text-xs text-foreground placeholder:text-foreground-subtle`})]})}var Su=[{value:`immediate`,get label(){return V.t(`helpers.ruleFormParsers.immediate`)},get hint(){return V.t(`helpers.ruleFormParsers.immediateHint`)}},{value:`track-end`,get label(){return V.t(`helpers.ruleFormParsers.trackEnd`)},get hint(){return V.t(`helpers.ruleFormParsers.trackEndHint`)}},{value:`device-event`,get label(){return V.t(`helpers.ruleFormParsers.deviceEvent`)},get hint(){return V.t(`helpers.ruleFormParsers.deviceEventHint`)}},{value:`package-event`,get label(){return V.t(`helpers.ruleFormParsers.packageEvent`)},get hint(){return V.t(`helpers.ruleFormParsers.packageEventHint`)}},{value:`system-event`,get label(){return V.t(`helpers.ruleFormParsers.systemEvent`)},get hint(){return V.t(`helpers.ruleFormParsers.systemEventHint`)}}],Cu=`Immediate, grouped`,wu=Su.flatMap(e=>e.value===`immediate`?[e,{value:`immediate-grouped`,get label(){return V.t(`notificationRules.grouping.choice`)},get hint(){return V.t(`helpers.ruleFormParsers.groupedHint`)}}]:[e]);function Tu(e){return e.groupingSec!==void 0&&en(e)?`immediate-grouped`:e.delivery}function Eu(e){let t=(e.delivery===`immediate`||e.delivery===`track-end`)&&en({delivery:`immediate`,conditions:e.conditions});return wu.filter(e=>e.value!==`immediate-grouped`||t)}function Du(e){return wu.find(t=>t.value===e)?.value}function Ou(e,t=Cu){return Tu(e)===`immediate-grouped`?`${t} · ${String(e.groupingSec)} s`:Au(e.delivery)}function ku(e){if(e.trim().length===0)return;let t=Number(e);return Number.isFinite(t)&&t>=0?Math.trunc(t):void 0}function Au(e){return Su.find(t=>t.value===e)?.label??e}function ju(e){return Su.some(t=>t.value===e)}var Mu=[{key:`all`,get label(){return V.t(`helpers.ruleFormParsers.sec_all_label`)},get blurb(){return V.t(`helpers.ruleFormParsers.sec_all_blurb`)},get newRuleLabel(){return V.t(`helpers.ruleFormParsers.sec_all_new`)},get emptyHint(){return V.t(`helpers.ruleFormParsers.sec_all_empty`)},creatable:!0},{key:`detection`,get label(){return V.t(`helpers.ruleFormParsers.sec_detection_label`)},get blurb(){return V.t(`helpers.ruleFormParsers.sec_detection_blurb`)},get newRuleLabel(){return V.t(`helpers.ruleFormParsers.sec_detection_new`)},get emptyHint(){return V.t(`helpers.ruleFormParsers.sec_detection_empty`)},creatable:!0},{key:`sensor`,get label(){return V.t(`helpers.ruleFormParsers.sec_sensor_label`)},get blurb(){return V.t(`helpers.ruleFormParsers.sec_sensor_blurb`)},get newRuleLabel(){return V.t(`helpers.ruleFormParsers.sec_sensor_new`)},get emptyHint(){return V.t(`helpers.ruleFormParsers.sec_sensor_empty`)},creatable:!0},{key:`audio`,get label(){return V.t(`helpers.ruleFormParsers.sec_audio_label`)},get blurb(){return V.t(`helpers.ruleFormParsers.sec_audio_blurb`)},get newRuleLabel(){return V.t(`helpers.ruleFormParsers.sec_audio_new`)},get emptyHint(){return V.t(`helpers.ruleFormParsers.sec_audio_empty`)},creatable:!0},{key:`occupancy`,get label(){return V.t(`helpers.ruleFormParsers.sec_occupancy_label`)},get blurb(){return V.t(`helpers.ruleFormParsers.sec_occupancy_blurb`)},get newRuleLabel(){return V.t(`helpers.ruleFormParsers.sec_occupancy_new`)},get emptyHint(){return V.t(`helpers.ruleFormParsers.sec_occupancy_empty`)},creatable:!0},{key:`device-events`,get label(){return V.t(`helpers.ruleFormParsers.sec_deviceEvents_label`)},get blurb(){return V.t(`helpers.ruleFormParsers.sec_deviceEvents_blurb`)},get newRuleLabel(){return V.t(`helpers.ruleFormParsers.sec_deviceEvents_new`)},get emptyHint(){return V.t(`helpers.ruleFormParsers.sec_deviceEvents_empty`)},creatable:!0},{key:`system`,get label(){return V.t(`helpers.ruleFormParsers.sec_system_label`)},get blurb(){return V.t(`helpers.ruleFormParsers.sec_system_blurb`)},get newRuleLabel(){return V.t(`helpers.ruleFormParsers.sec_system_new`)},get emptyHint(){return V.t(`helpers.ruleFormParsers.sec_system_empty`)},creatable:!0},{key:`alarm`,get label(){return V.t(`helpers.ruleFormParsers.sec_alarm_label`)},get blurb(){return V.t(`helpers.ruleFormParsers.sec_alarm_blurb`)},get newRuleLabel(){return V.t(`helpers.ruleFormParsers.sec_alarm_new`)},get emptyHint(){return V.t(`helpers.ruleFormParsers.sec_alarm_empty`)},creatable:!0},{key:`mixed`,get label(){return V.t(`helpers.ruleFormParsers.sec_mixed_label`)},get blurb(){return V.t(`helpers.ruleFormParsers.sec_mixed_blurb`)},get newRuleLabel(){return V.t(`helpers.ruleFormParsers.sec_mixed_new`)},get emptyHint(){return V.t(`helpers.ruleFormParsers.sec_mixed_empty`)},creatable:!1}];function Nu(e){return Ft(nn(e)).editable}function Pu(e){return Vt(Fu(e))}function Fu(e){switch(e){case`device-events`:case`system`:case`alarm`:case`mixed`:return e;default:return}}var Iu=new Map([[0,`helpers.ruleFormParsers.cdNone`],[60,`helpers.ruleFormParsers.cd1m`],[3600,`helpers.ruleFormParsers.cd1h`]]),Lu=86400;function Ru(e){let t=Iu.get(e);return t===void 0?e%3600==0?V.t(`helpers.ruleFormParsers.cdHours`,{count:e/3600}):e%60==0?V.t(`helpers.ruleFormParsers.cdMinutes`,{count:e/60}):V.t(`helpers.ruleFormParsers.cdSeconds`,{count:e}):V.t(t)}function zu(e){if(e.trim().length===0)return;let t=Number(e);return Number.isFinite(t)&&t>=0?Math.trunc(t):void 0}var Bu=[{value:`rule-device`,get label(){return V.t(`helpers.ruleFormParsers.scopeDevice`)}},{value:`rule`,get label(){return V.t(`helpers.ruleFormParsers.scopeRule`)}}];function Vu(e){return Bu.find(t=>t.value===e)?.value}var Hu=[{value:`per-class`,get label(){return V.t(`helpers.ruleFormParsers.granPerClass`)}},{value:`shared`,get label(){return V.t(`helpers.ruleFormParsers.granShared`)}}];function Uu(e){return Hu.find(t=>t.value===e)?.value}var Wu=[{value:`scene-boxes`,get label(){return V.t(`helpers.ruleFormParsers.imageSceneBoxes`)},get description(){return V.t(`helpers.ruleFormParsers.imageSceneBoxesDesc`)}},{value:`crop`,get label(){return V.t(`helpers.ruleFormParsers.imageCrop`)},get description(){return V.t(`helpers.ruleFormParsers.imageCropDesc`)}},{value:`clean`,get label(){return V.t(`helpers.ruleFormParsers.imageClean`)},get description(){return V.t(`helpers.ruleFormParsers.imageCleanDesc`)}},{value:`none`,get label(){return V.t(`helpers.ruleFormParsers.imageNone`)},get description(){return V.t(`helpers.ruleFormParsers.imageNoneDesc`)}}];function Gu(e){return Wu.find(t=>t.value===e)?.value}var Ku=[{value:``,get label(){return V.t(`helpers.ruleFormParsers.linkedDefault`)}},{value:`mosaic`,get label(){return V.t(`helpers.ruleFormParsers.linkedMosaic`)}},{value:`each`,get label(){return V.t(`helpers.ruleFormParsers.linkedEach`)}}];function qu(e){let t=Ku.find(t=>t.value===e)?.value;return t===``?void 0:t}var Ju=[{value:``,get label(){return V.t(`helpers.ruleFormParsers.profileLowest`)}},{value:`low`,get label(){return V.t(`helpers.ruleFormParsers.profileLow`)}},{value:`mid`,get label(){return V.t(`helpers.ruleFormParsers.profileMid`)}},{value:`high`,get label(){return V.t(`helpers.ruleFormParsers.profileHigh`)}}];function Yu(e){let t=Ju.find(t=>t.value===e)?.value;return t===``?void 0:t}var Xu=[{value:`any`,get label(){return V.t(`helpers.ruleFormParsers.srcAny`)}},{value:`pipeline`,get label(){return V.t(`helpers.ruleFormParsers.srcPipeline`)}},{value:`onboard`,get label(){return V.t(`helpers.ruleFormParsers.srcOnboard`)}},{value:`sensor`,get label(){return V.t(`helpers.ruleFormParsers.srcSensor`)}}],Zu=[{value:`delivered`,get label(){return V.t(`helpers.ruleFormParsers.phaseDelivered`)}},{value:`picked-up`,get label(){return V.t(`helpers.ruleFormParsers.phasePickedUp`)}},{value:`both`,get label(){return V.t(`helpers.ruleFormParsers.phaseBoth`)}}],Qu=[{value:``,get label(){return V.t(`helpers.ruleFormParsers.stBoth`)}},{value:`raised`,get label(){return V.t(`helpers.ruleFormParsers.stRaised`)}},{value:`cleared`,get label(){return V.t(`helpers.ruleFormParsers.stCleared`)}}];function $u(e){return e===`raised`||e===`cleared`?e:void 0}function ed(e,t){return e===`sensorTransition`?pt(t.sensorKinds):!0}var td=[{value:`enter`,get label(){return V.t(`helpers.ruleFormParsers.crossEnter`)}},{value:`exit`,get label(){return V.t(`helpers.ruleFormParsers.crossExit`)}},{value:`any`,get label(){return V.t(`helpers.ruleFormParsers.crossAny`)}}],nd=`enter`;function rd(e){return e===`exit`||e===`any`?e:void 0}var id=[{value:1,get label(){return V.t(`helpers.ruleFormParsers.prioMin`)}},{value:2,get label(){return V.t(`helpers.ruleFormParsers.prioLow`)}},{value:3,get label(){return V.t(`helpers.ruleFormParsers.prioDefault`)}},{value:4,get label(){return V.t(`helpers.ruleFormParsers.prioHigh`)}},{value:5,get label(){return V.t(`helpers.ruleFormParsers.prioMax`)}}];function ad(e,t){return e.options&&e.options.length>0?e.options:t}var od=[{value:``,get label(){return V.t(`helpers.ruleFormParsers.speedDefault`)}},{value:`1`,get label(){return V.t(`helpers.ruleFormParsers.speedReal`)}},{value:`2`,label:`2×`},{value:`3`,label:`3×`},{value:`4`,label:`4×`},{value:`6`,label:`6×`},{value:`8`,label:`8×`}];function sd(e){if(e===``)return;let t=Number(e);return Number.isFinite(t)&&t>=1&&t<=8?t:void 0}var cd=new Map(Object.entries({"device-offline":`Device offline`,"device-online":`Device online`,"device-disabled":`Device switched off`,"device-enabled":`Device switched on`,"stream-offline":`Stream offline`,"stream-online":`Stream online`,"device-battery-low":`Battery low`,"device-battery-normal":`Battery back to normal`,"device-consumable-low":`Consumable low`,"device-consumable-normal":`Consumable back to normal`,"detection-blind":`Camera detecting nothing`,"motion-noisy":`Camera motion constant, no subject`,"motion-calm":`Camera motion calm again`,"recording-stalled":`Recording stalled`,"recording-healthy":`Recording healthy again`,"recording-degraded":`Recording degraded (restart storm)`,"device-attention-required":`Device needs attention`,"device-attention-resolved":`Device attention resolved`,"storage-location-low":`Storage location low`,"storage-location-critical":`Storage location critical`,"storage-location-ok":`Storage location ok again`,"node-offline":`Node offline`,"node-online":`Node online`,"node-restarting":`Node restarting`,"node-updating":`Node updating (restart imminent)`,"node-inference-unavailable":`Node has no usable inference device`,"addon-crash-loop":`Addon stopped after repeated crashes`,"addon-update-available":`Addon update available`,"addon-updated":`Addons updated`,"server-update-available":`Server update available`,"server-updated":`Server updated`,"wrapper-update-available":`Container / app update available`,"export-completed":`Export completed`,"backup-completed":`Backup completed`,"alert-critical":`Critical alert raised`,"alert-error":`Error alert raised`,"alert-critical-resolved":`Critical alert resolved`,"rule-broken":`Notification rule broken`,"rule-repaired":`Notification rule repaired`,"alarm-arm-refused":`Alarm arm refused (something is open)`,"alarm-check-failed":`Alarm check failed (armed anyway)`,"alarm-arming":`Alarm arming (exit delay)`,"alarm-armed":`Alarm armed`,"alarm-pending":`Alarm entry delay started`,"alarm-triggered":`Alarm triggered`,"alarm-rearmed":`Alarm re-armed after siren`,"alarm-sensor-bypass":`Alarm sensor bypass`,"alarm-disarmed":`Alarm disarmed`}));function ld(e){return cd.get(e)}var ud={"device-state":`A device the hub can no longer reach, or that came back. Switched off / on is a device an operator turned off or back on — not a fault, a choice.`,streams:`A stream that stopped or came back.`,battery:`A battery below the cluster threshold, and (optionally) its return to normal. Devices with a binary low-battery indicator are judged by the indicator, not by the percentage.`,consumables:`A consumable — filter, brush, bag, supply or waste tank — at or below this rule’s threshold, or that the device reports as due for replacement, and (optionally) its return to normal after a change. A device that only says "replace" is judged by that, not by a percentage.`,"detection-blind":`A camera that MOVED — at least 10 minutes of motion over 3 sessions — was analysed, and whose detector produced nothing at all, not even a candidate under the confidence floor.`,"motion-noise":`A camera whose motion fires constantly with no subject for an hour — a quarter of the time in motion, or 40 sessions — and (optionally) its return to calm. The detector is fine; tune the motion zones or sensitivity.`,recording:`A camera whose recording is on but no footage is landing (stall), a writer that burned its restart budget (degraded), and (optionally) the return to healthy writing.`,"device-attention":`A device whose own addon raised a critical alert because it needs the operator (a missing or rejected PIN), and the return to normal.`,nodes:`An agent or worker node joining or leaving the cluster, or an online node whose inference devices all went away.`,addons:`An addon the hub has stopped restarting after repeated crashes.`,"addon-updates":`A newer version of an addon, or an addon update that just finished.`,updates:`A newer version of the server itself, or of the container / app the node runs inside, is available — or a server update just finished.`,"backups-exports":`A scheduled or manual backup of the hub finished, or a footage export finished rendering.`,alerts:`A critical or error alert opening — a runner that failed or was refused, a recording location out of space, an expired sign-in — and (optionally) a critical alert resolving. One notification per alert episode.`,storage:`A storage location running low or critical on free space — or whose capacity probe failed — and (optionally) its return to ok.`,"rule-health":`A notification rule that cannot work — it no longer loads, or still names a device or destination that was deleted — and (optionally) its repair.`,alarm:`The alarm panel refusing to arm, arming, armed, counting down to a siren, going off, re-arming, excluding an open sensor, or being disarmed.`},dd=ct.map(e=>({id:e.id,family:e.family,label:e.label,hint:ud[e.id]??``,kinds:e.kinds.flatMap(e=>{let t=ld(e);return t===void 0?[]:[{value:e,label:t}]})}));function fd(e){return dd.filter(t=>t.family===e)}function pd(e){let t=Dt(e).conditions.systemEvent;return t===void 0?{kinds:(fd(e)[0]?.kinds??[]).map(e=>e.value)}:{...t,kinds:[...t.kinds]}}var md=dd.flatMap(e=>e.kinds);function hd(e){return md.find(t=>t.value===e)?.label??e}function gd(e){return{devices:Gt(e,`deviceIds`),deviceTypes:Gt(e,`deviceTypes`),nodes:Gt(e,`nodeIds`),packages:Gt(e,`packageNames`),consumableThreshold:Gt(e,`consumableLowPercent`)}}function _d(e,t){let n=lt[e],r=gd(t);return{devices:n.includes(`deviceIds`)&&r.devices,excludeDevices:n.includes(`excludeDeviceIds`)&&r.devices,deviceTypes:n.includes(`deviceTypes`)&&r.deviceTypes,nodes:n.includes(`nodeIds`)&&r.nodes,packages:n.includes(`packageNames`)&&r.packages,consumableThreshold:n.includes(`consumableLowPercent`)&&r.consumableThreshold}}var vd=Object.values(Ct).map(e=>({value:e,label:yd(e)})).toSorted((e,t)=>e.label.localeCompare(t.label));function yd(e){let t=e.replaceAll(`-`,` `);return t.charAt(0).toUpperCase()+t.slice(1)}function bd(e,t){let n=[],r=new Set;for(let i of e.kinds){let e=vt(i.value);if(e===void 0){n.push({key:i.value,label:i.label,kinds:[i.value],clears:[i.value]});continue}r.has(e.id)||(r.add(e.id),n.push({key:`class:${e.id}`,label:t?e.snapshotLabel:e.label,kinds:t?[...e.bad]:gt(e),clears:gt(e),classId:e.id,...t&&e.snapshotSection===null?{noSnapshot:!0}:{}}))}return n}function xd(e,t){return t.clears.some(t=>e.includes(t))}function Sd(e,t,n){if(!fd(n).some(e=>e.kinds.some(e=>t.kinds.includes(e.value))))return e;let r=e?.kinds??[];if(xd(r,t)){let i=r.filter(e=>!t.clears.includes(e));return i.length===0?e:Ed(e,i,n)}return Ed(e,md.filter(e=>t.kinds.includes(e.value)||r.includes(e.value)).map(e=>e.value),n)}function Cd(e,t){return t===void 0?void 0:Ed(t,t.kinds,e)}function wd(e,t){let n=e?.kinds??[];if(n.length===0)return;let r=Td(t,`deviceIds`,e?.deviceIds),i=Td(t,`excludeDeviceIds`,e?.excludeDeviceIds),a=Td(t,`deviceTypes`,e?.deviceTypes),o=Td(t,`nodeIds`,e?.nodeIds),s=Td(t,`packageNames`,e?.packageNames),c=Object.prototype.hasOwnProperty.call(t,`consumableLowPercent`)?t.consumableLowPercent:e?.consumableLowPercent;return{kinds:[...n],...r===void 0?{}:{deviceIds:[...r]},...i===void 0?{}:{excludeDeviceIds:[...i]},...a===void 0?{}:{deviceTypes:[...a]},...o===void 0?{}:{nodeIds:[...o]},...s===void 0?{}:{packageNames:[...s]},...c===void 0?{}:{consumableLowPercent:c}}}function Td(e,t,n){let r=Object.prototype.hasOwnProperty.call(e,t)?e[t]:n;return r!==void 0&&r.length===0?void 0:r}function Ed(e,t,n){let r=_d(n,t),i=r.devices?e?.deviceIds:void 0,a=r.excludeDevices?e?.excludeDeviceIds:void 0,o=r.deviceTypes?e?.deviceTypes:void 0,s=r.nodes?e?.nodeIds:void 0,c=r.packages?e?.packageNames:void 0,l=r.consumableThreshold?e?.consumableLowPercent:void 0;return{kinds:[...t],...i&&i.length>0?{deviceIds:[...i]}:{},...a&&a.length>0?{excludeDeviceIds:[...a]}:{},...o&&o.length>0?{deviceTypes:[...o]}:{},...s&&s.length>0?{nodeIds:[...s]}:{},...c&&c.length>0?{packageNames:[...c]}:{},...l===void 0?{}:{consumableLowPercent:l}}}var Dd=95;function Od(e){let t=e.trim();if(t===``)return{kind:`clear`};let n=Number(t);return Number.isInteger(n)&&n>=1&&n<=Dd?{kind:`set`,value:n}:{kind:`invalid`}}function kd(e,t=2){if(e===void 0||e.length===0)return V.t(`helpers.notificationSystemEvents.noneSelected`);let n=e.slice(0,t).map(hd).join(`, `),r=e.length-Math.min(t,e.length);return r>0?`${n} +${r}`:n}function Ad(e){if(e===void 0)return`—`;let t=[],n=e.deviceIds?.length??0,r=e.deviceTypes?.length??0,i=e.nodeIds?.length??0,a=e.packageNames?.length??0,o=e.excludeDeviceIds?.length??0;r>0&&t.push(e.deviceTypes?.map(yd).join(`, `)??``),n>0&&t.push(`${n} device${n===1?``:`s`}`),i>0&&t.push(`${i} node${i===1?``:`s`}`),a>0&&t.push(`${a} package${a===1?``:`s`}`);let s=o>0?`except ${o} device${o===1?``:`s`}`:null,c=e.consumableLowPercent===void 0?[]:[`consumables at ${e.consumableLowPercent}%`];return t.length===0?[s===null?`Everything`:`Everything ${s}`,...c].join(` · `):[...t,...s===null?[]:[s],...c].join(` · `)}function jd(e){return e===void 0||(e.deviceTypes?.length??0)===0?!1:e.kinds.some(e=>Bt.includes(e))}var Md=[`all`,`only`,`except`];function Nd(e,t){return(e??[]).length>0?`only`:(t??[]).length>0?`except`:`all`}function Pd(e,t){let n=[...e??[]],r=[...t??[]];return{mode:Nd(n,r),include:n,exclude:r,legacyBoth:n.length>0&&r.length>0}}function Fd(e,t){return{...e,mode:t}}function Id(e){switch(e.mode){case`only`:return e.include;case`except`:return e.exclude;case`all`:return[]}}function Ld(e,t){switch(e.mode){case`only`:return{...e,include:[...t]};case`except`:return{...e,exclude:[...t]};case`all`:return e}}function Rd(e){return e.mode===`only`&&e.legacyBoth?e.exclude:[]}function zd(e){return{...e,exclude:[],legacyBoth:!1}}function Bd(e){switch(e.mode){case`all`:return{};case`except`:return e.exclude.length>0?{exclude:[...e.exclude]}:{};case`only`:{let t=Rd(e);return{...e.include.length>0?{include:[...e.include]}:{},...t.length>0?{exclude:[...t]}:{}}}}}function Vd(e){let t=Bd(e),n=t.include??[],r=t.exclude??[];return[...e.include.filter(e=>!n.includes(e)),...e.exclude.filter(e=>!r.includes(e))]}var Hd=[`onActivation`,`onDeactivation`,`onTrigger`,`onTriggerOff`],Ud={onActivation:{get title(){return V.t(`helpers.notificationRuleActions.onActivationTitle`)},get hint(){return V.t(`helpers.notificationRuleActions.onActivationHint`)}},onDeactivation:{get title(){return V.t(`helpers.notificationRuleActions.onDeactivationTitle`)},get hint(){return V.t(`helpers.notificationRuleActions.onDeactivationHint`)}},onTrigger:{get title(){return V.t(`helpers.notificationRuleActions.onTriggerTitle`)},get hint(){return V.t(`helpers.notificationRuleActions.onTriggerHint`)}},onTriggerOff:{get title(){return V.t(`helpers.notificationRuleActions.onTriggerOffTitle`)},get hint(){return V.t(`helpers.notificationRuleActions.onTriggerOffHint`)}}},Wd={onActivation:[],onDeactivation:[],onTrigger:[],onTriggerOff:[],buttons:[]};function Gd(e){return e===void 0?Wd:{onActivation:[...e.onActivation??[]],onDeactivation:[...e.onDeactivation??[]],onTrigger:[...e.onTrigger??[]],onTriggerOff:[...e.onTriggerOff??[]],buttons:[...e.buttons??[]]}}function Kd(e){let t=e.buttons.filter(e=>e.id.trim()!==``&&e.label.trim()!==``&&e.sequenceId.trim()!==``),n={onActivation:e.onActivation,onDeactivation:e.onDeactivation,onTrigger:e.onTrigger,onTriggerOff:e.onTriggerOff};if(!(!Hd.some(e=>n[e].length>0)&&t.length===0))return{...n.onActivation.length>0?{onActivation:[...n.onActivation]}:{},...n.onDeactivation.length>0?{onDeactivation:[...n.onDeactivation]}:{},...n.onTrigger.length>0?{onTrigger:[...n.onTrigger]}:{},...n.onTriggerOff.length>0?{onTriggerOff:[...n.onTriggerOff]}:{},...t.length>0?{buttons:t}:{}}}function qd(e,t){let n=[];for(let r of Hd){let i=e[r];i.length>4&&n.push({kind:`too-many`,message:V.t(`helpers.notificationRuleActions.tooMany`,{title:Ud[r].title})});for(let e of i)e.kind===`sequence`&&!t.has(e.sequenceId)&&n.push({kind:`unknown-sequence`,message:V.t(`helpers.notificationRuleActions.hookUnknownSeq`,{title:Ud[r].title})})}let r=new Set;for(let i of e.buttons){let e=i.id.trim();e!==``&&(r.has(e)&&n.push({kind:`duplicate-button`,message:V.t(`helpers.notificationRuleActions.dupButton`,{id:e})}),r.add(e),t.has(i.sequenceId.trim())||n.push({kind:`unknown-sequence`,message:V.t(`helpers.notificationRuleActions.buttonUnknownSeq`,{label:i.label||e})}))}return n}function Jd(e,t){return{id:`action-${String(e+1)}`,label:V.t(`helpers.notificationRuleActions.newButtonLabel`),sequenceId:t}}function Yd(){return{kind:`do`,action:{kind:`cap`,deviceId:0,cap:``,method:``}}}function Xd(e){return{kind:`sequence`,sequenceId:e}}function Zd(){return{kind:`wait`,seconds:5}}var Qd=[{value:`acknowledge`,get label(){return V.t(`helpers.notificationRuleActions.icon_acknowledge`)}},{value:`dismiss`,get label(){return V.t(`helpers.notificationRuleActions.icon_dismiss`)}},{value:`silence`,get label(){return V.t(`helpers.notificationRuleActions.icon_silence`)}},{value:`snooze`,get label(){return V.t(`helpers.notificationRuleActions.icon_snooze`)}},{value:`view`,get label(){return V.t(`helpers.notificationRuleActions.icon_view`)}},{value:`play`,get label(){return V.t(`helpers.notificationRuleActions.icon_play`)}},{value:`camera`,get label(){return V.t(`helpers.notificationRuleActions.icon_camera`)}},{value:`open`,get label(){return V.t(`helpers.notificationRuleActions.icon_open`)}},{value:`close`,get label(){return V.t(`helpers.notificationRuleActions.icon_close`)}},{value:`unlock`,get label(){return V.t(`helpers.notificationRuleActions.icon_unlock`)}},{value:`lock`,get label(){return V.t(`helpers.notificationRuleActions.icon_lock`)}},{value:`disarm`,get label(){return V.t(`helpers.notificationRuleActions.icon_disarm`)}},{value:`arm`,get label(){return V.t(`helpers.notificationRuleActions.icon_arm`)}},{value:`arm-home`,get label(){return V.t(`helpers.notificationRuleActions.icon_arm_home`)}},{value:`arm-away`,get label(){return V.t(`helpers.notificationRuleActions.icon_arm_away`)}},{value:`arm-night`,get label(){return V.t(`helpers.notificationRuleActions.icon_arm_night`)}},{value:`light`,get label(){return V.t(`helpers.notificationRuleActions.icon_light`)}},{value:`alert`,get label(){return V.t(`helpers.notificationRuleActions.icon_alert`)}}],$d=[10,30,60],ef=[5,10,15,30,60,120,240,480];function tf(e){return e>=60&&e%60==0?V.t(`helpers.ruleFormState.snoozeHours`,{count:e/60}):V.t(`helpers.ruleFormState.snoozeMin`,{count:e})}var nf=new Set([`alarm-arm-refused`,`alarm-check-failed`,`alarm-arming`,`alarm-armed`,`alarm-pending`,`alarm-triggered`,`alarm-rearmed`,`alarm-sensor-bypass`,`alarm-disarmed`]),rf=`alarm-panel`;function af(e,t){for(let t of e.systemEvent?.kinds??[])if(nf.has(t))return!0;for(let e of t)if(e.kind===`cap`&&e.cap===rf)return!0;return!1}function of(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[];for(let t of[`onActivation`,`onDeactivation`,`onTrigger`,`onTriggerOff`])for(let i of e[t])if(i.kind===`do`)r.push(i.action);else{let e=n.get(i.sequenceId);e!==void 0&&r.push(...e.actions)}for(let t of e.buttons){let e=n.get(t.sequenceId);e!==void 0&&r.push(...e.actions)}return r}function sf(e){let{devices:t,devicesExclude:n,classes:r,classesExclude:i,...a}=e;return{conditions:a,deviceScope:Pd(t,n),classScope:Pd(r,i)}}function cf(e){let t=Bd(e.deviceScope),n=Bd(e.classScope);return{...e.conditions,...t.include===void 0?{}:{devices:[...t.include]},...t.exclude===void 0?{}:{devicesExclude:[...t.exclude]},...n.include===void 0?{}:{classes:[...n.include]},...n.exclude===void 0?{}:{classesExclude:[...n.exclude]}}}function lf(e){return e.deviceScope.mode===`only`?e.deviceScope.include:[]}function uf(e,t,n){let r=nn(n);return e.some(e=>e.id===t&&Rt(e,n.delivery,r))}function df(e=`immediate`,t={}){return{name:``,enabled:!0,delivery:e,targetIds:[],targetUsers:[],targetParams:{},priority:3,mediaImage:It({},nn({delivery:e,conditions:t})),mediaShowTriggerZone:!1,mediaShowSubjectPath:!1,mediaGif:!1,mediaClip:!1,mediaProfile:void 0,mediaClipSpeed:void 0,mediaLinkedCameras:void 0,templateTitle:``,templateBody:``,...sf(t),schedule:void 0,systemEventDelivery:void 0,snoozeAllowGlobal:!1,groupingSec:void 0,snoozeOptions:void 0,actions:Wd,cooldownSec:30,cooldownScope:`rule-device`,cooldownGranularity:void 0}}function ff(e){let t={};for(let n of e.targets)n.params&&Object.keys(n.params).length>0&&(t[n.targetId]=n.params);return{name:e.name,enabled:e.enabled,delivery:e.delivery,targetIds:e.targets.map(e=>e.targetId),targetUsers:e.targetUsers??[],targetParams:t,priority:e.priority,mediaImage:It(e.media,nn(e)),mediaShowTriggerZone:e.media.showTriggerZone===!0,mediaShowSubjectPath:e.media.showSubjectPath===!0,mediaGif:e.media.gif===!0,mediaClip:e.media.clip===!0,mediaProfile:e.media.profile,mediaClipSpeed:e.media.clipSpeed,mediaLinkedCameras:e.media.linkedCameras,templateTitle:e.template?.title??``,templateBody:e.template?.body??``,...sf(e.conditions),schedule:e.schedule,systemEventDelivery:e.systemEventDelivery,snoozeAllowGlobal:e.snoozeAllowGlobal===!0,groupingSec:e.groupingSec,snoozeOptions:e.snoozeOptions,actions:Gd(e.actions),cooldownSec:e.throttle.cooldownSec,cooldownScope:e.throttle.scope,cooldownGranularity:e.throttle.granularity}}function pf(e,t){let n=[];if(bf(e)){let r=e.groupingSec;r!==void 0&&(!Number.isInteger(r)||r<5||r>60)&&n.push(`The grouping window is a whole number of seconds between 5 and 60.`);let i=t?.confirm;i?.enabled===!0&&i.expect!==void 0&&!xf(i.expect)&&n.push(`This rule’s AI confirm expects more than one subject, but a grouped message judges one picture per subject, so it would never send. Remove the confirm expectation (viewer or API), or choose Immediate.`)}if(_t(e.conditions.audio)&&n.push(`This sound rule names neither a sound nor a level threshold, so it can never fire — every sample would count as a hit and the engine refuses it rather than notifying on silence. Pick at least one sound, or add a level.`),(!Number.isInteger(e.cooldownSec)||e.cooldownSec<0||e.cooldownSec>86400)&&n.push(`The cooldown is a whole number of seconds between 0 and ${String(Lu)} (24 hours). 0 means every match is delivered.`),gf(e))for(let t of xt({delivery:e.delivery,conditions:e.conditions,...e.systemEventDelivery===void 0?{}:{systemEventDelivery:e.systemEventDelivery},...Kd(e.actions)===void 0?{}:{actions:Kd(e.actions)}}))n.push(Wt(t));return n}function mf(e){let t=e.systemEventDelivery;if(t===void 0)return{};if(!qt(e.delivery))return t.mode===`summary`?{systemEventDelivery:{mode:`instant`}}:{};if(t.mode===`summary`&&bt(t.schedule)===null){let e=Ut(t.schedule);if(e!==null&&e.times.length>0)return{systemEventDelivery:{...t,schedule:it(e.times,t.schedule.timezone)}}}return{systemEventDelivery:t}}function hf(e){if(!gf(e))return null;if(!ut(e.templateBody))return V.t(`helpers.ruleFormState.summaryWarnNone`,{token:`{{summaryText}}`});let t=e.templateBody;return(e.systemEventDelivery?.mode===`summary`?e.systemEventDelivery.split:void 0)===`section`&&t.trim().length>0&&!/\{\{\s*summaryText\s*\}\}/.test(t)?V.t(`helpers.ruleFormState.summaryWarnSplit`,{token:`{{summaryText}}`}):null}function gf(e){return qt(e.delivery)&&e.systemEventDelivery?.mode===`summary`}function _f(e,t,n=new Set){return pf(e,t).length===0&&ju(e.delivery)&&(!qt(e.delivery)||Tf(e)>0)&&nn(e)!==`mixed`&&e.name.trim().length>0&&(e.targetIds.length>0||e.targetUsers.length>0)&&qd(e.actions,n).length===0}function vf(e,t){let n=Cf(e.conditions,t);return qt(t)&&(n.systemEvent?.kinds.length??0)===0?{...e,delivery:t,conditions:{...n,systemEvent:pd(`device-events`)}}:{...e,delivery:t,conditions:n}}function yf(e,t){return t===`immediate-grouped`?{...vf(e,`immediate`),groupingSec:e.groupingSec??20}:{...vf(e,t),groupingSec:void 0}}function bf(e){return e.groupingSec!==void 0&&en(e)}function xf(e){switch(e.op){case`>`:return 1>e.count;case`<=`:return 1<=e.count;case`<`:return 1<e.count;case`==`:return e.count===1;default:return 1>=e.count}}var Sf=new Set([`immediate`,`track-end`,`package-event`]);function Cf(e,t){if(e.source!==`pipeline`||Sf.has(t))return e;let{source:n,...r}=e;return r}function wf(e,t){return tn(e.conditions.systemEvent)===t?e:{...e,conditions:{...e.conditions,systemEvent:pd(t)}}}function Tf(e){return e.conditions.systemEvent?.kinds.length??0}function Ef(e,t){return e.appliesTo.includes(t)}var Df={source:`any`};function Of(e,t){if(t==null)return!0;if(Array.isArray(t))return t.length===0;if(typeof t==`string`)return t.length===0||Df[e]===t;if(typeof t==`number`)return!Number.isFinite(t);if(typeof t==`object`){if(`ids`in t){let e=t.ids;return!Array.isArray(e)||e.length===0}if(`values`in t){let e=t.values;return!Array.isArray(e)||e.length===0}return!1}return!1}var kf=zt.filter(e=>e.id===`audio`);function Af(e){if(e.length===0)return e;let t=new Set(e.map(e=>e.id)),n=kf.filter(e=>!t.has(e.id));return n.length===0?e:[...e,...n]}function jf(e,t,n,r=nn({delivery:t,conditions:e})){let i=n.length===0?null:new Set(n.filter(e=>e.id!==`schedule`&&Rt(e,t,r)).map(e=>e.id)),a={};for(let[t,n]of Object.entries(e))i!==null&&!i.has(t)||ed(t,e)&&(Of(t,n)||(a[t]=n));return a}function Mf(e,t){if(e===void 0)return{};let n=Cd(e,t.systemEvent);return n===void 0?{}:{systemEvent:n}}function Nf(e){return e!==void 0&&e.windows.length>0}function Pf(e){let t={...e.clipPreRollSec===void 0?{}:{clipPreRollSec:e.clipPreRollSec},...e.clipPostRollSec===void 0?{}:{clipPostRollSec:e.clipPostRollSec}};return Object.keys(t).length>0?t:void 0}function Ff(e){let t=Pf(e.media);return{...e.confirm===void 0?{}:{confirm:e.confirm},...t===void 0?{}:{media:t}}}function If(e,t,n=[]){let r=e.templateTitle.trim(),i=e.templateBody.trim(),a=r.length>0||i.length>0?{...r.length>0?{title:r}:{},...i.length>0?{body:i}:{}}:void 0,o=Kd(e.actions),s=nn(e),c=Ft(s),l=st(s),u=n.length===0?!0:n.some(t=>t.id===`schedule`&&Ef(t,e.delivery)),d=!gf(e)&&u&&Nf(e.schedule)?e.schedule:void 0,f=n.length===0?!0:n.some(t=>t.id===`devices`&&Ef(t,e.delivery)),p=n.length===0?!0:n.some(t=>t.id===`devicesExclude`&&Ef(t,e.delivery)),{devices:m,devicesExclude:h,...g}=cf(e),_=jf(g,e.delivery,n,s);return{name:e.name.trim(),enabled:e.enabled,delivery:e.delivery,conditions:{..._,...f&&m!==void 0?{devices:m}:{},...p&&h!==void 0?{devicesExclude:h}:{},...Mf(l,e.conditions)},...d?{schedule:d}:{},...mf(e),targets:e.targetIds.map(t=>{let n=e.targetParams[t];return n&&Object.keys(n).length>0?{targetId:t,params:n}:{targetId:t}}),...e.targetUsers.length>0?{targetUsers:[...e.targetUsers]}:{},media:c.carriesMedia?{image:e.mediaImage,...e.mediaShowTriggerZone&&e.mediaImage!==`crop`&&e.mediaImage!==`none`&&Kt(_).length>0?{showTriggerZone:!0}:{},...e.mediaShowSubjectPath&&e.mediaImage!==`none`&&$t(s)?{showSubjectPath:!0}:{},...e.mediaGif?{gif:!0}:{},...e.mediaClip?{clip:!0}:{},...e.mediaProfile===void 0?{}:{profile:e.mediaProfile},...e.mediaClipSpeed===void 0?{}:{clipSpeed:e.mediaClipSpeed},...s===`sensor`&&e.mediaImage!==`none`&&e.mediaLinkedCameras!==void 0?{linkedCameras:e.mediaLinkedCameras}:{},...(e.mediaGif||e.mediaClip)&&t?.media?.clipPreRollSec!==void 0?{clipPreRollSec:t.media.clipPreRollSec}:{},...(e.mediaGif||e.mediaClip)&&t?.media?.clipPostRollSec!==void 0?{clipPostRollSec:t.media.clipPostRollSec}:{}}:{image:`none`},throttle:{cooldownSec:e.cooldownSec,scope:e.cooldownScope,...e.cooldownGranularity===void 0?{}:{granularity:e.cooldownGranularity}},priority:e.priority,...a?{template:a}:{},...e.snoozeAllowGlobal?{snoozeAllowGlobal:!0}:{},...bf(e)?{groupingSec:e.groupingSec}:{},...e.snoozeOptions===void 0?{}:{snoozeOptions:[...e.snoozeOptions]},...t?.confirm===void 0?{}:{confirm:t.confirm},...o===void 0?{}:{actions:o}}}function Lf(e,t){let n=If(e,void 0,t);return[`template`,`schedule`,`targetUsers`,`snoozeOptions`,`snoozeAllowGlobal`,`groupingSec`,`actions`].filter(e=>n[e]===void 0)}var Rf=[{key:`rule`,get label(){return V.t(`helpers.ruleFormTabs.tab_rule`)},fields:[`name`,`enabled`,`delivery`,`groupingSec`,`targetIds`,`targetUsers`,`targetParams`]},{key:`devices`,get label(){return V.t(`helpers.ruleFormTabs.tab_devices`)},fields:[`deviceScope`]},{key:`conditions`,get label(){return V.t(`helpers.ruleFormTabs.tab_conditions`)},fields:[`conditions`,`classScope`,`schedule`,`systemEventDelivery`]},{key:`notification`,get label(){return V.t(`helpers.ruleFormTabs.tab_notification`)},fields:[`priority`,`mediaImage`,`mediaShowTriggerZone`,`mediaShowSubjectPath`,`mediaGif`,`mediaClip`,`mediaProfile`,`mediaClipSpeed`,`mediaLinkedCameras`,`templateTitle`,`templateBody`]},{key:`actions`,get label(){return V.t(`helpers.ruleFormTabs.tab_actions`)},fields:[`actions`]},{key:`advanced`,get label(){return V.t(`helpers.ruleFormTabs.tab_advanced`)},fields:[`snoozeAllowGlobal`,`snoozeOptions`,`cooldownSec`,`cooldownScope`,`cooldownGranularity`]}];function zf(e,t={}){let n=nn({delivery:e,conditions:t}),r=Ft(n),i=Rf.map(e=>e.key===`conditions`?{...e,label:r.label}:e);return Vt(n)?i.filter(e=>e.key!==`devices`):i}function Bf(e){if(e.audio!==void 0)return V.t(`helpers.ruleFormTabs.condSound`);if(e.occupancy!==void 0)return V.t(`helpers.ruleFormTabs.condOccupancy`)}function Vf(e){let t=nn(e),n=Xt(cf(e),t);return t===`sensor`&&e.conditions.sensorTransition!==void 0&&!ed(`sensorTransition`,e.conditions)?[...n,{conditionId:`sensorTransition`,reason:Nt}]:n}var Hf=`rule`;function Uf(e){return Rf.find(t=>t.key===e)?.key}function Wf(e){return e?.toLowerCase().startsWith(`it`)===!0?`it`:`en`}function Gf(){let{i18n:e}=H(),t=Wf(e.language);return e=>Ot(e,t)}a();var Kf=`block text-[11px] font-medium text-foreground`,qf=`text-[10px] text-foreground-subtle mt-0.5`;function Jf({cameras:e,fleet:t,value:n,onChange:r,emptyMeansAll:i=!1,savedHadDevices:a=!1}){return P(Bn,{devices:e,listState:t.state,fleet:t,value:n,onChange:r,emptyMeansAll:i,savedHadDevices:a})}function Yf({value:e,placeholder:t,onChange:n}){let{t:r}=H(),[i,a]=f(``),o=()=>{let t=i.trim();if(t.length===0||e.includes(t)){a(``);return}n([...e,t]),a(``)},s=t=>n(e.filter(e=>e!==t));return y(`div`,{className:`mt-1 space-y-1.5`,children:[e.length>0&&P(`div`,{className:`flex flex-wrap gap-1`,children:e.map(e=>y(`span`,{className:`inline-flex items-center gap-1 rounded bg-surface-hover px-1.5 py-0.5 text-[11px] text-foreground`,children:[e,P(`button`,{type:`button`,onClick:()=>s(e),"aria-label":r(`system.notificationConditionWidgets.remove`,`remove {{v}}`,{v:e}),className:`text-foreground-subtle hover:text-danger`,children:P(Oe,{className:`h-3 w-3`})})]},e))}),P(Ln,{value:i,placeholder:t,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),o())},onBlur:o})]})}function Xf({picker:e,value:t,onChange:n}){let{t:r}=H(),i=d(()=>at(e),[e]),a=d(()=>new Set(t),[t]),o=t.filter(e=>!i.has(e)),s=e=>{n(a.has(e)?t.filter(t=>t!==e):[...t,e])};return y(`div`,{className:`space-y-2`,children:[o.length>0&&P(`div`,{className:`flex flex-wrap gap-1`,children:o.map(e=>y(`button`,{type:`button`,onClick:()=>n(t.filter(t=>t!==e)),className:`inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground hover:bg-surface-hover`,title:r(`system.notificationConditionWidgets.customValueClickToRemove`,`Custom value — click to remove`),children:[e,` ×`]},e))}),e.groups.map(e=>y(`div`,{children:[P(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-muted mb-1`,children:e.fallbackLabel}),P(`div`,{className:`flex flex-wrap gap-1`,children:e.options.map(e=>{let t=a.has(e.value);return P(`button`,{type:`button`,"aria-pressed":t,onClick:()=>s(e.value),className:t?`rounded border border-primary bg-primary/15 px-1.5 py-0.5 text-[10px] text-foreground`:`rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground hover:bg-surface-hover`,children:e.label},e.value)})})]},e.key))]})}function Zf({value:e,min:t,max:n,step:r,onChange:i}){let{t:a}=H();return y(`div`,{className:`mt-1 flex items-center gap-2`,children:[P(Ln,{type:`number`,value:e??``,min:t,max:n,step:r,className:`max-w-[8rem]`,onChange:e=>{let t=e.target.value;if(t===``){i(void 0);return}let n=Number(t);i(Number.isFinite(n)?n:void 0)}}),e!==void 0&&n!==void 0&&P(`input`,{type:`range`,min:t,max:n,step:r,value:e,onChange:e=>i(Number(e.target.value)),className:`flex-1 accent-primary`,"aria-label":a(`common.valueWord`)})]})}function Qf({value:e,onChange:t,options:n}){let{t:r}=H(),i=$f(n??[]),a=i.length>0?i:td;return y(`div`,{className:`mt-1 space-y-1`,children:[P(ir,{value:e??`enter`,options:a.map(e=>({value:e.value,label:r(`notificationRules.crossing.${e.value}`,e.label)})),onChange:e=>t(rd(e.target.value))}),P(`p`,{className:qf,children:r(`notificationRules.crossing.hint`,`Which way the subject crosses the zone.`)})]})}function $f(e){let t=[];for(let n of e){let e=n.value===``||n.value===`enter`?nd:rd(n.value);e===void 0||t.some(t=>t.value===e)||t.push({value:e,label:n.label})}return t}function ep({deviceIds:e,cameras:t,value:n,onChange:r}){let{options:i,loading:a}=_u(e,t);return P(xu,{options:i,value:n,onChange:r,loading:a,noFreeText:!0,emptyHint:e.length===0?`Select cameras first — a rule can only use zones those cameras actually have.`:`The selected cameras have no zones. Draw one in the camera’s zone editor first.`,placeholder:``})}function tp({deviceIds:e,value:t,onChange:n}){let{t:r}=H(),{options:i,loading:a}=vu(e);return P(xu,{options:i,value:t,onChange:n,loading:a,emptyHint:e.length===0?`Select cameras above to pick their event kinds — or type a token.`:`No event kinds reported for the selected cameras — type a token.`,placeholder:r(`system.notificationConditionWidgets.eventToken`,`Event token…`)})}var np=[{value:`became-occupied`,labelKey:`system.notificationConditionWidgets.opBecameOccupied`},{value:`became-free`,labelKey:`system.notificationConditionWidgets.opBecameFree`},{value:`>=`,labelKey:`system.notificationConditionWidgets.opCountAtLeast`},{value:`<=`,labelKey:`system.notificationConditionWidgets.opCountAtMost`}];function rp(e,t){let n=e.map(e=>({value:e.value,label:e.label}));return t===void 0||t===``||n.some(e=>e.value===t)?n:[...n,{value:t,label:V.t(`system.notificationConditionWidgets.subTypeNeverCountsAlways`,`{{stored}} — sub-type, never counts (always 0)`,{stored:t})}]}function ip({deviceIds:e,cameras:t,classOptions:n,value:r,onChange:i}){let{t:a}=H(),{options:o,loading:s}=_u(e,t),c=r??Lt,l=e=>i({...c,...e}),u=c.op===`became-occupied`||c.op===`became-free`,d=rp(n,c.className);return y(`div`,{className:`mt-1 space-y-1.5`,children:[y(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[P(`div`,{className:`min-w-[10rem]`,children:P(ir,{value:c.zoneId??``,options:[{value:``,label:s?a(`system.notificationConditionWidgets.loadingZones`,`Loading zones…`):a(`system.notificationConditionWidgets.wholeFrame`,`— whole frame —`)},...o.map(e=>({value:e.value,label:e.label}))],onChange:e=>l({zoneId:e.target.value===``?void 0:e.target.value})})}),P(`div`,{className:`min-w-[9rem]`,children:P(ir,{value:c.className??``,options:[{value:``,label:a(`system.notificationConditionWidgets.anyClass`,`— any class —`)},...d],onChange:e=>l({className:e.target.value===``?void 0:e.target.value})})}),P(`div`,{className:`min-w-[9rem]`,children:P(ir,{value:c.op,options:np.map(e=>({value:e.value,label:a(e.labelKey)})),onChange:e=>{let t=np.find(t=>t.value===e.target.value);t&&l({op:t.value})}})})]}),y(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-foreground-subtle`,children:[y(`label`,{className:`flex items-center gap-1`,children:[u?a(`system.notificationConditionWidgets.threshold`,`Threshold`):a(`system.notificationConditionWidgets.count`,`Count`),P(Ln,{type:`number`,min:0,className:`w-16`,value:String(c.count),onChange:e=>l({count:Math.max(0,Number(e.target.value)||0)})})]}),y(`label`,{className:`flex items-center gap-1`,children:[a(`system.notificationConditionWidgets.holdFor`,`Hold for`),P(Ln,{type:`number`,min:0,max:3600,className:`w-16`,value:String(c.sustainSeconds),onChange:e=>l({sustainSeconds:Math.min(3600,Math.max(0,Number(e.target.value)||0))})}),`s`]}),r===void 0?null:P(`button`,{type:`button`,onClick:()=>i(void 0),className:`underline hover:text-foreground`,children:a(`system.notificationConditionWidgets.clear`,`Clear`)})]}),e.length===0&&P(`p`,{className:`text-[11px] text-warning`,children:a(`system.notificationConditionWidgets.noCameraPickedOnThe`,`No camera picked on the Devices tab: this watches EVERY camera's occupancy, and no zone can be offered until you choose one — a zone id belongs to a camera.`)}),P(`p`,{className:`text-[11px] text-foreground-subtle`,children:a(`system.notificationConditionWidgets.countsConfirmedTrackedObjectsFrom`,`Counts confirmed tracked objects from zone analytics. The change must hold for the sustain window before it fires; with no snapshot for the camera or zone the rule never fires.`)})]})}var ap=[{value:`label`,labelKey:`system.notificationConditionWidgets.audioModeLabel`,Icon:Ae},{value:`level`,labelKey:`system.notificationConditionWidgets.audioModeLevel`,Icon:Je}];function op({taxonomy:e,value:t,onChange:n}){let{t:r}=H(),i=rn(t),a=e=>n(Mt(t,e)),{choices:o,unknownLabels:s}=yt(e,i.labels),c=Et(t)??`label`;return y(`div`,{className:`mt-1 space-y-2`,children:[y(`div`,{className:`flex flex-wrap items-center gap-1`,children:[ap.map(e=>P(`button`,{type:`button`,"aria-pressed":c===e.value,onClick:()=>a({mode:e.value}),className:`rounded border px-2 py-0.5 text-[11px] ${c===e.value?`border-primary bg-primary/15 text-foreground`:`border-border text-foreground-subtle hover:bg-surface-hover`}`,children:y(`span`,{className:`inline-flex items-center gap-1`,children:[P(e.Icon,{className:`h-3 w-3`}),r(e.labelKey)]})},e.value)),t===void 0?null:P(`button`,{type:`button`,onClick:()=>n(void 0),className:`ml-1 text-xs text-foreground-subtle underline hover:text-foreground`,children:r(`system.notificationConditionWidgets.clear`,`Clear`)})]}),c===`label`?y(E,{children:[P(`div`,{className:`flex flex-wrap gap-1`,children:o.map(e=>{let t=ot(i.labels,e.value),n=e.unknown?`border-dashed border-warning text-warning`:t?`border-primary bg-primary/15 text-foreground`:`border-border text-foreground hover:bg-surface-hover`;return P(`button`,{type:`button`,"aria-pressed":t,title:e.unknown?r(`system.notificationConditionWidgets.storedByTheRuleNot`,`Stored by the rule — not offered by this hub`):void 0,onClick:()=>a({labels:ht(i.labels,e.value)}),className:`rounded border px-1.5 py-0.5 text-[10px] ${n}`,children:y(`span`,{className:`inline-flex items-center gap-1`,children:[P(zn,{iconId:e.iconId,size:12}),e.label]})},e.value)})}),s.length>0&&y(`p`,{className:`text-[10px] text-warning`,children:[r(`system.notificationConditionWidgets.keptFromTheRuleUnknown`,`Kept from the rule, unknown to this hub:`),` `,s.join(`, `)]}),y(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-foreground-subtle`,children:[y(`label`,{className:`flex items-center gap-1`,children:[r(`system.notificationConditionWidgets.confirmAfter`,`Confirm after`),P(Ln,{type:`number`,min:1,max:20,step:1,className:`w-16`,value:String(i.confirmHits??2),onChange:e=>a({confirmHits:Number(e.target.value)})}),r(`system.notificationConditionWidgets.frames`)]}),y(`label`,{className:`flex items-center gap-1`,children:[r(`system.notificationConditionWidgets.within`),P(Ln,{type:`number`,min:1,max:60,step:1,className:`w-16`,value:String(i.confirmWindowSec??5),onChange:e=>a({confirmWindowSec:Number(e.target.value)})}),`s`]})]}),P(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`system.notificationConditionWidgets.audioConfirmHint`,{hits:2,window:5})})]}):y(E,{children:[P(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-foreground-subtle`,children:y(`label`,{className:`flex items-center gap-1`,children:[r(`system.notificationConditionWidgets.louderThan`,`Louder than`),P(Ln,{type:`number`,min:St,max:0,step:3,className:`w-20`,value:String(i.dbThreshold??Tt),onChange:e=>a({dbThreshold:Number(e.target.value)})}),`dBFS`]})}),y(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-foreground-subtle`,children:[y(`label`,{className:`flex items-center gap-1`,children:[r(`system.notificationConditionWidgets.hits`,`Hits`),P(Ln,{type:`number`,min:1,max:100,step:5,className:`w-16`,value:String(i.hitPercent),onChange:e=>a({hitPercent:Number(e.target.value)})}),r(`system.notificationConditionWidgets.hitsPercentDefault`,{value:ft.hitPercent})]}),y(`label`,{className:`flex items-center gap-1`,children:[r(`system.notificationConditionWidgets.over`),P(Ln,{type:`number`,min:1,max:300,step:5,className:`w-16`,value:String(i.samplingSeconds),onChange:e=>a({samplingSeconds:Number(e.target.value)})}),r(`system.notificationConditionWidgets.secondsDefault`,{value:ft.samplingSeconds})]})]}),P(`p`,{className:`text-[11px] text-foreground-subtle`,children:r(`system.notificationConditionWidgets.dbfsHint`,{min:St})})]}),_t(t)?P(`p`,{className:`text-[11px] text-warning`,children:r(`system.notificationConditionWidgets.withNeitherASoundNor`,`With neither a sound nor a level threshold this can never match — every sample would be a hit, so the engine refuses it rather than notifying on silence.`)}):null]})}function sp({value:e,onChange:t}){let{t:n}=H(),r=e?.values??[],i=e?.maxDistance??1,a=e=>t(e.length>0?{values:e,maxDistance:i}:void 0),o=e=>t(r.length>0?{values:r,maxDistance:e}:void 0),s=bu().filter(e=>!r.includes(e));return y(`div`,{className:`mt-1 space-y-1.5`,children:[P(Yf,{value:r,placeholder:n(`system.notificationConditionWidgets.plateText`,`Plate text…`),onChange:a}),s.length>0&&y(`div`,{className:`flex flex-wrap items-center gap-1`,children:[P(`span`,{className:`text-[10px] text-foreground-subtle`,children:n(`system.notificationConditionWidgets.seen`,`Seen:`)}),s.slice(0,12).map(e=>P(`button`,{type:`button`,onClick:()=>a([...r,e]),className:`rounded border border-border px-1.5 py-0.5 text-[10px] text-foreground-subtle hover:bg-surface-hover hover:text-foreground`,children:e},e))]}),y(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[n(`system.notificationConditionWidgets.maxDistance`,`Max distance`),P(Ln,{type:`number`,min:0,max:3,step:1,value:i,className:`max-w-[5rem]`,onChange:e=>{let t=Number(e.target.value);o(Number.isFinite(t)?Math.max(0,Math.min(3,t)):1)}})]})]})}function cp({gateable:e,value:t,onChange:n}){let{t:r}=H(),i=Gf(),a=e.find(e=>e.id===t?.deviceId),o=new Set(t?.states??[]),s=e=>{let t=Number(e);if(!Number.isFinite(t)||t===0)return n(void 0);n({deviceId:t,states:[]})},c=e=>{if(t===void 0)return;let r=new Set(o);r.has(e)?r.delete(e):r.add(e),n(r.size===0?void 0:{deviceId:t.deviceId,states:[...r]})};return y(`div`,{className:`mt-1 space-y-2`,children:[P(ir,{value:t===void 0?``:String(t.deviceId),options:[{value:``,label:r(`system.notificationConditionWidgets.noDeviceGate`,`— no device gate —`)},...e.map(e=>({value:String(e.id),label:e.name}))],onChange:e=>s(e.target.value)}),a!==void 0&&P(`div`,{className:`flex flex-wrap gap-1.5`,children:a.states.map(e=>P(`button`,{type:`button`,onClick:()=>c(e),className:o.has(e)?`rounded-md border border-primary bg-primary/10 px-2 py-0.5 text-[11px] text-primary`:`rounded-md border border-border px-2 py-0.5 text-[11px] text-foreground-subtle`,children:i(e)},e))}),a!==void 0&&a.states.length===0&&P(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:r(`system.notificationConditionWidgets.thisDeviceReportsNoState`,`This device reports no state the gate can read, so it cannot arm a rule.`)}),t!==void 0&&P(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:r(`system.notificationConditionWidgets.theRuleIsSilentWhile`,`The rule is silent while the device is in any other state — including when its state cannot be read at all.`)})]})}function lp(e,t){let n=t(e.verdict);return e.latched?`${n} · ${t(`latched`)}`:n}function up({scenes:e,value:t,onChange:n}){let{t:r}=H(),i=Gf(),a=e.find(e=>e.sceneId===t?.sceneId),o=r=>{if(r===``)return n(void 0);let i=e.find(e=>e.sceneId===r);if(i===void 0)return n(void 0);n({sceneId:r,deviceId:i.deviceId,requiredState:t?.requiredState??`diverged`,...t?.latched===void 0?{}:{latched:t.latched}})},s=e=>{t!==void 0&&n({...t,requiredState:e===`matched`?`matched`:`diverged`})},c=e=>{if(t!==void 0){if(e===``){let{latched:e,...r}=t;return n(r)}n({...t,latched:e===`latched`})}};return e.length===0?P(`p`,{className:qf,children:r(`notificationRules.scene.none`,`No scenes yet — create one on the Scenes page.`)}):y(`div`,{className:`mt-1 space-y-2`,children:[P(ir,{value:t?.sceneId??``,options:[{value:``,label:r(`notificationRules.scene.noGate`,`— no scene gate —`)},...e.map(e=>({value:e.sceneId,label:`${e.cameraName} · ${e.label} — ${lp(e,i)}`}))],onChange:e=>o(e.target.value)}),t!==void 0&&y(`div`,{className:`flex flex-wrap items-center gap-2`,children:[y(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[r(`notificationRules.scene.onlyWhile`,`Only while it is`),P(ir,{value:t.requiredState,options:[{value:`diverged`,label:i(`diverged`)},{value:`matched`,label:i(`matched`)}],onChange:e=>s(e.target.value)})]}),y(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[r(`notificationRules.scene.read`,`Read`),P(ir,{value:t.latched===void 0?``:t.latched?`latched`:`live`,options:[{value:``,label:a===void 0?r(`notificationRules.scene.readOwn`,`The scene's own setting`):`${r(`notificationRules.scene.readOwn`,`The scene's own setting`)} (${i(a.emit)})`},{value:`latched`,label:i(`latched`)},{value:`live`,label:i(`live`)}],onChange:e=>c(e.target.value)})]})]}),a!==void 0&&y(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:[r(`notificationRules.scene.rightNow`,`Right now:`),` `,lp(a,i)]}),t!==void 0&&a===void 0&&P(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:r(`notificationRules.scene.missing`,`This scene no longer exists — pick another or remove the gate.`)})]})}var dp={days:[0,1,2,3,4,5,6],minute:480},fp=[{value:1,get label(){return V.t(`helpers.notificationSystemEventDelivery.wd_mon`)}},{value:2,get label(){return V.t(`helpers.notificationSystemEventDelivery.wd_tue`)}},{value:3,get label(){return V.t(`helpers.notificationSystemEventDelivery.wd_wed`)}},{value:4,get label(){return V.t(`helpers.notificationSystemEventDelivery.wd_thu`)}},{value:5,get label(){return V.t(`helpers.notificationSystemEventDelivery.wd_fri`)}},{value:6,get label(){return V.t(`helpers.notificationSystemEventDelivery.wd_sat`)}},{value:0,get label(){return V.t(`helpers.notificationSystemEventDelivery.wd_sun`)}}];function pp(e){let t=Math.floor(e/60),n=e%60;return`${String(t).padStart(2,`0`)}:${String(n).padStart(2,`0`)}`}function mp(e){let[t,n]=e.split(`:`),r=Number(t)*60+Number(n);return Number.isFinite(r)?Math.max(0,Math.min(1439,r)):0}function hp(e){if(typeof e!=`object`||!e||!(`data`in e))return;let t=e.data;if(!(typeof t!=`object`||!t||!(`code`in t)))return typeof t.code==`string`?t.code:void 0}function gp(e){let t=Object.entries(e).map(([e,t])=>`${e} ${String(t)}`);return t.length>0?V.t(`helpers.notificationSystemEventDelivery.dropped`,{parts:t.join(`, `)}):null}function _p(e,t,n,r=`rule`){if(e===`error`)return hp(n)===`NOT_FOUND`?{lines:[`This hub does not serve summary rules yet — update @camstack/server first. A rule saved now would be stored without its summary, and stay instant.`]}:{lines:[`The preview could not be read: ${n instanceof Error?n.message:String(n)}`]};if(e!==`success`||t===void 0)return null;let i=[];if(r===`section`&&t.split===void 0&&i.push(`This hub does not send per-category summaries yet — update @camstack/server first. Until then it sends one message.`),t.empty)i.push(`Nothing to report right now — no notification would be sent.`);else if(t.split===`section`&&t.rows!==void 0){let e=t.rows.length;i.push(`${String(e)} notification${e===1?``:`s`} would be sent now, one per category:`);for(let e of t.rows)i.push(`${e.title}\n${e.text}`)}else i.push(`${String(t.count)} item(s) would be sent now:\n${t.text}`);let a=gp(t.dropped);return a!==null&&i.push(a),t.excludedGroups.includes(`backups-exports`)&&i.push(`Backups and exports are completed jobs, not a state — they are not in a summary.`),{lines:i}}function vp(e,t){return{...e,schedule:t}}function yp(e,t){let{split:n,...r}=e;return t===`section`?{...r,split:t}:r}function bp(e){return pp(e)}function xp(e){return mp(e)}function Sp(){return{days:[1,2,3,4,5],startMinute:540,endMinute:1080}}function Cp(e){return{days:[...dp.days],minute:e}}var wp=`Always active — add a window to restrict when the rule fires.`;function Tp({value:e,onChange:t,mode:n=`windows`,defaultMinute:r=dp.minute,emptyHint:i}){return n===`times`?P(Dp,{value:e,onChange:t,defaultMinute:r}):P(Ep,{value:e,onChange:t,emptyHint:i??wp})}function Ep({value:e,onChange:t,emptyHint:n}){let{t:r}=H(),i=e?.windows??[],a=e?.invert??!1,o=(n,r)=>{if(n.length===0){t(void 0);return}t({windows:n,...r?{invert:!0}:{},...e?.timezone?{timezone:e.timezone}:{}})},s=()=>o([...i,Sp()],a),c=e=>o(i.filter((t,n)=>n!==e),a),l=(e,t)=>o(i.map((n,r)=>r===e?t:n),a);return y(`div`,{className:`mt-1 space-y-2`,"data-testid":`schedule-field-windows`,children:[i.length===0?P(`p`,{className:qf,children:n}):i.map((e,t)=>P(Op,{window:e,onChange:e=>l(t,e),onRemove:()=>c(t)},t)),y(`div`,{className:`flex items-center gap-3`,children:[y(`button`,{type:`button`,onClick:s,className:`flex items-center gap-1 rounded-md bg-surface-hover px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground`,children:[P(Ie,{className:`h-3 w-3`}),` `,r(`system.notificationScheduleField.addWindow`)]}),i.length>0&&y(`label`,{className:`flex items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[P(`input`,{type:`checkbox`,checked:a,onChange:e=>o([...i],e.target.checked),className:`accent-primary`}),r(`system.notificationScheduleField.activeOutsideTheWindows`,`Active outside the windows`)]})]})]})}function Dp({value:e,onChange:t,defaultMinute:n}){let{t:r}=H(),i=e?.timezone,a=e===void 0?{times:[],approximated:!1}:Ut(e);if(a===null)return y(`div`,{className:`mt-1 space-y-2`,"data-testid":`schedule-field-times-fallback`,children:[P(`p`,{className:qf,children:r(`system.notificationScheduleField.invertedScheduleShownAsBands`,`Inverted schedule — shown as bands. Clear the invert flag (or the windows) to author punctual times.`)}),P(Ep,{value:e,onChange:t,emptyHint:wp})]});let o=a.times,s=e=>{if(e.length===0){t(void 0);return}t(it(e,i))};return y(`div`,{className:`mt-1 space-y-2`,"data-testid":`schedule-field-times`,children:[a.approximated&&P(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,"data-testid":`schedule-field-times-approximated`,children:r(`system.notificationScheduleField.shownAsSendAtTimes`,`Shown as send-at times from each window's end (when the summary fires). Edit or save to store them as punctual one-minute windows.`)}),o.length===0?P(`p`,{className:qf,children:r(`system.notificationScheduleField.noTimesYetAddOne`,`No times yet — add one to send on those days at that clock time.`)}):o.map((e,t)=>P(kp,{time:e,index:t,onChange:e=>s(o.map((n,r)=>r===t?e:n)),onRemove:o.length>1?()=>s(o.filter((e,n)=>n!==t)):void 0},t)),y(`button`,{type:`button`,onClick:()=>s([...o,Cp(n)]),className:`flex items-center gap-1 rounded-md bg-surface-hover px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground`,"data-testid":`schedule-field-add-time`,children:[P(Ie,{className:`h-3 w-3`}),` `,r(`system.notificationScheduleField.addTime`)]})]})}function Op({window:e,onChange:t,onRemove:n}){let{t:r}=H();return y(`div`,{className:`space-y-1.5 rounded-md border border-border p-2`,children:[y(`div`,{className:`flex items-center gap-2 text-xs`,children:[P(`input`,{type:`time`,value:bp(e.startMinute),onChange:n=>t({...e,startMinute:xp(n.target.value)}),className:`rounded-md border border-border bg-background px-1 py-0.5`}),P(`span`,{className:`text-foreground-subtle`,children:`→`}),P(`input`,{type:`time`,value:bp(e.endMinute),onChange:n=>t({...e,endMinute:xp(n.target.value)}),className:`rounded-md border border-border bg-background px-1 py-0.5`}),P(`span`,{className:`flex-1`}),P(`button`,{type:`button`,onClick:n,"aria-label":r(`system.notificationScheduleField.removeWindow`,`Remove window`),className:`text-foreground-subtle hover:text-danger`,children:P(ie,{className:`h-3.5 w-3.5`})})]}),P(Ap,{days:e.days,onToggle:n=>{let r=e.days.includes(n)?e.days.filter(e=>e!==n):[...e.days,n];r.length!==0&&t({...e,days:r})}})]})}function kp({time:e,index:t,onChange:n,onRemove:r}){let{t:i}=H();return y(`div`,{className:`space-y-1.5 rounded-md border border-border p-2`,children:[y(`div`,{className:`flex items-center gap-2 text-xs`,children:[P(`span`,{className:`text-foreground-subtle`,children:i(`system.notificationScheduleField.at`,`At`)}),P(`input`,{type:`time`,value:pp(e.minute),onChange:t=>n({...e,minute:mp(t.target.value)}),className:`rounded-md border border-border bg-background px-1 py-0.5`,"data-testid":`schedule-field-time-${String(t)}`}),P(`span`,{className:`flex-1`}),r!==void 0&&P(`button`,{type:`button`,onClick:r,"aria-label":i(`system.notificationScheduleField.removeTime`,`Remove time`),className:`text-foreground-subtle hover:text-danger`,children:P(ie,{className:`h-3.5 w-3.5`})})]}),P(Ap,{days:e.days,onToggle:t=>{let r=e.days.includes(t)?e.days.filter(e=>e!==t):[...e.days,t];r.length!==0&&n({...e,days:r})}})]})}function Ap({days:e,onToggle:t}){return P(`div`,{className:`flex flex-wrap gap-1`,children:fp.map(n=>P(`button`,{type:`button`,onClick:()=>t(n.value),className:`rounded px-1.5 py-0.5 text-[10px] ${e.includes(n.value)?`bg-primary text-primary-foreground`:`bg-surface-hover text-foreground-subtle`}`,children:n.label},n.value))})}function jp(e){return e>=8}a();function Mp(e){if(typeof e!=`object`||!e)return;let t=Reflect.get(e,`windows`);if(!(!Array.isArray(t)||t.length===0))return e}function Np(e){return e.type===`multiselect`}function Pp(e){let t=e.suggestions;return t===void 0||t.length===0?[]:t.map(e=>({value:e,label:e}))}function Fp(e){return e.map(e=>({value:e.value,label:e.label,...e.description===void 0?{}:{description:e.description},...e.iconId===void 0?{}:{iconId:e.iconId}}))}function Ip(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Lp({field:e,values:t,onChange:n,onChangeMany:r,disabled:i,translationFn:a,onTestField:o,externalProbe:s,allFields:c,onAction:l}){let{t:u}=H();if(e.type===`tags`){if(!Ur(e,t,c))return null;let r=e.creatable!==!1;return P(An,{mode:`multi`,options:Pp(e),value:Ip(t[e.key]),onChange:t=>n(e.key,t),disabled:i===!0||e.disabled===!0,creatable:r,...e.createLabel===void 0?{}:{createLabel:e.createLabel},...e.maxTags===void 0?{}:{maxItems:e.maxTags},label:zp(e.label,a),description:e.description===void 0?void 0:zp(e.description,a),placeholder:e.placeholder??u(`formBuilder.formBuilder.searchOrAdd`,`Search or add…`),testId:`config-tags-${e.key}`})}if(e.type===`schedule`){if(!Ur(e,t,c))return null;let r=zp(e.label,a),i=e.description===void 0?void 0:zp(e.description,a),o=e.mode===`times`?`times`:`windows`;return y(`div`,{className:`space-y-1`,"data-testid":`config-schedule-${e.key}`,children:[r!==void 0&&P(`label`,{className:`block text-[11px] font-medium text-foreground-subtle`,children:r}),i!==void 0&&P(`p`,{className:`text-[10px] text-foreground-subtle`,children:i}),P(Tp,{mode:o,value:Mp(t[e.key]),onChange:t=>n(e.key,t)})]})}return Np(e)&&(jp(e.options.length)||e.creatable===!0)?Ur(e,t,c)?P(An,{mode:`multi`,options:Fp(e.options),value:Ip(t[e.key]),onChange:t=>n(e.key,t),disabled:i===!0||e.disabled===!0,creatable:e.creatable===!0,...e.createLabel===void 0?{}:{createLabel:e.createLabel},...e.maxItems===void 0?{}:{maxItems:e.maxItems},label:zp(e.label,a),description:e.description===void 0?void 0:zp(e.description,a),placeholder:e.placeholder??u(`formBuilder.formBuilder.searchToAdd`,`Search to add…`),testId:`config-multiselect-${e.key}`,listboxId:`msel-${e.key}`}):null:P(lr,{field:e,values:t,onChange:n,onChangeMany:r,disabled:i,translationFn:a,onTestField:o,externalProbe:s,allFields:c,onAction:l})}function Rp(e){return/^[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)+$/.test(e)}function zp(e,t){if(e!==void 0)return t&&Rp(e)?t(e):e}function Bp({section:e,values:t,onChange:n,onChangeMany:r,disabled:i,translationFn:a,onTestField:o,probeResults:s,onAction:c}){let[l,u]=f(e.defaultCollapsed??!1),d=e.style===`accordion`;if(e.fields.reduce((n,r)=>n+ +!!Ur(r,t,e.fields),0)===0)return null;let p=e.fields,m=e.columns??2,h=m===1?`grid-cols-1`:m===3?`grid-cols-1 @[480px]:grid-cols-2 @[880px]:grid-cols-3`:m===4?`grid-cols-1 @[480px]:grid-cols-2 @[1140px]:grid-cols-4`:`grid-cols-1 @[480px]:grid-cols-2`,g=e.fields.length===1&&e.fields[0]?.type===`widget`?e.fields[0]:void 0,_=g!==void 0||!e.title&&!e.description;return y(`div`,{className:`@container rounded-lg border border-border bg-surface p-3`,style:{containerType:`inline-size`},"data-settings-section":e.id,children:[!_&&y(`div`,{className:[`flex items-center justify-between mb-2`,d?`cursor-pointer`:``].join(` `),onClick:d?()=>u(e=>!e):void 0,children:[y(`div`,{children:[e.title&&P(`h3`,{className:`text-[11px] font-semibold text-foreground-subtle uppercase tracking-wider`,children:zp(e.title,a)}),e.description&&P(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:zp(e.description,a)})]}),d&&P(`span`,{className:`text-foreground-subtle text-xs ml-2`,children:l?`▸`:`▾`})]}),!(l&&!_)&&(g===void 0?P(E,{children:P(`div`,{className:`grid ${h} gap-x-3 gap-y-2.5`,children:p.map(l=>P(Lp,{field:l,values:t,onChange:n,onChangeMany:r,disabled:i,translationFn:a,onTestField:o,externalProbe:s?.[l.key],allFields:e.fields,onAction:c},l.key))})}):P(lr,{field:g,values:t,onChange:n,onChangeMany:r,disabled:i,translationFn:a,onTestField:o,externalProbe:s?.[g.key],allFields:e.fields,onAction:c},g.key))]})}function Vp({schema:e,values:t,onChange:n,disabled:r,translationFn:i,onTestField:a,probeResults:o,onClearProbe:s,onAction:c,visibilityContext:l}){let u=l?{...l,...t}:t,d=(e,r)=>{n({...t,[e]:r}),s?.(e)},f=e=>{n({...t,...e});for(let t of Object.keys(e))s?.(t)};return P(`div`,{className:`space-y-4`,children:e.sections.map((e,t)=>P(Bp,{section:e,values:u,onChange:d,onChangeMany:f,disabled:r,translationFn:i,onTestField:a,probeResults:o,onAction:c},`${e.id}-${t}`))})}function Hp({pendingCount:e,onSave:t,onDiscard:n,saving:r=!1,saveLabel:i=`Save`,discardLabel:a=`Discard`}){let{t:o}=H();return e<=0?null:y(`div`,{className:`sticky bottom-0 -mb-3 flex items-center justify-between gap-3 rounded-lg border border-primary/40 bg-primary/5 px-3 py-2 shadow-sm z-10`,children:[P(`span`,{className:`text-xs text-foreground`,children:o(`formBuilder.saveBar.unsavedChanges`,{count:e})}),y(`div`,{className:`flex items-center gap-2`,children:[P(`button`,{type:`button`,onClick:n,disabled:r,className:`inline-flex items-center rounded-md border border-border px-2.5 py-1 text-xs text-foreground-subtle hover:bg-surface-hover disabled:opacity-50`,children:a}),P(`button`,{type:`button`,onClick:t,disabled:r,className:`inline-flex items-center rounded-md bg-primary px-3 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:r?o(`formBuilder.formSaveBar.saving`,`Saving…`):i})]})]})}function Up({tabs:e,activeId:t,onChange:n,countByTab:r,pendingByTab:i}){return e.length===0?null:P(`div`,{className:`flex flex-wrap items-center gap-1 border-b border-border shrink-0`,children:e.map(e=>{let a=e.id===t,o=r?.get(e.id)??0,s=i?.get(e.id)??0;return y(`button`,{type:`button`,onClick:()=>n(e.id),className:`relative shrink-0 px-3 py-1.5 text-xs font-medium rounded-t-md transition-colors -mb-px border-b-2 whitespace-nowrap ${a?`text-primary border-primary bg-primary/5`:`text-foreground-subtle border-transparent hover:text-foreground hover:bg-surface-hover`}`,children:[e.label,o>0&&y(`span`,{className:`ml-1.5 text-[10px] opacity-60`,children:[`(`,o,`)`]}),s>0&&P(`span`,{className:`ml-1.5 inline-flex h-1.5 w-1.5 rounded-full bg-primary`})]},e.id)})})}a();function Wp({schema:e,values:t,pendingKeys:n,onChange:r,onAction:i,onSave:a,onDiscard:o,disabled:s,activeSubTab:c,onSubTabChange:l,flattenTabs:u=!1,visibilityContext:p,hideSaveBar:m=!1}){let h=e.tabs??[],g=d(()=>{let t=new Map;for(let n of e.sections){let e=n.tab??`general`,r=t.get(e)??[];r.push(n),t.set(e,r)}return t},[e.sections]),_=new Set(h.map(e=>e.id)),v=[...h,...[...g.keys()].filter(e=>!_.has(e)).map(e=>({id:e,label:e,icon:`wrench`,order:100}))],b=v[0]?.id??`general`,[x,S]=f(b),C=l!==void 0,w=new Set(v.map(e=>e.id)),T=M(new Set);for(let e of w)T.current.add(e);let E=T.current,D=(e=>e&&(w.has(e)||E.has(e))?e:b)(C?c:x),O=e=>{C?l(e):S(e)},k=g.get(D)??[],A={sections:k.length<=1?k.length===1?[{...k[0],title:``}]:k:k.every(e=>!e.title)?[{...k[0],title:``,fields:k.flatMap(e=>e.fields)}]:k},j=m?null:P(Hp,{pendingCount:n.length,onSave:()=>a(n),onDiscard:()=>o(n),saving:s});if(u||v.length<=1)return y(`div`,{className:`flex flex-col gap-3`,children:[P(Vp,{schema:e,values:t,onChange:r,onAction:i,disabled:s,visibilityContext:p}),j]});let N=new Map,F=new Map;for(let[e,t]of g){N.set(e,t.length);let r=new Set,i=e=>{for(let t of e)if(`key`in t&&typeof t.key==`string`&&r.add(t.key),t.type===`group`)i(t.fields);else if(t.type===`sub-tabs`)for(let e of t.tabs)i(e.fields)};for(let e of t)i(e.fields);let a=n.filter(e=>r.has(e)).length;a>0&&F.set(e,a)}return y(`div`,{className:`flex flex-col gap-3`,children:[P(Up,{tabs:v.map(e=>({id:e.id,label:e.label})),activeId:D,onChange:O,countByTab:N,pendingByTab:F}),P(Rr,{tabKey:D,children:P(Vp,{schema:A,values:t,onChange:r,onAction:i,disabled:s,visibilityContext:p})}),j]})}var Gp=`device-export`,Kp=`export`,qp=`Export`;function Jp(e){return e.type===`separator`||e.type===`info`||e.type===`object-array`||e.type===`widget`||e.type===`addon-action-button`||e.type===`device-action-button`?!1:e.type===`group`?e.fields.some(Jp):e.type===`sub-tabs`?e.tabs.some(e=>e.fields.some(Jp)):e.writerCapName===Gp}function Yp(e){return e.tab===`export`?!0:e.fields.some(Jp)}var Xp=`host/extensions-panel`;function Zp(e){return e.type===`widget`?e.widgetId===Xp:e.type===`group`?e.fields.some(Zp):e.type===`sub-tabs`?e.tabs.some(e=>e.fields.some(Zp)):!1}function Qp(e){return e.fields.some(Zp)}function $p(e,t){return!t&&e!==void 0&&wt.includes(e)}function em(e){return e.location!==`top-tab`&&e.location!==`hero`&&!Yp(e)&&!Qp(e)}function tm(e,t,n,r){return!r||$p(t,n)?!0:(e??[]).some(em)}function nm(e,t){for(let n of e){if(n.type===`group`){nm(n.fields,t);continue}if(n.type===`sub-tabs`){for(let e of n.tabs)nm(e.fields,t);continue}if(!(`value`in n))continue;let e=n.value===void 0?n.default:n.value;e!==void 0&&(t[n.key]=e)}}function rm(e){let t={};for(let n of e)nm(n.fields,t);return t}a();function im(e,t){return t&&t===`admin`?e:!0}function am(e){if(!e)return null;let t={sections:[...e.sections].toSorted((e,t)=>{let n=e.tab??`general`,r=t.tab??`general`;return n===r?Yp(e)&&Yp(t)?e.id.localeCompare(t.id):(e.order??0)-(t.order??0):n.localeCompare(r)})};return e.tabs?{...t,tabs:e.tabs}:t}function om(e){return e.type===`separator`||e.type===`info`||e.type===`button`||e.type===`widget`||e.type===`addon-action-button`||e.type===`device-action-button`||e.type===`account-sign-in`||e.type===`secret-presence`}function sm(e){return e.key}function cm(e){if(!om(e))return e.value}function lm(e){return om(e)?null:e}function um(e,t){for(let n of e)if(t(n),n.type===`group`)um(n.fields,t);else if(n.type===`sub-tabs`)for(let e of n.tabs)um(e.fields,t)}function dm(e){if(!e)return{};let t={};for(let n of e.sections)um(n.fields,e=>{let n=sm(e);n!==null&&(t[n]=cm(e))});return t}function fm(e,t){if(!e)return null;let n=null;for(let r of e.sections)if(um(r.fields,e=>{if(n!==null||sm(e)!==t)return;let r=lm(e);r&&r.writerCapName&&r.writerAddonId&&(n={capName:r.writerCapName,addonId:r.writerAddonId})}),n!==null)break;return n}function pm(e){return{...e,fields:e.fields.map(mm)}}function mm(e){return e.type===`separator`||e.type===`info`||e.type===`button`||e.type===`object-array`?e:{...e,readonlyField:!0}}function hm(e,t){return e&&{...e,sections:e.sections.map(e=>({...e,fields:e.fields.map(e=>{let n=lm(e);return n?im(t,n.minRole)?e:mm(e):e})}))}}function gm({deviceId:e,sectionFilter:t,activeSubTab:n,onSubTabChange:r,flattenSubTabs:i,subTabGrouping:a}){let{t:o}=H(),c=j(),{user:l}=Ql(),u=l?.isAdmin===!0,f=M(!1),{data:m,isLoading:h}=Dr({deviceId:e},{refetchInterval:()=>f.current?!1:2500,enabled:Number.isFinite(e)}),{data:g}=Xr({deviceId:e},{enabled:Number.isFinite(e)}),_=m?.settings??null,v=m?.live??null,b=d(()=>{if(!_&&!v)return null;let e=_?.sections??[],n=(v?.sections??[]).map(pm),r=[...e,...n],i=t?r.filter(t):r.filter(em);if(i.length===0)return null;if(a){let e=i.map(e=>({...e,tab:a.groupOf(e)})),t=new Set(e.map(e=>e.tab)),n=a.tabs.filter(e=>t.has(e.id));return n.length>0?{tabs:n,sections:e}:{sections:e}}let o=new Set;for(let e of i)o.add(e.tab??`general`);let s=[..._?.tabs??[],...(v?.tabs??[]).filter(e=>!(_?.tabs??[]).some(t=>t.id===e.id))].filter(e=>o.has(e.id));return s.length>0?{tabs:s,sections:i}:{sections:i}},[_,v,t,a]),x=d(()=>rm([..._?.sections??[],...v?.sections??[]]),[_,v]),S=d(()=>am(b),[b]),C=d(()=>hm(S,u),[S,u]),w=d(()=>dm(C),[C]),T=Zr(),E=Vr(),D=Xn(),O=tr(),k=On({onSuccess:()=>{c.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]})}}),A={isPending:k.isPending,mutate:t=>{k.mutate({deviceId:e,changes:[...t]})}},N=eu({schema:C,serverValues:w,onImmediateSave:p(e=>{let t=Object.entries(e).map(([e,t])=>{let n=fm(C,e);return n?{writerCapName:n.capName,writerAddonId:n.addonId,key:e,value:t}:null}).filter(e=>e!==null);t.length>0&&A.mutate(t)},[C,A]),onDeferredSave:p(async t=>{let n=Object.entries(t).map(([e,t])=>{let n=fm(C,e);return n?{writerCapName:n.capName,writerAddonId:n.addonId,key:e,value:t}:null}).filter(e=>e!==null);if(n.length!==0)try{let t=await k.mutateAsync({deviceId:e,changes:n});if(t.failures.length>0)throw Error(t.failures.map(e=>e.error).join(`; `))}finally{await c.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]})}},[C,k,e,c])}),{values:F,pendingKeys:I,handleChange:ee,handleSave:L,handleDiscard:te}=N;f.current=N.editingPaused;let R=vc(),ne=M(L),re=M(te);ne.current=L,re.current=te;let ie=R?.register,ae=k.isError?k.error instanceof Error?k.error.message:String(k.error):null,z=I.join(`\0`);if(s(()=>{if(ie===void 0)return;let e=z===``?[]:z.split(`\0`);return ie({id:`export`,dirty:e.length>0,saving:k.isPending,error:ae,save:()=>(ne.current(e),Promise.resolve()),discard:()=>re.current(e)})},[ie,z,k.isPending,ae]),h)return y(`div`,{className:`flex items-center justify-center py-12 text-foreground-subtle`,children:[P(Re,{className:`h-4 w-4 animate-spin mr-2`}),P(`span`,{className:`text-xs`,children:o(`device.deviceAggregateSection.loadingDeviceAggregate`,`Loading device aggregate…`)})]});if(!C||C.sections.length===0)return P(`div`,{className:`text-xs text-foreground-subtle italic py-4 text-center`,children:o(`device.deviceAggregateSection.noAggregateContributionsForThis`,`No aggregate contributions for this device.`)});async function oe(t,n,r){if(t===`regenerate-rtsp-token`){let t=[`rtspUrl:`,`regenerateToken:`].find(e=>n.startsWith(e));if(!t)throw Error(`regenerate-rtsp-token: unrecognised key "${n}" (expected "rtspUrl:<streamId>" or "regenerateToken:<streamId>")`);let r=n.slice(t.length);if(!r)throw Error(`regenerate-rtsp-token: key "${n}" has no streamId after prefix`);let i=Zt(e,r);await T.mutateAsync({brokerId:i}),c.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]});return}if(t===`test-probe`){if(!g)return{status:`error`,error:o(`device.deviceAggregateSection.metadataNotLoaded`)};try{return await D.mutateAsync({addonId:g.addonId,type:g.type,key:n,value:r})}catch(e){return{status:`error`,error:e instanceof Error?e.message:String(e)}}}if(t===`refresh-probe`){if(!n.startsWith(`probedInfo:`))throw Error(`refresh-probe: unrecognised key "${n}" (expected "probedInfo:<streamId>")`);let t=n.slice(11);if(!t)throw Error(`refresh-probe: key "${n}" has no streamId after prefix`);let r=Zt(e,t),i=await E.mutateAsync({brokerId:r});return c.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]}),i}if(t===`device-custom-action`){let t=await O.mutateAsync({deviceId:e,action:n,input:r});return c.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]}),t}throw Error(`[device-aggregate] unknown action "${t}"`)}return P(Wp,{schema:C,values:F,pendingKeys:I,onChange:ee,onAction:oe,onSave:L,onDiscard:te,hideSaveBar:R!==null,disabled:A.isPending,activeSubTab:n,onSubTabChange:r,flattenTabs:i,visibilityContext:x})}var _m=`w-full min-w-0 px-1.5 py-0.5 text-[11px] bg-background border border-border rounded focus:outline-none focus:border-primary disabled:opacity-50 disabled:cursor-not-allowed`,vm=0,ym=10;function bm(e){if(e.trim()===``)return``;let t=Number.parseInt(e,10);return Number.isFinite(t)?String(t<vm?vm:t>ym?ym:t):``}function xm({value:e,onChange:t,disabled:n=!1,placeholder:r,className:i,id:a,"aria-label":o}){return P(`input`,{type:`number`,min:vm,max:ym,step:1,id:a,className:i??_m,"aria-label":o,placeholder:r,value:e,onChange:e=>{t(bm(e.target.value))},disabled:n})}function Sm({deviceName:e,value:t,inheritedIcon:n,inheritedLabel:r,disabled:i,onChange:a}){let{t:o}=H(),s={trigger:o(`deviceDisplay.pickIcon`,{name:e}),panel:o(`deviceDisplay.iconFor`,{name:e}),searchPlaceholder:o(`deviceDisplay.iconSearchPlaceholder`),clear:r,noMatches:o(`deviceDisplay.iconNoMatches`)};return y(`div`,{className:`flex items-center gap-2`,children:[P(ar,{value:t===``?null:t,onPick:e=>a(e??``),categoryLabel:e=>o(`deviceDisplay.iconCategory.${e}`,{defaultValue:jt(e)}),fallbackGlyph:n,labels:s,disabled:i}),P(`span`,{className:`text-[11px] text-foreground-subtle`,children:t===``?r:t})]})}a();var Cm=`w-full min-w-0 px-1.5 py-0.5 text-[11px] bg-background border border-border rounded focus:outline-none focus:border-primary disabled:opacity-50`,wm={icon:``,label:``,unit:``,precision:``,hidden:!1};function Tm(e,t){return e.icon===t.icon&&e.label===t.label&&e.unit===t.unit&&e.precision===t.precision&&e.hidden===t.hidden}function Em(e){return{icon:e?.icon??``,label:e?.label??``,unit:e?.unit??``,precision:e?.precision===void 0?``:String(e.precision),hidden:e?.hidden===!0}}function Dm(e){if(e.trim()===``)return;let t=Number.parseInt(e,10);return Number.isFinite(t)?t:void 0}function Om(e,t){let n=Dm(e.precision),r={...e.icon===``?{}:{icon:e.icon},...e.label.trim()===``?{}:{label:e.label.trim()},...e.unit===``?{}:{unit:e.unit},...n===void 0?{}:{precision:n},...e.hidden?{hidden:!0}:{},...t?.perCap===void 0?{}:{perCap:t.perCap}};return Object.keys(r).length===0?null:r}function km({deviceId:e}){let t=Ge();Tr();let{t:n}=H(),r=j(),{data:i}=Xr({deviceId:e},{enabled:e>0}),a=typeof i?.role==`string`&&i.role.length>0?i.role:null,o=a===null?void 0:In[a],c=o?.kind===`numeric`,l=String(i?.type??``),u=a!==null||i?.parentDeviceId!==null&&i?.parentDeviceId!==void 0,d=i?.sourceInfo?.quantity,p=o?.kind===`numeric`?o.quantity??(d!==void 0&&d!==`device`?d:void 0):void 0,m=p===void 0?void 0:Yt(p),h=m===void 0?void 0:At(m),[g,_]=f(null),v=g??Em(i?.display),b=Sn({onSuccess:()=>{r.invalidateQueries({queryKey:[[`deviceManager`]]})}}),{data:x}=cr({},{staleTime:6e4,enabled:a!==null}),S=Or({onSuccess:()=>{r.invalidateQueries({queryKey:[[`deviceManager`]]})}}),C=vc(),w=Em(i?.display),T=i!=null&&!Tm(v,w),D=b.isError?b.error instanceof Error?b.error.message:String(b.error):null,O=M(async()=>{}),k=M(()=>{});O.current=async()=>{i!=null&&await b.mutateAsync({deviceId:e,display:Om(v,i.display)})},k.current=()=>_(w);let A=C?.register;if(s(()=>{if(!(A===void 0||i==null))return A({id:`display`,dirty:T,saving:b.isPending,error:D,save:()=>O.current(),discard:()=>k.current()})},[A,i,T,b.isPending,D]),i==null)return null;let N=e=>{_({...v,...e})},F=()=>{b.mutate({deviceId:e,display:Om(v,i.display)})},I=()=>{_(wm),b.mutate({deviceId:e,display:null})},ee=()=>{if(a===null)return;let e=Dm(v.precision),t={...v.icon===``?{}:{icon:v.icon},...v.unit===``?{}:{unit:v.unit},...e===void 0?{}:{precision:e}},n={...x?.defaults,[a]:t};S.mutate({defaults:n})},L=a===null?void 0:x?.defaults[a]?.icon,te=L===void 0?void 0:qr(L),R=a===null?pr(l,t):Hr(a,t),ne={icon:te??R.icon,label:te===void 0?R.label:String(L)},re=a===null&&l===Ct.Container?n(`deviceDisplay.inheritedContainer`):te===void 0?n(`deviceDisplay.inherited`,{name:ne.label}):n(`deviceDisplay.inheritedRoleDefault`,{icon:ne.label,role:R.label}),ie=typeof i.name==`string`?i.name:`#${String(e)}`,ae=a===null?``:Hr(a,t).label;return y(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[P(`div`,{className:`border-b border-border px-3 sm:px-4 py-2`,children:P(`h2`,{className:`text-[11px] font-semibold text-foreground uppercase tracking-wider`,children:n(`deviceDisplay.title`)})}),y(`div`,{className:`divide-y divide-border`,children:[P(X,{label:n(`deviceDisplay.icon`),value:P(Sm,{deviceName:ie,value:v.icon,inheritedIcon:ne.icon,inheritedLabel:re,disabled:b.isPending,onChange:e=>N({icon:e})})}),u&&P(X,{label:n(`deviceDisplay.label`),value:P(`input`,{type:`text`,className:Cm,"aria-label":n(`deviceDisplay.label`),placeholder:a===null?ie:ae,value:v.label,onChange:e=>N({label:e.target.value})})}),c&&y(E,{children:[P(X,{label:n(`deviceDisplay.unit`),value:P(Tn,{dimension:h,value:v.unit,onChange:e=>N({unit:e}),disabled:b.isPending,"aria-label":n(`deviceDisplay.unit`),inheritLabel:n(`deviceDisplay.unitSource`,{unit:m===void 0?``:` (${m})`}),emptyReason:n(`deviceDisplay.unitSource`,{unit:``})})}),P(X,{label:n(`deviceDisplay.precision`),value:P(xm,{"aria-label":n(`deviceDisplay.precision`),placeholder:n(`deviceDisplay.precisionInherit`),value:v.precision,onChange:e=>N({precision:e}),disabled:b.isPending})})]}),P(X,{label:n(`deviceDisplay.hidden`),value:y(`label`,{className:`flex items-center gap-2`,children:[P(`input`,{type:`checkbox`,checked:v.hidden,onChange:e=>N({hidden:e.target.checked})}),P(`span`,{className:`text-[11px] text-foreground`,children:n(`deviceDisplay.hideFromLists`)})]})})]}),(C===null||a!==null)&&y(`div`,{className:`border-t border-border px-3 sm:px-4 py-2 flex flex-wrap items-center gap-2`,children:[C===null&&P(`button`,{type:`button`,className:`rounded bg-primary px-3 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-50`,onClick:F,disabled:b.isPending,children:n(`common.save`)}),C===null&&P(`button`,{type:`button`,className:`rounded border border-border px-3 py-1 text-[11px] text-foreground-subtle`,onClick:I,disabled:b.isPending,children:n(`common.reset`)}),a!==null&&P(`button`,{type:`button`,className:`rounded border border-border px-3 py-1 text-[11px] text-foreground-subtle`,onClick:ee,disabled:S.isPending,title:n(`deviceDisplay.setRoleDefaultTitle`,{role:ae}),children:n(`deviceDisplay.setRoleDefault`,{role:ae})})]})]})}a();function Am({deviceId:e,onClose:t}){let{t:n}=H(),[r,i]=f(`info`),{data:a}=Xr({deviceId:e},{enabled:e>0}),o=Wr(e),s=rc(o.presence,o.list),c=r===`history`&&!s?`info`:r,l=typeof a?.name==`string`&&a.name.length>0?a.name:`#${String(e)}`,u=typeof a?.name==`string`?a.name:``,d=typeof a?.location==`string`?a.location:``,p=[[`info`,n(`deviceQuickDetail.tabInfo`,{defaultValue:`Device info`})],[`display`,n(`deviceQuickDetail.tabDisplay`,{defaultValue:`Display`})],[`export`,n(`deviceQuickDetail.tabExport`,{defaultValue:`Export`})],...s?[[`history`,n(`deviceQuickDetail.tabHistory`,{defaultValue:`History`})]]:[]];return P(Pr,{open:!0,onOpenChange:e=>!e&&t(),children:P(vr,{width:`lg`,scroll:`body`,children:y(yc,{deviceId:e,deviceName:u,deviceLocation:d,deviceReady:a!=null,onClose:t,children:[P(Lr,{children:P(wr,{children:l})}),P(`div`,{className:`mt-3 flex items-center gap-1 rounded-md bg-surface-hover p-0.5 w-fit`,children:p.map(([e,t])=>P(`button`,{type:`button`,onClick:()=>i(e),className:`px-2.5 py-1 rounded text-[11px] font-medium transition-colors ${c===e?`bg-surface text-foreground shadow-sm`:`text-foreground-subtle hover:text-foreground`}`,children:t},e))}),P(ii,{className:`mt-3`,children:y(kn,{deviceId:e,device:a??void 0,children:[P(`div`,{className:c===`info`?void 0:`hidden`,children:P(Pc,{})}),P(`div`,{className:c===`display`?void 0:`hidden`,children:P(km,{deviceId:e})}),P(`div`,{className:c===`export`?void 0:`hidden`,children:P(gm,{deviceId:e,sectionFilter:Yp})}),s?P(`div`,{className:c===`history`?void 0:`hidden`,children:P(nc,{deviceId:e})}):null]})})]})})})}function jm({children:e}){let[t,n]=f(null),r=p(e=>n(e),[]),i=p(()=>n(null),[]);return y(Qn,{open:r,children:[e,t===null?null:P(Am,{deviceId:t,onClose:i})]})}a();function Mm({tabs:e,active:t,onChange:n}){return P(`div`,{className:`flex rounded-lg border border-border bg-surface p-0.5 gap-0.5`,children:e.map(e=>P(`button`,{type:`button`,onClick:()=>n(e.id),className:[`flex-1 rounded-md px-3 py-1.5 text-xs font-medium transition-colors`,t===e.id?`bg-primary/12 text-primary`:`text-foreground-subtle hover:text-foreground hover:bg-surface-hover`].join(` `),children:e.label},e.id))})}function Nm(e){let t=e.formats;if(!t)return``;let n=Object.values(t).filter(e=>e!==void 0&&e.sizeMB>0).map(e=>e.sizeMB);if(n.length===0)return``;let r=Math.min(...n),i=Math.max(...n);return r===i?`${r} MB`:`${r}-${i} MB`}function Pm(e){return`${e.inputSize.width}x${e.inputSize.height}`}function Fm(e){return e.formats?Object.keys(e.formats).filter(t=>e.formats[t]!==void 0):[]}function Im({entry:e,selected:t,onSelect:n,disabled:r}){let{t:i}=H(),a=Nm(e),o=Pm(e),s=Fm(e);return y(`button`,{type:`button`,onClick:n,disabled:r,className:[`w-full text-left rounded-lg border p-3 transition-all`,t?`border-primary bg-primary/5 ring-1 ring-primary/30`:`border-border bg-background hover:border-foreground-subtle/40 hover:bg-surface-hover/50`,r?`opacity-50 cursor-not-allowed`:`cursor-pointer`].join(` `),children:[P(`div`,{className:`flex items-start justify-between gap-2`,children:y(`div`,{className:`flex-1 min-w-0`,children:[y(`div`,{className:`flex items-center gap-2`,children:[P(`span`,{className:`text-xs font-semibold text-foreground truncate`,children:e.name}),t&&P(me,{className:`h-3.5 w-3.5 text-primary shrink-0`})]}),P(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5 line-clamp-2`,children:e.description})]})}),y(`div`,{className:`flex items-center gap-3 mt-2 flex-wrap`,children:[y(`span`,{className:`inline-flex items-center gap-1 text-[10px] text-foreground-subtle`,children:[P(be,{className:`h-3 w-3`}),o]}),a&&P(`span`,{className:`text-[10px] text-foreground-subtle`,children:a}),s.length>0&&P(`div`,{className:`flex gap-1`,children:s.map(e=>P(`span`,{className:`text-[9px] uppercase rounded bg-surface border border-border px-1 py-0.5 text-foreground-subtle font-mono`,children:e},e))}),e.labels.length>0&&P(`span`,{className:`text-[10px] text-foreground-subtle`,children:i(`common.labels`,{count:e.labels.length})})]})]})}function Lm({field:e,value:t,onChange:n,disabled:r}){let{t:i}=H(),a=e.catalog??[],o=a.length>0,s=dt(a).length>0,c=e.allowCustomPath!==!1||e.allowCustom===!0,l=[...o?[{id:`catalog`,label:i(`formBuilder.modelSelector.models`,`Models ({{length}})`,{length:a.length})}]:[],...c?[{id:`custom`,label:i(`formBuilder.modelSelector.customPath`,`Custom Path`)}]:[]],[u,d]=f(o?`catalog`:`custom`),p=t==null?``:String(t);return y(`div`,{className:`space-y-3`,children:[l.length>1&&P(Mm,{tabs:l,active:u,onChange:d}),u===`catalog`&&o&&s&&P(Sr,{catalog:a,value:p,onChange:e=>n(e),disabled:r||e.disabled}),u===`catalog`&&o&&!s&&P(`div`,{className:`space-y-1.5 max-h-[320px] overflow-y-auto pr-1`,children:a.filter(e=>e.legacy!==!0).map(t=>P(Im,{entry:t,selected:p===t.id,onSelect:()=>n(t.id),disabled:r||e.disabled},t.id))}),u===`catalog`&&!o&&y(`div`,{className:`rounded-md border border-info/30 bg-info/5 px-3 py-2 flex items-start gap-2`,children:[P(Le,{className:`h-3.5 w-3.5 text-info shrink-0 mt-0.5`}),P(`p`,{className:`text-[11px] text-foreground-subtle leading-relaxed`,children:i(`formBuilder.modelSelector.noPredefinedModelsAvailableUse`,`No predefined models available. Use the Custom Path tab to specify a model file path or URL.`)})]}),u===`custom`&&c&&y(`div`,{className:`space-y-2`,children:[P(`input`,{type:`text`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none disabled:opacity-50`,placeholder:i(`formBuilder.modelSelector.enterPathLikeDataModels`,`Enter path like /data/models/custom.onnx or https://...`),value:p,disabled:r||e.disabled,onChange:e=>n(e.target.value)}),e.acceptFormats&&e.acceptFormats.length>0&&y(`p`,{className:`text-[10px] text-foreground-subtle`,children:[i(`formBuilder.modelSelector.acceptedFormats`,`Accepted formats:`),` `,e.acceptFormats.join(`, `)]})]}),(e.compatibilityNote||e.conversionGuideUrl)&&y(`div`,{className:`flex items-start justify-between gap-3 pt-1`,children:[e.compatibilityNote&&y(`p`,{className:`flex items-start gap-1 text-[10px] text-foreground-subtle`,children:[P(Le,{className:`h-3 w-3 mt-0.5 shrink-0`}),e.compatibilityNote]}),e.conversionGuideUrl&&y(`a`,{href:e.conversionGuideUrl,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1 text-[11px] text-primary hover:underline shrink-0`,children:[i(`formBuilder.modelSelector.howToConvertYourModel`,`How to convert your model`),P(I,{className:`h-3 w-3`})]})]})]})}function Rm({to:e}){let{search:t}=q();return P(J,{to:`${e}${t}`,replace:!0})}a();function zm(){return V.t(`helpers.keychainRevealHost.forbidden`)}function Bm(e){if(typeof e!=`object`||!e)return null;let t=Reflect.get(e,`data`);if(typeof t!=`object`||!t)return null;let n=Reflect.get(t,`code`);return typeof n==`string`?n:null}function Vm(e){let t=Bm(e);if(t===`FORBIDDEN`||t===`UNAUTHORIZED`)return zm();let n=e instanceof Error?e.message:String(e);return n.length>0?V.t(`helpers.keychainRevealHost.failedWith`,{message:n}):V.t(`helpers.keychainRevealHost.failed`)}function Hm({children:e}){let t=fr();return P(Nn,{reveal:p(async e=>{try{return(await t.mutateAsync({ref:e})).value}catch(e){throw Error(Vm(e))}},[t]),children:e})}a();function Um(){let e=ze(),t=j(),[n,r]=f(()=>e.isConnected()?`connected`:`disconnected`),i=M(!1),[a,o]=f(0),[c,l]=f([]);s(()=>e.subscribeConnectionEvents(e=>{r(t=>(t!==`connected`&&e===`connected`&&i.current&&o(e=>e+1),e!==`connected`&&(i.current=!0),e))}),[e]),s(()=>{a!==0&&t.invalidateQueries({queryKey:[[`addons`,`getLastRestart`]]})},[a,t]);let{data:u}=Ir(void 0,{enabled:n===`connected`&&a>0,staleTime:0,refetchOnMount:!1,refetchOnWindowFocus:!1}),d=M(null);return s(()=>{if(u==null||u.requestedAt===d.current)return;d.current=u.requestedAt;let e=Gm(u);l(t=>[...t,e]);let t=window.setTimeout(()=>{l(t=>t.filter(t=>t.id!==e.id))},6e3);return()=>window.clearTimeout(t)},[u]),P(E,{children:c.length>0&&P(Wm,{toasts:c})})}function Wm({toasts:e}){return P(`div`,{className:`fixed top-[calc(env(safe-area-inset-top)+1rem)] right-[calc(env(safe-area-inset-right)+1rem)] z-50 flex flex-col gap-2 max-w-sm w-full pointer-events-none`,children:e.map(e=>y(`div`,{className:`pointer-events-auto flex items-start gap-2 px-3 py-2.5 rounded-md border border-green-500/30 bg-green-500/10 shadow-lg backdrop-blur-sm`,children:[P(Be,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),y(`div`,{children:[P(`div`,{className:`text-[11px] font-semibold text-foreground`,children:e.title}),P(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:e.message})]})]},e.id))})}function Gm(e){let t=`restart-${e.requestedAt}`;if(e.kind===`framework-update`&&e.packageName!==void 0&&e.toVersion!==void 0){let n=e.fromVersion===void 0?`v${e.toVersion}`:`v${e.fromVersion} → v${e.toVersion}`;return{id:t,title:V.t(`system.reconnectOverlay.frameworkUpdated`,`Framework updated`),message:V.t(`system.reconnectOverlay.isNow`,`{{packageName}} is now {{fromTo}}.`,{packageName:e.packageName,fromTo:n})}}return{id:t,title:V.t(`system.reconnectOverlay.serverRestarted`,`Server restarted`),message:e.requestedBy===void 0?V.t(`system.reconnectOverlay.manualRestartCompleted`,`Manual restart completed.`):V.t(`system.reconnectOverlay.manualRestartByCompleted`,`Manual restart by {{requestedBy}} completed.`,{requestedBy:e.requestedBy})}}var Km=`/system/settings`,qm=[{path:`/system/secrets`,tab:`secrets`},{path:`/system/capabilities`,tab:`capabilities`}];function Jm(e,t=``){let n=new URLSearchParams(t);return n.delete(`tab`),n.set(`tab`,e),`${Km}?${n.toString()}`}function Ym({tab:e}){let{search:t,hash:n}=q();return P(J,{to:`${Jm(e,t)}${n}`,replace:!0})}a();var Xm={info:{bg:`bg-info/10`,border:`border-info/30`,icon:Le},warning:{bg:`bg-warning/10`,border:`border-warning/30`,icon:le},critical:{bg:`bg-danger/10`,border:`border-danger/30`,icon:Me}};function Zm({toast:e,onDismiss:t}){let n=Xm[e.severity]??Xm.info,r=n.icon;return s(()=>{let n=e.duration??5e3;if(n<=0)return;let r=setTimeout(()=>t(e.id),n);return()=>clearTimeout(r)},[e.id,e.duration,t]),y(`div`,{className:`flex items-start gap-3 px-4 py-3 rounded-lg border ${n.border} ${n.bg} shadow-lg backdrop-blur-sm animate-in slide-in-from-right-5 fade-in duration-200`,children:[P(r,{className:`h-4 w-4 shrink-0 mt-0.5 text-foreground-subtle`}),y(`div`,{className:`flex-1 min-w-0`,children:[P(`div`,{className:`text-xs font-semibold text-foreground`,children:e.title}),P(`div`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:e.message})]}),P(`button`,{type:`button`,onClick:()=>t(e.id),className:`shrink-0 p-0.5 rounded hover:bg-surface-hover transition-colors`,children:P(Oe,{className:`h-3.5 w-3.5 text-foreground-subtle`})})]})}function Qm(){let[e,t]=f([]),n=p(e=>{t(t=>t.filter(t=>t.id!==e))},[]);return nr(void 0,{onData:e=>{let n=e,r=`toast-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;t(e=>[...e,{...n,id:r,timestamp:Date.now()}])}}),e.length===0?null:P(`div`,{className:`fixed bottom-[calc(env(safe-area-inset-bottom)+1rem)] right-[calc(env(safe-area-inset-right)+1rem)] z-50 flex flex-col gap-2 max-w-sm w-full pointer-events-none`,children:e.map(e=>P(`div`,{className:`pointer-events-auto`,children:P(Zm,{toast:e,onDismiss:n})},e.id))})}function $m(e){return(t,n,r)=>e(t,{...typeof n==`string`?{defaultValue:n}:{defaultValue_one:n.one,defaultValue_other:n.other},...r})}var eh=(e,t,n)=>$m(V.t.bind(V))(e,t,n);a();function th({children:e}){let{t}=H();return P(He,{t:d(()=>$m(t),[t]),children:e})}a();function nh(e){if(typeof e!=`object`||!e)return;let{data:t}=e;return t?.code}function rh(e,t){let n=nh(e);return n===`UNAUTHORIZED`||n===`FORBIDDEN`?!0:/UNAUTHORIZED|FORBIDDEN/.test(t)}function ih(e,t,n,r){let[i,a]=f(!1),[o,c]=f(null);return s(()=>{if(a(!1),c(null),!t){a(!0);return}let i=!1;e.init().catch(()=>void 0);let o=t=>{e.awaitConnected().then(()=>{i||a(!0)},e=>{if(i)return;let s=e instanceof Error?e.message:String(e);if(rh(e,s)){if(t&&r!==void 0){r().then(e=>{if(!i){if(e){o(!1);return}console.warn(`[boot-gate] logout: probe UNAUTHORIZED and the refresh was refused`),n()}},()=>{i||(console.warn(`[boot-gate] logout: probe UNAUTHORIZED and recovery failed`),n())});return}console.warn(`[boot-gate] logout: probe UNAUTHORIZED after a successful refresh`,s),n();return}c(s),a(!0)})};return o(!0),()=>{i=!0}},[e,t,n,r]),{bootReady:i,bootError:o}}a();var ah=3e4;function oh(e){let t=M(e);t.current=e,s(()=>{let e=null,n=()=>{if(document.visibilityState===`hidden`){e=Date.now();return}if(document.visibilityState===`visible`&&e!==null){let n=Date.now()-e;e=null,n>=ah&&t.current()}},r=()=>{t.current()},i=e=>{e.persisted&&t.current()};return document.addEventListener(`visibilitychange`,n),window.addEventListener(`online`,r),window.addEventListener(`pageshow`,i),()=>{document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`online`,r),window.removeEventListener(`pageshow`,i)}},[])}a();function sh(){let{t:e}=H();return y(`div`,{role:`status`,"aria-busy":`true`,"aria-label":e(`layouts.addonPageLoader.loading`,`Loading page`),"data-testid":`addon-page-loading`,className:`flex flex-col gap-4 p-2 sm:p-4`,children:[P(wn,{className:`h-7 w-48`}),P(wn,{className:`h-5 w-72 max-w-full`}),P(wn,{className:`h-40`})]})}function ch({message:e}){let{t}=H();return P(`div`,{className:`p-2 sm:p-4`,"data-testid":`addon-page-error`,children:P(Cn,{title:t(`layouts.addonPageLoader.failedTitle`,`This page could not be shown`),message:e})})}var lh=class extends _{state={error:null,resetKey:this.props.resetKey};static getDerivedStateFromError(e){return{error:e instanceof Error?e:Error(String(e))}}static getDerivedStateFromProps(e,t){return e.resetKey===t.resetKey?null:{error:null,resetKey:e.resetKey}}componentDidCatch(e,t){console.error(`[addon-page] ${this.props.resetKey} crashed`,e,t.componentStack)}render(){return this.state.error===null?this.props.children:P(ch,{message:this.state.error.message})}};function uh({pageKey:e,children:t}){return P(lh,{resetKey:e,children:P(w,{fallback:P(sh,{}),children:t})})}a();function dh(e){let t=new Set,n=new Set,r=e=>e.page.remoteName.includes(e.addonId.replace(/[^a-zA-Z0-9]+/g,`_`)),i=[...e.filter(r),...e.filter(e=>!r(e))],a=[];for(let e of i){let r=`${e.addonId}::${e.page.id}`;t.has(r)||n.has(e.page.path)||(t.add(r),n.add(e.page.path),a.push({id:e.page.id,addonId:e.addonId,label:e.page.label,icon:e.page.icon,path:e.page.path,remoteName:e.page.remoteName,bundle:e.page.bundle,bundleUrl:e.bundleUrl,...e.page.section===void 0?{}:{section:e.page.section},...e.page.sectionLabel===void 0?{}:{sectionLabel:e.page.sectionLabel}}))}return a}var fh=new Map,ph=new Map,mh=new Set;function hh(e){return!e||typeof e!=`object`?!1:typeof e.default==`function`}async function gh(e,t){let i=fh.get(e);if(i)return i;let a=ph.get(e);if(a)return a;mh.has(e)||(Zn(),r([{name:e,entry:B(t),type:`module`}],{force:!1}),mh.add(e));let o=n(`${e}/page`).then(n=>{if(!hh(n))throw Error(`Addon page remote ${e} (${t}) does not expose a default React component on './page'`);return fh.set(e,n.default),ph.delete(e),n.default}).catch(t=>{throw ph.delete(e),t});return ph.set(e,o),o}function _h(){let{t:e}=H(),{pagePath:t}=Ya(),n=Ga(),r=ze(),{data:i}=Jr(void 0),a=d(()=>i?dh(i):void 0,[i]),o=a?.find(e=>e.path===`/addon/${t}`),c=o?.remoteName,l=o?.bundleUrl,[u,p]=f(null),[m,h]=f(null);return s(()=>{if(!c||!l)return;h(null);let e=fh.get(c);if(e){p(()=>e);return}p(null);let t=!1;return gh(c,l).then(e=>{t||p(()=>e)}).catch(e=>{t||h(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[c,l]),a?o?m?P(ch,{message:m}):u?P(uh,{pageKey:o.remoteName,children:P(u,{trpc:r.trpcClient,theme:{isDark:document.documentElement.classList.contains(`dark`)},navigate:e=>{n(e.startsWith(`/`)?e:`/${e}`)}})}):P(sh,{}):P(`div`,{className:`flex items-center justify-center h-full text-foreground-subtle`,children:e(`layouts.addonPageLoader.addonPageNotFound`,`Addon page not found`)}):P(sh,{})}function vh({children:e}){let t=$n({});return P($r,{value:t.isPending?{status:`pending`}:t.isError||t.data===void 0?{status:`unknown`,reason:t.isError?String(t.error):`no palette`}:t.data.status===`unknown`?{status:`unknown`,reason:t.data.reason}:{status:`ready`,palette:t.data},children:e})}function yh(){let e=Nr(),{t}=H();return e.status===`unknown`?P(`p`,{role:`status`,className:`shrink-0 px-4 py-1 text-xs text-warning`,children:t(`pipeline.palette.unknown`,`The stored palette cannot be read ({{reason}}). Boxes use the bundled CamStack preset.`,{reason:e.reason})}):null}ui();var bh=/\p{Mn}/gu;function xh(e){return e.normalize(`NFD`).replace(bh,``).toLowerCase().trim()}var Sh=[`device`,`page`,`integration`],Ch=0,wh=1,Th=2,Eh=3,Dh=4,Oh=5,kh=6,Ah=7;function jh(e,t,n,r){return n.includes(r)?Ch:e===r?wh:e.startsWith(r)?Th:e.split(/\s+/).some(e=>e.startsWith(r))?Eh:e.includes(r)?Dh:t.some(e=>e.includes(r))?Oh:null}function Mh(e,t){let n=0;for(let r=0;r<e.length&&n<t.length;r++)e[r]===t[n]&&n++;return n===t.length}function Nh(e){return e<4?0:e<=7?1:e<=12?2:3}function Ph(e,t,n){if(e===t)return 0;if(n<=0||Math.abs(e.length-t.length)>n)return null;let r=t.length,i=Array(r+1).fill(0),a=Array.from({length:r+1},(e,t)=>t),o=Array(r+1).fill(0);for(let s=1;s<=e.length;s++){o[0]=s;let c=s,l=e[s-1];for(let n=1;n<=r;n++){let r=t[n-1],u=l===r?0:1,d=Math.min((a[n]??1/0)+1,o[n-1]+1,(a[n-1]??1/0)+u);s>1&&n>1&&l===t[n-2]&&e[s-2]===r&&(d=Math.min(d,(i[n-2]??1/0)+1)),o[n]=d,d<c&&(c=d)}if(c>n)return null;let u=i;i=a,a=o,o=u}let s=a[r]??1/0;return s<=n?s:null}function Fh(e,t){if(Mh(e,t))return kh;let n=Nh(t.length);if(n>0){for(let r of e.split(/\s+/))if(Ph(r,t,n)!==null)return Ah}return null}function Ih(e,t,n=200){let r=xh(t);if(r.length===0)return{groups:[],totalMatched:0,truncated:!1};let i=new Map;for(let t of e){let e=xh(t.label),n=jh(e,(t.keywords??[]).map(xh),(t.identifiers??[]).map(xh),r)??Fh(e,r);if(n===null)continue;let a=i.get(t.domain)??[];a.push({item:t,rank:n}),i.set(t.domain,a)}let a=0;for(let e of i.values())a+=e.length;let o=n,s=[];for(let e of Sh){let t=i.get(e);if(!t||t.length===0||o<=0)continue;t.sort((e,t)=>e.rank-t.rank||e.item.label.localeCompare(t.item.label));let n=t.slice(0,o).map(e=>e.item);o-=n.length,s.push({domain:e,items:n})}return{groups:s,totalMatched:a,truncated:a>n}}function Lh(e){return e.flatMap(e=>e.items)}function Rh(e){let t=new Map;for(let n of e)t.set(n.id,n.name);let n=new Map;for(let r of e){let e=r.parentDeviceId;e!==null&&e!==r.id&&n.set(r.id,t.get(e)??`#${String(e)}`)}return n}function zh(e,t){return e.filter(e=>!e.adminOnly||t)}function Bh({t:e,isAdmin:t}){let n=zh([{label:e(`nav.devices`,`Devices`),icon:L,path:`/devices`},{label:e(`nav.integrations`),icon:ue,path:`/integrations`},{label:e(`nav.build`,`Build-your-self`),icon:$e,path:`/build`,adminOnly:!0},{label:e(`nav.locations`,`Locations`),icon:Ye,path:`/locations`,adminOnly:!0},{label:e(`nav.viewer`,`Viewer`),icon:an,path:`/live`}],t),r=zh([{label:e(`nav.library`,`Library`),icon:on,path:`/library`,adminOnly:!0,keywords:[`People`,`Vehicles`,`Events`,`Scenes`,`plates`,`faces`,`detection-intelligence`]},{label:e(`nav.recordings`,`Recordings`),icon:re,path:`/recordings`,adminOnly:!0}],t),i=zh([{label:e(`nav.nodes`,`Nodes`),icon:nt,path:`/system/nodes`,adminOnly:!0},{label:e(`nav.history`,`History`),icon:ee,path:`/system/history`,adminOnly:!0,keywords:[`charts`,`graphs`,`energy`,`temperature`,`metrics`,`trends`]},{label:e(`nav.pipeline`,`Pipeline`),icon:yn,path:`/system/pipeline`},{label:e(`system.addons`),icon:ge,path:`/system/addons`,adminOnly:!0},{label:e(`system.ai`,`AI`),icon:Se,path:`/system/ai`,adminOnly:!0}],t),a=zh([{label:e(`system.identity`,`Identity & Access`),icon:Ue,path:`/system/identity`,adminOnly:!0},{label:e(`system.network`,`Network`),icon:dn,path:`/system/network`,adminOnly:!0},{label:e(`system.integrations`,`Connectivity`),icon:ue,path:`/system/integrations`,adminOnly:!0},{label:e(`system.data`,`Data`),icon:ae,path:`/system/data`,adminOnly:!0},{label:e(`system.notifications`,`Notifications`),icon:se,path:`/system/notifications`,adminOnly:!0},{label:e(`system.calendars`,`Calendars`),icon:ln,path:`/system/calendars`,adminOnly:!0},{label:e(`system.systemNav`,`System`),icon:Xe,path:Km,adminOnly:!0},{label:e(`system.logs`,`Logs`),icon:Ve,path:`/system/logs`,adminOnly:!0},{label:e(`system.terminal`,`Terminal`),icon:pn,path:`/system/terminal`,adminOnly:!0}],t);return[{key:`top`,label:null,items:n},{key:`detection`,label:e(`nav.detectionSection`,`Detection`),items:r},{key:`cluster`,label:e(`nav.clusterSection`,`Cluster`),items:i},{key:`administration`,label:e(`system.title`,`Administration`),items:a}]}var Vh={gauge:de,puzzle:ge,bot:ce,cpu:be,terminal:pn,box:Fe,boxes:Fe,monitor:an,wrench:je,activity:Je,plug:ue,"graduation-cap":te};function Hh(e){return Vh[e]??ge}function Uh(e,t){for(let n of Bh(t))for(let t of n.items)if(t.path===e)return{icon:t.icon,title:t.label,path:t.path};return null}var Wh=` · `;function Gh(e,t,n,r){let i=[`#${t}`];return r!==void 0&&i.push(r),e.stableId.length>0&&e.stableId!==n&&i.push(e.stableId),i.push(e.type),e.disabled&&i.push(`disabled`),i.join(Wh)}function Kh(e,t=null){let n=Rh(e),r=Jn(t);return e.map(e=>{let t=String(e.id),i=e.name||e.stableId||`#${t}`,a=n.get(e.id),o=r(e),s=o.kind===`resolved`?o.integration.name:``;return{key:`device:${t}`,domain:`device`,label:i,subtitle:Gh(e,t,i,a),identifiers:[t,`#${t}`],keywords:[e.stableId,e.addonId,e.location??``,a??``,s].filter(e=>e.length>0),path:`/devices/${t}`,icon:Qr(e.type).icon}})}function qh(e){return e.map(e=>({key:`integration:${e.id}`,domain:`integration`,label:e.name||e.addonId,subtitle:e.enabled?e.addonId:V.t(`helpers.searchItems.disabled`,{addonId:e.addonId}),keywords:[e.addonId,e.processState],path:`/integrations/${e.id}`}))}function Jh(e,t,n){let r=e.section?.trim();return r?t[r]??e.sectionLabel?.trim()??r:n}function Yh(e,t,n){let r=e.flatMap(e=>e.items.map(t=>({key:`page:${t.path}`,domain:`page`,label:t.label,subtitle:e.label??void 0,path:t.path,icon:t.icon,...t.keywords!==void 0&&t.keywords.length>0?{keywords:t.keywords}:{}}))),i={detection:n.detection,cluster:n.cluster,administration:n.administration},a=t.map(e=>({key:`page:addon:${e.addonId}:${e.id}`,domain:`page`,label:e.label,subtitle:Jh(e,i,n.ungrouped),keywords:[e.addonId],path:e.path,icon:Hh(e.icon)}));return[...r,...a]}a();var Xh={device:{labelKey:`search.resultsList.devices`,icon:L},page:{labelKey:`search.resultsList.pages`,icon:cn},integration:{labelKey:`search.resultsList.integrations`,icon:ue}};function Zh({groups:e,activeKey:t,query:n,totalMatched:r,truncated:i,onSelect:a,onHover:o}){let{t:c}=H(),l=M(null);if(s(()=>{t&&(l.current?.querySelector(`[data-key="${CSS.escape(t)}"]`))?.scrollIntoView({block:`nearest`})},[t]),n.trim().length===0)return null;if(e.length===0)return P(`div`,{className:`px-3 py-4 text-center text-[12px] text-foreground-subtle`,children:c(`search.resultsList.noResults`,{query:n})});let u=e.reduce((e,t)=>e+t.items.length,0);return y(E,{children:[P(`div`,{ref:l,role:`listbox`,className:`max-h-[60vh] overflow-y-auto py-1`,children:e.map(e=>{let n=Xh[e.domain],r=n.icon;return y(`div`,{className:`px-1 py-1`,children:[y(`div`,{className:`sticky top-0 z-10 flex items-center gap-1.5 bg-surface px-2 py-1 text-[10px] font-semibold uppercase tracking-widest text-foreground-subtle/60`,children:[P(r,{className:`h-3 w-3`}),c(n.labelKey)]}),e.items.map(e=>{let r=e.icon??n.icon,i=e.key===t;return y(`button`,{type:`button`,role:`option`,"aria-selected":i,"data-key":e.key,onMouseEnter:()=>o(e),onClick:()=>a(e),className:`flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left text-[12px] transition-colors ${i?`bg-primary/12 text-primary`:`text-foreground hover:bg-surface-hover`}`,children:[P(r,{className:`h-3.5 w-3.5 shrink-0 ${i?`text-primary`:`text-foreground-subtle`}`}),y(`span`,{className:`flex-1 min-w-0`,children:[P(`span`,{className:`block truncate font-medium`,children:e.label}),e.subtitle&&P(`span`,{className:`block truncate text-[10px] text-foreground-subtle`,children:e.subtitle})]})]},e.key)})]},e.domain)})}),i&&P(`div`,{className:`border-t border-border px-3 py-1.5 text-center text-[10px] text-foreground-subtle`,children:c(`search.truncatedResults`,`Showing first {{shown}} of {{total}} — refine your search.`,{shown:u,total:r})})]})}a();function Qh({navSections:e,addonPages:t,compact:n,onNavigated:r}){let{t:i}=H(),a=Ga(),o=M(null),c=M(null),l=M(null),[u,m]=f(null),[h,g]=f(``),[_,v]=f(0),[b,x]=f(!1),{data:S}=ei({projection:`slim`}),{data:C}=ur(void 0),w=d(()=>{let n={detection:i(`nav.detectionSection`,`Detection`),cluster:i(`nav.clusterSection`,`Cluster`),administration:i(`system.title`,`Administration`),ungrouped:i(`nav.addonPages`,`Addon Pages`)};return[...Kh(S??[],C??null),...Yh(e,t,n),...qh(C??[])]},[S,C,e,t,i]),{groups:T,totalMatched:E,truncated:D}=d(()=>Ih(w,h),[w,h]),O=d(()=>Lh(T),[T]);s(()=>{v(0)},[h,w]),s(()=>{b&&o.current?.focus()},[b]);let k=p(()=>{x(!1),g(``),v(0)},[]),A=p(e=>{a(e.path),k(),o.current?.blur(),r?.()},[a,k,r]);s(()=>{function e(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),x(!0))}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),s(()=>{if(!b)return;function e(e){if(!(e.target instanceof Node))return;let t=c.current?.contains(e.target)===!0,n=l.current?.contains(e.target)===!0;!t&&!n&&x(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[b]);let j=b&&h.trim().length>0;s(()=>{if(!j){m(null);return}let e=()=>{let e=o.current?.getBoundingClientRect();e&&m({left:e.left,top:e.bottom+4,width:e.width})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[j]);let N=O[_]?.key??null,F=i(`search.placeholder`,`Search devices, pages, integrations…`),I=y(`div`,{className:`relative`,children:[P(Ae,{className:`pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-foreground-subtle`}),P(`input`,{ref:o,type:`text`,value:h,placeholder:F,"aria-label":F,role:`combobox`,"aria-expanded":b&&h.trim().length>0,"aria-controls":`global-search-results`,onChange:e=>{g(e.target.value),x(!0)},onFocus:()=>x(!0),onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),O.length>0&&v(e=>(e+1)%O.length);else if(e.key===`ArrowUp`)e.preventDefault(),O.length>0&&v(e=>(e-1+O.length)%O.length);else if(e.key===`Enter`){e.preventDefault();let t=O[_];t&&A(t)}else e.key===`Escape`&&(e.preventDefault(),k(),o.current?.blur())},className:`w-full rounded-md border border-border bg-surface py-1.5 pl-7 pr-6 text-[12px] text-foreground placeholder:text-foreground-subtle/70 focus:outline-none focus:ring-1 focus:ring-primary/50`}),h.length>0&&P(`button`,{type:`button`,"aria-label":i(`search.globalSearch.clearSearch`,`Clear search`),onClick:()=>{g(``),o.current?.focus()},className:`absolute right-1.5 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground`,children:P(Oe,{className:`h-3 w-3`})}),j&&u!==null&&di(P(`div`,{ref:l,id:`global-search-results`,className:`fixed z-50 w-max max-w-[26rem] rounded-lg border border-border bg-surface shadow-xl`,style:{left:u.left,top:u.top,minWidth:u.width},children:P(Zh,{groups:T,activeKey:N,query:h,totalMatched:E,truncated:D,onSelect:A,onHover:e=>{let t=O.findIndex(t=>t.key===e.key);t>=0&&v(t)}})}),document.body)]});return n?P(`div`,{ref:c,className:`px-1.5 pb-1.5`,children:b?P(`div`,{className:`fixed z-50 w-max min-w-72 max-w-[26rem]`,style:{left:`calc(env(safe-area-inset-left) + 3.5rem)`,top:`calc(env(safe-area-inset-top) + 3.5rem)`},children:I}):P(`button`,{type:`button`,onClick:()=>x(!0),"aria-label":F,title:F,className:`flex w-full items-center justify-center rounded-md px-0 py-2 text-foreground-subtle hover:bg-surface-hover hover:text-foreground transition-colors`,children:P(Ae,{className:`h-3.5 w-3.5 shrink-0`})})}):P(`div`,{ref:c,className:`px-2 pb-2`,children:I})}var $h=/^(\d{1,3}\.){3}\d{1,3}$/;function eg(e){let t=e.startsWith(`[`)&&e.endsWith(`]`)?e.slice(1,-1):e;return!!($h.test(t)||t.includes(`:`))}function tg(e,t){return!t||eg(e)?!1:e===t||e.endsWith(`.${t}`)}a();var ng=`auth-webauthn/passkey-enrollment`,rg=`camstack_passkey_prompt_dismissed:`,ig=720*60*60*1e3;function ag(e){try{let t=localStorage.getItem(`${rg}${e}`);if(!t)return!1;let n=Number(t);return Number.isFinite(n)?Date.now()-n<ig:!1}catch{return!1}}function og(e){try{localStorage.setItem(`${rg}${e}`,String(Date.now()))}catch{}}function sg(){let{user:e}=Ql(),{t}=H(),n=ze(),r=Kn(ng),[i,a]=f(!1),[o,s]=f(!1),c=d(()=>e?ag(e.id):!0,[e]),l=Fr.auth.listLoginMethods.useQuery().data?.find(e=>e.kind===`passkey`),u=l!==void 0&&tg(window.location.hostname,l.rpId),m=e!==null&&u&&r!=null&&!c,h=T({queryKey:[`auth`,`listOwnPasskeys`],queryFn:()=>n.listOwnPasskeys(),enabled:m,staleTime:6e4}),g=p(()=>{e&&og(e.id),a(!0),s(!1)},[e]),_=p(()=>{s(!1),h.refetch()},[h]);return!m||i||h.data===void 0||h.data.length>0?null:y(`div`,{className:`shrink-0 border-b border-primary/20 bg-primary/5`,children:[y(`div`,{className:`flex items-center gap-2.5 px-3 py-2 text-xs text-foreground`,children:[P(sn,{className:`h-4 w-4 text-primary shrink-0`}),P(`span`,{className:`flex-1 min-w-0`,children:t(`passkeyPrompt.message`,`Save a passkey for faster sign-in?`)}),P(`button`,{onClick:()=>s(e=>!e),className:`rounded bg-primary px-2.5 py-1 text-[11px] font-semibold text-primary-foreground hover:bg-primary/90`,children:t(`passkeyPrompt.enrollNow`,`Enroll now`)}),P(`button`,{onClick:g,className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground hover:bg-surface-hover`,children:t(`passkeyPrompt.notNow`,`Not now`)}),P(`button`,{onClick:g,"aria-label":t(`passkeyPrompt.notNow`,`Not now`),className:`p-1 rounded text-foreground-subtle hover:text-foreground`,children:P(Oe,{className:`h-3.5 w-3.5`})})]}),o&&P(`div`,{className:`px-3 pb-3`,children:y(`div`,{className:`max-w-xl`,children:[P(hr,{widgetId:ng,host:`dashboard`}),P(`div`,{className:`mt-2 flex justify-end`,children:P(`button`,{onClick:_,className:`rounded border border-border px-2.5 py-1 text-[11px] text-foreground-subtle hover:text-foreground hover:bg-surface-hover`,children:t(`common.close`,`Close`)})})]})})]})}var cg=6e4;function lg(){let e=gr(void 0,{staleTime:cg});return{info:e.data?.serverName??null,isLoading:e.isLoading}}a();var ug=`system-config`,dg=`hub`,fg=`camstack_server_name_prompt_dismissed`;function pg(){try{return sessionStorage.getItem(fg)===`1`}catch{return!1}}function mg(){try{sessionStorage.setItem(fg,`1`)}catch{}}function hg(e){return e.isAdmin&&e.info!==null&&e.info.isDefault&&!e.dismissed}function gg(){let{user:e}=Ql(),{info:t}=lg(),[n,r]=f(pg);return hg({isAdmin:e?.isAdmin===!0,info:t,dismissed:n})?P(_g,{suggestion:t?.name??``,onLater:()=>{mg(),r(!0)}}):null}function _g({suggestion:e,onLater:t}){let{t:n}=H(),r=j(),i=mr(),[a,o]=f(e),[c,l]=f(null),u=M(null);s(()=>u.current?.focus(),[]);let d=p(async()=>{let e=mt.safeParse(a);if(!e.success){l(e.error.issues[0]?.message??n(`serverName.invalid`,`Not a valid name`));return}l(null);try{await i.mutateAsync({addonId:ug,nodeId:dg,patch:{name:e.data}}),await r.invalidateQueries({queryKey:[[`system`,`info`]]}),await r.invalidateQueries({queryKey:[[`addonSettings`]]})}catch(e){l(e instanceof Error&&e.message.length>0?e.message:`Could not save`)}},[r,i,n,a]);return P(Pr,{open:!0,onOpenChange:e=>!e&&t(),children:P(vr,{children:y(`form`,{onSubmit:e=>{e.preventDefault(),i.isPending||d()},children:[y(Lr,{children:[P(wr,{children:n(`serverName.title`,`Name this server`)}),P(Cr,{children:n(`serverName.description`,`Pick a name for this hub. It shows in the admin UI and on the apps’ sign-in screen. You can change it later in System settings.`)})]}),P(ii,{children:P(li,{label:n(`serverName.label`,`Server name`),...c===null?{}:{error:c},children:P(Ln,{ref:u,value:a,maxLength:48,onChange:e=>o(e.target.value),state:c===null?`default`:`error`,"aria-label":n(`serverName.label`,`Server name`)})})}),y(Kr,{children:[P(jn,{type:`button`,variant:`ghost`,onClick:t,disabled:i.isPending,children:n(`serverName.later`,`Later`)}),y(jn,{type:`submit`,disabled:i.isPending||a.trim().length===0,children:[i.isPending&&P(Re,{className:`h-4 w-4 animate-spin`}),n(`common.save`,`Save`)]})]})]})})})}var vg=4,yg=160,bg=320,xg=`env(safe-area-inset-top)`,Sg=`env(safe-area-inset-bottom)`;function Cg(e){let{rect:t,viewportWidth:n,viewportHeight:r}=e,i=Math.min(bg,n-16),a={position:`fixed`,left:Math.max(8,Math.min(t.left,n-8-i)),width:i,zIndex:9999};if(r-t.bottom>=t.top){let e=`max(${t.bottom+vg}px, calc(${xg} + 8px))`;return{...a,top:e,maxHeight:`max(${yg}px, calc(100dvh - ${e} - ${Sg} - 8px))`}}let o=`max(${r-t.top+vg}px, calc(${Sg} + 8px))`;return{...a,bottom:o,maxHeight:`max(${yg}px, calc(100dvh - ${o} - ${xg} - 8px))`}}function wg(e){return e===`totp`||e===`passkey`}function Tg(e){if(!e.startsWith(`#`))return null;let t=new URLSearchParams(e.slice(1)),n=t.get(`challenge`);if(n!==null){if(n.length===0)return null;let e=(t.get(`factors`)??``).split(`,`).filter(wg);return e.length===0?null:{kind:`challenge`,challengeToken:n,factors:e}}let r=t.get(`error`);return r===`sso-not-linked`||r===`sso-state`?{kind:`error`,code:r,provider:t.get(`provider`)}:null}function Eg(e,t){switch(e){case`sso-not-linked`:return V.t(`helpers.ssoReturn.notLinked`,{provider:t??V.t(`helpers.ssoReturn.signInFallback`)});case`sso-state`:return V.t(`helpers.ssoReturn.state`)}}var Dg={expired:`helpers.ssoReturn.link.expired`,provider:`helpers.ssoReturn.link.provider`,session:`helpers.ssoReturn.link.session`,conflict:`helpers.ssoReturn.link.conflict`,state:`helpers.ssoReturn.link.state`};function Og(e){let t=new URLSearchParams(e),n=t.get(`linked`);if(n!==null&&n.length>0)return{kind:`linked`,provider:n};let r=t.get(`linkError`);return r===null?null:{kind:`error`,message:V.t(Dg[r]??`helpers.ssoReturn.link.failed`)}}var kg=`camstack:sso-return`,Ag=`camstack:sso-ack`,jg=`/sso-complete`,Mg=1500,Ng=520,Pg=680;function Fg(e){if(!e.startsWith(`#`))return null;let t=new URLSearchParams(e.slice(1)),n=t.get(`return`);t.delete(`return`);let r=t.toString();return n===`login`?r.length>0?{target:n,fragment:r}:null:n===`profile`&&r.length>0?{target:n,query:r}:null}function Ig(e){return e.target===`login`?`/login#${e.fragment}`:`/system/my-access?${e.query}`}function Lg(e){let t=new URL(e,`http://placeholder.invalid`);return t.searchParams.set(`popup`,`1`),/^[a-z][a-z0-9+.-]*:/i.test(e)?t.toString():`${t.pathname}${t.search}${t.hash}`}function Rg(e=window){let t=Math.max(0,Math.round(e.screenX+(e.outerWidth-Ng)/2)),n=Math.max(0,Math.round(e.screenY+(e.outerHeight-Pg)/2));return[`popup=yes`,`width=${Ng}`,`height=${Pg}`,`left=${t}`,`top=${n}`,`toolbar=no`,`menubar=no`,`location=no`,`status=no`,`resizable=yes`,`scrollbars=yes`].join(`,`)}function zg(e){try{return window.open(e??`about:blank`,`camstack-sso`,Rg())??null}catch{return null}}function Bg(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.target===`login`?typeof t.fragment==`string`:t.target===`profile`?typeof t.query==`string`:!1}function Vg(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`camstack:sso-return`&&Bg(t.completion)}function Hg(e,t,n){return t===null||e.source!==t||e.origin!==n?null:Vg(e.data)?e.data.completion:null}var Ug=`camstack-sso`,Wg=`camstack:sso-done`;function Gg(e,t){return e.target===`profile`?{target:`profile`,query:e.query}:t?{target:`login`}:null}function Kg(e){if(typeof e!=`object`||!e)return null;let t=e;if(t.type!==`camstack:sso-done`)return null;let n=Object.keys(t).sort().join(`,`);return t.target===`login`&&n===`target,type`?{target:`login`}:t.target===`profile`&&typeof t.query==`string`&&n===`query,target,type`?{target:`profile`,query:t.query}:null}function qg(e){return typeof e==`object`&&!!e&&e.type===`camstack:sso-done-ack`}function Jg(e){try{let t=e.location.origin;return typeof t==`string`?t:null}catch{return null}}function Yg(){if(typeof BroadcastChannel>`u`)return null;try{let e=new BroadcastChannel(Ug);return{post:t=>e.postMessage(t),subscribe:t=>{let n=e=>t(e.data);return e.addEventListener(`message`,n),()=>e.removeEventListener(`message`,n)},close:()=>e.close()}}catch{return null}}var Xg=500;function Zg(e,t,n=window,r={}){let i=n.location.origin,a=r.channel===void 0?Yg():null,o=r.channel===void 0?a:r.channel,s=r.setInterval??((e,t)=>window.setInterval(e,t)),c=r.clearInterval??(e=>window.clearInterval(e)),l=!1,u=!1,d=r=>{let a=Hg(r,e,i);a===null||l||(l=!0,n.removeEventListener(`message`,d),e.postMessage({type:Ag},i),t.onReturn(a))};n.addEventListener(`message`,d);let f=o?.subscribe(e=>{let n=Kg(e);n===null||l||(l=!0,o.post({type:`camstack:sso-done-ack`}),t.onDone?.(n))})??null,p=s(()=>{u||!e.closed||(u=!0,c(p),t.onClosed?.())},Xg);return()=>{n.removeEventListener(`message`,d),f?.(),a?.close(),c(p)}}function Qg(e,t,n){if(t===null||e.source!==t||e.origin!==n)return!1;let r=e.data;return typeof r==`object`&&!!r&&r.type===`camstack:sso-ack`}function $g(e,t){return new Promise(n=>{let r=!1,i=t(()=>{r||(r=!0,i(),n(!0))});e.setTimeout(()=>{r||(r=!0,i(),n(!1))},Mg)})}function e_(e,t,n){let r=$g(n,e=>{let r=r=>{Qg(r,t,n.origin)&&e()};return n.addEventListener(`message`,r),()=>n.removeEventListener(`message`,r)});try{let r={type:kg,completion:e};t.postMessage(r,n.origin)}catch{}return r}function t_(e,t,n){let r=$g(n,e=>t.subscribe(t=>{qg(t)&&e()}));return t.post({type:Wg,...e}),r}async function n_(e,t){let n=t.opener!==null&&!t.opener.closed?t.opener:null;if(n!==null&&Jg(n)===t.origin&&await e_(e,n,t)){t.close();return}let r=e.target===`login`?new URLSearchParams(e.fragment).get(`token`):null,i=r!==null&&r.length>0,a=Gg(e,i);if(a!==null&&t.channel!==null&&(r!==null&&i&&await t.persistSession(r),await t_(a,t.channel,t))){t.close();return}if(n!==null&&e.target===`profile`){let n=Og(`?${e.query}`);if(n?.kind===`error`){t.showResult({kind:`link-error`,message:n.message});return}t.close();return}t.continueAt(Ig(e))}function r_(e,t){return(t.length>0&&e.startsWith(t)?e.slice(t.length):e).replace(/\/+$/,``)===jg}var i_=`camstack:broker-oauth`;function a_(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`camstack:broker-oauth`&&typeof t.ok==`boolean`}function o_(e,t){return e.split(`{{brokerId}}`).join(encodeURIComponent(t))}function s_(e,t,n=window){let r=n.location.origin,i=!1,a=e=>{i||(i=!0,n.removeEventListener(`message`,o),window.clearInterval(s),t(e))},o=t=>{t.origin!==r||t.source!==e||a_(t.data)&&a({ok:t.data.ok,...t.data.brokerId===void 0?{}:{brokerId:t.data.brokerId},...t.data.error===void 0?{}:{error:t.data.error}})};n.addEventListener(`message`,o);let s=window.setInterval(()=>{e.closed&&a({ok:!0})},500);return()=>{i=!0,n.removeEventListener(`message`,o),window.clearInterval(s)}}var c_={open:e=>zg(e),assign:e=>window.location.assign(e),watch:(e,t)=>s_(e,t)};function l_(e,t,n=c_){let r=B(Lg(e)),i=n.open(r);if(i===null){n.assign(r);return}n.watch(i,e=>{t?.(e)})}function u_(e,t,n){l_(o_(e,t),n)}var d_=!1;function f_(){return d_}function p_(){d_=!0}function m_(e){return!e.read&&e.severity===`critical`}function h_(e){return e.filter(m_)}function g_(e){return e!==void 0&&typeof e.href==`string`&&e.href.length>0}var __=/^\/addon\/[^/?#]+\/oauth\//;function v_(e){return e.navigation===void 0?__.test(e.href):e.navigation===`server`}function y_({action:e,className:t,onActivate:n}){let r=j();return v_(e)?P(`a`,{href:B(e.href),className:t,onClick:t=>{t.preventDefault(),n?.(t),l_(e.href,()=>{r.invalidateQueries({queryKey:[[`alerts`]]}),r.invalidateQueries({queryKey:[[`broker`]]}),r.invalidateQueries({queryKey:[[`recordEntries`]]})})},children:e.label}):P(fs,{to:e.href,className:t,onClick:n,children:e.label})}a(),ui();var b_={info:Le,success:Be,warning:le,error:Me,critical:un},x_={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-danger`,critical:`text-danger`},S_={active:`border-l-info`,"in-progress":`border-l-warning`,completed:`border-l-success`,failed:`border-l-danger`,dismissed:`border-l-foreground-subtle/30`};function C_(e){let t=Math.floor((Date.now()-e)/1e3);if(t<60)return V.t(`helpers.relativeTime.justNow`);let n=Math.floor(t/60);if(n<60)return V.t(`helpers.relativeTime.minutesAgo`,{count:n});let r=Math.floor(n/60);if(r<24)return V.t(`helpers.relativeTime.hoursAgo`,{count:r});let i=Math.floor(r/24);return V.t(`helpers.relativeTime.daysAgo`,{count:i})}function w_(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function T_(e){return typeof e==`string`&&e.length>0?e:void 0}function E_(e){if(w_(e.metadata)){let t=T_(e.metadata.nodeId)??T_(e.metadata.agentId);if(t!==void 0)return t}let t=e.source;if(t!==void 0&&!(t.type!==`node`&&t.type!==`agent`))return T_(t.id)}function D_({alert:e,onMarkRead:t,onDismiss:n}){let{t:r}=H(),i=e.severity in b_?e.severity:`info`,a=g_(e.action)?e.action:void 0,o=e.status in S_?e.status:`active`,s=b_[i],c=x_[i],l=S_[o],{nodes:u}=Mr(),d=E_(e),f=d===void 0?void 0:u.find(e=>e.id===d),p=d===void 0?void 0:f?.name??d;return y(`div`,{className:`flex items-start gap-2.5 px-3 py-2.5 border-l-2 ${l} ${e.read?`opacity-60`:``} hover:bg-surface-hover transition-colors`,children:[P(s,{className:`h-3.5 w-3.5 shrink-0 mt-0.5 ${c}`}),y(`div`,{className:`flex-1 min-w-0`,children:[y(`div`,{className:`flex items-center gap-1.5`,children:[P(`span`,{className:`text-[11px] font-semibold ${e.read?`text-foreground-subtle`:`text-foreground`}`,children:e.title}),!e.read&&P(`span`,{className:`h-1.5 w-1.5 rounded-full bg-primary shrink-0`})]}),p!==void 0&&P(`div`,{className:`text-foreground-subtle text-[10px] mt-0.5 truncate`,children:p}),P(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5 line-clamp-2`,children:e.message}),a!==void 0&&P(y_,{action:a,className:`inline-flex mt-1.5 items-center rounded-md bg-primary px-2 py-0.5 text-[10px] font-medium text-primary-foreground hover:bg-primary/90 transition-colors`,onActivate:e=>e.stopPropagation()}),e.status===`in-progress`&&e.progress!==void 0&&y(`div`,{className:`mt-1.5 flex items-center gap-2`,children:[P(`div`,{className:`flex-1 h-1 bg-surface-hover rounded-full overflow-hidden`,children:P(`div`,{className:`h-full bg-primary rounded-full transition-all duration-300`,style:{width:`${String(Math.min(100,Math.max(0,e.progress)))}%`}})}),y(`span`,{className:`text-[9px] text-foreground-subtle font-mono shrink-0`,children:[String(Math.round(e.progress)),`%`]})]}),P(`div`,{className:`text-[9px] text-foreground-subtle/60 mt-1`,children:C_(e.updatedAt)})]}),y(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[!e.read&&P(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),t(e.id)},className:`p-1 rounded hover:bg-surface-hover transition-colors`,title:r(`ui.alertBell.markAsRead`,`Mark as read`),children:P(me,{className:`h-3 w-3 text-foreground-subtle`})}),e.status!==`in-progress`&&P(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),n(e.id)},className:`p-1 rounded hover:bg-surface-hover transition-colors`,title:r(`ui.alertBell.dismiss`,`Dismiss`),children:P(Oe,{className:`h-3 w-3 text-foreground-subtle`})})]})]})}function O_({variant:e=`icon`,compact:t=!1}={}){let{t:n}=H(),[r,i]=f(!1),[a,o]=f(!1),c=M(null),l=M(null),u=j(),{data:d=0}=Yn(void 0,{refetchInterval:3e4}),{data:m=[],isLoading:h}=En({limit:50},{enabled:r}),g=a?m:m.filter(e=>!e.read),_=m.filter(e=>e.read).length,v=()=>{u.invalidateQueries({queryKey:[[`alerts`]]})},b=Vn({onSuccess:v}),x=Pn({onSuccess:v}),S=Gn({onSuccess:v});Gr(`alert.created`,()=>{u.invalidateQueries({queryKey:[[`alerts`]]})}),Gr(`alert.updated`,()=>{u.invalidateQueries({queryKey:[[`alerts`]]})}),s(()=>{if(!r)return;let e=e=>{let t=e.target;c.current&&!c.current.contains(t)&&l.current&&!l.current.contains(t)&&i(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e)}},[r]);let C=p(e=>{b.mutate({alertId:e})},[b]),w=p(e=>{e&&S.mutate({alertId:e})},[S]),T=p(()=>{x.mutate(void 0),i(!1)},[x]),E=g.filter(m_),D=new Set(E.map(e=>e.id)),O=g.filter(e=>e.status===`in-progress`&&!D.has(e.id)),k=g.filter(e=>e.status!==`in-progress`&&!D.has(e.id)),[A,N]=f({}),F=p(()=>{let e=l.current;e&&N(Cg({rect:e.getBoundingClientRect(),viewportWidth:window.innerWidth,viewportHeight:window.innerHeight}))},[]);return s(()=>{if(!r)return;F();let e=()=>F();return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[r,F]),y(`div`,{children:[e===`sidebar`?y(`button`,{ref:l,type:`button`,onClick:()=>i(!r),className:`flex w-full items-center gap-2.5 rounded-md ${t?`justify-center px-0 py-2`:`px-2.5 py-1.5`} text-[12px] text-foreground-subtle hover:bg-surface-hover hover:text-foreground transition-colors`,title:t?d>0?n(`ui.alertBell.alertsUnread`,{count:d}):n(`ui.alertBell.alerts`):void 0,children:[y(`span`,{className:`relative inline-flex shrink-0`,children:[P(Ve,{className:`h-3.5 w-3.5`}),t&&d>0&&P(`span`,{className:`absolute -top-1 -right-1 h-2 w-2 rounded-full bg-primary`})]}),!t&&P(`span`,{className:`flex-1 text-left`,children:n(`ui.alertBell.alerts`,`Alerts`)}),!t&&d>0&&P(`span`,{className:`flex items-center justify-center h-4 min-w-4 px-1 rounded-full bg-primary text-primary-foreground text-[9px] font-bold leading-none`,children:d>99?`99+`:String(d)})]}):y(`button`,{ref:l,type:`button`,onClick:()=>i(!r),className:`relative p-1.5 rounded-md hover:bg-surface-hover text-foreground-subtle hover:text-foreground transition-colors`,"aria-label":n(`ui.alertBell.alerts`,`Alerts`),children:[P(Ve,{className:`h-4.5 w-4.5`}),d>0&&P(`span`,{className:`absolute -top-0.5 -right-0.5 flex items-center justify-center h-4 min-w-4 px-0.5 rounded-full bg-primary text-primary-foreground text-[9px] font-bold leading-none`,children:d>99?`99+`:String(d)})]}),r&&di(y(`div`,{ref:c,style:A,className:`bg-surface border border-border rounded-lg shadow-xl flex flex-col overflow-hidden`,children:[y(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border shrink-0`,children:[P(`span`,{className:`text-[12px] font-semibold text-foreground`,children:n(`ui.alertBell.alerts`,`Alerts`)}),y(`div`,{className:`flex items-center gap-2`,children:[_>0&&y(`label`,{className:`flex items-center gap-1 text-[10px] text-foreground-subtle cursor-pointer select-none`,children:[P(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked),className:`h-3 w-3 rounded border-border accent-primary cursor-pointer`}),n(`ui.alertBell.showRead`,`Show read`)]}),d>0&&y(`button`,{type:`button`,onClick:T,className:`flex items-center gap-1 text-[10px] text-primary hover:text-primary/80 transition-colors`,children:[P(hn,{className:`h-3 w-3`}),n(`ui.alertBell.markAllRead`,`Mark all read`)]})]})]}),y(`div`,{className:`flex-1 overflow-y-auto`,children:[h&&P(`div`,{className:`flex items-center justify-center py-8`,children:P(Re,{className:`h-4 w-4 animate-spin text-foreground-subtle`})}),!h&&g.length===0&&y(`div`,{className:`flex flex-col items-center justify-center py-8 text-foreground-subtle`,children:[P(Ve,{className:`h-6 w-6 mb-2 opacity-40`}),P(`span`,{className:`text-[11px]`,children:m.length>0?n(`ui.alertBell.noUnreadAlerts`,`No unread alerts`):n(`ui.alertBell.noAlerts`,`No alerts`)}),m.length>0&&!a&&P(`button`,{type:`button`,onClick:()=>o(!0),className:`text-[10px] text-primary mt-1 hover:underline`,children:n(`ui.alertBell.showRead`,{count:_})})]}),E.length>0&&y(`div`,{className:`border-b border-border`,children:[P(`div`,{className:`px-3 py-1.5 bg-danger/5`,children:P(`span`,{className:`text-[9px] font-semibold uppercase tracking-widest text-danger`,children:n(`ui.alertBell.urgent`,`Urgent`)})}),E.map(e=>P(D_,{alert:e,onMarkRead:C,onDismiss:w},e.id))]}),O.length>0&&y(`div`,{className:`border-b border-border`,children:[P(`div`,{className:`px-3 py-1.5 bg-surface-hover/50`,children:P(`span`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60`,children:n(`ui.alertBell.inProgress`,`In Progress`)})}),O.map(e=>P(D_,{alert:e,onMarkRead:C,onDismiss:w},e.id))]}),k.map(e=>P(D_,{alert:e,onMarkRead:C,onDismiss:w},e.id))]})]}),document.body)]})}a(),ui();function k_({alert:e,onMarkRead:t}){let{t:n}=H(),r=g_(e.action)?e.action:void 0;return y(`div`,{className:`border-b border-border last:border-b-0 px-3 py-2.5`,children:[P(`div`,{className:`text-[12px] font-semibold text-foreground`,children:e.title}),P(`div`,{className:`text-[11px] text-foreground-muted mt-0.5`,children:e.message}),y(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[r!==void 0&&P(y_,{action:r,className:`inline-flex items-center justify-center rounded-md bg-primary px-2.5 py-1 text-[11px] font-medium text-primary-foreground hover:bg-primary/90 transition-colors`}),P(jn,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>t(e.id),children:n(`ui.alertBell.markAsRead`,`Mark as read`)})]})]})}function A_(){let{t:e}=H(),t=j(),[n,r]=f(f_()),{data:i=[],isLoading:a}=En({limit:50}),o=d(()=>h_(i),[i]),s=Vn({onSuccess:p(()=>{t.invalidateQueries({queryKey:[[`alerts`]]})},[t])}),c=p(e=>{s.mutate({alertId:e})},[s]),l=p(()=>{p_(),r(!0)},[]);return a||n||o.length===0?null:di(P(`div`,{className:`fixed inset-x-0 bottom-0 z-[10000] flex justify-center p-2 sm:p-4 pb-[max(0.5rem,env(safe-area-inset-bottom))] pointer-events-none`,"data-testid":`critical-alerts-on-load-panel`,children:y(`div`,{className:`pointer-events-auto w-full max-w-lg bg-surface border border-danger/30 rounded-lg shadow-xl flex flex-col max-h-[min(70dvh,32rem)] overflow-hidden`,role:`region`,"aria-labelledby":`critical-alerts-panel-title`,children:[y(`div`,{className:`flex items-start justify-between gap-2 px-3 py-2.5 border-b border-border shrink-0 bg-danger/5`,children:[y(`div`,{children:[P(`h2`,{id:`critical-alerts-panel-title`,className:`text-[12px] font-semibold text-foreground`,children:e(`ui.criticalAlertsPanel.title`,`Urgent alerts`)}),P(`p`,{className:`text-[10px] text-foreground-muted mt-0.5`,children:e(`ui.criticalAlertsPanel.subtitle`,`These need your attention.`)})]}),P(or,{type:`button`,variant:`ghost`,onClick:l,"aria-label":e(`ui.criticalAlertsPanel.close`,`Close`),"data-testid":`critical-alerts-panel-close`,icon:Oe})]}),P(`div`,{className:`flex-1 overflow-y-auto`,children:o.map(e=>P(k_,{alert:e,onMarkRead:c},e.id))})]})}),document.body)}a();function j_(){let e=Jc();return C(e.subscribe,e.getSnapshot,e.getSnapshot)}var M_=[`detection`,`cluster`,`administration`];function N_(e){return M_.includes(e)}function P_(e){let t=new Map,n=new Map,r=[];for(let i of e){let e=i.section?.trim();if(e===void 0||e.length===0){r.push(i);continue}if(N_(e)){let n=t.get(e)??[];n.push(i),t.set(e,n);continue}let a=n.get(e);a?a.pages.push(i):n.set(e,{label:i.sectionLabel?.trim()||e,pages:[i]})}return{known:t,custom:[...n.entries()].map(([e,t])=>({id:e,label:t.label,pages:t.pages})),ungrouped:r}}var F_=`camstack:last-path`,I_=512,L_=[`/login`,`/change-password`,`/access-denied`,`/logout`];function R_(e){return!e.startsWith(`/`)||e.startsWith(`//`)||e.length>I_?!1:!L_.some(t=>e===t||e.startsWith(t+`/`))}function z_(e){if(!(typeof window>`u`)&&R_(e))try{window.localStorage.setItem(F_,e)}catch{}}function B_(){if(typeof window>`u`)return null;try{let e=window.localStorage.getItem(F_);return e===null?null:R_(e)?e:null}catch{return null}}var V_=`/devices`;function H_(e){return e!==void 0&&R_(e)?e:B_()??V_}function U_(e){return e.split(`.`)[0]===`0`?`${e} beta`:e}function W_(e){if(e===null)return null;let t=e.trim();return t.length>0?t:null}function G_(e){let t=W_(e.productVersion),n=W_(e.serverVersion),r=W_(e.fallbackVersion);return t!==null&&n!==null?{kind:`both`,productLabel:U_(t),serverVersion:n}:t===null?n===null?r===null?{kind:`none`}:{kind:`fallback`,version:r}:{kind:`server`,serverVersion:n}:{kind:`product`,productLabel:U_(t)}}function K_(e,t){if(!Object.hasOwn(e,t))return null;let n=Reflect.get(e,t);return typeof n==`string`?n:null}function q_(e){return typeof e!=`object`||!e?null:{productVersion:K_(e,`productVersion`),serverVersion:K_(e,`serverVersion`)}}a();function J_(e,t){return e.kind===`both`?t(`releaseIdentity.both`,`{{product}} · server {{server}}`,{product:e.productLabel,server:e.serverVersion}):e.kind===`product`?e.productLabel:e.kind===`server`?t(`releaseIdentity.serverOnly`,`server {{version}}`,{version:e.serverVersion}):e.kind===`fallback`?t(`releaseIdentity.fallback`,`v{{version}}`,{version:e.version}):null}function Y_({placement:e,compact:t=!1}){let{t:n}=H(),[r,i]=f({kind:`fallback`,version:`1.2.471`});s(()=>{let e=new AbortController;return fetch(B(`/api/release-identity`),{signal:e.signal}).then(async e=>e.ok?q_(await e.json()):null).then(t=>{e.signal.aborted||t===null||i(G_({productVersion:t.productVersion,serverVersion:t.serverVersion,fallbackVersion:`1.2.471`}))}).catch(t=>{e.signal.aborted||t instanceof DOMException&&t.name}),()=>e.abort()},[]);let a=J_(r,n);return a===null?null:e===`login`?P(`span`,{"data-testid":`release-identity`,children:a}):P(`div`,{"data-testid":`release-identity`,className:`pt-1 text-[10px] text-foreground-disabled select-none truncate ${t?`text-center`:`px-2`}`,title:a,children:a})}a();var X_=g(!0);function Z_(e){return e===`/addon`||e.startsWith(`/addon/`)}function Q_(e,t,n){let r=[...e.filter(e=>e!==t),t];return r.length<=n?r:r.slice(r.length-n)}function $_({maxCached:e=6}){let t=Ja(),n=q(),r=Ha(),i=v(K),a=n.pathname,o=Z_(a),s=M(new Map),c=M([]);if(o){s.current.set(a,{key:a,outlet:t,location:n,navigationType:r,routeContext:i});let o=Q_(c.current,a,e),l=new Set(o);for(let e of s.current.keys())l.has(e)||s.current.delete(e);c.current=o}return y(E,{children:[c.current.map(e=>{let t=s.current.get(e);if(t?.outlet==null)return null;let n=o&&e===a;return P(`div`,{className:n?`h-full min-h-0`:void 0,style:n?void 0:{display:`none`},hidden:!n,"aria-hidden":!n,children:P(X_.Provider,{value:n,children:P(Na.Provider,{value:{location:t.location,navigationType:t.navigationType},children:P(K.Provider,{value:t.routeContext,children:t.outlet})})})},e)}),!o&&t!=null?P(`div`,{className:`h-full min-h-0`,children:t},a):null]})}a();var ev={dark:z,light:oe,system:an};function tv(){return P(`div`,{className:`flex h-full min-h-[50vh] items-center justify-center`,children:P(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-primary/30 border-t-primary`})})}function nv(){let e=q(),t=Ga(),{user:n,logout:r}=Ql(),i=ni(),{t:a}=H(),o=ti(),c=yr(),{info:l}=lg();s(()=>{document.title=l===null?`CamStack Admin`:`${l.name} \u00b7 CamStack Admin`},[l]);let u=Rc(j_()),[p,m]=f(!1);s(()=>{z_(e.pathname+e.search)},[e.pathname,e.search]);let[h,g]=f(()=>typeof window>`u`?!1:window.localStorage.getItem(`camstack:sidebar-collapsed`)===`1`);s(()=>{typeof window>`u`||window.localStorage.setItem(`camstack:sidebar-collapsed`,h?`1`:`0`)},[h]);let[_]=f(()=>{if(typeof window>`u`)return new Set;try{let e=window.localStorage.getItem(`camstack:sidebar-collapsed-groups`);if(!e)return new Set;let t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(e=>typeof e==`string`)):new Set}catch{return new Set}});s(()=>{typeof window>`u`||window.localStorage.setItem(`camstack:sidebar-collapsed-groups`,JSON.stringify([..._]))},[_]),s(()=>{c&&window.localStorage.getItem(`camstack:sidebar-collapsed`)===null&&g(!0)},[c]);let{data:v=[]}=si({nodeId:`hub`},{refetchInterval:3e4}),b=v.length,x=j(),S=M(Date.now()),{data:C}=Jr(void 0,{staleTime:0,refetchOnMount:`always`,refetchInterval:e=>{let t=e.state.data;return t&&t.length>0||Date.now()-S.current>=3e4?!1:2e3}}),T=d(()=>C&&n?.isAdmin?dh(C):[],[C,n?.isAdmin]),D=d(()=>P_(T),[T]),O=D.known.get(`detection`)??[],k=D.known.get(`cluster`)??[],A=D.known.get(`administration`)??[];Gr(`addon.page-ready`,()=>{x.invalidateQueries({queryKey:[[`addonPages`,`listPages`]]})});let N=()=>{r(),t(`/login`)},F=t=>!!(e.pathname===t||e.pathname.startsWith(t+`/`)),I=[`/system/pipeline`,`/live`,`/addon/osd-manager`,`/build`].some(t=>e.pathname===t||e.pathname.startsWith(t+`/`)),ee=n?.isAdmin===!0,L=d(()=>Bh({t:a,isAdmin:ee}),[a,ee]),te=L[0]?.items??[],R=L[1]?.items??[],ne=L[2]?.items??[],re=L[3]?.items??[],ie=i?.mode??`system`,ae={dark:a(`theme.dark`),light:a(`theme.light`),system:a(`theme.system`)},z=h&&!o,oe=(e,t=`md`)=>`flex w-full items-center gap-2.5 rounded-md ${z?`justify-center px-0 py-2`:`px-2.5 py-1.5`} ${t===`lg`?`text-[13px] font-medium`:`text-[12px]`} transition-all ${e?t===`lg`?`bg-primary/12 text-primary shadow-sm shadow-primary/5`:`bg-primary/12 text-primary`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground`}`,se=(e,t)=>e===0?null:z?P(`div`,{className:`pt-3 mb-1 mx-2 border-t border-border/60`},`sep-${t}`):P(`div`,{className:`pt-4 pb-1.5 px-2.5`,children:P(`span`,{className:`text-[10px] font-semibold uppercase tracking-widest text-foreground-subtle/60`,children:t})},`hdr-${t}`),ce=e=>{let n=F(e.path),r=Hh(e.icon);return y(`button`,{onClick:()=>{t(e.path),m(!1)},className:oe(n),title:z?e.label:void 0,children:[P(r,{className:`h-3.5 w-3.5 shrink-0 ${n?`text-primary`:``}`}),!z&&e.label]},`${e.addonId}::${e.id}`)},le=e=>{let n=e.icon,r=F(e.path),i=e.path===`/system/addons`;return y(`button`,{"data-testid":`nav-${e.path.replace(/^\//,``).replace(/\//g,`-`)}`,onClick:()=>{t(e.path),m(!1)},className:oe(r),title:z?e.label:void 0,children:[P(n,{className:`h-3.5 w-3.5 shrink-0 ${r?`text-primary`:``}`}),!z&&y(E,{children:[P(`span`,{className:`flex-1 text-left`,children:e.label}),i&&b>0&&P(`span`,{className:`ml-auto rounded-full bg-primary px-1.5 py-0.5 text-[9px] font-bold text-primary-foreground leading-none`,children:b})]}),z&&i&&b>0&&P(`span`,{className:`absolute mt-[-14px] ml-3 h-2 w-2 rounded-full bg-primary`})]},e.path)},ue=y(E,{children:[y(`div`,{className:`flex h-14 items-center border-b border-border ${z?`justify-center px-1`:`pl-3 pr-4 gap-2`}`,children:[!z&&P(`img`,{src:i?.resolvedMode===`light`?B(`/brand/logo-horizontal-light.svg`):B(`/brand/logo-horizontal-dark.svg`),alt:a(`layouts.appLayout.camstackAdmin`,`CamStack Admin`),className:`h-9 flex-1 min-w-0`}),!o&&P(`button`,{onClick:()=>g(e=>!e),className:`p-1.5 rounded-md hover:bg-surface-hover text-foreground-subtle transition-colors flex-shrink-0 ${z?``:`mr-2`}`,"aria-label":h?a(`layouts.appLayout.expandSidebar`,`Expand sidebar`):a(`layouts.appLayout.collapseSidebar`,`Collapse sidebar`),title:h?a(`layouts.appLayout.expandSidebar`,`Expand sidebar`):a(`layouts.appLayout.collapseSidebar`,`Collapse sidebar`),children:P(h?tt:Te,{className:`h-4 w-4`})})]}),!z&&l!==null&&P(`div`,{"data-testid":`sidebar-server-name`,title:l.name,className:`truncate border-b border-border px-3 py-1.5 text-xs font-medium text-foreground-muted`,children:l.name}),P(`div`,{className:`border-b border-border pt-2`,children:P(Qh,{navSections:L,addonPages:T,compact:z,onNavigated:()=>m(!1)})}),y(`nav`,{className:`flex-1 overflow-y-auto py-3 ${z?`px-1.5`:`px-2`} space-y-0.5`,children:[te.map(e=>le(e)),se(R.length+O.length,a(`nav.detectionSection`,`Detection`)),R.map(e=>le(e)),O.map(e=>ce(e)),se(ne.length+k.length,a(`nav.clusterSection`,`Cluster`)),ne.map(e=>le(e)),k.map(e=>ce(e)),se(re.length+A.length,a(`system.title`,`Administration`)),re.map(e=>le(e)),A.map(e=>ce(e)),D.custom.map(e=>y(`div`,{className:`contents`,children:[se(e.pages.length,e.label),e.pages.map(e=>ce(e))]},`custom-${e.id}`)),se(D.ungrouped.length,a(`nav.addonPages`,`Addon Pages`)),D.ungrouped.map(e=>ce(e))]}),y(`div`,{className:`border-t border-border ${z?`p-1.5`:`p-2`} space-y-0.5`,children:[y(`button`,{onClick:()=>i?.toggleMode(),className:oe(!1),title:z?ae[ie]:void 0,children:[(()=>{let e=ev[ie];return P(e,{className:`h-3.5 w-3.5 shrink-0`})})(),!z&&P(`span`,{children:ae[ie]})]}),P(O_,{variant:`sidebar`,compact:z}),y(`button`,{type:`button`,onClick:()=>t(`/system/my-access`),className:oe(F(`/system/my-access`)),title:z?a(`system.myAccess`,`My access`):void 0,children:[P(qe,{className:`h-3.5 w-3.5 shrink-0`}),!z&&P(`span`,{className:`truncate`,children:a(`system.myAccess`,`My access`)})]}),y(`button`,{onClick:N,className:oe(!1).replace(`hover:text-foreground`,`hover:text-danger`),title:z?n?.username??a(`layouts.appLayout.logout`,`Logout`):void 0,children:[P(_n,{className:`h-3.5 w-3.5 shrink-0`}),!z&&P(`span`,{className:`truncate`,children:n?.username??a(`layouts.appLayout.user`,`User`)})]}),P(Y_,{placement:`sidebar`,compact:z})]})]});return y(`div`,{className:`flex h-dvh overflow-hidden bg-background text-foreground pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)]`,children:[!o&&P(`aside`,{className:`flex flex-col border-r border-border bg-surface/80 backdrop-blur-sm shrink-0 transition-[width] duration-150 ease-out ${z?`w-12`:`w-48`}`,children:ue}),o&&P(Dn,{open:p,onClose:()=>m(!1),width:`w-64`,children:ue}),y(`div`,{className:`flex flex-1 flex-col min-w-0`,children:[u!==null&&y(`div`,{className:`flex items-center justify-center gap-2 px-3 py-2 text-[12px] font-medium shrink-0 ${u.severity===`danger`?`bg-danger/90 text-white`:`bg-warning/15 text-warning border-b border-warning/30`}`,children:[u.severity===`danger`?P(Ce,{className:`h-3.5 w-3.5`}):P(Je,{className:`h-3.5 w-3.5`}),P(`span`,{children:a(u.i18nKey,{defaultValue:u.message,...u.i18nParams})}),u.action===`sign-in`&&P(`button`,{onClick:()=>r(),className:`ml-2 rounded border border-white/40 px-2 py-0.5 text-[11px] font-semibold hover:bg-white/10`,children:a(`connection.signIn`,`Sign in`)}),u.showSpinner&&P(Re,{className:`h-3.5 w-3.5 animate-spin`})]}),P(sg,{}),P(gg,{}),P(A_,{}),o&&y(`header`,{className:`flex items-center h-12 border-b border-border px-3 shrink-0 bg-surface/80 backdrop-blur-sm`,children:[P(`button`,{onClick:()=>m(!0),className:`p-1.5 -ml-1.5 rounded-md hover:bg-surface-hover text-foreground-muted transition-colors`,"aria-label":a(`layouts.appLayout.openMenu`,`Open menu`),children:P(fe,{className:`h-5 w-5`})}),P(`div`,{className:`flex-1 flex justify-center`,children:P(`img`,{src:i?.resolvedMode===`light`?B(`/brand/logo-horizontal-light.svg`):B(`/brand/logo-horizontal-dark.svg`),alt:a(`layouts.appLayout.camstack`,`CamStack`),className:`h-7`})}),P(O_,{})]}),y(vh,{children:[P(yh,{}),P(`main`,{className:`relative flex-1 min-h-0 overscroll-contain bg-background ${I?`overflow-hidden`:`overflow-auto`}`,children:P(w,{fallback:P(tv,{}),children:P($_,{})})})]})]})]})}function $({children:e,requireAdmin:t}){let{t:n}=H(),{user:r,loading:i,mustChangePassword:a}=Ql(),o=q();return i?P(`div`,{className:`flex h-screen items-center justify-center bg-background text-foreground-subtle`,children:n(`layouts.protectedRoute.loading`,`Loading...`)}):r?a&&o.pathname!==`/change-password`?P(J,{to:`/change-password`,replace:!0}):t&&!r.isAdmin?P(J,{to:`/access-denied`,replace:!0}):P(E,{children:e}):P(J,{to:`/login`,replace:!0,state:{from:o.pathname+o.search}})}var rv=`customize`,iv=`/build/compositions/new`,av=`/build/compositions/:blockId`,ov=`/build?tab=custom-device`;function sv(e){return`/devices/${e}?tab=${rv}`}var cv=`integration`,lv=`section`,uv=[cv,lv],dv={connectivity:{path:`/system/integrations`,tab:null},remoteAccess:{path:`/system/network`,tab:`remote-access`},mesh:{path:`/system/network`,tab:`mesh`},turn:{path:`/system/network`,tab:`turn`},authentication:{path:`/system/identity`,tab:`authentication`},access:{path:`/system/identity`,tab:`access`},logging:{path:`/system/logs`,tab:`destinations`}},fv=`settings`,pv=`activity`;function mv(e,t={}){let{path:n,tab:r}=dv[e],i=new URLSearchParams;r===null?t.kindSection!==void 0&&i.set(`tab`,t.kindSection):i.set(`tab`,r),t.integration!==void 0&&i.set(cv,t.integration),t.section!==void 0&&i.set(lv,t.section);let a=i.toString();return a.length>0?`${n}?${a}`:n}function hv(e){let{ids:t,requested:n,answered:r,legacyGroup:i=null,groupFirst:a={}}=e;if(n!==null&&t.includes(n))return{selectedId:n,staleId:null};let o=n!==null&&r?n:null,s=i===null?void 0:a[i];return s!==void 0&&t.includes(s)?{selectedId:s,staleId:o}:{selectedId:t[0]??null,staleId:o}}function gv(e,t,n=null,r=null){let i=new URLSearchParams(e);return i.set(cv,t),r===null?i.delete(lv):i.set(lv,r),n!==null&&i.delete(n),i}function _v(e){return e===`/admin`||e===`/admin/`?`/`:e.startsWith(`/admin/`)?e.slice(6):e}function vv(){let{t:e}=H(),t=Ga();return y(`div`,{className:`flex flex-col items-center justify-center text-foreground py-16 px-4`,children:[P(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-2xl bg-danger/10 mb-4`,children:P(gn,{className:`h-8 w-8 text-danger`})}),P(`h1`,{className:`text-xl font-bold`,children:e(`accessDenied.accessDenied`,`Access Denied`)}),P(`p`,{className:`mt-2 text-sm text-foreground-subtle`,children:e(`accessDenied.youDonTHavePermission`,`You don't have permission to access this page.`)}),P(`button`,{onClick:()=>t(`/devices`),className:`mt-6 rounded-lg bg-primary px-5 py-2.5 text-sm font-medium text-primary-foreground shadow-md shadow-primary/20 hover:shadow-lg transition-all`,children:e(`accessDenied.goToDevices`,`Go to Devices`)})]})}var yv=`auth.password-incorrect`;function bv(e,t){return typeof e==`object`&&e?Reflect.get(e,t):void 0}function xv(e){if(!(e instanceof Error))return{kind:`connection-lost`};let t=bv(e,`data`);return typeof t!=`object`||!t?{kind:`connection-lost`}:bv(bv(t,`i18n`),`code`)===yv?{kind:`wrong-current`}:bv(t,`code`)===`UNAUTHORIZED`?{kind:`session-ended`}:{kind:`rejected`,message:e.message}}a();var Sv=8;function Cv(e,t){let n=xv(e);switch(n.kind){case`wrong-current`:return t(`changePassword.errorWrongCurrent`,`The current password is incorrect.`);case`session-ended`:return t(`changePassword.errorSessionEnded`,`Your session ended before the change was confirmed. Sign in again — try the new password first.`);case`connection-lost`:return t(`changePassword.errorConnectionLost`,`The connection to the hub dropped before it confirmed the change. Sign in again — try the new password first.`);case`rejected`:return n.message}}function wv(){let{t:e}=H(),{user:t,mustChangePassword:n,clearMustChangePassword:r,logout:i}=Ql(),a=ze(),o=ni(),s=Ga(),[c,l]=f(``),[u,d]=f(``),[p,m]=f(``),[h,g]=f(!1),[_,v]=f(``),[b,x]=f(!1),S=n?Hl:c;return P(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:y(`div`,{className:`w-full max-w-sm`,children:[P(`div`,{className:`flex justify-center mb-8`,children:P(`img`,{src:o?.resolvedMode===`light`?B(`/brand/logo-horizontal-light.svg`):B(`/brand/logo-horizontal-dark.svg`),alt:e(`changePassword.camstackAdmin`,`CamStack Admin`),className:`h-12`})}),y(`form`,{onSubmit:async i=>{if(i.preventDefault(),v(``),!t){v(`Not signed in`);return}if(!n&&c.length===0){v(e(`changePassword.enterCurrent`,`Enter your current password`));return}if(u.length<Sv){v(`Password must be at least ${Sv} characters`);return}if(u!==p){v(`The two passwords do not match`);return}if(u===`changeme`){v(`Choose a password different from the seed default`);return}x(!0);try{await a.changeOwnPassword({currentPassword:S,newPassword:u}),r(),s(`/devices`,{replace:!0})}catch(t){v(Cv(t,e))}finally{x(!1)}},className:`space-y-4 rounded-xl border border-border bg-surface p-6 shadow-xl shadow-black/10`,children:[y(`div`,{className:`space-y-1`,children:[P(`h1`,{className:`text-sm font-semibold text-foreground`,children:e(`changePassword.setANewPassword`,`Set a new password`)}),P(`p`,{className:`text-xs text-foreground-subtle`,children:n?e(`changePassword.youMustRotateTheSeed`,`You must rotate the seed password before continuing.`):e(`changePassword.chooseANewPasswordFor`,`Choose a new password for your account.`)})]}),_&&P(`div`,{role:`alert`,className:`rounded-md bg-danger/10 border border-danger/20 px-3 py-2 text-xs text-danger`,children:_}),!n&&y(`div`,{className:`space-y-1.5`,children:[P(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`changePassword.currentPassword`,`Current password`)}),P(`input`,{"data-testid":`change-password-current`,type:h?`text`:`password`,value:c,onChange:e=>l(e.target.value),autoComplete:`current-password`,className:`w-full rounded-lg border border-border bg-background px-3 py-2.5 text-sm text-foreground placeholder:text-foreground-disabled focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none transition-all`,autoFocus:!0})]}),y(`div`,{className:`space-y-1.5`,children:[P(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`changePassword.newPassword`,`New password`)}),y(`div`,{className:`relative`,children:[P(`input`,{"data-testid":`change-password-new`,type:h?`text`:`password`,value:u,onChange:e=>d(e.target.value),autoComplete:`new-password`,className:`w-full rounded-lg border border-border bg-background px-3 py-2.5 pr-10 text-sm text-foreground placeholder:text-foreground-disabled focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none transition-all`,autoFocus:n}),P(`button`,{type:`button`,onClick:()=>g(!h),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground transition-colors`,tabIndex:-1,children:P(h?rt:pe,{className:`h-4 w-4`})})]})]}),y(`div`,{className:`space-y-1.5`,children:[P(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`changePassword.confirmNewPassword`,`Confirm new password`)}),P(`input`,{"data-testid":`change-password-confirm`,type:h?`text`:`password`,value:p,onChange:e=>m(e.target.value),autoComplete:`new-password`,className:`w-full rounded-lg border border-border bg-background px-3 py-2.5 text-sm text-foreground placeholder:text-foreground-disabled focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none transition-all`})]}),P(`button`,{"data-testid":`change-password-submit`,type:`submit`,disabled:b||!u||!p,className:`w-full rounded-lg bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground shadow-md shadow-primary/20 hover:shadow-lg hover:shadow-primary/30 disabled:opacity-50 disabled:shadow-none transition-all`,children:b?e(`changePassword.saving`,`Saving…`):e(`changePassword.saveAndContinue`,`Save and continue`)}),n&&P(`button`,{type:`button`,onClick:()=>{i(),s(`/login`,{replace:!0})},className:`w-full text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:e(`changePassword.signOutInstead`,`Sign out instead`)})]})]})})}function Tv(e){let t=new Uint8Array(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Ev(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=(4-t.length%4)%4,r=t.padEnd(t.length+n,`=`),i=atob(r),a=new ArrayBuffer(i.length),o=new Uint8Array(a);for(let e=0;e<i.length;e++)o[e]=i.charCodeAt(e);return a}function Dv(){return window?.PublicKeyCredential!==void 0&&typeof window.PublicKeyCredential==`function`}function Ov(e){let{id:t}=e;return{...e,id:Ev(t),transports:e.transports}}function kv(e){return e===`localhost`||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}var Av=class extends Error{constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),this.name=r??n.name,this.code=t}},jv=new class{createNewAbortSignal(){if(this.controller){let e=Error(`Cancelling existing WebAuthn API call for new one`);e.name=`AbortError`,this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error(`Manually cancelling existing WebAuthn API call`);e.name=`AbortError`,this.controller.abort(e),this.controller=void 0}}},Mv=[`cross-platform`,`platform`];function Nv(e){if(e&&!(Mv.indexOf(e)<0))return e}function Pv(){if(!Dv())return new Promise(e=>e(!1));let e=window.PublicKeyCredential;return e.isConditionalMediationAvailable===void 0?new Promise(e=>e(!1)):e.isConditionalMediationAvailable()}function Fv({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new Av({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new Av({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=window.location.hostname;if(!kv(t))return new Av({message:`${window.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new Av({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`UnknownError`)return new Av({message:`The authenticator was unable to process the specified options, or could not create a new assertion signature`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}async function Iv(e){let{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:r=!0}=e;if(!Dv())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(Ov));let a={...t,challenge:Ev(t.challenge),allowCredentials:i},o={};if(n){if(!await Pv())throw Error(`Browser does not support WebAuthn autofill`);if(document.querySelectorAll(`input[autocomplete$='webauthn']`).length<1&&r)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');o.mediation=`conditional`,a.allowCredentials=[]}o.publicKey=a,o.signal=jv.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw Fv({error:e,options:o})}if(!s)throw Error(`Authentication was not completed`);let{id:c,rawId:l,response:u,type:d}=s,f;return u.userHandle&&(f=Tv(u.userHandle)),{id:c,rawId:Tv(l),response:{authenticatorData:Tv(u.authenticatorData),clientDataJSON:Tv(u.clientDataJSON),signature:Tv(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:Nv(s.authenticatorAttachment)}}function Lv(e){return typeof e==`object`&&!!e}function Rv(e){return Lv(e)&&typeof e.challenge==`string`}a();async function zv(e){if(!Rv(e))throw Error(`passkey authentication options missing challenge`);let t=await Iv({optionsJSON:e});return Object.fromEntries(Object.entries(t))}function Bv({method:e,challengeToken:t,onComplete:n,onSecondFactor:r,onError:i}){let[a,o]=f(!1),[s,c]=f(null),l=async()=>{c(null),o(!0);try{let e=Z();if(t){let r=await zv((await e.loginBeginPasskey(t)).optionsJSON),i=await e.loginVerifyPasskey(t,r,{refreshable:!0});n(i.token,i);return}let a=await zv((await e.passkeyLoginBegin()).optionsJSON),o=await e.passkeyLoginFinish(a,{refreshable:!0}),s=o.secondFactors??(o.requiresTotp===!0?[`totp`]:[]);if(s.length>0){if(r)r({challengeToken:o.token,factors:s});else{let e=`Additional verification is required — sign in with your password to continue.`;c(e),i?.(e)}return}n(o.token,o)}catch(e){let n=t?`Passkey verification failed`:`Passkey sign-in failed`,r=e instanceof Error?e.message:n;c(r),i?.(r)}finally{o(!1)}};return y(`div`,{className:`space-y-2`,children:[y(`button`,{type:`button`,"data-testid":t?`login-passkey`:`login-passkey-direct`,onClick:()=>void l(),disabled:a,className:`w-full flex items-center justify-center gap-2 rounded-lg border border-border bg-surface px-4 py-2.5 text-sm font-medium text-foreground hover:bg-surface-hover disabled:opacity-50 transition-colors`,children:[a?P(Re,{className:`h-4 w-4 animate-spin text-primary`}):P(sn,{className:`h-4 w-4 text-primary`}),e.label]}),s&&P(`div`,{className:`rounded-md bg-danger/10 border border-danger/20 px-3 py-2 text-xs text-danger`,children:s})]})}var Vv=()=>window.location.hostname;function Hv(e,t=Vv){return Dv()&&tg(t(),e.rpId)}function Uv(e,t=Vv){let n=e.filter(e=>e.kind===`passkey`&&e.stage===`second-factor`).filter(e=>Hv(e,t));return{passkeyMethods:n,widgetMethods:n.length>0?[]:e.filter(e=>e.kind===`widget`&&e.stage===`second-factor`)}}function Wv(e,t){let n=e.includes(`passkey`),r=t.passkeyMethods.length>0||t.widgetMethods.length>0,i=e.includes(`totp`);return n&&!r&&!i}function Gv(e){let t=e.onComplete,n=e.onSecondFactor;return typeof t==`function`?{onComplete:t,onSecondFactor:typeof n==`function`?n:void 0}:null}function Kv({methods:e,widgetConfig:t,onRedirect:n}){let{t:r}=H();Tr();let i=e.filter(e=>e.kind!==`passkey`||Hv(e));return i.length===0?null:y(`div`,{className:`mt-6 space-y-3`,children:[y(`div`,{className:`flex items-center gap-3`,children:[P(`div`,{className:`h-px flex-1 bg-border`}),P(`span`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:r(`login.primaryLoginMethods.orContinueWith`,`Or continue with`)}),P(`div`,{className:`h-px flex-1 bg-border`})]}),P(`div`,{className:`space-y-2`,children:i.map(e=>{if(e.kind===`redirect`){let t=(e.icon===void 0?void 0:qr(e.icon))??qe;return y(`a`,{href:e.startUrl,onClick:t=>{n?.(e)===!0&&t.preventDefault()},className:`flex items-center justify-center gap-2 w-full rounded-lg border border-border bg-surface px-4 py-2.5 text-sm font-medium text-foreground hover:bg-surface-hover transition-colors`,children:[P(t,{className:`h-4 w-4 text-primary`}),e.label]},e.id)}if(e.kind===`passkey`){let n=Gv(t);return n?P(Bv,{method:e,onComplete:n.onComplete,onSecondFactor:n.onSecondFactor},e.id):null}return P(qv,{method:e,config:t},e.id)})})]})}function qv({method:e,config:t}){let{t:n}=H(),r=Wn(e.remote,e.bundleUrl);return r===null?y(`div`,{className:`flex items-center justify-center gap-2 rounded-lg border border-border bg-background px-4 py-2.5 text-xs text-foreground-subtle`,children:[P(Re,{className:`h-3.5 w-3.5 animate-spin`}),n(`common.loading`,`Loading…`)]}):r===void 0?y(`div`,{"data-testid":`login-method-load-error`,className:`flex items-center justify-center gap-2 rounded-lg border border-danger/20 bg-danger/10 px-4 py-2.5 text-xs text-danger`,children:[P(Me,{className:`h-3.5 w-3.5 shrink-0`}),n(`login.primaryMethods.loadFailed`)]}):P(r,{instanceId:e.id,host:`dashboard`,config:t})}var Jv=4e3,Yv=/^[A-Za-z0-9._-]{1,64}$/;function Xv(e){let t=e.addonId!==void 0&&Yv.test(e.addonId)?e.addonId:null,n=e.integration!==void 0&&Yv.test(e.integration)?e.integration:null;if(t!==null&&e.brokerId!==void 0)return mv(`connectivity`,{integration:t,kindSection:`brokers`});let r=n??t;return mv(`connectivity`,r===null?{}:{integration:r})}function Zv(e,t){let n=t.opener;if(n===null||n.closed||Jg(n)!==t.origin)return!1;try{return n.postMessage({type:i_,ok:e.status===`success`,...e.brokerId===void 0?{}:{brokerId:e.brokerId},...e.status===`error`?{error:e.reason??`unknown`}:{}},t.origin),!0}catch{return!1}}a();var Qv=500;function $v(e){let{t}=H();switch(e){case`access_denied`:return t(`oauthLanding.reason.access_denied`,`Access was denied, so nothing was connected.`);case`invalid_state`:return t(`oauthLanding.reason.invalid_state`,`This sign-in link expired or was already used. Start the sign-in again.`);case`invalid_request`:return t(`oauthLanding.reason.invalid_request`,`The request was not valid for this hub. Start the link again from the beginning.`);case`unknown_broker`:return t(`oauthLanding.reason.unknown_broker`,`That connection no longer exists. Add it again, then sign in.`);case`not_configured`:return t(`oauthLanding.reason.not_configured`,`The connection is missing its client ID or secret. Fill them in, save, then sign in.`);case`exchange_failed`:return t(`oauthLanding.reason.exchange_failed`,`The provider did not accept the sign-in. Check the client ID and secret, then try again.`);case`no_refresh_token`:return t(`oauthLanding.reason.no_refresh_token`,`The provider returned no long-lived access. Remove CamStack from the account’s connected apps, then sign in again.`);case`unavailable`:return t(`oauthLanding.reason.unavailable`,`The hub is still starting this integration. Wait a moment and try again.`);case`unknown`:return t(`oauthLanding.reason.unknown`,`Something went wrong. Try again in a moment.`)}}function ey({outcome:e}){let{t}=H(),n=$v(e.reason??`unknown`);if(e.status===`error`)return y(E,{children:[P(Ke,{className:`mx-auto h-8 w-8 text-danger`,"aria-hidden":!0}),P(`h1`,{"data-testid":`oauth-landing-title`,className:`text-sm font-semibold text-foreground`,children:t(`oauthLanding.errorTitle`,`Sign-in did not finish`)}),P(`p`,{"data-testid":`oauth-landing-reason`,className:`rounded-md border border-danger/20 bg-danger/10 px-3 py-2 text-xs text-danger`,children:n})]});let r=e.action===`disconnect`;return y(E,{children:[P(Be,{className:`mx-auto h-8 w-8 text-success`,"aria-hidden":!0}),P(`h1`,{"data-testid":`oauth-landing-title`,className:`text-sm font-semibold text-foreground`,children:r?t(`oauthLanding.signedOutTitle`,`Signed out`):t(`oauthLanding.successTitle`,`Signed in`)}),P(`p`,{className:`text-xs text-foreground-muted`,children:r?t(`oauthLanding.signedOutBody`,`The account was disconnected from this hub.`):t(`oauthLanding.successBody`,`The account is connected. Returning to CamStack…`)})]})}function ty({outcome:e,closable:t,onContinue:n,onClose:r}){let{t:i}=H(),a=Xv(e);return s(()=>{if(e.status!==`success`)return;let t=window.setTimeout(()=>n(a),Jv);return()=>window.clearTimeout(t)},[e.status,n,a]),P(`main`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:y(`div`,{className:`w-full max-w-sm space-y-4`,children:[P(`div`,{className:`flex justify-center`,children:y(`picture`,{children:[P(`source`,{media:`(prefers-color-scheme: dark)`,srcSet:B(`/brand/logo-horizontal-dark.svg`)}),P(`img`,{src:B(`/brand/logo-horizontal-light.svg`),alt:i(`oauthLanding.brand`,`CamStack`),className:`h-12`})]})}),y(`div`,{className:`space-y-4 rounded-xl border border-border bg-surface p-6 text-center shadow-xl shadow-black/10`,children:[P(ey,{outcome:e}),y(`div`,{className:`flex flex-col gap-2`,children:[P(jn,{type:`button`,variant:`primary`,onClick:()=>n(a),children:i(`oauthLanding.back`,`Back to CamStack`)}),t&&P(jn,{type:`button`,variant:`ghost`,onClick:r,children:i(`oauthLanding.close`,`Close this window`)})]})]})]})})}function ny(e,t){window.history.replaceState(null,``,window.location.pathname);let n=window.opener,r=Zv(t,{opener:n,origin:window.location.origin}),i=()=>e.render(P(ty,{outcome:t,closable:r,onContinue:e=>window.location.replace(B(e)),onClose:()=>window.close()}));if(r&&t.status===`success`){window.close(),window.setTimeout(i,Qv);return}i()}function ry(e){return Jt(e)}var iy=`Done — you can close this window.`,ay=500,oy=`camstack_admin_token`;async function sy(e,t=``){try{let n=sl(new URLSearchParams(t));n!==null&&n.token===e?al(n):localStorage.setItem(oy,e)}catch{}await fetch(B(`/api/auth/session`),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({token:e})}).catch(()=>{})}function cy(){try{let e=localStorage.getItem(oy);return e!==null&&e.length>0?e:null}catch{return null}}function ly(e){let t=ry(window.location.hash);if(t!==null){ny(e,t);return}let n=Fg(window.location.hash);window.history.replaceState(null,``,window.location.pathname);let r=t=>e.render(P(uy,{completion:n,result:t}));if(r(null),n===null)return;let i=Yg();n_(n,{opener:window.opener,origin:window.location.origin,channel:i,addEventListener:(e,t)=>window.addEventListener(e,t),removeEventListener:(e,t)=>window.removeEventListener(e,t),close:()=>{window.close(),window.setTimeout(()=>r({kind:`done`,message:iy}),ay)},continueAt:e=>window.location.replace(B(e)),persistSession:e=>sy(e,n.target===`login`?n.fragment:``),showResult:r,setTimeout:(e,t)=>window.setTimeout(e,t)})}function uy({completion:e,result:t}){let{t:n}=H();return P(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:P(`div`,{className:`flex flex-col items-center gap-3 text-sm text-foreground-subtle`,children:e===null?P(`a`,{className:`text-primary underline`,href:B(`/login`),children:n(`ssoComplete.nothingToFinishHereGo`,`Nothing to finish here — go to sign-in`)}):t===null?y(`span`,{className:`flex items-center gap-3`,children:[P(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-primary/30 border-t-primary`}),n(`ssoComplete.finishingSignIn`,`Finishing sign-in…`)]}):y(E,{children:[P(`span`,{"data-testid":`sso-complete-result`,className:t.kind===`link-error`?`text-danger`:`text-foreground`,children:t.message}),P(`button`,{type:`button`,className:`rounded-md border border-border px-3 py-1.5 text-foreground hover:bg-surface-hover`,onClick:()=>window.close(),children:n(`ssoComplete.closeThisWindow`,`Close this window`)})]})})})}a();function dy(e){if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`message`),n=Reflect.get(e,`data`);return(typeof n==`object`&&n?Reflect.get(n,`code`):void 0)===`FORBIDDEN`||typeof t==`string`&&/sign in again first/i.test(t)}function fy(){let e=new URLSearchParams(window.location.search);return Sl({codeChallenge:e.get(`code_challenge`),codeChallengeMethod:e.get(`code_challenge_method`),state:e.get(`state`),purpose:e.get(`purpose`)})}function py(e){return Math.min(1e3*2**e,15e3)}function my(){let{t:e}=H(),{login:t,verifyTotp:n,finalizePasskeyLogin:r,user:i}=Ql(),{i18n:a}=H(),o=ni(),c=Ga(),l=q(),u=new URLSearchParams(window.location.search).get(`next`);s(()=>{jl(u)},[u]);let d=new URLSearchParams(window.location.search).get(`redirect`);s(()=>{Bl(d)},[d]);let p=fy();s(()=>{Tl(p)},[p?.codeChallenge,p?.state,p?.purpose]);let m=l.state,h=H_(m?.from),[g,_]=f(``),[v,b]=f(``),[x,S]=f(!1),[C,w]=f(``),[T,D]=f(!1),[O,k]=f(`credentials`),[A,j]=f(``),[N,I]=f([]),[ee,L]=f(``),[te,R]=f(void 0),[ne,re]=f(`sso-not-linked`),ie=Fr.auth.listLoginMethods.useQuery(void 0,{retry:!0,retryDelay:py}),ae=ie.data===void 0,z=(ie.data??[]).filter(e=>e.kind!==`device-certificate`),oe=Fr.auth.getServerName.useQuery().data,se=z.filter(e=>e.stage===`primary`),ce=Uv(z);s(()=>{let e=Tg(window.location.hash);if(e!==null){if(window.history.replaceState({},``,window.location.pathname+window.location.search),e.kind===`challenge`){j(e.challengeToken),I(e.factors),L(``),k(`second-factor`);return}re(e.code),R(e.provider)}},[]);let le=te==null?null:z.find(e=>e.id===te&&`label`in e)?.label??null,ue=C||(te===void 0?``:Eg(ne,le)),{passkeyMethods:de,widgetMethods:fe}=ce,me=M(!1),he=async()=>{if(me.current)return;me.current=!0;let e=Ol(d);if(e?.kind===`app-callback`){await ye(e.url);return}else if(e){window.location.assign(B(e.path));return}let t=Nl(u);t?window.location.assign(B(t)):c(h,{replace:!0})},[ge,_e]=f(null),ye=async e=>{_e({callbackBase:e,mintedUrl:null,failed:!1});try{let t=fy()??El();if(t===null)throw Error(`The app sent no PKCE challenge and state`);let{code:n}=await Z().trpcClient.auth.createHandoffCode.mutate({purpose:t.purpose,codeChallenge:t.codeChallenge,state:t.state}),r=Dl(e,n,t.state);_e({callbackBase:e,mintedUrl:r,failed:!1}),window.location.assign(r)}catch(t){if(dy(t)){me.current=!1,_e(null),w(`Sign in again to confirm it is you.`);return}_e({callbackBase:e,mintedUrl:null,failed:!0})}},be=i!==null,[xe,Se]=f(!1);s(()=>{!be||!d&&!u||xe||(Se(!0),he())},[be,d,u,xe]);let Ce=async e=>{e.preventDefault(),w(``),R(void 0),D(!0);try{let e=await t(g,v);if(e.kind===`second-factor`){j(e.challengeToken),I(e.factors),k(`second-factor`);return}v===`changeme`?c(`/change-password`,{replace:!0}):await he()}catch(e){w(e instanceof Error?e.message:`Login failed`)}finally{D(!1)}},we=async e=>{e.preventDefault(),w(``),D(!0);try{await n(A,ee.trim()),await he()}catch(e){w(e instanceof Error?e.message:`TOTP verification failed`),L(``)}finally{D(!1)}},Te=async(e,t)=>{try{await r(e,t),await he()}catch(e){w(e instanceof Error?e.message:`Passkey sign-in failed`)}},Ee=M(null);s(()=>()=>Ee.current?.(),[]);let De=async e=>{if(e.target!==`login`)return;let t=sl(new URLSearchParams(e.fragment));if(t!==null){try{await r(t.token,t),await he()}catch(e){w(e instanceof Error?e.message:`Sign-in failed`)}return}let n=Tg(`#${e.fragment}`);if(n!==null){if(n.kind===`challenge`){ke({challengeToken:n.challengeToken,factors:n.factors});return}re(n.code),R(n.provider)}},Oe=e=>{if(yl(d)?.kind===`app-callback`)return!1;let t=zg(B(Lg(e.startUrl)));return t===null?!1:(w(``),R(void 0),Ee.current?.(),Ee.current=Zg(t,{onReturn:e=>{Ee.current?.(),Ee.current=null,De(e)},onDone:e=>{if(Ee.current?.(),Ee.current=null,e.target!==`login`)return;let t=cy()===null?null:il();t!==null&&De({target:`login`,fragment:new URLSearchParams({token:t.token,...t.refreshToken===void 0?{}:{refreshToken:t.refreshToken},...t.expiresAt===void 0?{}:{expiresAt:String(t.expiresAt)}}).toString()})}}),!0)},ke=e=>{let t=e.factors.filter(e=>e===`totp`||e===`passkey`);j(e.challengeToken),I(t),L(``),w(``),k(`second-factor`)};return ge===null?P(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:y(`div`,{className:`w-full max-w-sm`,children:[P(`div`,{className:`flex justify-center mb-8`,children:P(`img`,{src:o?.resolvedMode===`light`?B(`/brand/logo-horizontal-light.svg`):B(`/brand/logo-horizontal-dark.svg`),alt:e(`login.camstackAdmin`,`CamStack Admin`),className:`h-12`})}),oe!==void 0&&!oe.isDefault&&P(`p`,{"data-testid":`login-server-name`,className:`-mt-4 mb-6 text-center text-sm text-foreground-muted`,children:P(ec,{i18nKey:`login.signInTo`,values:{name:oe.name},components:{b:P(`span`,{className:`font-semibold text-foreground`})}})}),O===`credentials`?y(`form`,{onSubmit:Ce,className:`space-y-4 rounded-xl border border-border bg-surface p-6 shadow-xl shadow-black/10`,children:[ue&&P(`div`,{"data-testid":`login-error`,className:`rounded-md bg-danger/10 border border-danger/20 px-3 py-2 text-xs text-danger`,children:ue}),y(`div`,{className:`space-y-1.5`,children:[P(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`login.username`,`Username`)}),P(`input`,{"data-testid":`login-username`,type:`text`,placeholder:e(`login.username`,`Username`),value:g,onChange:e=>_(e.target.value),className:`w-full rounded-lg border border-border bg-background px-3 py-2.5 text-sm text-foreground placeholder:text-foreground-disabled focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none transition-all`,autoFocus:!0})]}),y(`div`,{className:`space-y-1.5`,children:[P(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`login.password`,`Password`)}),y(`div`,{className:`relative`,children:[P(`input`,{"data-testid":`login-password`,type:x?`text`:`password`,placeholder:e(`login.password`,`Password`),value:v,onChange:e=>b(e.target.value),className:`w-full rounded-lg border border-border bg-background px-3 py-2.5 pr-10 text-sm text-foreground placeholder:text-foreground-disabled focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none transition-all`}),P(`button`,{type:`button`,onClick:()=>S(!x),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground transition-colors`,tabIndex:-1,children:P(x?rt:pe,{className:`h-4 w-4`})})]})]}),P(`button`,{"data-testid":`login-submit`,type:`submit`,disabled:T||!g||!v,className:`w-full rounded-lg bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground shadow-md shadow-primary/20 hover:shadow-lg hover:shadow-primary/30 disabled:opacity-50 disabled:shadow-none transition-all`,children:T?y(`span`,{className:`flex items-center justify-center gap-2`,children:[P(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground/30 border-t-primary-foreground`}),e(`login.loggingIn`,`Logging in...`)]}):e(`login.logIn`,`Log in`)})]}):y(`div`,{className:`space-y-4 rounded-xl border border-border bg-surface p-6 shadow-xl shadow-black/10`,children:[y(`div`,{className:`flex items-center gap-2 pb-1 border-b border-border`,children:[P(F,{className:`h-4 w-4 text-primary`}),P(`div`,{className:`text-sm font-medium text-foreground`,children:e(`login.twoFactorAuthentication`,`Two-factor authentication`)})]}),P(`p`,{className:`text-xs text-foreground-subtle`,children:g?P(E,{children:P(ec,{i18nKey:`login.finishSigningInAs`,values:{username:g},components:{mono:P(`span`,{className:`font-mono text-foreground`})}})}):e(`login.finishSigningInAs`,`Finish signing in.`)}),C&&P(`div`,{className:`rounded-md bg-danger/10 border border-danger/20 px-3 py-2 text-xs text-danger`,children:C}),N.includes(`passkey`)&&de.map(e=>P(Bv,{method:e,challengeToken:A,onComplete:Te},e.id)),N.includes(`passkey`)&&fe.map(e=>P(qv,{method:e,config:{challengeToken:A,onComplete:Te}},e.id)),Wv(N,ce)&&P(`div`,{className:`rounded-md border border-border bg-background px-3 py-2 text-xs text-foreground-subtle`,children:e(`login.passkeyVerificationIsnTAvailable`,`Passkey verification isn't available on this address. Open the hub via its domain URL to complete sign-in.`)}),N.includes(`passkey`)&&N.includes(`totp`)&&y(`div`,{className:`flex items-center gap-3`,children:[P(`div`,{className:`h-px flex-1 bg-border`}),P(`span`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:`or`}),P(`div`,{className:`h-px flex-1 bg-border`})]}),N.includes(`totp`)&&y(`form`,{onSubmit:we,className:`space-y-4`,children:[y(`div`,{className:`space-y-1.5`,children:[P(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`login.authenticationCode`,`Authentication code`)}),P(`input`,{"data-testid":`login-totp`,type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,placeholder:`123456`,value:ee,onChange:e=>L(e.target.value.replace(/\D/g,``).slice(0,6)),className:`w-full rounded-lg border border-border bg-background px-3 py-3 text-center text-2xl font-mono tracking-widest text-foreground placeholder:text-foreground-disabled focus:border-primary focus:ring-1 focus:ring-primary/30 outline-none transition-all`,autoFocus:!0})]}),P(`button`,{"data-testid":`login-totp-submit`,type:`submit`,disabled:T||ee.length!==6,className:`w-full rounded-lg bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground shadow-md shadow-primary/20 hover:shadow-lg hover:shadow-primary/30 disabled:opacity-50 disabled:shadow-none transition-all`,children:T?y(`span`,{className:`flex items-center justify-center gap-2`,children:[P(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-primary-foreground/30 border-t-primary-foreground`}),e(`login.verifying`,`Verifying...`)]}):e(`login.verifyAndSignIn`,`Verify and sign in`)})]}),y(`button`,{type:`button`,onClick:()=>{k(`credentials`),j(``),I([]),L(``),w(``)},className:`w-full flex items-center justify-center gap-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:[P(ve,{className:`h-3 w-3`}),e(`login.backToUsernamePassword`,`Back to username + password`)]})]}),O===`credentials`&&ae&&y(`p`,{"data-testid":`login-methods-pending`,role:`status`,className:`mt-4 flex items-center justify-center gap-2 text-xs text-foreground-subtle`,children:[P(`span`,{className:`h-3 w-3 animate-spin rounded-full border-2 border-foreground-subtle/30 border-t-foreground-subtle`}),e(`login.methodsPending`,`Loading other sign-in options...`)]}),O===`credentials`&&P(Kv,{methods:se,widgetConfig:{onComplete:Te,onSecondFactor:ke,locale:a.language},onRedirect:Oe}),P(`p`,{className:`mt-6 text-center text-[10px] text-foreground-subtle/50`,children:P(Y_,{placement:`login`})})]})}):P(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:y(`div`,{className:`w-full max-w-sm rounded-xl border border-border bg-surface p-6 text-center space-y-4`,children:[P(`h1`,{className:`text-sm font-semibold text-foreground`,children:e(`login.returningToTheApp`,`Returning to the app…`)}),ge.failed?y(E,{children:[P(`p`,{className:`text-xs text-danger`,children:e(`login.couldNotPrepareTheSign`,`Could not prepare the sign-in handoff. You are logged in — retry below.`)}),P(`button`,{onClick:()=>void ye(ge.callbackBase),className:`inline-flex rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90`,children:e(`common.retry`,`Retry`)})]}):ge.mintedUrl===null?P(`p`,{className:`text-xs text-foreground-subtle`,children:e(`login.preparingAOneTimeSign`,`Preparing a one-time sign-in code…`)}):y(E,{children:[P(`p`,{className:`text-xs text-foreground-subtle`,children:e(`login.ifTheAppDoesNot`,`If the app does not open automatically, tap below (the code expires in 60s).`)}),P(`a`,{href:ge.mintedUrl,className:`inline-flex rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90`,children:e(`login.openCamstack`,`Open CamStack`)})]})]})})}a();function hy(){let{pathname:e,search:t,hash:n}=q();return P(J,{to:`${_v(e)}${t}${n}`,replace:!0})}function gy(){return P(J,{to:B_()??`/devices`,replace:!0})}var _y=m(()=>i(()=>import(`./Devices-BAfbzc8b.js`).then(e=>({default:e.DevicesPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url)),vy=m(()=>i(()=>import(`./Integrations-XcsYTI2I.js`).then(e=>({default:e.IntegrationsPage})),__vite__mapDeps([9,1,2,3,4,10,5,6,11,12,13,7,8]),import.meta.url)),yy=m(()=>i(()=>import(`./IntegrationDetail-B4X-8vcl.js`).then(e=>({default:e.IntegrationDetailPage})),__vite__mapDeps([14,1,2,3,4,15,5,16,11,12,13,7,17]),import.meta.url)),by=m(()=>i(()=>import(`./Pipeline-BMhn1YbR.js`).then(e=>({default:e.PipelinePage})),__vite__mapDeps([18,1,2,3,4,10,5,19,20,21,22,16,23,24,8]),import.meta.url)),xy=m(()=>i(()=>import(`./DeviceDetail-BSWf6l6J.js`).then(e=>({default:e.DeviceDetailPage})),__vite__mapDeps([25,1,2,3,4,10,5,26,27,28,29,19,30,22,31,32,33,34,35,36,23,8,37,13]),import.meta.url)),Sy=m(()=>i(()=>import(`./Showroom-2gQYW-h2.js`).then(e=>({default:e.ShowroomPage})),__vite__mapDeps([38,1,2,3,4]),import.meta.url)),Cy=m(()=>i(()=>import(`./EmbedPlayerPage-CZM7W_SR.js`).then(e=>({default:e.EmbedPlayerPage})),__vite__mapDeps([39,1,2,3,4,5]),import.meta.url)),wy=m(()=>i(()=>import(`./Library-X3g7Mvql.js`).then(e=>({default:e.LibraryPage})),__vite__mapDeps([40,1,2,3,4,10,5,41,19,21,42,43,34,44,37,13]),import.meta.url)),Ty=m(()=>i(()=>import(`./Recordings-Ct8JWW27.js`).then(e=>({default:e.RecordingsPage})),__vite__mapDeps([45,1,2,3,4,10,5,46,43,47,26,48,49,50,37,13]),import.meta.url)),Ey=m(()=>i(()=>import(`./Viewer-ukAW_oJQ.js`).then(e=>({default:e.ViewerPage})),__vite__mapDeps([51,2,3,4,52,5,13,1]),import.meta.url)),Dy=m(()=>i(()=>import(`./Build-Dlf7sJhk.js`).then(e=>({default:e.BuildPage})),__vite__mapDeps([53,1,2,3,4,10,5,29,54,19,43,55,31,32,33,56]),import.meta.url)),Oy=m(()=>i(()=>import(`./CompositionEditorPage-CdJtfEi1.js`).then(e=>({default:e.CompositionEditorPage})),__vite__mapDeps([57,1,2,3,4,29,5,6,55,31,10,32,33]),import.meta.url)),ky=m(()=>i(()=>import(`./Locations-C--r0_cW.js`).then(e=>({default:e.LocationsPage})),__vite__mapDeps([58,1,2,3,4,10,5,29,59,42,43,35,32,33]),import.meta.url)),Ay=m(()=>i(()=>import(`./Addons-BNo3Y3g8.js`).then(e=>({default:e.AddonsPage})),__vite__mapDeps([60,1,2,3,4,19,5,6,16,61,13]),import.meta.url)),jy=m(()=>i(()=>import(`./AiProfiles-CTHbBMUB.js`).then(e=>({default:e.AiProfilesPage})),__vite__mapDeps([62,1,2,3,4,10,5,63,64,6,43,13]),import.meta.url)),My=m(()=>i(()=>import(`./MyAccess-Di7tv0VI.js`).then(e=>({default:e.MyAccessPage})),__vite__mapDeps([65,1,2,3,4,10,5,19,66,67,68,6,43,69,13]),import.meta.url)),Ny=m(()=>i(()=>import(`./Logs-C7Z3D9TY.js`).then(e=>({default:e.LogsPage})),__vite__mapDeps([70,1,2,3,4,71,22,5,6,43,72,73,16,74,17,13,75]),import.meta.url)),Py=m(()=>i(()=>import(`./Identity-6QdzCJrT.js`).then(e=>({default:e.IdentityPage})),__vite__mapDeps([76,1,2,3,4,10,5,77,19,66,67,68,6,43,72,73,16,74,17,13,69,75]),import.meta.url)),Fy=m(()=>i(()=>import(`./Network-3FZdyZoe.js`).then(e=>({default:e.NetworkPage})),__vite__mapDeps([78,1,2,3,4,10,5,29,19,79,6,43,72,73,16,74,17,13,75]),import.meta.url)),Iy=m(()=>i(()=>import(`./Integrations-JcvhEroF.js`).then(e=>({default:e.IntegrationsPage})),__vite__mapDeps([80,1,2,3,4,10,5,19,79,67,81,43,72,73,6,16,74,17,13,12]),import.meta.url)),Ly=m(()=>i(()=>import(`./Data-DkPbjXNV.js`).then(e=>({default:e.DataPage})),__vite__mapDeps([82,1,2,3,4,10,5,83,30,49,6,43,47,26,48,50,37,13]),import.meta.url)),Ry=m(()=>i(()=>import(`./System-CDHw7Mcx.js`).then(e=>({default:e.SystemPage})),__vite__mapDeps([84,1,2,3,4,10,5,19,66,6,43,16,74,17,13]),import.meta.url)),zy=m(()=>i(()=>import(`./Cluster-C4BsKola.js`).then(e=>({default:e.ClusterPage})),__vite__mapDeps([85,1,2,3,4,10,5,49,86,68,6,16,24,61,50]),import.meta.url)),By=m(()=>i(()=>import(`./Terminal-UXpMvEO1.js`).then(e=>({default:e.TerminalPage})),__vite__mapDeps([87,1,2,3,4,19,5,6,16,88]),import.meta.url)),Vy=m(()=>i(()=>import(`./Notifications-D4LJlejx.js`).then(e=>({default:e.NotificationsPage})),__vite__mapDeps([89,1,2,3,4,10,5,28,19,63,90,6,43,56,36,44,13,33]),import.meta.url)),Hy=m(()=>i(()=>import(`./History-BfD8lMf9.js`).then(e=>({default:e.HistoryPage})),__vite__mapDeps([91,1,2,3,4,5,6]),import.meta.url)),Uy=m(()=>i(()=>import(`./Calendars-YnCFbUE7.js`).then(e=>({default:e.CalendarsPage})),__vite__mapDeps([92,1,2,3,4,10,5,19,6]),import.meta.url)),Wy=new D({defaultOptions:{queries:{gcTime:0,staleTime:0,retry:!1,refetchOnWindowFocus:!1}}});br(Wy);function Gy({field:e,value:t,onChange:n,disabled:r}){return P(Lm,{field:e,value:t,onChange:n,disabled:r})}var Ky={"model-selector":Gy};function qy({children:e}){let{t}=H(),{user:n,logout:r}=Ql(),[i,a]=f(0),o=M(n?.username??null);s(()=>{let e=n?.username??null;e!==o.current&&(o.current=e,Qc(),a(e=>e+1))},[n]);let c=d(()=>Z(),[i]),l=p(()=>{Z().reconnect(),a(e=>e+1),Wy.invalidateQueries()},[]);oh(p(()=>gl(l),[l])),s(()=>fl(()=>{Z().isSocketTokenStale()&&l()}),[l]);let u=p(async()=>{let e=await _l();return e&&l(),e},[l]),{bootReady:m,bootError:h}=ih(c,n??null,r,u);return P(th,{children:P(Pe,{system:c,children:P(Fr.Provider,{client:c.trpcClient,queryClient:Wy,children:y(kr,{children:[P(Un,{children:m?e:P(Jy,{})}),m&&P(Um,{}),h!==null&&m&&y(`div`,{className:`fixed bottom-[calc(env(safe-area-inset-bottom)+1rem)] right-[calc(env(safe-area-inset-right)+1rem)] z-50 max-w-sm rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning shadow-lg`,children:[t(`app.bootProbeFailed`,`Boot probe failed:`),` `,h,`. Retrying in background.`]})]})})})})}function Jy(){let{t:e}=H();return P(`div`,{className:`flex min-h-screen items-center justify-center bg-background`,children:y(`div`,{className:`flex items-center gap-3 text-sm text-foreground-subtle`,children:[P(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-primary/30 border-t-primary`}),e(`app.connecting`,`Connecting…`)]})})}function Yy(){return P(`div`,{className:`flex min-h-screen items-center justify-center bg-background`,children:P(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-primary/30 border-t-primary`})})}function Xy(){return P(Br,{defaultMode:`dark`,children:P(N,{client:Wy,children:P(Zl,{children:P(qy,{children:P(er,{children:P(Hm,{children:y(rr,{renderers:Ky,children:[P(us,{basename:We(),children:P(jm,{children:P(w,{fallback:P(Yy,{}),children:y(xo,{children:[P(Y,{path:`/login`,element:P(my,{})}),P(Y,{path:`/admin/*`,element:P(hy,{})}),P(Y,{path:`/admin`,element:P(hy,{})}),P(Y,{path:`/change-password`,element:P($,{children:P(wv,{})})}),P(Y,{path:`/showroom`,element:P(Sy,{})}),P(Y,{path:`/embed/player`,element:P(Cy,{})}),y(Y,{element:P($,{children:P(Ci,{children:P(nv,{})})}),children:[P(Y,{index:!0,element:P(gy,{})}),P(Y,{path:`/access-denied`,element:P(vv,{})}),P(Y,{path:`/dashboard`,element:P(J,{to:`/devices`,replace:!0})}),P(Y,{path:`/devices`,element:P(_y,{})}),P(Y,{path:`/cameras`,element:P(J,{to:`/devices`,replace:!0})}),P(Y,{path:`/integrations`,element:P(vy,{})}),P(Y,{path:`/integrations/:integrationId`,element:P(yy,{})}),P(Y,{path:`/system/pipeline`,element:P(by,{})}),P(Y,{path:`/pipeline`,element:P(J,{to:`/system/pipeline`,replace:!0})}),P(Y,{path:`/live`,element:P(Ey,{})}),P(Y,{path:`/devices/:deviceId`,element:P(xy,{})}),P(Y,{path:`/system/logs`,element:P($,{requireAdmin:!0,children:P(Ny,{})})}),P(Y,{path:`/system/addons`,element:P($,{requireAdmin:!0,children:P(Ay,{})})}),P(Y,{path:`/system/ai`,element:P($,{requireAdmin:!0,children:P(jy,{})})}),P(Y,{path:`/system/settings`,element:P($,{requireAdmin:!0,children:P(Ry,{})})}),P(Y,{path:`/system/nodes`,element:P($,{requireAdmin:!0,children:P(zy,{})})}),P(Y,{path:`/system/notifications`,element:P($,{requireAdmin:!0,children:P(Vy,{})})}),P(Y,{path:`/system/history`,element:P($,{requireAdmin:!0,children:P(Hy,{})})}),P(Y,{path:`/system/calendars`,element:P($,{requireAdmin:!0,children:P(Uy,{})})}),P(Y,{path:`/system/identity`,element:P($,{requireAdmin:!0,children:P(Py,{})})}),P(Y,{path:`/system/my-access`,element:P(My,{})}),P(Y,{path:`/system/network`,element:P($,{requireAdmin:!0,children:P(Fy,{})})}),P(Y,{path:`/system/integrations`,element:P($,{requireAdmin:!0,children:P(Iy,{})})}),P(Y,{path:`/system/data`,element:P($,{requireAdmin:!0,children:P(Ly,{})})}),P(Y,{path:`/system`,element:P(J,{to:Km,replace:!0})}),P(Y,{path:`/system/terminal`,element:P($,{requireAdmin:!0,children:P(By,{})})}),qm.map(e=>P(Y,{path:e.path,element:P(Ym,{tab:e.tab})},e.path)),P(Y,{path:`/system/users`,element:P(J,{to:`/system/identity?tab=users`,replace:!0})}),P(Y,{path:`/system/api-keys`,element:P(J,{to:`/system/identity?tab=api-keys`,replace:!0})}),P(Y,{path:`/system/authentication`,element:P(J,{to:mv(`authentication`),replace:!0})}),P(Y,{path:`/system/linked-sessions`,element:P(J,{to:`/system/identity?tab=linked-sessions`,replace:!0})}),P(Y,{path:`/system/remote-access`,element:P(J,{to:mv(`remoteAccess`),replace:!0})}),P(Y,{path:`/system/turn`,element:P(J,{to:mv(`turn`),replace:!0})}),P(Y,{path:`/system/storage`,element:P(J,{to:`/system/data?tab=storage`,replace:!0})}),P(Y,{path:`/system/backup`,element:P(J,{to:`/system/data?tab=backup`,replace:!0})}),P(Y,{path:`/library`,element:P($,{requireAdmin:!0,children:P(wy,{})})}),P(Y,{path:`/retrain`,element:P(J,{to:`/addon/training`,replace:!0})}),P(Y,{path:`/recordings`,element:P($,{requireAdmin:!0,children:P(Ty,{})})}),P(Y,{path:`/build`,element:P($,{requireAdmin:!0,children:P(Dy,{})})}),P(Y,{path:iv,element:P($,{requireAdmin:!0,children:P(Oy,{})})}),P(Y,{path:av,element:P($,{requireAdmin:!0,children:P(Oy,{})})}),P(Y,{path:`/locations`,element:P($,{requireAdmin:!0,children:P(ky,{})})}),P(Y,{path:`/automation`,element:P(Rm,{to:`/build`})}),P(Y,{path:`/addon/:pagePath`,element:P($,{requireAdmin:!0,children:P(_h,{})})}),P(Y,{path:`*`,element:P(J,{to:`/devices`,replace:!0})})]})]})})})}),P(Qm,{})]})})})})})})})}a(),window.__camstackUiLibrary=zr,window.__camstackSdk=Yr,window.__camstackTypes=Qt;var Zy=fi(document.getElementById(`root`));r_(window.location.pathname,We())?ly(Zy):Zy.render(P(S,{children:P(Xy,{})}));export{Xf as $,eu as $n,hd as $t,Kp as A,qu as An,Yd as At,yp as B,pu as Bn,Id as Bt,eh as C,Yu as Cn,tf as Ct,gm as D,Vu as Dn,Ud as Dt,km as E,Uu as En,Hd as Et,Vp as F,yu as Fn,Bd as Ft,tp as G,lu as Gn,jd as Gt,Qf as H,iu as Hn,Fd as Ht,Tp as I,_u as In,zd as It,Zf as J,au as Jn,kd as Jt,qf as K,mu as Kn,Od as Kt,dp as L,du as Ln,Vd as Lt,Yp as M,$u as Mn,Zd as Mt,Up as N,Ou as Nn,qd as Nt,tm as O,Du as On,Kd as Ot,Hp as P,xu as Pn,Md as Pt,Yf as Q,hu as Qn,fd as Qt,_p as R,ou as Rn,Pd as Rt,Rh as S,Pu as Sn,ff as St,Vm as T,zu as Tn,Qd as Tt,Jf as U,uu as Un,Dd as Ut,op as V,ru as Vn,Ld as Vt,cp as W,su as Wn,vd as Wt,sp as X,fu as Xn,_d as Xt,ip as Y,nu as Yn,Ad as Yt,up as Z,gu as Zn,bd as Zt,Zg as _,Tu as _n,_f as _t,dv as a,Lu as an,wc as ar,zf as at,lg as b,ju as bn,pf as bt,fv as c,Wu as cn,fc as cr,Ff as ct,gv as d,id as dn,fs as dr,ef as dt,xd as en,Ql as er,ep as et,ov as f,Mu as fn,J as fr,yf as ft,zg as g,Ru as gn,of as gt,u_ as h,ed as hn,bs as hr,lf as ht,uv as i,Hu as in,Tc as ir,Uf as it,qp as j,Gu as jn,Xd as jt,$p as k,ku as kn,Jd as kt,mv as l,Ku as ln,oc as lr,Af as lt,sv as m,Xu as mn,Ya as mr,df as mt,Iv as n,Ju as nn,Ec as nr,Bf as nt,cv as o,Bu as on,Cc as or,Lf as ot,rv as p,Qu as pn,Ga as pr,wf as pt,Kf as q,cu as qn,wd as qt,pv as r,od as rn,kc as rr,Vf as rt,lv as s,Cu as sn,X as sr,If as st,Rv as t,Sd as tn,Pc as tr,Hf as tt,hv as u,Zu as un,ec as ur,$d as ut,Lg as v,Eu as vn,af as vt,Km as w,sd as wn,hf as wt,Uh as x,Nu as xn,uf as xt,Og as y,ad as yn,gf as yt,vp as z,tu as zn,Rd as zt};