@camstack/addon-admin-ui 1.2.440 → 1.2.441

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/assets/{AddonAssetIcon-DoCqXzAv.js → AddonAssetIcon-CCzVCA49.js} +1 -1
  2. package/dist/assets/{Addons-CrSVEbe3.js → Addons-CUPFTOFz.js} +1 -1
  3. package/dist/assets/{AdminPage-KGO_m_yt.js → AdminPage--m3xHpjx.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-BiMhPKOP.js → AdminSectionedPage-D5J86Kfp.js} +1 -1
  5. package/dist/assets/{AiProfiles-D8mKo1K9.js → AiProfiles-CEZqx-Sw.js} +1 -1
  6. package/dist/assets/{BrokerForm-yx58WRgh.js → BrokerForm-Cd5z8Mk0.js} +1 -1
  7. package/dist/assets/{Build-BArewEF3.js → Build-RW9SjiCM.js} +5 -5
  8. package/dist/assets/{Calendars-BdN8ZQmv.js → Calendars-CVnE0N6y.js} +1 -1
  9. package/dist/assets/{Cluster-Bn5YZafT.js → Cluster-DdgLAQcF.js} +1 -1
  10. package/dist/assets/{ClusterStepModel-DPmlzTfm.js → ClusterStepModel-BbVbEWqh.js} +1 -1
  11. package/dist/assets/CompositionEditor-BDEQF7e9.js +1 -0
  12. package/dist/assets/{CompositionEditorPage-BwqVkeY-.js → CompositionEditorPage-D3LiFLq4.js} +1 -1
  13. package/dist/assets/{Data-BvY-zVHv.js → Data-TI1fXQ8e.js} +1 -1
  14. package/dist/assets/DeviceDetail-Ry7b522t.js +2 -0
  15. package/dist/assets/{DeviceDoActionFields-C6f9gioM.js → DeviceDoActionFields-n2-NdVST.js} +1 -1
  16. package/dist/assets/{Devices-CtivG8K9.js → Devices-BacO9x6N.js} +1 -1
  17. package/dist/assets/{EmbedPlayerPage-BD-Z7zz-.js → EmbedPlayerPage-DgFNOUrt.js} +1 -1
  18. package/dist/assets/{Identity-BQNP0wku.js → Identity-BPWd0o-B.js} +1 -1
  19. package/dist/assets/{IntegrationDetail-CzEG-I4B.js → IntegrationDetail-CFsboI2-.js} +1 -1
  20. package/dist/assets/{IntegrationHub-tqxee2Rm.js → IntegrationHub-BRMnV56J.js} +1 -1
  21. package/dist/assets/{Integrations-C7Ptcn3c.js → Integrations-Bf2SzcCT.js} +1 -1
  22. package/dist/assets/{Integrations-GZm_SrQK.js → Integrations-CBqnh8t8.js} +1 -1
  23. package/dist/assets/{Library-ToUHY4O3.js → Library-yKp-qGfV.js} +1 -1
  24. package/dist/assets/{Locations-CPFCvUKd.js → Locations-BCY7diBp.js} +1 -1
  25. package/dist/assets/{Logs-Ds6SPC6o.js → Logs-DWz6dVJo.js} +1 -1
  26. package/dist/assets/{MaskShapeCanvas-BoY32Qvt.js → MaskShapeCanvas-wkrQJhyN.js} +1 -1
  27. package/dist/assets/{MotionZonesSettings-DBW4jTEr.js → MotionZonesSettings-BZneggiu.js} +1 -1
  28. package/dist/assets/{MyAccess-2mSUBp14.js → MyAccess-DmuNu2nC.js} +1 -1
  29. package/dist/assets/{Network-BddKO6B1.js → Network-CMlIm20D.js} +1 -1
  30. package/dist/assets/{NodeAddonsSettingsPanel-CIISQuIL.js → NodeAddonsSettingsPanel-BxeQZ-hu.js} +1 -1
  31. package/dist/assets/Notifications-B0nD4977.js +1 -0
  32. package/dist/assets/{PrivacyMaskSettings-z8P3R0fA.js → PrivacyMaskSettings-CN2hF3qR.js} +1 -1
  33. package/dist/assets/{Recordings-g1Jxg_Lr.js → Recordings-CkHyBhqh.js} +1 -1
  34. package/dist/assets/{ScanNetworkModal-D7N2aC7y.js → ScanNetworkModal-CfHHLP_k.js} +1 -1
  35. package/dist/assets/{SceneMonitorEditor-CyjEekEM.js → SceneMonitorEditor-CU-Yj4Sw.js} +1 -1
  36. package/dist/assets/{SessionsList-bmTxxIOE.js → SessionsList-DrSkZMrj.js} +1 -1
  37. package/dist/assets/{Showroom-PlFtcQrL.js → Showroom-ChGRG_dB.js} +1 -1
  38. package/dist/assets/{System-DxszqVYV.js → System-GfppoElu.js} +1 -1
  39. package/dist/assets/{Terminal-BMG2w8DZ.js → Terminal-C7azorOj.js} +1 -1
  40. package/dist/assets/{Viewer-CRLD_tt7.js → Viewer-DWdf6_8H.js} +1 -1
  41. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-GapjKGVe.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CGI8Rmb1.js} +1 -1
  42. package/dist/assets/{addon-icons-context-BrgGsfoE.js → addon-icons-context-D3LZwxs2.js} +1 -1
  43. package/dist/assets/{archive-Dx-auPAN.js → archive-BOODG6Jz.js} +1 -1
  44. package/dist/assets/{authed-media-MhMmWNH3.js → authed-media-F_SweyTm.js} +1 -1
  45. package/dist/assets/{bell-off-BQQTURVF.js → bell-off-acWBqVHX.js} +1 -1
  46. package/dist/assets/{boxes-BIK98bHo.js → boxes-U2BARjlG.js} +1 -1
  47. package/dist/assets/circle-slash-90QkMLx4.js +1 -0
  48. package/dist/assets/client-yfOXPkcm.js +358 -0
  49. package/dist/assets/{cloud-upload-FvK6xW2I.js → cloud-upload-C12rtBFh.js} +1 -1
  50. package/dist/assets/crop-BjSJZpbg.js +1 -0
  51. package/dist/assets/{device-integration-icon-ClmWzwM_.js → device-integration-icon-BeeizbXV.js} +1 -1
  52. package/dist/assets/device-picker-model-CRpYde_B.js +1 -0
  53. package/dist/assets/dist-BfR6seq4.js +358 -0
  54. package/dist/assets/{dist-CEnfZ10I.js → dist-CQud2KJs.js} +1 -1
  55. package/dist/assets/{eraser-CUAqtnBD.js → eraser-BmJjK2wc.js} +1 -1
  56. package/dist/assets/{hard-drive-download-XGtks2vE.js → hard-drive-download-DfnBSa39.js} +1 -1
  57. package/dist/assets/{history-DqvhlzWX.js → history-CNfarVY1.js} +1 -1
  58. package/dist/assets/{hostInit-DzBGXsvZ.js → hostInit-Df4MAORd.js} +1 -1
  59. package/dist/assets/{icons-DNRi-jSy.js → icons-BLn-D-gO.js} +1 -1
  60. package/dist/assets/{index-yoPG03d0.js → index-CcAR8Rlk.js} +3 -3
  61. package/dist/assets/{key-bw9xhRgT.js → key-BF4fZLz_.js} +1 -1
  62. package/dist/assets/{key-round-BngMS2dZ.js → key-round-CjE9GF4T.js} +1 -1
  63. package/dist/assets/{layers-CIl8QXpN.js → layers-b-H6nVdd.js} +1 -1
  64. package/dist/assets/{linked-devices-model-CclOXMLj.js → linked-devices-model-BMUapBfD.js} +1 -1
  65. package/dist/assets/{list-ordered-_52_xrQ7.js → list-ordered-CxtL1h3H.js} +1 -1
  66. package/dist/assets/{location-owned-usage-5eb6nny3.js → location-owned-usage-DVh3ypCw.js} +1 -1
  67. package/dist/assets/{log-in-DH9Lu6bJ.js → log-in-D4y0eEu8.js} +1 -1
  68. package/dist/assets/{memory-stick-CzaP6KiN.js → memory-stick-jw7STOQc.js} +1 -1
  69. package/dist/assets/{message-square-plus-vMywres_.js → message-square-plus-EaPlmlsM.js} +1 -1
  70. package/dist/assets/{mf-entry-bootstrap-0-54468006.js → mf-entry-bootstrap-0-8a2679ae.js} +2 -2
  71. package/dist/assets/{mic-off-Da09u2hl.js → mic-off-DiEVWn3e.js} +1 -1
  72. package/dist/assets/{monitor-off-jOOWdiSg.js → monitor-off-bCAhCbCp.js} +1 -1
  73. package/dist/assets/{monitor-smartphone-D_W4zyWO.js → monitor-smartphone-ASdELIYw.js} +1 -1
  74. package/dist/assets/mount-CRpYde_B.js +1 -0
  75. package/dist/assets/{notification-schedule-field-LytDFkpQ.js → notification-schedule-field-BKROBLSv.js} +1 -1
  76. package/dist/assets/{player-overlays-CCZE3o8q.js → player-overlays-Fx6RE6kI.js} +1 -1
  77. package/dist/assets/{recycle-BVcCaHVd.js → recycle-twm2_92b.js} +1 -1
  78. package/dist/assets/remoteEntry-D-hdlf-C.js +1 -0
  79. package/dist/assets/{scan-eye-CHwWv39K.js → scan-eye-DuyDP-FQ.js} +1 -1
  80. package/dist/assets/{scissors-BrUBwnKn.js → scissors-BJ2tjgEs.js} +1 -1
  81. package/dist/assets/{search-x-BcR2pidC.js → search-x-C9z-zNBZ.js} +1 -1
  82. package/dist/assets/{send-8R5TbxHN.js → send-C_-A97md.js} +1 -1
  83. package/dist/assets/{settings-2-C4PaSGfb.js → settings-2-A0nya3CH.js} +1 -1
  84. package/dist/assets/{speaker-CBRM7GNH.js → speaker-C8juqhRE.js} +1 -1
  85. package/dist/assets/{src-Cw4W7OtK.js → src-AhVPNkCn.js} +7 -7
  86. package/dist/assets/{timer-reset-DlfKkTg_.js → timer-reset-DHBRudwU.js} +1 -1
  87. package/dist/assets/{ungroup-BzlNECzG.js → ungroup-BLEMoVnk.js} +1 -1
  88. package/dist/assets/{unlink-HIuzqEig.js → unlink-YiKNaJO_.js} +1 -1
  89. package/dist/assets/{usb-DqboQtO8.js → usb-DzR5JdOt.js} +1 -1
  90. package/dist/assets/{use-scenes-feed-Cnl4Is6T.js → use-scenes-feed-wz6RYR34.js} +1 -1
  91. package/dist/assets/{use-stationary-objects-DmFWTPK0.js → use-stationary-objects-ByxBafUy.js} +1 -1
  92. package/dist/assets/useEventInvalidation-CRpYde_B.js +1 -0
  93. package/dist/assets/{useNodeUrlSelection-CSh6gqLc.js → useNodeUrlSelection-v_RZ_Gxk.js} +1 -1
  94. package/dist/assets/user-round-CjXCVqIf.js +1 -0
  95. package/dist/assets/{user-x-ciro8k7Z.js → user-x-CY41cwk1.js} +1 -1
  96. package/dist/assets/{video-BJUj4GaK.js → video-BRgeujOO.js} +1 -1
  97. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CwjeQPZx.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BrkS3kK7.js} +2 -2
  98. package/dist/index.html +9 -9
  99. package/dist/server/addon.js +230 -197
  100. package/package.json +1 -1
  101. package/dist/assets/CompositionEditor-BhL25d6e.js +0 -1
  102. package/dist/assets/DeviceDetail-g2esa6u-.js +0 -2
  103. package/dist/assets/Notifications-DWJcnXvV.js +0 -1
  104. package/dist/assets/circle-slash-DKE4hxbW.js +0 -1
  105. package/dist/assets/client-Cy6wyTLQ.js +0 -358
  106. package/dist/assets/crop-7vsE3Qcd.js +0 -1
  107. package/dist/assets/device-picker-model-DVvq9nYp.js +0 -1
  108. package/dist/assets/dist-BPMeH1J4.js +0 -358
  109. package/dist/assets/mount-DVvq9nYp.js +0 -1
  110. package/dist/assets/remoteEntry-BOaeaEWk.js +0 -1
  111. package/dist/assets/useEventInvalidation-DVvq9nYp.js +0 -1
  112. package/dist/assets/user-round-C4K7vDWN.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Devices-CtivG8K9.js","./src-Cw4W7OtK.js","./player-overlays-CCZE3o8q.js","./client-Cy6wyTLQ.js","./__vite-browser-external-BlMfPwfH.js","./useTranslation-D3Is_4B6.js","./AdminPage-KGO_m_yt.js","./device-integration-icon-ClmWzwM_.js","./useEventInvalidation-DVvq9nYp.js","./Integrations-C7Ptcn3c.js","./i18n-B1bxeya5.js","./ScanNetworkModal-D7N2aC7y.js","./BrokerForm-yx58WRgh.js","./mount-DVvq9nYp.js","./IntegrationDetail-CzEG-I4B.js","./search-x-BcR2pidC.js","./NodeAddonsSettingsPanel-CIISQuIL.js","./addon-icons-context-BrgGsfoE.js","./ClusterStepModel-DPmlzTfm.js","./video-BJUj4GaK.js","./usb-DqboQtO8.js","./crop-7vsE3Qcd.js","./layers-CIl8QXpN.js","./board-model-Bdetmchn.js","./DeviceDetail-g2esa6u-.js","./archive-Dx-auPAN.js","./scan-eye-CHwWv39K.js","./bell-off-BQQTURVF.js","./boxes-BIK98bHo.js","./circle-slash-DKE4hxbW.js","./CompositionEditor-BhL25d6e.js","./use-stationary-objects-DmFWTPK0.js","./linked-devices-model-CclOXMLj.js","./device-picker-model-DVvq9nYp.js","./authed-media-MhMmWNH3.js","./Showroom-PlFtcQrL.js","./EmbedPlayerPage-BD-Z7zz-.js","./Library-ToUHY4O3.js","./user-x-ciro8k7Z.js","./user-round-C4K7vDWN.js","./AdminSectionedPage-BiMhPKOP.js","./use-scenes-feed-Cnl4Is6T.js","./Recordings-g1Jxg_Lr.js","./scissors-BrUBwnKn.js","./location-owned-usage-5eb6nny3.js","./eraser-CUAqtnBD.js","./hard-drive-download-XGtks2vE.js","./format-size-DIxKXxtj.js","./Viewer-CRLD_tt7.js","./monitor-off-jOOWdiSg.js","./Build-BArewEF3.js","./ungroup-BzlNECzG.js","./DeviceDoActionFields-C6f9gioM.js","./notification-schedule-field-LytDFkpQ.js","./CompositionEditorPage-BwqVkeY-.js","./Locations-CPFCvUKd.js","./speaker-CBRM7GNH.js","./Addons-CrSVEbe3.js","./useNodeUrlSelection-CSh6gqLc.js","./AiProfiles-D8mKo1K9.js","./message-square-plus-vMywres_.js","./send-8R5TbxHN.js","./MyAccess-2mSUBp14.js","./key-round-BngMS2dZ.js","./monitor-smartphone-D_W4zyWO.js","./unlink-HIuzqEig.js","./SessionsList-bmTxxIOE.js","./Logs-Ds6SPC6o.js","./timer-reset-DlfKkTg_.js","./IntegrationHub-tqxee2Rm.js","./settings-2-C4PaSGfb.js","./AddonAssetIcon-DoCqXzAv.js","./addon-display-names-BkwMrExv.js","./Identity-BQNP0wku.js","./key-bw9xhRgT.js","./history-DqvhlzWX.js","./Network-BddKO6B1.js","./log-in-DH9Lu6bJ.js","./Integrations-GZm_SrQK.js","./recycle-BVcCaHVd.js","./Data-BvY-zVHv.js","./cloud-upload-FvK6xW2I.js","./System-DxszqVYV.js","./Cluster-Bn5YZafT.js","./memory-stick-CzaP6KiN.js","./Terminal-BMG2w8DZ.js","./Terminal-kHJ-D0s7.css","./Notifications-DWJcnXvV.js","./list-ordered-_52_xrQ7.js","./Calendars-BdN8ZQmv.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_-CwjeQPZx.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,j as O,k,o as A,q as j,u as M,x as N}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 P,Ai as F,Br as I,Cr as L,Dr as ee,Ei as te,Er as ne,Fn as re,Fr as ie,Hi as ae,Ii as oe,Jr as R,Kn as se,Kt as ce,Nt as le,On as ue,Q as z,Qn as de,Rr as fe,Si as pe,T as me,Tn as he,Tr as ge,Xn as _e,Xr as ve,Yi as ye,Z as be,Zt as xe,_t as Se,an as Ce,bi as we,bn as Te,dn as Ee,dt as De,ea as Oe,fi as ke,fn as Ae,ft as je,hi as Me,ht as Ne,it as Pe,ji as Fe,mr as Ie,na as Le,oa as Re,or as ze,ot as Be,pi as Ve,pn as He,rr as Ue,rt as We,si as Ge,sn as Ke,tr as qe,un as Je,ut as Ye,vr as Xe,xn as Ze,yi as Qe,zn as $e,zr as et}from"./player-overlays-CCZE3o8q.js";import{Jr as tt,Nr as nt,Ur as rt,Zn as it,hi as at,hn as ot,ir as st,n as ct,pn as lt,r as ut,t as dt,ur as ft}from"./client-Cy6wyTLQ.js";import{a as pt,c as mt,d as ht,f as gt,h as _t,i as vt,l as yt,m as bt,n as xt,o as St,p as Ct,r as wt,s as Tt,t as Et,u as Dt}from"./video-BJUj4GaK.js";import{An as Ot,At as kt,Ba as At,Bl as jt,Cn as Mt,Dn as Nt,En as Pt,Eo as Ft,Gn as It,Gr as Lt,Hn as Rt,Jn as zt,Jr as Bt,Kn as Vt,Kr as Ht,La as Ut,Ma as Wt,Mn as Gt,Mr as Kt,Mt as qt,Na as Jt,Nn as Yt,Nt as Xt,On as Zt,Ot as Qt,Ra as $t,Su as en,Tr as tn,U as nn,Ua as rn,Wa as an,Wn as on,Wr as sn,Xl as cn,Xn as ln,Yn as un,Zn as dn,_a as fn,_u as pn,cu as mn,da as hn,do as gn,du as _n,fl as vn,ft as yn,fu as bn,gt as xn,gu as Sn,ha as Cn,hu as wn,iu as Tn,ja as En,jn as Dn,jt as On,kl as kn,kn as An,kt as jn,l as Mn,lt as Nn,lu as Pn,ma as Fn,mr as In,mu as Ln,n as Rn,nu as zn,ol as Bn,pa as Vn,q as Hn,qn as Un,qr as Wn,rr as Gn,rt as Kn,ru as qn,s as Jn,sl as Yn,tn as Xn,tr as Zn,ua as Qn,vn as $n,vt as er,wn as tr,wt as nr,xa as rr,xu as ir,yr as ar}from"./src-Cw4W7OtK.js";import{r as or,t as sr}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-DPkvGqVU.js";import{t as cr}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-Cb2QlpvS.js";import{n as lr,t as B}from"./i18n-B1bxeya5.js";import{a as ur,c as dr,i as fr,l as pr,n as mr,o as hr,s as gr,t as V,u as _r}from"./useTranslation-D3Is_4B6.js";import"./mount-DVvq9nYp.js";import{n as vr,t as yr}from"./addon-icons-context-BrgGsfoE.js";import{t as br}from"./notification-schedule-field-LytDFkpQ.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 xr=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Sr=/^[\\/]{2}/;function Cr(e,t){return t+e.replace(/\\/g,`/`)}var wr=`popstate`;function Tr(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Er(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return kr(``,{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:Ar(t)}return Mr(t,n,null,e)}function H(e,t){if(e===!1||e==null)throw Error(t)}function U(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Dr(){return Math.random().toString(36).substring(2,10)}function Or(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 kr(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?jr(t):t,state:n,key:t&&t.key||r||Dr(),mask:i}}function Ar({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 jr(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 Mr(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=Tr(e)?e:kr(h.location,e,t);n&&n(r,e),l=u()+1;let d=Or(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=Tr(e)?e:kr(h.location,e,t);n&&n(r,e),l=u();let i=Or(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 Nr(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(wr,d),c=e,()=>{i.removeEventListener(wr,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 Nr(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),H(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:Ar(t);return i=i.replace(/ $/,`%20`),!n&&Sr.test(i)&&(i=r+i),new URL(i,r)}function Pr(e,t,n=`/`){return Fr(e,t,n,!1)}function Fr(e,t,n,r,i){let a=ti((typeof t==`string`?jr(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Lr(e),s=null,c=ei(a);for(let e=0;s==null&&e<o.length;++e)s=Xr(o[e],c,r);return s}function Ir(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 Lr(e){let t=Rr(e);return Br(t),t}function Rr(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;H(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=W([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(H(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Rr(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Jr(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=$r(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 zr(e.path))a(e,t,!0,n)}),t}function zr(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=zr(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 Br(e){e.sort((e,t)=>e.score===t.score?Yr(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Vr=/^:[\w-]+$/,Hr=3,Ur=2,Wr=1,Gr=10,Kr=-2,qr=e=>e===`*`;function Jr(e,t){let n=e.split(`/`),r=n.length;return n.some(qr)&&(r+=Kr),t&&(r+=Ur),n.filter(e=>!qr(e)).reduce((e,t)=>e+(Vr.test(t)?Hr:t===``?Wr:Gr),r)}function Yr(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 Xr(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?Qr(u,l,s.matcher,s.compiledParams):Zr(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=Zr({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:W([a,d.pathname]),pathnameBase:ui(W([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=W([a,d.pathnameBase]))}return o}function Zr(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=$r(e.path,e.caseSensitive,e.end);return Qr(e,t,n,r)}function Qr(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 $r(e,t=!1,n=!0){U(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 ei(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return U(!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 ti(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 ni(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?jr(e):e,a;return n?(n=ci(n),a=n.startsWith(`/`)?ri(n.substring(1),`/`):ri(n,t)):a=t,{pathname:a,search:di(r),hash:fi(i)}}function ri(e,t){let n=li(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ii(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 ai(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function oi(e){let t=ai(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function si(e,t,n,r=!1){let i;typeof e==`string`?i=jr(e):(i={...e},H(!i.pathname||!i.pathname.includes(`?`),ii(`?`,`pathname`,`search`,i)),H(!i.pathname||!i.pathname.includes(`#`),ii(`#`,`pathname`,`hash`,i)),H(!i.search||!i.search.includes(`#`),ii(`#`,`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=ni(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var ci=e=>e.replace(/[\\/]{2,}/g,`/`),W=e=>ci(e.join(`/`)),li=e=>e.replace(/\/+$/,``),ui=e=>li(e).replace(/^\/*/,`/`),di=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,fi=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,pi=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 mi(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function hi(e){return W(e.map(e=>e.route.path).filter(Boolean))||`/`}var gi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function _i(e,t){let n=e;if(typeof n!=`string`||!xr.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(gi)try{let e=new URL(window.location.href),r=Sr.test(n)?new URL(Cr(n,e.protocol)):new URL(n),a=ti(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{U(!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 vi=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(vi);var yi=[`GET`,...vi];new Set(yi);var bi=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function xi(e){try{return bi.includes(new URL(e).protocol)}catch{return!1}}var Si=g(null);Si.displayName=`DataRouter`;var Ci=g(null);Ci.displayName=`DataRouterState`;var wi=g(!1);function Ti(){return v(wi)}var Ei=g({isTransitioning:!1});Ei.displayName=`ViewTransition`;var Di=g(new Map);Di.displayName=`Fetchers`;var Oi=g(null);Oi.displayName=`Await`;var G=g(null);G.displayName=`Navigation`;var ki=g(null);ki.displayName=`Location`;var K=g({outlet:null,matches:[],isDataRoute:!1});K.displayName=`Route`;var Ai=g(null);Ai.displayName=`RouteError`;var ji=`REACT_ROUTER_ERROR`,Mi=`REDIRECT`,Ni=`ROUTE_ERROR_RESPONSE`;function Pi(e){if(e.startsWith(`${ji}:${Mi}:{`))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 Fi(e){if(e.startsWith(`${ji}:${Ni}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new pi(t.status,t.statusText,t.data)}catch{}}function Ii(e,{relative:t}={}){H(Li(),`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}=Ki(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:W([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Li(){return v(ki)!=null}function q(){return H(Li(),`useLocation() may be used only in the context of a <Router> component.`),v(ki).location}function Ri(){return v(ki).navigationType}var zi=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Bi(e){v(G).static||x(e)}function Vi(){let{isDataRoute:e}=v(K);return e?da():Hi()}function Hi(){H(Li(),`useNavigate() may be used only in the context of a <Router> component.`);let e=v(Si),{basename:t,navigator:n}=v(G),{matches:r}=v(K),{pathname:i}=q(),a=JSON.stringify(oi(r)),o=j(!1);return Bi(()=>{o.current=!0}),p((r,s={})=>{if(U(o.current,zi),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=si(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:W([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Ui=g(null);function Wi(e){let t=v(K).outlet;return d(()=>t&&k(Ui.Provider,{value:e},t),[t,e])}function Gi(){let{matches:e}=v(K);return e[e.length-1]?.params??{}}function Ki(e,{relative:t}={}){let{matches:n}=v(K),{pathname:r}=q(),i=JSON.stringify(oi(n));return d(()=>si(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function qi(e,t){return Ji(e,t)}function Ji(e,t,n){H(Li(),`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||``;pa(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.
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Devices-BacO9x6N.js","./src-AhVPNkCn.js","./player-overlays-Fx6RE6kI.js","./client-yfOXPkcm.js","./__vite-browser-external-BlMfPwfH.js","./useTranslation-D3Is_4B6.js","./AdminPage--m3xHpjx.js","./device-integration-icon-BeeizbXV.js","./useEventInvalidation-CRpYde_B.js","./Integrations-Bf2SzcCT.js","./i18n-B1bxeya5.js","./ScanNetworkModal-CfHHLP_k.js","./BrokerForm-Cd5z8Mk0.js","./mount-CRpYde_B.js","./IntegrationDetail-CFsboI2-.js","./search-x-C9z-zNBZ.js","./NodeAddonsSettingsPanel-BxeQZ-hu.js","./addon-icons-context-D3LZwxs2.js","./ClusterStepModel-BbVbEWqh.js","./video-BRgeujOO.js","./usb-DzR5JdOt.js","./crop-BjSJZpbg.js","./layers-b-H6nVdd.js","./board-model-Bdetmchn.js","./DeviceDetail-Ry7b522t.js","./archive-BOODG6Jz.js","./scan-eye-DuyDP-FQ.js","./bell-off-acWBqVHX.js","./boxes-U2BARjlG.js","./circle-slash-90QkMLx4.js","./CompositionEditor-BDEQF7e9.js","./use-stationary-objects-ByxBafUy.js","./linked-devices-model-BMUapBfD.js","./device-picker-model-CRpYde_B.js","./authed-media-F_SweyTm.js","./Showroom-ChGRG_dB.js","./EmbedPlayerPage-DgFNOUrt.js","./Library-yKp-qGfV.js","./user-x-CY41cwk1.js","./user-round-CjXCVqIf.js","./AdminSectionedPage-D5J86Kfp.js","./use-scenes-feed-wz6RYR34.js","./Recordings-CkHyBhqh.js","./scissors-BJ2tjgEs.js","./location-owned-usage-DVh3ypCw.js","./eraser-BmJjK2wc.js","./hard-drive-download-DfnBSa39.js","./format-size-DIxKXxtj.js","./Viewer-DWdf6_8H.js","./monitor-off-bCAhCbCp.js","./Build-RW9SjiCM.js","./ungroup-BLEMoVnk.js","./DeviceDoActionFields-n2-NdVST.js","./notification-schedule-field-BKROBLSv.js","./CompositionEditorPage-D3LiFLq4.js","./Locations-BCY7diBp.js","./speaker-C8juqhRE.js","./Addons-CUPFTOFz.js","./useNodeUrlSelection-v_RZ_Gxk.js","./AiProfiles-CEZqx-Sw.js","./message-square-plus-EaPlmlsM.js","./send-C_-A97md.js","./MyAccess-DmuNu2nC.js","./key-round-CjE9GF4T.js","./monitor-smartphone-ASdELIYw.js","./unlink-YiKNaJO_.js","./SessionsList-DrSkZMrj.js","./Logs-DWz6dVJo.js","./timer-reset-DHBRudwU.js","./IntegrationHub-BRMnV56J.js","./settings-2-A0nya3CH.js","./AddonAssetIcon-CCzVCA49.js","./addon-display-names-BkwMrExv.js","./Identity-BPWd0o-B.js","./key-BF4fZLz_.js","./history-CNfarVY1.js","./Network-CMlIm20D.js","./log-in-D4y0eEu8.js","./Integrations-CBqnh8t8.js","./recycle-twm2_92b.js","./Data-TI1fXQ8e.js","./cloud-upload-C12rtBFh.js","./System-GfppoElu.js","./Cluster-DdgLAQcF.js","./memory-stick-jw7STOQc.js","./Terminal-C7azorOj.js","./Terminal-kHJ-D0s7.css","./Notifications-B0nD4977.js","./list-ordered-CxtL1h3H.js","./Calendars-CVnE0N6y.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_-BrkS3kK7.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,j as O,k,o as A,q as j,u as M,x as N}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 P,Ai as F,Br as I,Cr as L,Dr as ee,Ei as te,Er as ne,Fn as re,Fr as ie,Hi as ae,Ii as oe,Jr as R,Kn as se,Kt as ce,Nt as le,On as ue,Q as z,Qn as de,Rr as fe,Si as pe,T as me,Tn as he,Tr as ge,Xn as _e,Xr as ve,Yi as ye,Z as be,Zt as xe,_t as Se,an as Ce,bi as we,bn as Te,dn as Ee,dt as De,ea as Oe,fi as ke,fn as Ae,ft as je,hi as Me,ht as Ne,it as Pe,ji as Fe,mr as Ie,na as Le,oa as Re,or as ze,ot as Be,pi as Ve,pn as He,rr as Ue,rt as We,si as Ge,sn as Ke,tr as qe,un as Je,ut as Ye,vr as Xe,xn as Ze,yi as Qe,zn as $e,zr as et}from"./player-overlays-Fx6RE6kI.js";import{Br as tt,Jr as nt,Ur as rt,Zn as it,hi as at,hn as ot,ir as st,n as ct,pn as lt,r as ut,t as dt,ur as ft}from"./client-yfOXPkcm.js";import{a as pt,c as mt,d as ht,f as gt,h as _t,i as vt,l as yt,m as bt,n as xt,o as St,p as Ct,r as wt,s as Tt,t as Et,u as Dt}from"./video-BRgeujOO.js";import{An as Ot,At as kt,Ba as At,Bl as jt,Cn as Mt,Dn as Nt,En as Pt,Eo as Ft,Gn as It,Gr as Lt,Hn as Rt,Jn as zt,Jr as Bt,Kn as Vt,Kr as Ht,La as Ut,Ma as Wt,Mn as Gt,Mr as Kt,Mt as qt,Na as Jt,Nn as Yt,Nt as Xt,On as Zt,Ot as Qt,Ra as $t,Su as en,Tr as tn,U as nn,Ua as rn,Wa as an,Wn as on,Wr as sn,Xl as cn,Xn as ln,Yn as un,Zn as dn,_a as fn,_u as pn,cu as mn,da as hn,do as gn,du as _n,fl as vn,ft as yn,fu as bn,gt as xn,gu as Sn,ha as Cn,hu as wn,iu as Tn,ja as En,jn as Dn,jt as On,kl as kn,kn as An,kt as jn,l as Mn,lt as Nn,lu as Pn,ma as Fn,mr as In,mu as Ln,n as Rn,nu as zn,ol as Bn,pa as Vn,q as Hn,qn as Un,qr as Wn,rr as Gn,rt as Kn,ru as qn,s as Jn,sl as Yn,tn as Xn,tr as Zn,ua as Qn,vn as $n,vt as er,wn as tr,wt as nr,xa as rr,xu as ir,yr as ar}from"./src-AhVPNkCn.js";import{r as or,t as sr}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-DPkvGqVU.js";import{t as cr}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-Cb2QlpvS.js";import{n as lr,t as B}from"./i18n-B1bxeya5.js";import{a as ur,c as dr,i as fr,l as pr,n as mr,o as hr,s as gr,t as V,u as _r}from"./useTranslation-D3Is_4B6.js";import"./mount-CRpYde_B.js";import{n as vr,t as yr}from"./addon-icons-context-D3LZwxs2.js";import{t as br}from"./notification-schedule-field-BKROBLSv.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 xr=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Sr=/^[\\/]{2}/;function Cr(e,t){return t+e.replace(/\\/g,`/`)}var wr=`popstate`;function Tr(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Er(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return kr(``,{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:Ar(t)}return Mr(t,n,null,e)}function H(e,t){if(e===!1||e==null)throw Error(t)}function U(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Dr(){return Math.random().toString(36).substring(2,10)}function Or(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 kr(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?jr(t):t,state:n,key:t&&t.key||r||Dr(),mask:i}}function Ar({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 jr(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 Mr(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=Tr(e)?e:kr(h.location,e,t);n&&n(r,e),l=u()+1;let d=Or(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=Tr(e)?e:kr(h.location,e,t);n&&n(r,e),l=u();let i=Or(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 Nr(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(wr,d),c=e,()=>{i.removeEventListener(wr,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 Nr(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),H(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:Ar(t);return i=i.replace(/ $/,`%20`),!n&&Sr.test(i)&&(i=r+i),new URL(i,r)}function Pr(e,t,n=`/`){return Fr(e,t,n,!1)}function Fr(e,t,n,r,i){let a=ti((typeof t==`string`?jr(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Lr(e),s=null,c=ei(a);for(let e=0;s==null&&e<o.length;++e)s=Xr(o[e],c,r);return s}function Ir(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 Lr(e){let t=Rr(e);return Br(t),t}function Rr(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;H(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=W([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(H(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Rr(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Jr(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=$r(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 zr(e.path))a(e,t,!0,n)}),t}function zr(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=zr(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 Br(e){e.sort((e,t)=>e.score===t.score?Yr(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Vr=/^:[\w-]+$/,Hr=3,Ur=2,Wr=1,Gr=10,Kr=-2,qr=e=>e===`*`;function Jr(e,t){let n=e.split(`/`),r=n.length;return n.some(qr)&&(r+=Kr),t&&(r+=Ur),n.filter(e=>!qr(e)).reduce((e,t)=>e+(Vr.test(t)?Hr:t===``?Wr:Gr),r)}function Yr(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 Xr(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?Qr(u,l,s.matcher,s.compiledParams):Zr(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=Zr({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:W([a,d.pathname]),pathnameBase:ui(W([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=W([a,d.pathnameBase]))}return o}function Zr(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=$r(e.path,e.caseSensitive,e.end);return Qr(e,t,n,r)}function Qr(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 $r(e,t=!1,n=!0){U(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 ei(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return U(!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 ti(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 ni(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?jr(e):e,a;return n?(n=ci(n),a=n.startsWith(`/`)?ri(n.substring(1),`/`):ri(n,t)):a=t,{pathname:a,search:di(r),hash:fi(i)}}function ri(e,t){let n=li(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ii(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 ai(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function oi(e){let t=ai(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function si(e,t,n,r=!1){let i;typeof e==`string`?i=jr(e):(i={...e},H(!i.pathname||!i.pathname.includes(`?`),ii(`?`,`pathname`,`search`,i)),H(!i.pathname||!i.pathname.includes(`#`),ii(`#`,`pathname`,`hash`,i)),H(!i.search||!i.search.includes(`#`),ii(`#`,`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=ni(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var ci=e=>e.replace(/[\\/]{2,}/g,`/`),W=e=>ci(e.join(`/`)),li=e=>e.replace(/\/+$/,``),ui=e=>li(e).replace(/^\/*/,`/`),di=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,fi=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,pi=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 mi(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function hi(e){return W(e.map(e=>e.route.path).filter(Boolean))||`/`}var gi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function _i(e,t){let n=e;if(typeof n!=`string`||!xr.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(gi)try{let e=new URL(window.location.href),r=Sr.test(n)?new URL(Cr(n,e.protocol)):new URL(n),a=ti(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{U(!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 vi=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(vi);var yi=[`GET`,...vi];new Set(yi);var bi=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function xi(e){try{return bi.includes(new URL(e).protocol)}catch{return!1}}var Si=g(null);Si.displayName=`DataRouter`;var Ci=g(null);Ci.displayName=`DataRouterState`;var wi=g(!1);function Ti(){return v(wi)}var Ei=g({isTransitioning:!1});Ei.displayName=`ViewTransition`;var Di=g(new Map);Di.displayName=`Fetchers`;var Oi=g(null);Oi.displayName=`Await`;var G=g(null);G.displayName=`Navigation`;var ki=g(null);ki.displayName=`Location`;var K=g({outlet:null,matches:[],isDataRoute:!1});K.displayName=`Route`;var Ai=g(null);Ai.displayName=`RouteError`;var ji=`REACT_ROUTER_ERROR`,Mi=`REDIRECT`,Ni=`ROUTE_ERROR_RESPONSE`;function Pi(e){if(e.startsWith(`${ji}:${Mi}:{`))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 Fi(e){if(e.startsWith(`${ji}:${Ni}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new pi(t.status,t.statusText,t.data)}catch{}}function Ii(e,{relative:t}={}){H(Li(),`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}=Ki(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:W([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Li(){return v(ki)!=null}function q(){return H(Li(),`useLocation() may be used only in the context of a <Router> component.`),v(ki).location}function Ri(){return v(ki).navigationType}var zi=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Bi(e){v(G).static||x(e)}function Vi(){let{isDataRoute:e}=v(K);return e?da():Hi()}function Hi(){H(Li(),`useNavigate() may be used only in the context of a <Router> component.`);let e=v(Si),{basename:t,navigator:n}=v(G),{matches:r}=v(K),{pathname:i}=q(),a=JSON.stringify(oi(r)),o=j(!1);return Bi(()=>{o.current=!0}),p((r,s={})=>{if(U(o.current,zi),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=si(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:W([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Ui=g(null);function Wi(e){let t=v(K).outlet;return d(()=>t&&k(Ui.Provider,{value:e},t),[t,e])}function Gi(){let{matches:e}=v(K);return e[e.length-1]?.params??{}}function Ki(e,{relative:t}={}){let{matches:n}=v(K),{pathname:r}=q(),i=JSON.stringify(oi(n));return d(()=>si(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function qi(e,t){return Ji(e,t)}function Ji(e,t,n){H(Li(),`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||``;pa(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
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`?jr(t):t;H(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})):Pr(e,{pathname:p});U(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),U(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=ta(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:W([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:W([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?k(ki.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function Yi(){let e=ua(),t=mi(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=k(b,null,k(`p`,null,`💿 Hey developer 👋`),k(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,k(`code`,{style:a},`ErrorBoundary`),` or`,` `,k(`code`,{style:a},`errorElement`),` prop on your route.`)),k(b,null,k(`h2`,null,`Unexpected Application Error!`),k(`h3`,{style:{fontStyle:`italic`}},t),n?k(`pre`,{style:i},n):null,o)}var Xi=k(Yi,null),Zi=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=Fi(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:k(K.Provider,{value:this.props.routeContext},k(Ai.Provider,{value:e,children:this.props.component}));return this.context?k($i,{error:e},t):t}};Zi.contextType=wi;var Qi=new WeakMap;function $i({children:e,error:t}){let{basename:n}=v(G);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Pi(t.digest);if(e){let r=Qi.get(t);if(r)throw r;let i=_i(e.location,n),a=i.absoluteURL||i.to;if(xi(a))throw Error(`Invalid redirect location`);if(gi&&!Qi.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 Qi.set(t,n),n}return k(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function ea({routeContext:e,match:t,children:n}){let r=v(Si);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),k(K.Provider,{value:e},n)}function ta(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);H(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:hi(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||Xi,o&&(s<0&&c===0?(pa(`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?k(n.route.Component,null):n.route.element?n.route.element:e,k(ea,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?k(Zi,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function na(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ra(e){let t=v(Si);return H(t,na(e)),t}function ia(e){let t=v(Ci);return H(t,na(e)),t}function aa(e){let t=v(K);return H(t,na(e)),t}function oa(e){let t=aa(e),n=t.matches[t.matches.length-1];return H(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function sa(){return oa(`useRouteId`)}function ca(){let e=ia(`useNavigation`);return d(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function la(){let{matches:e,loaderData:t}=ia(`useMatches`);return d(()=>e.map(e=>Ir(e,t)),[e,t])}function ua(){let e=v(Ai),t=ia(`useRouteError`),n=oa(`useRouteError`);return e===void 0?t.errors?.[n]:e}function da(){let{router:e}=ra(`useNavigate`),t=oa(`useNavigate`),n=j(!1);return Bi(()=>{n.current=!0}),p(async(r,i={})=>{U(n.current,zi),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var fa={};function pa(e,t,n){!t&&!fa[e]&&(fa[e]=!0,U(!1,n))}h(ma);function ma({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Ji(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function J({to:e,replace:t,state:n,relative:r}){H(Li(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=v(G);U(!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=Vi(),l=si(e,oi(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){H(!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 ha({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){H(!Li(),`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=jr(n));let{pathname:l=`/`,search:u=``,hash:f=``,state:p=null,key:m=`default`,mask:h}=n,g=d(()=>{let e=ti(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 U(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:k(G.Provider,{value:c},k(ki.Provider,{children:t,value:g}))}function ga({children:e,location:t}){return qi(_a(e),t)}function _a(e,t=[]){let n=[];return l.forEach(e,(e,r)=>{if(!O(e))return;let i=[...t,r];if(e.type===b){n.push.apply(n,_a(e.props.children,i));return}H(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>`),H(!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=_a(e.props.children,i)),n.push(a)}),n}var va=`get`,ya=`application/x-www-form-urlencoded`;function ba(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function xa(e){return ba(e)&&e.tagName.toLowerCase()===`button`}function Sa(e){return ba(e)&&e.tagName.toLowerCase()===`form`}function Ca(e){return ba(e)&&e.tagName.toLowerCase()===`input`}function wa(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ta(e,t){return e.button===0&&(!t||t===`_self`)&&!wa(e)}function Ea(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 Da(e,t){let n=Ea(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Oa=null;function ka(){if(Oa===null)try{new FormData(document.createElement(`form`),0),Oa=!1}catch{Oa=!0}return Oa}var Aa=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function ja(e){return e!=null&&!Aa.has(e)?(U(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ya}"`),null):e}function Ma(e,t){let n,r,i,a,o;if(Sa(e)){let o=e.getAttribute(`action`);r=o?ti(o,t):null,n=e.getAttribute(`method`)||va,i=ja(e.getAttribute(`enctype`))||ya,a=new FormData(e)}else if(xa(e)||Ca(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?ti(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||va,i=ja(e.getAttribute(`formenctype`))||ja(o.getAttribute(`enctype`))||ya,a=new FormData(o,e),!ka()){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(ba(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=va,r=null,i=ya,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 Na={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Pa=/[&><\u2028\u2029]/g;function Fa(e){return e.replace(Pa,e=>Na[e])}function Ia(e,t){if(e===!1||e==null)throw Error(t)}function La(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&&ti(i.pathname,t)===`/`?i.pathname=`${li(t)}/_root.${r}`:i.pathname=`${li(i.pathname)}.${r}`,i}async function Ra(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 za(e){return e!=null&&typeof e.page==`string`}function Ba(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 Va(e,t,n){return Ka((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Ra(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Ba).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Ha(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 Ua(e,t,{includeHydrateFallback:n}={}){return Wa(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 Wa(e){return[...new Set(e)]}function Ga(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Ka(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!za(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Ga(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function qa(){let e=v(Si);return Ia(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Ja(){let e=v(Ci);return Ia(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Ya=g(void 0);Ya.displayName=`FrameworkContext`;function Xa(){let e=v(Ya);return Ia(e,`You must render this element inside a <HydratedRouter> element`),e}function Za(e,t){let n=v(Ya),[r,i]=f(!1),[a,o]=f(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:p}=t,m=j(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:Qa(c,h),onBlur:Qa(l,g),onMouseEnter:Qa(u,h),onMouseLeave:Qa(d,g),onTouchStart:Qa(p,h)}]:[a,m,{}]:[!1,m,{}]}function Qa(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function $a({page:e,...t}){let n=Ti(),{nonce:r}=Xa(),{router:i}=qa(),a=d(()=>Pr(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),k(n?to:no,{page:e,matches:a,...t})):null}function eo(e){let{manifest:t,routeModules:n}=Xa(),[r,i]=f([]);return s(()=>{let r=!1;return Va(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function to({page:e,matches:t,...n}){let r=q(),{future:i}=Xa(),{basename:a}=qa();return k(b,null,d(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=La(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=>k(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function no({page:e,matches:t,...n}){let r=q(),{future:i,manifest:a,routeModules:o}=Xa(),{basename:s}=qa(),{loaderData:c,matches:l}=Ja(),u=d(()=>Ha(e,t,l,a,r,`data`),[e,t,l,a,r]),f=d(()=>Ha(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=La(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(()=>Ua(f,a),[f,a]),h=eo(f);return k(b,null,p.map(e=>k(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>k(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>k(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function ro(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var io=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{io&&(window.__reactRouterVersion=`7.18.0`)}catch{}function ao({basename:e,children:t,useTransitions:n,window:r}){let i=j();i.current??=Er({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]),k(ha,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function oo({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]),k(ha,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}oo.displayName=`unstable_HistoryRouter`;var so=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`&&xr.test(l),x=_i(l,h);l=x.to;let S=Ii(l,{relative:r}),C=q(),w=null;if(o){let e=si(o,[],C.mask?C.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:W([h,e.pathname])),w=g.createHref(e)}let[T,E,D]=Za(n,p),O=ho(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function A(t){e&&e(t),t.defaultPrevented||O(t)}let j=!(x.isExternal||i),M=k(`a`,{...p,...D,href:(j?w:void 0)||x.absoluteURL||S,onClick:j?A:e,ref:ro(m,E),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return T&&!y?k(b,null,M,k($a,{page:S})):M});so.displayName=`Link`;var co=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=Ki(a,{relative:c.relative}),d=q(),f=v(Ci),{navigator:p,basename:m}=v(G),h=f!=null&&Eo(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=ti(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 k(so,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});co.displayName=`NavLink`;var lo=o(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=va,action:s,onSubmit:c,relative:l,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h)=>{let{useTransitions:g}=v(G),_=yo(),y=bo(s,{relative:l}),b=o.toLowerCase()===`get`?`get`:`post`,x=typeof s==`string`&&xr.test(s);return k(`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})});lo.displayName=`Form`;function uo({getKey:e,storageKey:t,...n}){let r=v(Ya),{basename:i}=v(G),a=q(),o=la();wo({getKey:e,storageKey:t});let s=d(()=>{if(!r||!e)return null;let t=Co(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),k(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Fa(JSON.stringify(t||xo))}, ${Fa(JSON.stringify(s))})`}})}uo.displayName=`ScrollRestoration`;function fo(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function po(e){let t=v(Si);return H(t,fo(e)),t}function mo(e){let t=v(Ci);return H(t,fo(e)),t}function ho(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let d=Vi(),f=q(),m=Ki(e,{relative:o});return p(p=>{if(Ta(p,t)){p.preventDefault();let t=n===void 0?Ar(f)===Ar(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 go(e){U(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=j(Ea(e)),n=j(!1),r=q(),i=d(()=>Da(r.search,n.current?null:t.current),[r.search]),a=Vi();return[i,p((e,t)=>{let r=Ea(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var _o=0,vo=()=>`__${String(++_o)}__`;function yo(){let{router:e}=po(`useSubmit`),{basename:t}=v(G),n=sa(),r=e.fetch,i=e.navigate;return p(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Ma(e,t);a.navigate===!1?await r(a.fetcherKey||vo(),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 bo(e,{relative:t}={}){let{basename:n}=v(G),r=v(K);H(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Ki(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:W([n,a.pathname])),Ar(a)}var xo=`react-router-scroll-positions`,So={};function Co(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:ti(e.pathname,n)||e.pathname},t)),i??=e.key,i}function wo({getKey:e,storageKey:t}={}){let{router:n}=po(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=mo(`useScrollRestoration`),{basename:a}=v(G),o=q(),c=la(),l=ca();s(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),To(p(()=>{if(l.state===`idle`){let t=Co(o,c,a,e);So[t]=window.scrollY}try{sessionStorage.setItem(t||xo,JSON.stringify(So))}catch(e){U(!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||xo);e&&(So=JSON.parse(e))}catch{}},[t]),x(()=>{let t=n?.enableScrollRestoration(So,()=>window.scrollY,e?(t,n)=>Co(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{U(!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 To(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 Eo(e,{relative:t}={}){let n=v(Ei);H(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=po(`useViewTransitionState`),i=Ki(e,{relative:t});if(!n.isTransitioning)return!1;let a=ti(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=ti(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Zr(i.pathname,o)!=null||Zr(i.pathname,a)!=null}var Do=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}}))()),Oo=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function ko(e){var t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(Do.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(Oo),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 Ao=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,jo=/^\s*$/,Mo=Object.create(null);function No(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(No,``)+`</`+t.name+`>`;case`comment`:return e+`<!--`+t.comment+`-->`}}var Po={parse:function(e,t){t||={},t.components||=Mo;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(Ao,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=ko(s);return a<0?(r.push(m),r):((l=i[a]).children.push(m),r)}if(u&&(a++,(n=ko(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);jo.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+No(``,t)},``)}};a();var Fo=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},Io=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?Ro(t):t},Lo=e=>Array.isArray(e)&&e.every(O),Ro=e=>Array.isArray(e)?e:[e],zo=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},Bo=e=>{let t={};if(!e)return t;let n=e=>{Ro(e).forEach(e=>{dr(e)||(Fo(e)?n(Io(e)):gr(e)&&!O(e)&&Object.assign(t,e))})};return n(e),t},Vo=(e,t,n,r)=>{if(!e)return``;let i=``,a=Ro(e),o=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return a.forEach((e,a)=>{if(dr(e)){i+=`${e}`;return}if(O(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=dr(d)?d:Vo(d,t,n,r);i+=`<${c}>${e}</${c}>`;return}let f=Vo(d,t,n,r);i+=`<${a}>${f}</${a}>`;return}if(e===null){pr(n,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:r});return}if(gr(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}pr(n,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:r,child:e});return}pr(n,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:r,child:e})}),i},Ho=(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},Uo=(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=>{Ro(e).forEach(e=>{dr(e)||(Fo(e)?f(Io(e)):gr(e)&&!O(e)&&Object.assign(d,e))})};f(e);let p=Ho(n,s,d),m=Po.parse(`<0>${p}</0>`),h={...d,...a},g=(e,t,n)=>{let r=Io(e),i=v(r,t.children,n);return Lo(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])}),k(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=Ro(e),l=Ro(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];dr(t)&&(m[e]=hr(t))});let y=Object.keys(m).length===0?p:zo({props:m},p),b=O(y),x=b&&Fo(n,!0)&&!n.voidElement,S=u&&gr(y)&&y.dummy&&!b,C=gr(t)&&Object.hasOwnProperty.call(t,n.name);if(dr(y)){let t=r.services.interpolator.interpolate(y,h,r.language);e.push(t)}else if(Fo(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(k(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(O(a)&&a.type===n.name){if(i===t){r=a;break}i+=1}}let o=v(r?Ro(Io(r)):c,n.children,a);e.push(k(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(gr(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:ur().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(k(t,{key:`${n.name}-${l}`},s)):e.push(s)}return e},[])};return Io(v([{dummy:!0,children:e||[]}],m,Ro(e||[]))[0])},Wo=(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 k(b,null,i)}return k(a,{key:r})},Go=(e,t)=>e.map((e,n)=>Wo(e,n,t)),Ko=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:Wo(e[r],r,t)})}),n},qo=(e,t,n,r)=>e?Array.isArray(e)?Go(e,t):gr(e)?Ko(e,t):(_r(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,Jo=e=>!gr(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function Yo({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||fr();if(!m)return _r(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={...ur(),...m.options?.react},_=l||h.ns||m.options?.defaultNS;_=dr(_)?[_]:_||[`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=Vo(e,g,m,r),w=s||y?.defaultValue||C||g.transEmptyNodeValue||(typeof r==`function`?lr(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=Bo(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:`?$#`}},A={...y,context:i||y.context,count:t,...o,...O,defaultValue:w,ns:_},j=E?h(E,A):w;j===E&&w&&(j=w);let M=qo(S,j,m,r),N=M||e,P=null;Jo(M)&&(P=M,N=e);let F=Uo(N,P,j,m,g,A,b),I=n??g.defaultTransParent;return I?k(I,p,F):F}a();function Xo({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(mr)||{},g=u||m||fr(),_=d||g?.t.bind(g);return Yo({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})}var Zo={streaming:{icon:Et,labelKey:`capabilityBadges.streaming`},detection:{icon:fe,labelKey:`capabilityBadges.detection`},recording:{icon:ke,labelKey:`capabilityBadges.recording`},audio:{icon:_e,labelKey:`capabilityBadges.audio`},snapshot:{icon:te,labelKey:`capabilityBadges.snapshot`},motion:{icon:Ye,labelKey:`capabilityBadges.motion`},ptz:{icon:Je,labelKey:`capabilityBadges.ptz`},webrtc:{icon:Ze,labelKey:`capabilityBadges.webrtc`},onvif:{icon:Ce,labelKey:`capabilityBadges.onvif`},analytics:{icon:ve,labelKey:`capabilityBadges.analytics`},"battery-operated":{icon:ae,labelKey:`capabilityBadges.battery`},"native-snapshot":{icon:te,labelKey:`capabilityBadges.nativeSnapshot`},"pan-tilt-zoom":{icon:Je,labelKey:`capabilityBadges.ptz`},"two-way-audio":{icon:_e,labelKey:`capabilityBadges.twoWayAudio`},"doorbell-button":{icon:oe,labelKey:`capabilityBadges.doorbell`},rebootable:{icon:Te,labelKey:`capabilityBadges.rebootable`},"vacuum-has-map":{icon:St,labelKey:`capabilityBadges.map`},"vacuum-has-ai":{icon:xe,labelKey:`capabilityBadges.aiObstacle`},"mower-has-map":{icon:St,labelKey:`capabilityBadges.map`},"mower-has-targeted-mowing":{icon:ge,labelKey:`capabilityBadges.targetedMowing`}},Qo=F;function $o({capabilities:e,showLabels:t=!1}){let{t:n}=V();return N(`div`,{className:`flex items-center gap-1 flex-wrap`,children:e.map(e=>{let r=Zo[e],i=r?.icon??Qo,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:[N(i,{className:`h-3 w-3`}),t&&N(`span`,{children:a})]},e)})})}a();var es={amcrest:{icon:bt,color:`#3b82f6`,label:`Amcrest`},hikvision:{icon:Ee,color:`#a855f7`,label:`Hikvision`},reolink:{icon:Ze,color:`#06b6d4`,label:`Reolink`},homeassistant:{icon:Xe,color:`#22d3ee`,label:`Home Assistant`},rtsp:{icon:Ne,color:`#78716c`,label:`RTSP`},onvif:{icon:Ne,color:`#78716c`,label:`ONVIF`}},ts={sm:`h-4 w-4`,md:`h-5 w-5`,lg:`h-6 w-6`},ns={sm:`h-7 w-7`,md:`h-8 w-8`,lg:`h-10 w-10`};function rs(e){let t=e.toLowerCase();return t.startsWith(`provider-`)?t.slice(9):t}function is(e){return es[rs(e)]??{icon:bt,color:`#78716c`,label:e}}function as({type:e,size:t=`md`,showLabel:n}){let r=is(e),i=r.icon,[a,o]=f(!1),s=vr(e);return y(`div`,{className:`flex items-center gap-2`,children:[N(`div`,{className:`flex items-center justify-center rounded-lg ${ns[t]}`,style:{backgroundColor:`${r.color}15`},children:a||!s?N(i,{className:ts[t],style:{color:r.color}}):N(`img`,{src:s,alt:r.label,className:ts[t],onError:()=>o(!0)})}),n&&N(`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:[N(`span`,{className:`text-[11px] text-foreground-subtle`,children:e}),N(`div`,{className:`min-w-0 text-[11px] text-foreground`,children:t})]}):y(`div`,{className:`${me} flex items-start gap-2 sm:gap-3`,children:[N(`span`,{className:`w-20 sm:w-28 flex-shrink-0 text-[11px] text-foreground-subtle`,children:e}),N(`div`,{className:`flex-1 min-w-0 text-[11px] text-foreground`,children:t})]})}a();function os({deviceId:e,initialName:t,label:n=`Name`,layout:r=`inline`,onError:i,onSaved:a,onCancel:o}){let{t:c}=V(),l=A(),[u,d]=f(!1),[p,m]=f(t),[h,g]=f(!1),_=j(null);s(()=>{u||m(t)},[t,u]),s(()=>{u&&_.current?.focus()},[u]);let v=Ut({onSuccess:()=>{l.invalidateQueries({queryKey:[[`deviceManager`,`getDevice`]]}),l.invalidateQueries({queryKey:[[`deviceManager`,`listAll`]]}),l.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]})}}),b=async()=>{let n=p.trim();if(n.length===0||n===t){d(!1),m(t),a?.();return}g(!0);try{await v.mutateAsync({deviceId:e,name:n}),d(!1),a?.()}catch(e){i?.(e instanceof Error?e.message:String(e))}finally{g(!1)}},x=()=>{m(t),d(!1),o?.()};return u?N(X,{label:n,layout:r,value:y(`div`,{className:`flex items-center gap-1`,children:[N(`input`,{ref:_,type:`text`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`?b():e.key===`Escape`&&x()},disabled:h,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`}),N(`button`,{type:`button`,onClick:()=>void b(),disabled:h,className:`p-0.5 rounded hover:bg-success/10 text-success disabled:opacity-50`,"aria-label":c(`inlineEdit.save`),children:N(pe,{className:`h-3 w-3`})}),N(`button`,{type:`button`,onClick:x,disabled:h,className:`p-0.5 rounded hover:bg-danger/10 text-danger disabled:opacity-50`,"aria-label":c(`inlineEdit.cancel`),children:N(De,{className:`h-3 w-3`})})]})}):N(X,{label:n,layout:r,value:y(`div`,{className:`flex items-center gap-2 group`,children:[N(`span`,{className:`truncate`,children:t}),N(`button`,{type:`button`,onClick:()=>d(!0),className:`p-0.5 rounded text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,"aria-label":c(`inlineEdit.editName`),children:N(re,{className:`h-3.5 w-3.5`})})]})})}a();function ss({deviceId:e,initialLocation:t,label:n=`Location`,layout:r=`inline`,onError:i,onSaved:a,onCancel:o}){let{t:c}=V(),l=A(),[u,p]=f(!1),[m,h]=f(t??``),[g,_]=f(!1),v=j(null),{data:b}=rr(void 0,{enabled:u}),x=b??[];s(()=>{u||h(t??``)},[t,u]),s(()=>{u&&v.current?.focus()},[u]);let S=Jt({onSuccess:()=>{l.invalidateQueries({queryKey:[[`deviceManager`,`getDevice`]]}),l.invalidateQueries({queryKey:[[`deviceManager`,`listAll`]]}),l.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]}),l.invalidateQueries({queryKey:[[`deviceManager`,`listLocations`]]})}}),C=d(()=>{let e=m.trim().toLowerCase();return e.length===0?x:x.filter(t=>t.toLowerCase()!==e&&t.toLowerCase().includes(e))},[x,m]),w=m.trim().length>0&&!x.some(e=>e.toLowerCase()===m.trim().toLowerCase()),T=async n=>{let r=(n??m).trim(),o=r.length===0?null:r;if(o===(t??null)){p(!1),a?.();return}_(!0);try{await S.mutateAsync({deviceId:e,location:o}),p(!1),a?.()}catch(e){i?.(e instanceof Error?e.message:String(e))}finally{_(!1)}},E=()=>{h(t??``),p(!1),o?.()};return u?N(X,{label:n,layout:r,value:y(`div`,{className:`relative`,children:[y(`div`,{className:`flex items-center gap-1`,children:[N(`input`,{ref:v,type:`text`,value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`?T():e.key===`Escape`&&E()},disabled:g,placeholder:c(`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`}),N(`button`,{type:`button`,onClick:()=>void T(),disabled:g,className:`p-0.5 rounded hover:bg-success/10 text-success disabled:opacity-50`,"aria-label":c(`inlineEdit.save`),children:N(pe,{className:`h-3 w-3`})}),N(`button`,{type:`button`,onClick:E,disabled:g,className:`p-0.5 rounded hover:bg-danger/10 text-danger disabled:opacity-50`,"aria-label":c(`inlineEdit.cancel`),children:N(De,{className:`h-3 w-3`})})]}),(C.length>0||w)&&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:[C.map(e=>y(`button`,{type:`button`,onClick:()=>{h(e),T(e)},className:`w-full flex items-center gap-2 px-2 py-1 text-left text-[11px] hover:bg-surface-hover`,children:[N(qe,{className:`h-3 w-3 text-foreground-subtle flex-shrink-0`}),N(`span`,{className:`truncate`,children:e})]},e)),w&&y(`button`,{type:`button`,onClick:()=>void T(),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:[N(`span`,{className:`text-foreground-subtle`,children:c(`shared.locationRow.create`,`Create`)}),y(`span`,{className:`font-medium truncate`,children:[`"`,m.trim(),`"`]})]})]})]})}):N(X,{label:n,layout:r,value:y(`div`,{className:`flex items-center gap-2 group`,children:[t?N(`span`,{className:`truncate`,children:t}):N(`span`,{className:`italic text-foreground-subtle`,children:c(`common.unset`)}),N(`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":c(`inlineEdit.editLocation`),children:N(re,{className:`h-3.5 w-3.5`})})]})})}a();function cs(e){return fn({addonId:e,projection:`slim`})}function ls(e){return Vn({deviceId:e},{enabled:Number.isFinite(e)})}var us=3e4,ds=2e3;function fs(e){let t=j(0);return t.current===0&&(t.current=Date.now()),hn({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>=us?!1:ds}})}a();function ps({deviceId:e}){let{t}=V(),n=A(),{data:r}=ls(e),{data:i}=fs(e),[a,o]=f(null),s=$t({onSuccess:()=>{o(null),n.invalidateQueries({queryKey:[[`deviceManager`]]})},onError:e=>{o(`Could not change primary child: ${e.message}`)}});if(r==null||String(r.type??``)!==nt.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=er(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:[N(X,{label:t(`shared.primaryChildRow.primaryChild`,`Primary child`),value:N(xn,{childrenList:c,selectedId:u,onSetPrimary:t=>s.mutate({deviceId:e,primaryChildEntityId:t}),disabled:s.isPending})}),a!==null&&N(`p`,{role:`alert`,className:`px-3 sm:px-4 py-1.5 text-[11px] text-danger`,children:a})]})}a();var ms=[`manufacturer`,`model`,`hardware`,`firmware`,`serialNumber`,`uid`,`mac`,`itemNo`];function hs(e){return e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase())}function gs(e){return e==null?`—`:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e)}function _s(){let{t:e}=V(),t=un(),n=ln(),{data:r}=Vn({deviceId:t??0},{enabled:t!==null}),{data:i}=Qn({deviceId:t??0},{enabled:t!==null}),a=r??n??null,[o,s]=f(`identity`);if(t===null||!a)return null;let c=String(a.stableId??``),l=String(a.name??``),u=String(a.type??``),d=String(a.addonId??``),p=a.features??[],m=new Set([`device-status`,`feature-probe`,`device-ops`]),h=(i?.entries??[]).filter(e=>e.kind===`native`&&!m.has(e.capName)).map(e=>e.capName),g=p.length>0?p:h,_=a.location??null,v=a.metadata??null,b=v!==null&&Object.keys(v).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:[N(`h2`,{className:`text-[11px] font-semibold text-foreground uppercase tracking-wider`,children:e(`overviewAdapters.deviceInfoAdapter.deviceInfo`,`Device Info`)}),b&&y(`div`,{className:`flex items-center gap-1 rounded-md bg-surface-hover p-0.5`,children:[N(vs,{active:o===`identity`,onClick:()=>s(`identity`),label:e(`overviewAdapters.deviceInfoAdapter.identity`,`Identity`)}),N(vs,{active:o===`hardware`,onClick:()=>s(`hardware`),label:e(`overviewAdapters.deviceInfoAdapter.hardware`,`Hardware`)})]})]}),(!b||o===`identity`)&&y(`div`,{className:`divide-y divide-border`,children:[N(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:[`(`,c,`)`]})]})}),N(os,{deviceId:t,initialName:l}),N(ss,{deviceId:t,initialLocation:_}),N(ps,{deviceId:t}),N(X,{label:e(`overviewAdapters.deviceInfoAdapter.type`,`Type`),value:u}),N(X,{label:e(`overviewAdapters.deviceInfoAdapter.provider`,`Provider`),value:N(as,{type:d,size:`sm`,showLabel:!0})}),N(X,{label:e(`overviewAdapters.deviceInfoAdapter.capabilities`,`Capabilities`),value:g.length>0?N($o,{capabilities:g,showLabels:!0}):N(`span`,{className:`text-[11px] text-foreground-subtle`,children:e(`overviewAdapters.deviceInfoAdapter.none`,`None`)})})]}),b&&o===`hardware`&&N(ys,{metadata:v})]})}function vs({active:e,onClick:t,label:n}){return N(`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 ys({metadata:e}){let{t}=V(),n=ms.filter(t=>t in e),r=Object.keys(e).filter(e=>!ms.includes(e)).toSorted(),i=[...n,...r];return y(`div`,{children:[N(`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.`)}),N(`div`,{className:`divide-y divide-border`,children:i.map(t=>N(X,{label:hs(t),value:N(`span`,{className:`font-mono text-[11px] text-foreground break-all`,children:gs(e[t])})},t))})]})}function bs(e){return e.hubReachable?e.authOk===!1?{kind:`auth-expired`}:{kind:`cluster-degraded`,offlineAgents:e.offlineAgents,offlineAgentIds:e.offlineAgentIds}:{kind:`hub-unreachable`}}function xs(e){switch(e.kind){case`connected`:return null;case`reconnecting`:return{severity:`warning`,message:B.t(`connection.reconnecting`),i18nKey:`connection.reconnecting`,showSpinner:!0};case`cluster-degraded`:{let t=e.offlineAgentIds??[];return t.length>0?{severity:`warning`,message:B.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:B.t(`connection.degradedCount`,{count:e.offlineAgents}),i18nKey:`connection.degradedCount`,i18nParams:{count:e.offlineAgents},showSpinner:!0}:{severity:`warning`,message:B.t(`connection.degraded`),i18nKey:`connection.degraded`,showSpinner:!0}}case`hub-unreachable`:return{severity:`danger`,message:B.t(`connection.disconnected`),i18nKey:`connection.disconnected`,showSpinner:!0};case`auth-expired`:return{severity:`danger`,message:B.t(`connection.sessionExpired`),i18nKey:`connection.sessionExpired`,showSpinner:!1,action:`sign-in`}}}var Ss=4e3,Cs=5e3;function ws(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 Ts(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 Es(e){let t=e.fetchFn??fetch,n=e.timeoutMs??Ss,r=e.origin.replace(/\/+$/,``),i;try{i=await Ts(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 Ts(t,`${r}/health/details`,n,{Authorization:`Bearer ${o}`});e.ok&&(a=await e.json())}catch{}let s;try{s=ws(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 Ts(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 Ds={kind:`connected`},Os={kind:`reconnecting`};function ks(e){let t=e.probeIntervalMs??Cs,n=new Set,r=Ds,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(bs(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(Ds);return}if(e===`connecting`){c(),s(Os);return}(r.kind===`connected`||r.kind===`reconnecting`)&&s(Os),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 As=null;function js(){return As===null&&(As=ks({probe:()=>Es({origin:be(),getToken:()=>localStorage.getItem(`camstack_admin_token`)})})),As}function Ms(e){js().onSdkConnectionState(e)}var Ns=null,Ps=0;function Z(){if(!Ns){let e=Ps;Ns=qt({serverUrl:be(),token:localStorage.getItem(`camstack_admin_token`)??void 0,getLanguage:()=>B.language,refreshCredential:async e=>{e===`rejected`?await Xs().refreshNow():await Xs().ensureFresh()},onConnectionChange:t=>{e===Ps&&Ms(t)}})}return Ns}function Q(){let e=Ns;Ns=null,Ps+=1,e?.close()}var Fs=`camstack_admin_token`,Is=`camstack_admin_refresh`,Ls=`camstack_admin_token_expires`;function Rs(e){try{let t=localStorage.getItem(e);return t!==null&&t.length>0?t:null}catch{return null}}function zs(e,t){try{t===null?localStorage.removeItem(e):localStorage.setItem(e,t)}catch{}}function Bs(){let e=Rs(Fs);if(e===null)return null;let t=Rs(Is),n=Number(Rs(Ls));return{token:e,...t===null?{}:{refreshToken:t},...Number.isFinite(n)&&n>0?{expiresAt:n}:{}}}function Vs(e){zs(Fs,e.token),zs(Is,e.refreshToken??null),zs(Ls,e.expiresAt===void 0?null:String(e.expiresAt))}function Hs(){zs(Fs,null),zs(Is,null),zs(Ls,null)}function Us(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 Ws(e){await fetch(z(`/api/auth/session`),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({token:e})}).catch(()=>{})}var Gs=new Set;function Ks(e){return Gs.add(e),()=>Gs.delete(e)}var qs=new Set;function Js(e){return qs.add(e),()=>qs.delete(e)}var Ys=null;function Xs(){return Ys===null&&(Ys=new Xt({refresh:async e=>{let t=Bs();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=>{Vs(e),Z().setToken(e.token),Ws(e.token);for(let e of qs)e()},onExpired:()=>{Hs();for(let e of Gs)e()}})),Ys}function Zs(e){Vs(e),Xs().adopt(e)}async function Qs(e){try{await Xs().ensureFresh()}catch(e){console.warn(`[admin-session] pre-reconnect refresh failed; reconnecting anyway`,e)}e()}async function $s(){return await Xs().refreshNow()!==null}var ec=512;function tc(e){if(!e||e.length>ec)return null;let t=rt(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 nc=/^[A-Za-z0-9_-]{43,128}$/,rc=/^[A-Za-z0-9._~-]{1,256}$/;function ic(e){let{codeChallenge:t,state:n}=e;return!t||!nc.test(t)||(e.codeChallengeMethod??`S256`)!==`S256`||!n||!rc.test(n)?null:{codeChallenge:t,state:n,purpose:e.purpose===`step-up`?`step-up`:`new-session`}}var ac=`camstack:login-app-handoff`;function oc(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 ic({codeChallenge:n(`codeChallenge`),state:n(`state`),purpose:n(`purpose`)})}catch{return null}}function sc(e,t=Date.now()){e!==null&&yc(ac,JSON.stringify(e),oc,t)}function cc(e=Date.now()){return bc(ac,oc,e)}function lc(e,t,n){return`${e}?${`code=${encodeURIComponent(t)}`}${n===void 0?``:`&state=${encodeURIComponent(n)}`}`}function uc(e,t=Date.now()){return Cc(t)??tc(e)}var dc=2048;function fc(e){return!e||e.length>dc||!e.startsWith(`/`)||e.startsWith(`//`)||e.includes(`\\`)||e.includes(`://`)||e.includes(`..`)||e===`/login`||e.startsWith(`/login?`)||e.startsWith(`/login/`)?null:e}function pc(e,t=Date.now()){yc(_c,e,fc,t)}function mc(e=Date.now()){return bc(_c,fc,e)}function hc(e,t=Date.now()){return mc(t)??fc(e)}var gc=`camstack:login-redirect`,_c=`camstack:login-next`,vc=10*6e4;function yc(e,t,n,r){let i=xc();if(!i||!n(t))return;let a={raw:t??``,at:r};try{i.setItem(e,JSON.stringify(a))}catch{}}function bc(e,t,n){let r=xc();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>vc?null:t(a)}catch{return null}}function xc(){if(typeof window>`u`)return null;try{return window.sessionStorage}catch{return null}}function Sc(e,t=Date.now()){yc(gc,e,tc,t)}function Cc(e=Date.now()){return bc(gc,tc,e)}function wc(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:Tc(n.scopes)}}catch{return null}}function Tc(e){return ut(e)}function Ec(e){let t=wc(e);return t?t.exp*1e3<Date.now():!0}a();var Dc=`changeme`;function Oc(e){return{token:e.token,...e.refreshToken===void 0?{}:{refreshToken:e.refreshToken},...e.expiresAt===void 0?{}:{expiresAt:e.expiresAt}}}async function kc(e,t){if(await Ws(e),t.kind===`path`){window.location.replace(z(t.path));return}try{Q();let e=cc();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(lc(t.url,n,e.state))}catch{window.location.replace(z(`/`))}}async function Ac(e,t){await Ws(e),window.location.replace(z(t))}var jc=g(null);function Mc({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=Us(e),n=t?.token??null;if(t!==null&&n!==null){Zs(t);let r=Cc();if(r){kc(n,r);return}let i=mc()??fc(e.get(`next`));if(i){Ac(n,i);return}window.history.replaceState({},``,z(`/`))}}c()},[]);let c=async()=>{let e=Bs();if(e===null){i(!1);return}let t=e.token;if(e.refreshToken!==void 0){let n=Xs();n.adopt(e),await n.ensureFresh();let r=Bs();if(r===null){console.warn(`[auth] session restore: signed out — the hub refused the refresh token`),Q(),i(!1);return}t=r.token}if(Ec(t)){console.warn(`[auth] session restore: signed out — access token expired and no refresh recovered it`),Hs(),Q(),i(!1);return}let r=wc(t);if(!r){console.warn(`[auth] session restore: signed out — the stored access token is unreadable`),Hs(),Q(),i(!1);return}Ws(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 $s()){a.reconnect();try{await Z().trpcClient.system.info.query();let e=Bs();n(e&&wc(e.token)||r);return}catch{}}console.warn(`[auth] session restore: logout, probe UNAUTHORIZED and refresh did not recover it`),Xs().stop(),Hs(),Q()}else n(r)}).finally(()=>i(!1))};s(()=>Ks(()=>{Q(),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 Zs(Oc(r)),await Ws(a),Q(),n(wc(a)),o(t===Dc),{kind:`ok`}},[]),u=p(async(e,t)=>{let r=await Z().loginVerifyTotp(e,t,{refreshable:!0}),i=r.token;Zs(Oc(r)),await Ws(i),Q(),n(wc(i)),o(!1)},[]),d=p(async(e,t)=>{Zs({token:e,...t}),await Ws(e),Q(),n(wc(e)),o(!1)},[]),m=p(()=>{Z().logout().catch(()=>{}),Xs().stop(),Hs(),fetch(z(`/api/auth/session`),{method:`DELETE`}).catch(()=>{}),Q(),n(null),o(!1)},[]),h=p(()=>{o(!1)},[]);return N(jc.Provider,{value:{user:t,loading:r,mustChangePassword:a,login:l,verifyTotp:u,finalizePasskeyLogin:d,logout:m,clearMustChangePassword:h},children:e})}function Nc(){let e=v(jc);if(!e)throw Error(`useAuth must be used within AuthProvider`);return e}a();function Pc(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 Fc({schema:e,serverValues:t,onImmediateSave:n,onDeferredSave:r}){let[i,a]=f({}),[o,c]=f({}),[l,u]=f(!1),m=j(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&&(Pc(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 Ic(e){return e>=8}a();function Lc(e){if(typeof e!=`object`||!e)return;let t=Reflect.get(e,`windows`);if(!(!Array.isArray(t)||t.length===0))return e}function Rc(e){return e.type===`multiselect`}function zc(e){let t=e.suggestions;return t===void 0||t.length===0?[]:t.map(e=>({value:e,label:e}))}function Bc(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 Vc(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Hc({field:e,values:t,onChange:n,onChangeMany:r,disabled:i,translationFn:a,onTestField:o,externalProbe:s,allFields:c,onAction:l}){let{t:u}=V();if(e.type===`tags`){if(!tr(e,t,c))return null;let r=e.creatable!==!1;return N(Gn,{mode:`multi`,options:zc(e),value:Vc(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:Wc(e.label,a),description:e.description===void 0?void 0:Wc(e.description,a),placeholder:e.placeholder??u(`formBuilder.formBuilder.searchOrAdd`,`Search or add…`),testId:`config-tags-${e.key}`})}if(e.type===`schedule`){if(!tr(e,t,c))return null;let r=Wc(e.label,a),i=e.description===void 0?void 0:Wc(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&&N(`label`,{className:`block text-[11px] font-medium text-foreground-subtle`,children:r}),i!==void 0&&N(`p`,{className:`text-[10px] text-foreground-subtle`,children:i}),N(br,{mode:o,value:Lc(t[e.key]),onChange:t=>n(e.key,t)})]})}return Rc(e)&&(Ic(e.options.length)||e.creatable===!0)?tr(e,t,c)?N(Gn,{mode:`multi`,options:Bc(e.options),value:Vc(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:Wc(e.label,a),description:e.description===void 0?void 0:Wc(e.description,a),placeholder:e.placeholder??u(`formBuilder.formBuilder.searchToAdd`,`Search to add…`),testId:`config-multiselect-${e.key}`,listboxId:`msel-${e.key}`}):null:N(Mt,{field:e,values:t,onChange:n,onChangeMany:r,disabled:i,translationFn:a,onTestField:o,externalProbe:s,allFields:c,onAction:l})}function Uc(e){return/^[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)+$/.test(e)}function Wc(e,t){if(e!==void 0)return t&&Uc(e)?t(e):e}function Gc({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+ +!!tr(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&&N(`h3`,{className:`text-[11px] font-semibold text-foreground-subtle uppercase tracking-wider`,children:Wc(e.title,a)}),e.description&&N(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:Wc(e.description,a)})]}),d&&N(`span`,{className:`text-foreground-subtle text-xs ml-2`,children:l?`▸`:`▾`})]}),!(l&&!_)&&(g===void 0?N(E,{children:N(`div`,{className:`grid ${h} gap-x-3 gap-y-2.5`,children:p.map(l=>N(Hc,{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))})}):N(Mt,{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 Kc({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 N(`div`,{className:`space-y-4`,children:e.sections.map((e,t)=>N(Gc,{section:e,values:u,onChange:d,onChangeMany:f,disabled:r,translationFn:i,onTestField:a,probeResults:o,onAction:c},`${e.id}-${t}`))})}function qc({pendingCount:e,onSave:t,onDiscard:n,saving:r=!1,saveLabel:i=`Save`,discardLabel:a=`Discard`}){let{t:o}=V();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:[N(`span`,{className:`text-xs text-foreground`,children:o(`formBuilder.saveBar.unsavedChanges`,{count:e})}),y(`div`,{className:`flex items-center gap-2`,children:[N(`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}),N(`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 Jc({tabs:e,activeId:t,onChange:n,countByTab:r,pendingByTab:i}){return e.length===0?null:N(`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&&N(`span`,{className:`ml-1.5 inline-flex h-1.5 w-1.5 rounded-full bg-primary`})]},e.id)})})}a();function Yc({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}){let m=e.tabs??[],h=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]),g=new Set(m.map(e=>e.id)),_=[...m,...[...h.keys()].filter(e=>!g.has(e)).map(e=>({id:e,label:e,icon:`wrench`,order:100}))],v=_[0]?.id??`general`,[b,x]=f(v),S=l!==void 0,C=new Set(_.map(e=>e.id)),w=j(new Set);for(let e of C)w.current.add(e);let T=w.current,E=(e=>e&&(C.has(e)||T.has(e))?e:v)(S?c:b),D=e=>{S?l(e):x(e)},O=h.get(E)??[],k={sections:O.length<=1?O.length===1?[{...O[0],title:``}]:O:O.every(e=>!e.title)?[{...O[0],title:``,fields:O.flatMap(e=>e.fields)}]:O},A=N(qc,{pendingCount:n.length,onSave:()=>a(n),onDiscard:()=>o(n),saving:s});if(u||_.length<=1)return y(`div`,{className:`flex flex-col gap-3`,children:[N(Kc,{schema:e,values:t,onChange:r,onAction:i,disabled:s,visibilityContext:p}),A]});let M=new Map,P=new Map;for(let[e,t]of h){M.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&&P.set(e,a)}return y(`div`,{className:`flex flex-col gap-3`,children:[N(Jc,{tabs:_.map(e=>({id:e.id,label:e.label})),activeId:E,onChange:D,countByTab:M,pendingByTab:P}),N(nn,{tabKey:E,children:N(Kc,{schema:k,values:t,onChange:r,onAction:i,disabled:s,visibilityContext:p})}),A]})}var Xc=`device-export`,Zc=`export`,Qc=`Export`;function $c(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($c):e.type===`sub-tabs`?e.tabs.some(e=>e.fields.some($c)):e.writerCapName===Xc}function el(e){return e.tab===`export`?!0:e.fields.some($c)}var tl=`host/extensions-panel`;function nl(e){return e.type===`widget`?e.widgetId===tl:e.type===`group`?e.fields.some(nl):e.type===`sub-tabs`?e.tabs.some(e=>e.fields.some(nl)):!1}function rl(e){return e.fields.some(nl)}function il(e,t){return!t&&e!==void 0&&it.includes(e)}function al(e){return e.location!==`top-tab`&&!el(e)&&!rl(e)}function ol(e,t,n,r){return!r||il(t,n)?!0:(e??[]).some(al)}function sl(e,t){for(let n of e){if(n.type===`group`){sl(n.fields,t);continue}if(n.type===`sub-tabs`){for(let e of n.tabs)sl(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 cl(e){let t={};for(let n of e)sl(n.fields,t);return t}a();function ll(e,t){return t&&t===`admin`?e:!0}function ul(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?el(e)&&el(t)?e.id.localeCompare(t.id):(e.order??0)-(t.order??0):n.localeCompare(r)})};return e.tabs?{...t,tabs:e.tabs}:t}function dl(e){return e.type===`separator`||e.type===`info`||e.type===`button`||e.type===`widget`||e.type===`addon-action-button`||e.type===`device-action-button`}function fl(e){return e.key}function pl(e){if(!dl(e))return e.value}function ml(e){return dl(e)?null:e}function hl(e,t){for(let n of e)if(t(n),n.type===`group`)hl(n.fields,t);else if(n.type===`sub-tabs`)for(let e of n.tabs)hl(e.fields,t)}function gl(e){if(!e)return{};let t={};for(let n of e.sections)hl(n.fields,e=>{let n=fl(e);n!==null&&(t[n]=pl(e))});return t}function _l(e,t){if(!e)return null;let n=null;for(let r of e.sections)if(hl(r.fields,e=>{if(n!==null||fl(e)!==t)return;let r=ml(e);r&&r.writerCapName&&r.writerAddonId&&(n={capName:r.writerCapName,addonId:r.writerAddonId})}),n!==null)break;return n}function vl(e){return{...e,fields:e.fields.map(yl)}}function yl(e){return e.type===`separator`||e.type===`info`||e.type===`button`||e.type===`object-array`?e:{...e,readonlyField:!0}}function bl(e,t){return e&&{...e,sections:e.sections.map(e=>({...e,fields:e.fields.map(e=>{let n=ml(e);return n?ll(t,n.minRole)?e:yl(e):e})}))}}function xl({deviceId:e,sectionFilter:t,activeSubTab:n,onSubTabChange:r,flattenSubTabs:i,subTabGrouping:a}){let{t:o}=V(),s=A(),{user:c}=Nc(),l=c?.isAdmin===!0,u=j(!1),{data:f,isLoading:m}=Fn({deviceId:e},{refetchInterval:()=>u.current?!1:2500,enabled:Number.isFinite(e)}),{data:h}=Vn({deviceId:e},{enabled:Number.isFinite(e)}),g=f?.settings??null,_=f?.live??null,v=d(()=>{if(!g&&!_)return null;let e=g?.sections??[],n=(_?.sections??[]).map(vl),r=[...e,...n],i=t?r.filter(t):r.filter(al);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=[...g?.tabs??[],...(_?.tabs??[]).filter(e=>!(g?.tabs??[]).some(t=>t.id===e.id))].filter(e=>o.has(e.id));return s.length>0?{tabs:s,sections:i}:{sections:i}},[g,_,t,a]),b=d(()=>cl([...g?.sections??[],..._?.sections??[]]),[g,_]),x=d(()=>ul(v),[v]),S=d(()=>bl(x,l),[x,l]),C=d(()=>gl(S),[S]),w=Yn(),T=Bn(),E=rn(),D=En(),O=an({onSuccess:()=>{s.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]})}}),k={isPending:O.isPending,mutate:t=>{O.mutate({deviceId:e,changes:[...t]})}},M=Fc({schema:S,serverValues:C,onImmediateSave:p(e=>{let t=Object.entries(e).map(([e,t])=>{let n=_l(S,e);return n?{writerCapName:n.capName,writerAddonId:n.addonId,key:e,value:t}:null}).filter(e=>e!==null);t.length>0&&k.mutate(t)},[S,k]),onDeferredSave:p(async t=>{let n=Object.entries(t).map(([e,t])=>{let n=_l(S,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 O.mutateAsync({deviceId:e,changes:n});if(t.failures.length>0)throw Error(t.failures.map(e=>e.error).join(`; `))}finally{await s.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]})}},[S,O,e,s])}),{values:P,pendingKeys:F,handleChange:I,handleSave:L,handleDiscard:ee}=M;if(u.current=M.editingPaused,m)return y(`div`,{className:`flex items-center justify-center py-12 text-foreground-subtle`,children:[N(ze,{className:`h-4 w-4 animate-spin mr-2`}),N(`span`,{className:`text-xs`,children:o(`device.deviceAggregateSection.loadingDeviceAggregate`,`Loading device aggregate…`)})]});if(!S||S.sections.length===0)return N(`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 te(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=at(e,r);await w.mutateAsync({brokerId:i}),s.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]});return}if(t===`test-probe`){if(!h)return{status:`error`,error:o(`device.deviceAggregateSection.metadataNotLoaded`)};try{return await E.mutateAsync({addonId:h.addonId,type:h.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=at(e,t),i=await T.mutateAsync({brokerId:r});return s.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]}),i}if(t===`device-custom-action`){let t=await D.mutateAsync({deviceId:e,action:n,input:r});return s.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]}),t}throw Error(`[device-aggregate] unknown action "${t}"`)}return N(Yc,{schema:S,values:P,pendingKeys:F,onChange:I,onAction:te,onSave:L,onDiscard:ee,disabled:k.isPending,activeSubTab:n,onSubTabChange:r,flattenTabs:i,visibilityContext:b})}var Sl=`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`,Cl=0,wl=10;function Tl(e){if(e.trim()===``)return``;let t=Number.parseInt(e,10);return Number.isFinite(t)?String(t<Cl?Cl:t>wl?wl:t):``}function El({value:e,onChange:t,disabled:n=!1,placeholder:r,className:i,id:a,"aria-label":o}){return N(`input`,{type:`number`,min:Cl,max:wl,step:1,id:a,className:i??Sl,"aria-label":o,placeholder:r,value:e,onChange:e=>{t(Tl(e.target.value))},disabled:n})}function Dl({deviceName:e,value:t,inheritedIcon:n,inheritedLabel:r,disabled:i,onChange:a}){let{t:o}=V(),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:[N(Tn,{value:t===``?null:t,onPick:e=>a(e??``),categoryLabel:e=>o(`deviceDisplay.iconCategory.${e}`,{defaultValue:st(e)}),fallbackGlyph:n,labels:s,disabled:i}),N(`span`,{className:`text-[11px] text-foreground-subtle`,children:t===``?r:t})]})}a();var Ol=`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`,kl={icon:``,label:``,unit:``,precision:``,hidden:!1};function Al(e){return{icon:e?.icon??``,label:e?.label??``,unit:e?.unit??``,precision:e?.precision===void 0?``:String(e.precision),hidden:e?.hidden===!0}}function jl(e){if(typeof e!=`object`||!e)return;let t=e.unit;return typeof t==`string`?t:void 0}function Ml(e){if(e.trim()===``)return;let t=Number.parseInt(e,10);return Number.isFinite(t)?t:void 0}function Nl(e,t){let n=Ml(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 Pl({deviceId:e}){let t=Re();bn();let{t:n}=V(),r=Be(),i=A(),{data:a}=Vn({deviceId:e},{enabled:e>0}),o=typeof a?.role==`string`&&a.role.length>0?a.role:null,s=o===null?void 0:nr[o],c=s?.kind===`numeric`,l=String(a?.type??``),u=o!==null||a?.parentDeviceId!==null&&a?.parentDeviceId!==void 0,d=Jn(r.trpcClient,e,o??``),p=s?.kind===`numeric`?s.canonicalUnit:void 0,m=jl(d)??p,h=m===void 0?void 0:ft(m)??m,g=h===void 0?void 0:lt(h),[_,v]=f(null),b=_??Al(a?.display),x=Wt({onSuccess:()=>{i.invalidateQueries({queryKey:[[`deviceManager`]]})}}),{data:S}=Cn({},{staleTime:6e4,enabled:o!==null}),C=At({onSuccess:()=>{i.invalidateQueries({queryKey:[[`deviceManager`]]})}});if(a==null)return null;let w=e=>{v({...b,...e})},T=()=>{x.mutate({deviceId:e,display:Nl(b,a.display)})},D=()=>{v(kl),x.mutate({deviceId:e,display:null})},O=()=>{if(o===null)return;let e=Ml(b.precision),t={...b.icon===``?{}:{icon:b.icon},...b.unit===``?{}:{unit:b.unit},...e===void 0?{}:{precision:e}},n={...S?.defaults,[o]:t};C.mutate({defaults:n})},k=o===null?void 0:S?.defaults[o]?.icon,j=k===void 0?void 0:_n(k),M=o===null?Sn(l,t):Ln(o,t),P={icon:j??M.icon,label:j===void 0?M.label:String(k)},F=o===null&&l===nt.Container?n(`deviceDisplay.inheritedContainer`):j===void 0?n(`deviceDisplay.inherited`,{name:P.label}):n(`deviceDisplay.inheritedRoleDefault`,{icon:P.label,role:M.label}),I=typeof a.name==`string`?a.name:`#${String(e)}`,L=o===null?``:Ln(o,t).label;return y(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[N(`div`,{className:`border-b border-border px-3 sm:px-4 py-2`,children:N(`h2`,{className:`text-[11px] font-semibold text-foreground uppercase tracking-wider`,children:n(`deviceDisplay.title`)})}),y(`div`,{className:`divide-y divide-border`,children:[N(X,{label:n(`deviceDisplay.icon`),value:N(Dl,{deviceName:I,value:b.icon,inheritedIcon:P.icon,inheritedLabel:F,disabled:x.isPending,onChange:e=>w({icon:e})})}),u&&N(X,{label:n(`deviceDisplay.label`),value:N(`input`,{type:`text`,className:Ol,"aria-label":n(`deviceDisplay.label`),placeholder:o===null?I:L,value:b.label,onChange:e=>w({label:e.target.value})})}),c&&y(E,{children:[N(X,{label:n(`deviceDisplay.unit`),value:N(Mn,{dimension:g,value:b.unit,onChange:e=>w({unit:e}),disabled:x.isPending,"aria-label":n(`deviceDisplay.unit`),inheritLabel:n(`deviceDisplay.unitSource`,{unit:h===void 0?``:` (${h})`}),emptyReason:n(`deviceDisplay.unitSource`,{unit:``})})}),N(X,{label:n(`deviceDisplay.precision`),value:N(El,{"aria-label":n(`deviceDisplay.precision`),placeholder:n(`deviceDisplay.precisionInherit`),value:b.precision,onChange:e=>w({precision:e}),disabled:x.isPending})})]}),N(X,{label:n(`deviceDisplay.hidden`),value:y(`label`,{className:`flex items-center gap-2`,children:[N(`input`,{type:`checkbox`,checked:b.hidden,onChange:e=>w({hidden:e.target.checked})}),N(`span`,{className:`text-[11px] text-foreground`,children:n(`deviceDisplay.hideFromLists`)})]})})]}),y(`div`,{className:`border-t border-border px-3 sm:px-4 py-2 flex flex-wrap items-center gap-2`,children:[N(`button`,{type:`button`,className:`rounded bg-primary px-3 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-50`,onClick:T,disabled:x.isPending,children:n(`common.save`)}),N(`button`,{type:`button`,className:`rounded border border-border px-3 py-1 text-[11px] text-foreground-subtle`,onClick:D,disabled:x.isPending,children:n(`common.reset`)}),o!==null&&N(`button`,{type:`button`,className:`rounded border border-border px-3 py-1 text-[11px] text-foreground-subtle`,onClick:O,disabled:C.isPending,title:n(`deviceDisplay.setRoleDefaultTitle`,{role:L}),children:n(`deviceDisplay.setRoleDefault`,{role:L})})]})]})}a();function Fl({deviceId:e,onClose:t}){let{t:n}=V(),[r,i]=f(`info`),{data:a}=Vn({deviceId:e},{enabled:e>0});return N(Nt,{open:!0,onOpenChange:e=>!e&&t(),children:y(An,{width:`lg`,scroll:`body`,children:[y(Gt,{children:[N(Yt,{children:typeof a?.name==`string`&&a.name.length>0?a.name:`#${String(e)}`}),y(Ot,{children:[n(`deviceQuickDetail.description`,{defaultValue:`Device info, display and export — same surfaces as the detail page.`}),` `,N(so,{to:`/devices/${String(e)}`,className:`text-primary hover:underline`,onClick:t,children:n(`deviceQuickDetail.openFull`,{defaultValue:`Open full detail`})})]})]}),N(`div`,{className:`mt-3 flex items-center gap-1 rounded-md bg-surface-hover p-0.5 w-fit`,children:[[`info`,n(`deviceQuickDetail.tabInfo`,{defaultValue:`Device info`})],[`display`,n(`deviceQuickDetail.tabDisplay`,{defaultValue:`Display`})],[`export`,n(`deviceQuickDetail.tabExport`,{defaultValue:`Export`})]].map(([e,t])=>N(`button`,{type:`button`,onClick:()=>i(e),className:`px-2.5 py-1 rounded text-[11px] font-medium transition-colors ${r===e?`bg-surface text-foreground shadow-sm`:`text-foreground-subtle hover:text-foreground`}`,children:t},e))}),N(Zt,{className:`mt-3`,children:y(zt,{deviceId:e,device:a??void 0,children:[r===`info`&&N(_s,{}),r===`display`&&N(Pl,{deviceId:e}),r===`export`&&N(xl,{deviceId:e,sectionFilter:el})]})})]})})}function Il({children:e}){let[t,n]=f(null),r=p(e=>n(e),[]),i=p(()=>n(null),[]);return y(Nn,{open:r,children:[e,t===null?null:N(Fl,{deviceId:t,onClose:i})]})}a();function Ll({tabs:e,active:t,onChange:n}){return N(`div`,{className:`flex rounded-lg border border-border bg-surface p-0.5 gap-0.5`,children:e.map(e=>N(`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 Rl(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 zl(e){return`${e.inputSize.width}x${e.inputSize.height}`}function Bl(e){return e.formats?Object.keys(e.formats).filter(t=>e.formats[t]!==void 0):[]}function Vl({entry:e,selected:t,onSelect:n,disabled:r}){let{t:i}=V(),a=Rl(e),o=zl(e),s=Bl(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:[N(`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:[N(`span`,{className:`text-xs font-semibold text-foreground truncate`,children:e.name}),t&&N(pe,{className:`h-3.5 w-3.5 text-primary shrink-0`})]}),N(`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:[N(ve,{className:`h-3 w-3`}),o]}),a&&N(`span`,{className:`text-[10px] text-foreground-subtle`,children:a}),s.length>0&&N(`div`,{className:`flex gap-1`,children:s.map(e=>N(`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&&N(`span`,{className:`text-[10px] text-foreground-subtle`,children:i(`common.labels`,{count:e.labels.length})})]})]})}function Hl({field:e,value:t,onChange:n,disabled:r}){let{t:i}=V(),a=e.catalog??[],o=a.length>0,s=tt(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&&N(Ll,{tabs:l,active:u,onChange:d}),u===`catalog`&&o&&s&&N($n,{catalog:a,value:p,onChange:e=>n(e),disabled:r||e.disabled}),u===`catalog`&&o&&!s&&N(`div`,{className:`space-y-1.5 max-h-[320px] overflow-y-auto pr-1`,children:a.filter(e=>e.legacy!==!0).map(t=>N(Vl,{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:[N(Ie,{className:`h-3.5 w-3.5 text-info shrink-0 mt-0.5`}),N(`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:[N(`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:[N(Ie,{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`),N(I,{className:`h-3 w-3`})]})]})]})}function Ul({to:e}){let{search:t}=q();return N(J,{to:`${e}${t}`,replace:!0})}a();function Wl(){return B.t(`helpers.keychainRevealHost.forbidden`)}function Gl(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 Kl(e){let t=Gl(e);if(t===`FORBIDDEN`||t===`UNAUTHORIZED`)return Wl();let n=e instanceof Error?e.message:String(e);return n.length>0?B.t(`helpers.keychainRevealHost.failedWith`,{message:n}):B.t(`helpers.keychainRevealHost.failed`)}function ql({children:e}){let t=Ft();return N(cn,{reveal:p(async e=>{try{return(await t.mutateAsync({ref:e})).value}catch(e){throw Error(Kl(e))}},[t]),children:e})}a();function Jl(){let e=Be(),t=A(),[n,r]=f(()=>e.isConnected()?`connected`:`disconnected`),i=j(!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}=tn(void 0,{enabled:n===`connected`&&a>0,staleTime:0,refetchOnMount:!1,refetchOnWindowFocus:!1}),d=j(null);return s(()=>{if(u==null||u.requestedAt===d.current)return;d.current=u.requestedAt;let e=Xl(u);l(t=>[...t,e]);let t=window.setTimeout(()=>{l(t=>t.filter(t=>t.id!==e.id))},6e3);return()=>window.clearTimeout(t)},[u]),N(E,{children:c.length>0&&N(Yl,{toasts:c})})}function Yl({toasts:e}){return N(`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:[N(Ve,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),y(`div`,{children:[N(`div`,{className:`text-[11px] font-semibold text-foreground`,children:e.title}),N(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:e.message})]})]},e.id))})}function Xl(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:B.t(`system.reconnectOverlay.frameworkUpdated`,`Framework updated`),message:B.t(`system.reconnectOverlay.isNow`,`{{packageName}} is now {{fromTo}}.`,{packageName:e.packageName,fromTo:n})}}return{id:t,title:B.t(`system.reconnectOverlay.serverRestarted`,`Server restarted`),message:e.requestedBy===void 0?B.t(`system.reconnectOverlay.manualRestartCompleted`,`Manual restart completed.`):B.t(`system.reconnectOverlay.manualRestartByCompleted`,`Manual restart by {{requestedBy}} completed.`,{requestedBy:e.requestedBy})}}var Zl=`/system/settings`,Ql=[{path:`/system/secrets`,tab:`secrets`},{path:`/system/capabilities`,tab:`capabilities`}];function $l(e,t=``){let n=new URLSearchParams(t);return n.delete(`tab`),n.set(`tab`,e),`${Zl}?${n.toString()}`}function eu({tab:e}){let{search:t,hash:n}=q();return N(J,{to:`${$l(e,t)}${n}`,replace:!0})}a();var tu={info:{bg:`bg-info/10`,border:`border-info/30`,icon:Ie},warning:{bg:`bg-warning/10`,border:`border-warning/30`,icon:le},critical:{bg:`bg-danger/10`,border:`border-danger/30`,icon:Me}};function nu({toast:e,onDismiss:t}){let n=tu[e.severity]??tu.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:[N(r,{className:`h-4 w-4 shrink-0 mt-0.5 text-foreground-subtle`}),y(`div`,{className:`flex-1 min-w-0`,children:[N(`div`,{className:`text-xs font-semibold text-foreground`,children:e.title}),N(`div`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:e.message})]}),N(`button`,{type:`button`,onClick:()=>t(e.id),className:`shrink-0 p-0.5 rounded hover:bg-surface-hover transition-colors`,children:N(De,{className:`h-3.5 w-3.5 text-foreground-subtle`})})]})}function ru(){let[e,t]=f([]),n=p(e=>{t(t=>t.filter(t=>t.id!==e))},[]);return kn(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:N(`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=>N(`div`,{className:`pointer-events-auto`,children:N(nu,{toast:e,onDismiss:n})},e.id))})}function iu(e){return(t,n,r)=>e(t,{...typeof n==`string`?{defaultValue:n}:{defaultValue_one:n.one,defaultValue_other:n.other},...r})}var au=(e,t,n)=>iu(B.t.bind(B))(e,t,n);a();function ou({children:e}){let{t}=V();return N(Le,{t:d(()=>iu(t),[t]),children:e})}a();function su(e){if(typeof e!=`object`||!e)return;let{data:t}=e;return t?.code}function cu(e,t){let n=su(e);return n===`UNAUTHORIZED`||n===`FORBIDDEN`?!0:/UNAUTHORIZED|FORBIDDEN/.test(t)}function lu(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(cu(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 uu=3e4;function du(e){let t=j(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>=uu&&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 fu(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 pu=new Map,mu=new Map,hu=new Set;function gu(e){return!e||typeof e!=`object`?!1:typeof e.default==`function`}async function _u(e,t){let i=pu.get(e);if(i)return i;let a=mu.get(e);if(a)return a;hu.has(e)||(Un(),r([{name:e,entry:z(t),type:`module`}],{force:!1}),hu.add(e));let o=n(`${e}/page`).then(n=>{if(!gu(n))throw Error(`Addon page remote ${e} (${t}) does not expose a default React component on './page'`);return pu.set(e,n.default),mu.delete(e),n.default}).catch(t=>{throw mu.delete(e),t});return mu.set(e,o),o}function vu(){let{t:e}=V(),{pagePath:t}=Gi(),n=Vi(),r=Be(),{data:i}=In(void 0),a=d(()=>i?fu(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=pu.get(c);if(e){p(()=>e);return}p(null);let t=!1;return _u(c,l).then(e=>{t||p(()=>e)}).catch(e=>{t||h(`Failed to load addon page: ${e instanceof Error?e.message:String(e)}`)}),()=>{t=!0}},[c,l]),a?o?m?N(`div`,{className:`flex items-center justify-center h-full text-danger text-sm`,children:m}):u?N(u,{trpc:r.trpcClient,theme:{isDark:document.documentElement.classList.contains(`dark`)},navigate:e=>{n(e.startsWith(`/`)?e:`/${e}`)}}):N(`div`,{className:`flex items-center justify-center h-full`,children:N(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}):N(`div`,{className:`flex items-center justify-center h-full text-foreground-subtle`,children:e(`layouts.addonPageLoader.addonPageNotFound`,`Addon page not found`)}):N(`div`,{className:`flex items-center justify-center h-full`,children:N(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})})}or();var yu=/\p{Mn}/gu;function bu(e){return e.normalize(`NFD`).replace(yu,``).toLowerCase().trim()}var xu=[`device`,`page`,`integration`],Su=0,Cu=1,wu=2,Tu=3,Eu=4,Du=5,Ou=6,ku=7;function Au(e,t,n,r){return n.includes(r)?Su:e===r?Cu:e.startsWith(r)?wu:e.split(/\s+/).some(e=>e.startsWith(r))?Tu:e.includes(r)?Eu:t.some(e=>e.includes(r))?Du:null}function ju(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 Mu(e){return e<4?0:e<=7?1:e<=12?2:3}function Nu(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 Pu(e,t){if(ju(e,t))return Ou;let n=Mu(t.length);if(n>0){for(let r of e.split(/\s+/))if(Nu(r,t,n)!==null)return ku}return null}function Fu(e,t,n=200){let r=bu(t);if(r.length===0)return{groups:[],totalMatched:0,truncated:!1};let i=new Map;for(let t of e){let e=bu(t.label),n=Au(e,(t.keywords??[]).map(bu),(t.identifiers??[]).map(bu),r)??Pu(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 xu){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 Iu(e){return e.flatMap(e=>e.items)}function Lu(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 Ru(e,t){return e.filter(e=>!e.adminOnly||t)}function zu({t:e,isAdmin:t}){let n=Ru([{label:e(`nav.devices`,`Devices`),icon:te,path:`/devices`},{label:e(`nav.integrations`),icon:ue,path:`/integrations`},{label:e(`nav.build`,`Build-your-self`),icon:L,path:`/build`,adminOnly:!0},{label:e(`nav.locations`,`Locations`),icon:qe,path:`/locations`,adminOnly:!0},{label:e(`nav.viewer`,`Viewer`),icon:pt,path:`/live`}],t),r=Ru([{label:e(`nav.library`,`Library`),icon:mt,path:`/library`,adminOnly:!0,keywords:[`People`,`Vehicles`,`Events`,`Scenes`,`plates`,`faces`,`detection-intelligence`]},{label:e(`nav.recordings`,`Recordings`),icon:ie,path:`/recordings`,adminOnly:!0}],t),i=Ru([{label:e(`nav.nodes`,`Nodes`),icon:$e,path:`/system/nodes`,adminOnly:!0},{label:e(`nav.pipeline`,`Pipeline`),icon:Dt,path:`/system/pipeline`},{label:e(`system.addons`),icon:he,path:`/system/addons`,adminOnly:!0},{label:e(`system.ai`,`AI`),icon:xe,path:`/system/ai`,adminOnly:!0}],t),a=Ru([{label:e(`system.identity`,`Identity & Access`),icon:Ue,path:`/system/identity`,adminOnly:!0},{label:e(`system.network`,`Network`),icon:yt,path:`/system/network`,adminOnly:!0},{label:e(`system.integrations`,`Connectivity`),icon:ue,path:`/system/integrations`,adminOnly:!0},{label:e(`system.data`,`Data`),icon:R,path:`/system/data`,adminOnly:!0},{label:e(`system.notifications`,`Notifications`),icon:oe,path:`/system/notifications`,adminOnly:!0},{label:e(`system.calendars`,`Calendars`),icon:_t,path:`/system/calendars`,adminOnly:!0},{label:e(`system.systemNav`,`System`),icon:Je,path:Zl,adminOnly:!0},{label:e(`system.logs`,`Logs`),icon:He,path:`/system/logs`,adminOnly:!0},{label:e(`system.terminal`,`Terminal`),icon:xt,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 Bu={gauge:ee,puzzle:he,bot:Fe,cpu:ve,terminal:xt,box:F,boxes:F,monitor:pt,wrench:je,activity:Oe,plug:ue,"graduation-cap":ne};function Vu(e){return Bu[e]??he}function Hu(e,t){for(let n of zu(t))for(let t of n.items)if(t.path===e)return{icon:t.icon,title:t.label,path:t.path};return null}var Uu=` · `;function Wu(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(Uu)}function Gu(e,t=null){let n=Lu(e),r=Kn(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:Wu(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:wn(e.type).icon}})}function Ku(e){return e.map(e=>({key:`integration:${e.id}`,domain:`integration`,label:e.name||e.addonId,subtitle:e.enabled?e.addonId:B.t(`helpers.searchItems.disabled`,{addonId:e.addonId}),keywords:[e.addonId,e.processState],path:`/integrations/${e.id}`}))}function qu(e,t,n){let r=e.section?.trim();return r?t[r]??e.sectionLabel?.trim()??r:n}function Ju(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:qu(e,i,n.ungrouped),keywords:[e.addonId],path:e.path,icon:Vu(e.icon)}));return[...r,...a]}a();var Yu={device:{labelKey:`search.resultsList.devices`,icon:te},page:{labelKey:`search.resultsList.pages`,icon:gt},integration:{labelKey:`search.resultsList.integrations`,icon:ue}};function Xu({groups:e,activeKey:t,query:n,totalMatched:r,truncated:i,onSelect:a,onHover:o}){let{t:c}=V(),l=j(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 N(`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:[N(`div`,{ref:l,role:`listbox`,className:`max-h-[60vh] overflow-y-auto py-1`,children:e.map(e=>{let n=Yu[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:[N(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:[N(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:[N(`span`,{className:`block truncate font-medium`,children:e.label}),e.subtitle&&N(`span`,{className:`block truncate text-[10px] text-foreground-subtle`,children:e.subtitle})]})]},e.key)})]},e.domain)})}),i&&N(`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 Zu({navSections:e,addonPages:t,compact:n,onNavigated:r}){let{t:i}=V(),a=Vi(),o=j(null),c=j(null),l=j(null),[u,m]=f(null),[h,g]=f(``),[_,v]=f(0),[b,x]=f(!1),{data:S}=fn({projection:`slim`}),{data:C}=gn(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[...Gu(S??[],C??null),...Ju(e,t,n),...Ku(C??[])]},[S,C,e,t,i]),{groups:T,totalMatched:E,truncated:D}=d(()=>Fu(w,h),[w,h]),O=d(()=>Iu(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 M=b&&h.trim().length>0;s(()=>{if(!M){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)}},[M]);let P=O[_]?.key??null,F=i(`search.placeholder`,`Search devices, pages, integrations…`),I=y(`div`,{className:`relative`,children:[N(Ae,{className:`pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-foreground-subtle`}),N(`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&&N(`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:N(De,{className:`h-3 w-3`})}),M&&u!==null&&sr(N(`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:N(Xu,{groups:T,activeKey:P,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?N(`div`,{ref:c,className:`px-1.5 pb-1.5`,children:b?N(`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}):N(`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:N(Ae,{className:`h-3.5 w-3.5 shrink-0`})})}):N(`div`,{ref:c,className:`px-2 pb-2`,children:I})}var Qu=/^(\d{1,3}\.){3}\d{1,3}$/;function $u(e){let t=e.startsWith(`[`)&&e.endsWith(`]`)?e.slice(1,-1):e;return!!(Qu.test(t)||t.includes(`:`))}function ed(e,t){return!t||$u(e)?!1:e===t||e.endsWith(`.${t}`)}a();var td=`auth-webauthn/passkey-enrollment`,nd=`camstack_passkey_prompt_dismissed:`,rd=720*60*60*1e3;function id(e){try{let t=localStorage.getItem(`${nd}${e}`);if(!t)return!1;let n=Number(t);return Number.isFinite(n)?Date.now()-n<rd:!1}catch{return!1}}function ad(e){try{localStorage.setItem(`${nd}${e}`,String(Date.now()))}catch{}}function od(){let{user:e}=Nc(),{t}=V(),n=Be(),r=Vt(td),[i,a]=f(!1),[o,s]=f(!1),c=d(()=>e?id(e.id):!0,[e]),l=en.auth.listLoginMethods.useQuery().data?.find(e=>e.kind===`passkey`),u=l!==void 0&&ed(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&&ad(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:[N(ht,{className:`h-4 w-4 text-primary shrink-0`}),N(`span`,{className:`flex-1 min-w-0`,children:t(`passkeyPrompt.message`,`Save a passkey for faster sign-in?`)}),N(`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`)}),N(`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`)}),N(`button`,{onClick:g,"aria-label":t(`passkeyPrompt.notNow`,`Not now`),className:`p-1 rounded text-foreground-subtle hover:text-foreground`,children:N(De,{className:`h-3.5 w-3.5`})})]}),o&&N(`div`,{className:`px-3 pb-3`,children:y(`div`,{className:`max-w-xl`,children:[N(Pt,{widgetId:td,host:`dashboard`}),N(`div`,{className:`mt-2 flex justify-end`,children:N(`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 sd=6e4;function cd(){let e=vn(void 0,{staleTime:sd});return{info:e.data?.serverName??null,isLoading:e.isLoading}}a();var ld=`system-config`,ud=`hub`,dd=`camstack_server_name_prompt_dismissed`;function fd(){try{return sessionStorage.getItem(dd)===`1`}catch{return!1}}function pd(){try{sessionStorage.setItem(dd,`1`)}catch{}}function md(e){return e.isAdmin&&e.info!==null&&e.info.isDefault&&!e.dismissed}function hd(){let{user:e}=Nc(),{info:t}=cd(),[n,r]=f(fd);return md({isAdmin:e?.isAdmin===!0,info:t,dismissed:n})?N(gd,{suggestion:t?.name??``,onLater:()=>{pd(),r(!0)}}):null}function gd({suggestion:e,onLater:t}){let{t:n}=V(),r=A(),i=ar(),[a,o]=f(e),[c,l]=f(null),u=j(null);s(()=>u.current?.focus(),[]);let d=p(async()=>{let e=ot.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:ld,nodeId:ud,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 N(Nt,{open:!0,onOpenChange:e=>!e&&t(),children:N(An,{children:y(`form`,{onSubmit:e=>{e.preventDefault(),i.isPending||d()},children:[y(Gt,{children:[N(Yt,{children:n(`serverName.title`,`Name this server`)}),N(Ot,{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.`)})]}),N(Zt,{children:N(Hn,{label:n(`serverName.label`,`Server name`),...c===null?{}:{error:c},children:N(zn,{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(Dn,{children:[N(Rt,{type:`button`,variant:`ghost`,onClick:t,disabled:i.isPending,children:n(`serverName.later`,`Later`)}),y(Rt,{type:`submit`,disabled:i.isPending||a.trim().length===0,children:[i.isPending&&N(ze,{className:`h-4 w-4 animate-spin`}),n(`common.save`,`Save`)]})]})]})})})}var _d=4,vd=160,yd=320,bd=`env(safe-area-inset-top)`,xd=`env(safe-area-inset-bottom)`;function Sd(e){let{rect:t,viewportWidth:n,viewportHeight:r}=e,i=Math.min(yd,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+_d}px, calc(${bd} + 8px))`;return{...a,top:e,maxHeight:`max(${vd}px, calc(100dvh - ${e} - ${xd} - 8px))`}}let o=`max(${r-t.top+_d}px, calc(${xd} + 8px))`;return{...a,bottom:o,maxHeight:`max(${vd}px, calc(100dvh - ${o} - ${bd} - 8px))`}}function Cd(e){return e===`totp`||e===`passkey`}function wd(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(Cd);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 Td(e,t){switch(e){case`sso-not-linked`:return B.t(`helpers.ssoReturn.notLinked`,{provider:t??B.t(`helpers.ssoReturn.signInFallback`)});case`sso-state`:return B.t(`helpers.ssoReturn.state`)}}var Ed={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 Dd(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:B.t(Ed[r]??`helpers.ssoReturn.link.failed`)}}var Od=`camstack:sso-return`,kd=`camstack:sso-ack`,Ad=`/sso-complete`,jd=1500,Md=520,Nd=680;function Pd(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 Fd(e){return e.target===`login`?`/login#${e.fragment}`:`/system/my-access?${e.query}`}function Id(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 Ld(e=window){let t=Math.max(0,Math.round(e.screenX+(e.outerWidth-Md)/2)),n=Math.max(0,Math.round(e.screenY+(e.outerHeight-Nd)/2));return[`popup=yes`,`width=${Md}`,`height=${Nd}`,`left=${t}`,`top=${n}`,`toolbar=no`,`menubar=no`,`location=no`,`status=no`,`resizable=yes`,`scrollbars=yes`].join(`,`)}function Rd(e){try{return window.open(e??`about:blank`,`camstack-sso`,Ld())??null}catch{return null}}function zd(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 Bd(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`camstack:sso-return`&&zd(t.completion)}function Vd(e,t,n){return t===null||e.source!==t||e.origin!==n?null:Bd(e.data)?e.data.completion:null}var Hd=`camstack-sso`,Ud=`camstack:sso-done`;function Wd(e,t){return e.target===`profile`?{target:`profile`,query:e.query}:t?{target:`login`}:null}function Gd(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 Kd(e){return typeof e==`object`&&!!e&&e.type===`camstack:sso-done-ack`}function qd(e){try{let t=e.location.origin;return typeof t==`string`?t:null}catch{return null}}function Jd(){if(typeof BroadcastChannel>`u`)return null;try{let e=new BroadcastChannel(Hd);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 Yd=500;function Xd(e,t,n=window,r={}){let i=n.location.origin,a=r.channel===void 0?Jd():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=Vd(r,e,i);a===null||l||(l=!0,n.removeEventListener(`message`,d),e.postMessage({type:kd},i),t.onReturn(a))};n.addEventListener(`message`,d);let f=o?.subscribe(e=>{let n=Gd(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?.())},Yd);return()=>{n.removeEventListener(`message`,d),f?.(),a?.close(),c(p)}}function Zd(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 Qd(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))},jd)})}function $d(e,t,n){let r=Qd(n,e=>{let r=r=>{Zd(r,t,n.origin)&&e()};return n.addEventListener(`message`,r),()=>n.removeEventListener(`message`,r)});try{let r={type:Od,completion:e};t.postMessage(r,n.origin)}catch{}return r}function ef(e,t,n){let r=Qd(n,e=>t.subscribe(t=>{Kd(t)&&e()}));return t.post({type:Ud,...e}),r}async function tf(e,t){let n=t.opener!==null&&!t.opener.closed?t.opener:null;if(n!==null&&qd(n)===t.origin&&await $d(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=Wd(e,i);if(a!==null&&t.channel!==null&&(r!==null&&i&&await t.persistSession(r),await ef(a,t.channel,t))){t.close();return}if(n!==null&&e.target===`profile`){let n=Dd(`?${e.query}`);if(n?.kind===`error`){t.showResult({kind:`link-error`,message:n.message});return}t.close();return}t.continueAt(Fd(e))}function nf(e,t){return(t.length>0&&e.startsWith(t)?e.slice(t.length):e).replace(/\/+$/,``)===Ad}var rf=`camstack:broker-oauth`;function af(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`camstack:broker-oauth`&&typeof t.ok==`boolean`}function of(e,t){return e.split(`{{brokerId}}`).join(encodeURIComponent(t))}function sf(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||af(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 cf={open:e=>Rd(e),assign:e=>window.location.assign(e),watch:(e,t)=>sf(e,t)};function lf(e,t,n=cf){let r=z(Id(e)),i=n.open(r);if(i===null){n.assign(r);return}n.watch(i,e=>{t?.(e)})}function uf(e,t,n){lf(of(e,t),n)}var df=!1;function ff(){return df}function pf(){df=!0}function mf(e){return!e.read&&e.severity===`critical`}function hf(e){return e.filter(mf)}function gf(e){return e!==void 0&&typeof e.href==`string`&&e.href.length>0}var _f=/^\/addon\/[^/?#]+\/oauth\//;function vf(e){return e.navigation===void 0?_f.test(e.href):e.navigation===`server`}function yf({action:e,className:t,onActivate:n}){let r=A();return vf(e)?N(`a`,{href:z(e.href),className:t,onClick:t=>{t.preventDefault(),n?.(t),lf(e.href,()=>{r.invalidateQueries({queryKey:[[`alerts`]]}),r.invalidateQueries({queryKey:[[`broker`]]}),r.invalidateQueries({queryKey:[[`recordEntries`]]})})},children:e.label}):N(so,{to:e.href,className:t,onClick:n,children:e.label})}a(),or();var bf={info:Ie,success:Ve,warning:le,error:Me,critical:vt},xf={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-danger`,critical:`text-danger`},Sf={active:`border-l-info`,"in-progress":`border-l-warning`,completed:`border-l-success`,failed:`border-l-danger`,dismissed:`border-l-foreground-subtle/30`};function Cf(e){let t=Math.floor((Date.now()-e)/1e3);if(t<60)return B.t(`helpers.relativeTime.justNow`);let n=Math.floor(t/60);if(n<60)return B.t(`helpers.relativeTime.minutesAgo`,{count:n});let r=Math.floor(n/60);if(r<24)return B.t(`helpers.relativeTime.hoursAgo`,{count:r});let i=Math.floor(r/24);return B.t(`helpers.relativeTime.daysAgo`,{count:i})}function wf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Tf(e){return typeof e==`string`&&e.length>0?e:void 0}function Ef(e){if(wf(e.metadata)){let t=Tf(e.metadata.nodeId)??Tf(e.metadata.agentId);if(t!==void 0)return t}let t=e.source;if(t!==void 0&&!(t.type!==`node`&&t.type!==`agent`))return Tf(t.id)}function Df({alert:e,onMarkRead:t,onDismiss:n}){let{t:r}=V(),i=e.severity in bf?e.severity:`info`,a=gf(e.action)?e.action:void 0,o=e.status in Sf?e.status:`active`,s=bf[i],c=xf[i],l=Sf[o],{nodes:u}=pn(),d=Ef(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:[N(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:[N(`span`,{className:`text-[11px] font-semibold ${e.read?`text-foreground-subtle`:`text-foreground`}`,children:e.title}),!e.read&&N(`span`,{className:`h-1.5 w-1.5 rounded-full bg-primary shrink-0`})]}),p!==void 0&&N(`div`,{className:`text-foreground-subtle text-[10px] mt-0.5 truncate`,children:p}),N(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5 line-clamp-2`,children:e.message}),a!==void 0&&N(yf,{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:[N(`div`,{className:`flex-1 h-1 bg-surface-hover rounded-full overflow-hidden`,children:N(`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)),`%`]})]}),N(`div`,{className:`text-[9px] text-foreground-subtle/60 mt-1`,children:Cf(e.updatedAt)})]}),y(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[!e.read&&N(`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:N(pe,{className:`h-3 w-3 text-foreground-subtle`})}),e.status!==`in-progress`&&N(`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:N(De,{className:`h-3 w-3 text-foreground-subtle`})})]})]})}function Of({variant:e=`icon`,compact:t=!1}={}){let{t:n}=V(),[r,i]=f(!1),[a,o]=f(!1),c=j(null),l=j(null),u=A(),{data:d=0}=Lt(void 0,{refetchInterval:3e4}),{data:m=[],isLoading:h}=Ht({limit:50},{enabled:r}),g=a?m:m.filter(e=>!e.read),_=m.filter(e=>e.read).length,v=()=>{u.invalidateQueries({queryKey:[[`alerts`]]})},b=Bt({onSuccess:v}),x=Wn({onSuccess:v}),S=sn({onSuccess:v});ir(`alert.created`,()=>{u.invalidateQueries({queryKey:[[`alerts`]]})}),ir(`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(mf),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)),[M,P]=f({}),F=p(()=>{let e=l.current;e&&P(Sd({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:[N(He,{className:`h-3.5 w-3.5`}),t&&d>0&&N(`span`,{className:`absolute -top-1 -right-1 h-2 w-2 rounded-full bg-primary`})]}),!t&&N(`span`,{className:`flex-1 text-left`,children:n(`ui.alertBell.alerts`,`Alerts`)}),!t&&d>0&&N(`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:[N(He,{className:`h-4.5 w-4.5`}),d>0&&N(`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&&sr(y(`div`,{ref:c,style:M,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:[N(`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:[N(`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:[N(Ct,{className:`h-3 w-3`}),n(`ui.alertBell.markAllRead`,`Mark all read`)]})]})]}),y(`div`,{className:`flex-1 overflow-y-auto`,children:[h&&N(`div`,{className:`flex items-center justify-center py-8`,children:N(ze,{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:[N(He,{className:`h-6 w-6 mb-2 opacity-40`}),N(`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&&N(`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:[N(`div`,{className:`px-3 py-1.5 bg-danger/5`,children:N(`span`,{className:`text-[9px] font-semibold uppercase tracking-widest text-danger`,children:n(`ui.alertBell.urgent`,`Urgent`)})}),E.map(e=>N(Df,{alert:e,onMarkRead:C,onDismiss:w},e.id))]}),O.length>0&&y(`div`,{className:`border-b border-border`,children:[N(`div`,{className:`px-3 py-1.5 bg-surface-hover/50`,children:N(`span`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60`,children:n(`ui.alertBell.inProgress`,`In Progress`)})}),O.map(e=>N(Df,{alert:e,onMarkRead:C,onDismiss:w},e.id))]}),k.map(e=>N(Df,{alert:e,onMarkRead:C,onDismiss:w},e.id))]})]}),document.body)]})}a(),or();function kf({alert:e,onMarkRead:t}){let{t:n}=V(),r=gf(e.action)?e.action:void 0;return y(`div`,{className:`border-b border-border last:border-b-0 px-3 py-2.5`,children:[N(`div`,{className:`text-[12px] font-semibold text-foreground`,children:e.title}),N(`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&&N(yf,{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`}),N(Rt,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>t(e.id),children:n(`ui.alertBell.markAsRead`,`Mark as read`)})]})]})}function Af(){let{t:e}=V(),t=A(),[n,r]=f(ff()),{data:i=[],isLoading:a}=Ht({limit:50}),o=d(()=>hf(i),[i]),s=Bt({onSuccess:p(()=>{t.invalidateQueries({queryKey:[[`alerts`]]})},[t])}),c=p(e=>{s.mutate({alertId:e})},[s]),l=p(()=>{pf(),r(!0)},[]);return a||n||o.length===0?null:sr(N(`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:[N(`h2`,{id:`critical-alerts-panel-title`,className:`text-[12px] font-semibold text-foreground`,children:e(`ui.criticalAlertsPanel.title`,`Urgent alerts`)}),N(`p`,{className:`text-[10px] text-foreground-muted mt-0.5`,children:e(`ui.criticalAlertsPanel.subtitle`,`These need your attention.`)})]}),N(qn,{type:`button`,variant:`ghost`,onClick:l,"aria-label":e(`ui.criticalAlertsPanel.close`,`Close`),"data-testid":`critical-alerts-panel-close`,icon:De})]}),N(`div`,{className:`flex-1 overflow-y-auto`,children:o.map(e=>N(kf,{alert:e,onMarkRead:c},e.id))})]})}),document.body)}a();function jf(){let e=js();return C(e.subscribe,e.getSnapshot,e.getSnapshot)}var Mf=[`detection`,`cluster`,`administration`];function Nf(e){return Mf.includes(e)}function Pf(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(Nf(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 Ff=`camstack:last-path`,If=512,Lf=[`/login`,`/change-password`,`/access-denied`,`/logout`];function Rf(e){return!e.startsWith(`/`)||e.startsWith(`//`)||e.length>If?!1:!Lf.some(t=>e===t||e.startsWith(t+`/`))}function zf(e){if(!(typeof window>`u`)&&Rf(e))try{window.localStorage.setItem(Ff,e)}catch{}}function Bf(){if(typeof window>`u`)return null;try{let e=window.localStorage.getItem(Ff);return e===null?null:Rf(e)?e:null}catch{return null}}a();var Vf=g(!0);function Hf(e){return e===`/addon`||e.startsWith(`/addon/`)}function Uf(e,t,n){let r=[...e.filter(e=>e!==t),t];return r.length<=n?r:r.slice(r.length-n)}function Wf({maxCached:e=6}){let t=Wi(),n=q(),r=Ri(),i=v(K),a=n.pathname,o=Hf(a),s=j(new Map),c=j([]);if(o){s.current.set(a,{key:a,outlet:t,location:n,navigationType:r,routeContext:i});let o=Uf(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 N(`div`,{className:n?`h-full min-h-0`:void 0,style:n?void 0:{display:`none`},hidden:!n,"aria-hidden":!n,children:N(Vf.Provider,{value:n,children:N(ki.Provider,{value:{location:t.location,navigationType:t.navigationType},children:N(K.Provider,{value:t.routeContext,children:t.outlet})})})},e)}),!o&&t!=null?N(`div`,{className:`h-full min-h-0`,children:t},a):null]})}a();var Gf={dark:se,light:ce,system:pt};function Kf(){return N(`div`,{className:`flex h-full min-h-[50vh] items-center justify-center`,children:N(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-primary/30 border-t-primary`})})}function qf(){let e=q(),t=Vi(),{user:n,logout:r}=Nc(),i=jn(),{t:a}=V(),o=Pn(),c=mn(),{info:l}=cd();s(()=>{document.title=l===null?`CamStack Admin`:`${l.name} \u00b7 CamStack Admin`},[l]);let u=xs(jf()),[p,m]=f(!1);s(()=>{zf(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=[]}=Kt({nodeId:`hub`},{refetchInterval:3e4}),b=v.length,x=A(),S=j(Date.now()),{data:C}=In(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?fu(C):[],[C,n?.isAdmin]),D=d(()=>Pf(T),[T]),O=D.known.get(`detection`)??[],k=D.known.get(`cluster`)??[],M=D.known.get(`administration`)??[];ir(`addon.page-ready`,()=>{x.invalidateQueries({queryKey:[[`addonPages`,`listPages`]]})});let P=()=>{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+`/`)),L=n?.isAdmin===!0,ee=d(()=>zu({t:a,isAdmin:L}),[a,L]),te=ee[0]?.items??[],ne=ee[1]?.items??[],re=ee[2]?.items??[],ie=ee[3]?.items??[],ae=i?.mode??`system`,oe={dark:a(`theme.dark`),light:a(`theme.light`),system:a(`theme.system`)},R=h&&!o,se=(e,t=`md`)=>`flex w-full items-center gap-2.5 rounded-md ${R?`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`}`,ce=(e,t)=>e===0?null:R?N(`div`,{className:`pt-3 mb-1 mx-2 border-t border-border/60`},`sep-${t}`):N(`div`,{className:`pt-4 pb-1.5 px-2.5`,children:N(`span`,{className:`text-[10px] font-semibold uppercase tracking-widest text-foreground-subtle/60`,children:t})},`hdr-${t}`),le=e=>{let n=F(e.path),r=Vu(e.icon);return y(`button`,{onClick:()=>{t(e.path),m(!1)},className:se(n),title:R?e.label:void 0,children:[N(r,{className:`h-3.5 w-3.5 shrink-0 ${n?`text-primary`:``}`}),!R&&e.label]},`${e.addonId}::${e.id}`)},ue=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:se(r),title:R?e.label:void 0,children:[N(n,{className:`h-3.5 w-3.5 shrink-0 ${r?`text-primary`:``}`}),!R&&y(E,{children:[N(`span`,{className:`flex-1 text-left`,children:e.label}),i&&b>0&&N(`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})]}),R&&i&&b>0&&N(`span`,{className:`absolute mt-[-14px] ml-3 h-2 w-2 rounded-full bg-primary`})]},e.path)},fe=y(E,{children:[y(`div`,{className:`flex h-14 items-center border-b border-border ${R?`justify-center px-1`:`pl-3 pr-4 gap-2`}`,children:[!R&&N(`img`,{src:i?.resolvedMode===`light`?z(`/brand/logo-horizontal-light.svg`):z(`/brand/logo-horizontal-dark.svg`),alt:a(`layouts.appLayout.camstackAdmin`,`CamStack Admin`),className:`h-9 flex-1 min-w-0`}),!o&&N(`button`,{onClick:()=>g(e=>!e),className:`p-1.5 rounded-md hover:bg-surface-hover text-foreground-subtle transition-colors flex-shrink-0 ${R?``:`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:N(h?Qe:we,{className:`h-4 w-4`})})]}),!R&&l!==null&&N(`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}),N(`div`,{className:`border-b border-border pt-2`,children:N(Zu,{navSections:ee,addonPages:T,compact:R,onNavigated:()=>m(!1)})}),y(`nav`,{className:`flex-1 overflow-y-auto py-3 ${R?`px-1.5`:`px-2`} space-y-0.5`,children:[te.map(e=>ue(e)),ce(ne.length+O.length,a(`nav.detectionSection`,`Detection`)),ne.map(e=>ue(e)),O.map(e=>le(e)),ce(re.length+k.length,a(`nav.clusterSection`,`Cluster`)),re.map(e=>ue(e)),k.map(e=>le(e)),ce(ie.length+M.length,a(`system.title`,`Administration`)),ie.map(e=>ue(e)),M.map(e=>le(e)),D.custom.map(e=>y(`div`,{className:`contents`,children:[ce(e.pages.length,e.label),e.pages.map(e=>le(e))]},`custom-${e.id}`)),ce(D.ungrouped.length,a(`nav.addonPages`,`Addon Pages`)),D.ungrouped.map(e=>le(e))]}),y(`div`,{className:`border-t border-border ${R?`p-1.5`:`p-2`} space-y-0.5`,children:[y(`button`,{onClick:()=>i?.toggleMode(),className:se(!1),title:R?oe[ae]:void 0,children:[(()=>{let e=Gf[ae];return N(e,{className:`h-3.5 w-3.5 shrink-0`})})(),!R&&N(`span`,{children:oe[ae]})]}),N(Of,{variant:`sidebar`,compact:R}),y(`button`,{type:`button`,onClick:()=>t(`/system/my-access`),className:se(F(`/system/my-access`)),title:R?a(`system.myAccess`,`My access`):void 0,children:[N(Ke,{className:`h-3.5 w-3.5 shrink-0`}),!R&&N(`span`,{className:`truncate`,children:a(`system.myAccess`,`My access`)})]}),y(`button`,{onClick:P,className:se(!1).replace(`hover:text-foreground`,`hover:text-danger`),title:R?n?.username??a(`layouts.appLayout.logout`,`Logout`):void 0,children:[N(Tt,{className:`h-3.5 w-3.5 shrink-0`}),!R&&N(`span`,{className:`truncate`,children:n?.username??a(`layouts.appLayout.user`,`User`)})]}),N(`div`,{className:`pt-1 text-[10px] text-foreground-disabled select-none ${R?`text-center`:`px-2`}`,title:a(`layouts.appLayout.adminUiV`,`admin-ui v{{__APP_VERSION__}}`,{__APP_VERSION__:`1.2.440`}),children:R?`1.2.440`:`v1.2.440`})]})]});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&&N(`aside`,{className:`flex flex-col border-r border-border bg-surface/80 backdrop-blur-sm shrink-0 transition-[width] duration-150 ease-out ${R?`w-12`:`w-48`}`,children:fe}),o&&N(Xn,{open:p,onClose:()=>m(!1),width:`w-64`,children:fe}),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`?N(Se,{className:`h-3.5 w-3.5`}):N(Oe,{className:`h-3.5 w-3.5`}),N(`span`,{children:a(u.i18nKey,{defaultValue:u.message,...u.i18nParams})}),u.action===`sign-in`&&N(`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&&N(ze,{className:`h-3.5 w-3.5 animate-spin`})]}),N(od,{}),N(hd,{}),N(Af,{}),o&&y(`header`,{className:`flex items-center h-12 border-b border-border px-3 shrink-0 bg-surface/80 backdrop-blur-sm`,children:[N(`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:N(de,{className:`h-5 w-5`})}),N(`div`,{className:`flex-1 flex justify-center`,children:N(`img`,{src:i?.resolvedMode===`light`?z(`/brand/logo-horizontal-light.svg`):z(`/brand/logo-horizontal-dark.svg`),alt:a(`layouts.appLayout.camstack`,`CamStack`),className:`h-7`})}),N(Of,{})]}),N(`main`,{className:`relative flex-1 min-h-0 overscroll-contain bg-background ${I?`overflow-hidden`:`overflow-auto`}`,children:N(w,{fallback:N(Kf,{}),children:N(Wf,{})})})]})]})}function $({children:e,requireAdmin:t}){let{t:n}=V(),{user:r,loading:i,mustChangePassword:a}=Nc(),o=q();return i?N(`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`?N(J,{to:`/change-password`,replace:!0}):t&&!r.isAdmin?N(J,{to:`/access-denied`,replace:!0}):N(E,{children:e}):N(J,{to:`/login`,replace:!0,state:{from:o.pathname+o.search}})}var Jf=`customize`,Yf=`main`,Xf=`advanced`,Zf=`/build/compositions/new`,Qf=`/build/compositions/:blockId`,$f=`/build?tab=custom-device`;function ep(e){return`/devices/${e}?tab=${Jf}`}function tp(e){return`${ep(e)}&sub=${Xf}`}function np(e){return`/build/compositions/${encodeURIComponent(e)}`}var rp=`integration`,ip=`section`,ap=[rp,ip],op={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`}},sp=`settings`,cp=`activity`;function lp(e,t={}){let{path:n,tab:r}=op[e],i=new URLSearchParams;r!==null&&i.set(`tab`,r),t.integration!==void 0&&i.set(rp,t.integration),t.section!==void 0&&i.set(ip,t.section);let a=i.toString();return a.length>0?`${n}?${a}`:n}function up(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 dp(e,t,n=null,r=null){let i=new URLSearchParams(e);return i.set(rp,t),r===null?i.delete(ip):i.set(ip,r),n!==null&&i.delete(n),i}function fp(e){return e===`/admin`||e===`/admin/`?`/`:e.startsWith(`/admin/`)?e.slice(6):e}function pp(){let{t:e}=V(),t=Vi();return y(`div`,{className:`flex flex-col items-center justify-center text-foreground py-16 px-4`,children:[N(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-2xl bg-danger/10 mb-4`,children:N(wt,{className:`h-8 w-8 text-danger`})}),N(`h1`,{className:`text-xl font-bold`,children:e(`accessDenied.accessDenied`,`Access Denied`)}),N(`p`,{className:`mt-2 text-sm text-foreground-subtle`,children:e(`accessDenied.youDonTHavePermission`,`You don't have permission to access this page.`)}),N(`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`)})]})}a();var mp=8;function hp(){let{t:e}=V(),{user:t,mustChangePassword:n,clearMustChangePassword:r,logout:i}=Nc(),a=jn(),o=Vi(),[s,c]=f(``),[l,u]=f(``),[d,p]=f(!1),[m,h]=f(``),g=jt({onSuccess:()=>{r(),o(`/devices`,{replace:!0})},onError:e=>{h(e instanceof Error?e.message:`Could not change password`)}});return N(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:y(`div`,{className:`w-full max-w-sm`,children:[N(`div`,{className:`flex justify-center mb-8`,children:N(`img`,{src:a?.resolvedMode===`light`?z(`/brand/logo-horizontal-light.svg`):z(`/brand/logo-horizontal-dark.svg`),alt:e(`changePassword.camstackAdmin`,`CamStack Admin`),className:`h-12`})}),y(`form`,{onSubmit:async e=>{if(e.preventDefault(),h(``),!t){h(`Not signed in`);return}if(s.length<mp){h(`Password must be at least ${mp} characters`);return}if(s!==l){h(`The two passwords do not match`);return}if(s===`changeme`){h(`Choose a password different from the seed default`);return}g.mutate({id:t.id,newPassword:s})},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:[N(`h1`,{className:`text-sm font-semibold text-foreground`,children:e(`changePassword.setANewPassword`,`Set a new password`)}),N(`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.`)})]}),m&&N(`div`,{className:`rounded-md bg-danger/10 border border-danger/20 px-3 py-2 text-xs text-danger`,children:m}),y(`div`,{className:`space-y-1.5`,children:[N(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`changePassword.newPassword`,`New password`)}),y(`div`,{className:`relative`,children:[N(`input`,{"data-testid":`change-password-new`,type:d?`text`:`password`,value:s,onChange:e=>c(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`,autoFocus:!0}),N(`button`,{type:`button`,onClick:()=>p(!d),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground transition-colors`,tabIndex:-1,children:N(d?et:fe,{className:`h-4 w-4`})})]})]}),y(`div`,{className:`space-y-1.5`,children:[N(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`changePassword.confirmNewPassword`,`Confirm new password`)}),N(`input`,{"data-testid":`change-password-confirm`,type:d?`text`:`password`,value:l,onChange:e=>u(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`})]}),N(`button`,{"data-testid":`change-password-submit`,type:`submit`,disabled:g.isPending||!s||!l,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:g.isPending?e(`changePassword.saving`,`Saving…`):e(`changePassword.saveAndContinue`,`Save and continue`)}),n&&N(`button`,{type:`button`,onClick:()=>{i(),o(`/login`,{replace:!0})},className:`w-full text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:e(`changePassword.signOutInstead`,`Sign out instead`)})]})]})})}function gp(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 _p(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 vp(){return window?.PublicKeyCredential!==void 0&&typeof window.PublicKeyCredential==`function`}function yp(e){let{id:t}=e;return{...e,id:_p(t),transports:e.transports}}function bp(e){return e===`localhost`||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}var xp=class extends Error{constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),this.name=r??n.name,this.code=t}},Sp=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}}},Cp=[`cross-platform`,`platform`];function wp(e){if(e&&!(Cp.indexOf(e)<0))return e}function Tp(){if(!vp())return new Promise(e=>e(!1));let e=window.PublicKeyCredential;return e.isConditionalMediationAvailable===void 0?new Promise(e=>e(!1)):e.isConditionalMediationAvailable()}function Ep({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 xp({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new xp({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=window.location.hostname;if(!bp(t))return new xp({message:`${window.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new xp({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 xp({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 Dp(e){let{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:r=!0}=e;if(!vp())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(yp));let a={...t,challenge:_p(t.challenge),allowCredentials:i},o={};if(n){if(!await Tp())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=Sp.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw Ep({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=gp(u.userHandle)),{id:c,rawId:gp(l),response:{authenticatorData:gp(u.authenticatorData),clientDataJSON:gp(u.clientDataJSON),signature:gp(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:wp(s.authenticatorAttachment)}}function Op(e){return typeof e==`object`&&!!e}function kp(e){return Op(e)&&typeof e.challenge==`string`}a();async function Ap(e){if(!kp(e))throw Error(`passkey authentication options missing challenge`);let t=await Dp({optionsJSON:e});return Object.fromEntries(Object.entries(t))}function jp({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 Ap((await e.loginBeginPasskey(t)).optionsJSON),i=await e.loginVerifyPasskey(t,r,{refreshable:!0});n(i.token,i);return}let a=await Ap((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?N(ze,{className:`h-4 w-4 animate-spin text-primary`}):N(ht,{className:`h-4 w-4 text-primary`}),e.label]}),s&&N(`div`,{className:`rounded-md bg-danger/10 border border-danger/20 px-3 py-2 text-xs text-danger`,children:s})]})}var Mp=()=>window.location.hostname;function Np(e,t=Mp){return vp()&&ed(t(),e.rpId)}function Pp(e,t=Mp){let n=e.filter(e=>e.kind===`passkey`&&e.stage===`second-factor`).filter(e=>Np(e,t));return{passkeyMethods:n,widgetMethods:n.length>0?[]:e.filter(e=>e.kind===`widget`&&e.stage===`second-factor`)}}function Fp(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 Ip(e){let t=e.onComplete,n=e.onSecondFactor;return typeof t==`function`?{onComplete:t,onSecondFactor:typeof n==`function`?n:void 0}:null}function Lp({methods:e,widgetConfig:t,onRedirect:n}){let{t:r}=V();bn();let i=e.filter(e=>e.kind!==`passkey`||Np(e));return i.length===0?null:y(`div`,{className:`mt-6 space-y-3`,children:[y(`div`,{className:`flex items-center gap-3`,children:[N(`div`,{className:`h-px flex-1 bg-border`}),N(`span`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:r(`login.primaryLoginMethods.orContinueWith`,`Or continue with`)}),N(`div`,{className:`h-px flex-1 bg-border`})]}),N(`div`,{className:`space-y-2`,children:i.map(e=>{if(e.kind===`redirect`){let t=(e.icon===void 0?void 0:_n(e.icon))??Ke;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:[N(t,{className:`h-4 w-4 text-primary`}),e.label]},e.id)}if(e.kind===`passkey`){let n=Ip(t);return n?N(jp,{method:e,onComplete:n.onComplete,onSecondFactor:n.onSecondFactor},e.id):null}return N(Rp,{method:e,config:t},e.id)})})]})}function Rp({method:e,config:t}){let{t:n}=V(),r=It(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:[N(ze,{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:[N(Me,{className:`h-3.5 w-3.5 shrink-0`}),n(`login.primaryMethods.loadFailed`)]}):N(r,{instanceId:e.id,host:`dashboard`,config:t})}var zp=4e3,Bp=/^[A-Za-z0-9._-]{1,64}$/;function Vp(e){let t=e.addonId!==void 0&&Bp.test(e.addonId)?e.addonId:null,n=e.integration!==void 0&&Bp.test(e.integration)?e.integration:null;if(t!==null&&e.brokerId!==void 0)return`/system/integrations?tab=brokers&integration=${t}`;let r=n??t;return r===null?`/system/integrations`:`/system/integrations?integration=${r}`}function Hp(e,t){let n=t.opener;if(n===null||n.closed||qd(n)!==t.origin)return!1;try{return n.postMessage({type:rf,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 Up=500;function Wp(e){let{t}=V();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 Gp({outcome:e}){let{t}=V(),n=Wp(e.reason??`unknown`);if(e.status===`error`)return y(E,{children:[N(Ge,{className:`mx-auto h-8 w-8 text-danger`,"aria-hidden":!0}),N(`h1`,{"data-testid":`oauth-landing-title`,className:`text-sm font-semibold text-foreground`,children:t(`oauthLanding.errorTitle`,`Sign-in did not finish`)}),N(`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:[N(Ve,{className:`mx-auto h-8 w-8 text-success`,"aria-hidden":!0}),N(`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`)}),N(`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 Kp({outcome:e,closable:t,onContinue:n,onClose:r}){let{t:i}=V(),a=Vp(e);return s(()=>{if(e.status!==`success`)return;let t=window.setTimeout(()=>n(a),zp);return()=>window.clearTimeout(t)},[e.status,n,a]),N(`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:[N(`div`,{className:`flex justify-center`,children:y(`picture`,{children:[N(`source`,{media:`(prefers-color-scheme: dark)`,srcSet:z(`/brand/logo-horizontal-dark.svg`)}),N(`img`,{src:z(`/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:[N(Gp,{outcome:e}),y(`div`,{className:`flex flex-col gap-2`,children:[N(Rt,{type:`button`,variant:`primary`,onClick:()=>n(a),children:i(`oauthLanding.back`,`Back to CamStack`)}),t&&N(Rt,{type:`button`,variant:`ghost`,onClick:r,children:i(`oauthLanding.close`,`Close this window`)})]})]})]})})}function qp(e,t){window.history.replaceState(null,``,window.location.pathname);let n=window.opener,r=Hp(t,{opener:n,origin:window.location.origin}),i=()=>e.render(N(Kp,{outcome:t,closable:r,onContinue:e=>window.location.replace(z(e)),onClose:()=>window.close()}));if(r&&t.status===`success`){window.close(),window.setTimeout(i,Up);return}i()}function Jp(e){return ct(e)}var Yp=`Done — you can close this window.`,Xp=500,Zp=`camstack_admin_token`;async function Qp(e,t=``){try{let n=Us(new URLSearchParams(t));n!==null&&n.token===e?Vs(n):localStorage.setItem(Zp,e)}catch{}await fetch(z(`/api/auth/session`),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({token:e})}).catch(()=>{})}function $p(){try{let e=localStorage.getItem(Zp);return e!==null&&e.length>0?e:null}catch{return null}}function em(e){let t=Jp(window.location.hash);if(t!==null){qp(e,t);return}let n=Pd(window.location.hash);window.history.replaceState(null,``,window.location.pathname);let r=t=>e.render(N(tm,{completion:n,result:t}));if(r(null),n===null)return;let i=Jd();tf(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:Yp}),Xp)},continueAt:e=>window.location.replace(z(e)),persistSession:e=>Qp(e,n.target===`login`?n.fragment:``),showResult:r,setTimeout:(e,t)=>window.setTimeout(e,t)})}function tm({completion:e,result:t}){let{t:n}=V();return N(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:N(`div`,{className:`flex flex-col items-center gap-3 text-sm text-foreground-subtle`,children:e===null?N(`a`,{className:`text-primary underline`,href:z(`/login`),children:n(`ssoComplete.nothingToFinishHereGo`,`Nothing to finish here — go to sign-in`)}):t===null?y(`span`,{className:`flex items-center gap-3`,children:[N(`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:[N(`span`,{"data-testid":`sso-complete-result`,className:t.kind===`link-error`?`text-danger`:`text-foreground`,children:t.message}),N(`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 nm(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 rm(){let e=new URLSearchParams(window.location.search);return ic({codeChallenge:e.get(`code_challenge`),codeChallengeMethod:e.get(`code_challenge_method`),state:e.get(`state`),purpose:e.get(`purpose`)})}function im(e){return Math.min(1e3*2**e,15e3)}function am(){let{t:e}=V(),{login:t,verifyTotp:n,finalizePasskeyLogin:r,user:i}=Nc(),{i18n:a}=V(),o=jn(),c=Vi(),l=q(),u=new URLSearchParams(window.location.search).get(`next`);s(()=>{pc(u)},[u]);let d=new URLSearchParams(window.location.search).get(`redirect`);s(()=>{Sc(d)},[d]);let p=rm();s(()=>{sc(p)},[p?.codeChallenge,p?.state,p?.purpose]);let m=l.state?.from??Bf()??`/devices`,[h,g]=f(``),[_,v]=f(``),[b,x]=f(!1),[S,C]=f(``),[w,T]=f(!1),[D,O]=f(`credentials`),[k,A]=f(``),[M,F]=f([]),[I,L]=f(``),[ee,te]=f(void 0),[ne,re]=f(`sso-not-linked`),ie=en.auth.listLoginMethods.useQuery(void 0,{retry:!0,retryDelay:im}),ae=ie.data===void 0,oe=(ie.data??[]).filter(e=>e.kind!==`device-certificate`),R=en.auth.getServerName.useQuery().data,se=oe.filter(e=>e.stage===`primary`),ce=Pp(oe);s(()=>{let e=wd(window.location.hash);if(e!==null){if(window.history.replaceState({},``,window.location.pathname+window.location.search),e.kind===`challenge`){A(e.challengeToken),F(e.factors),L(``),O(`second-factor`);return}re(e.code),te(e.provider)}},[]);let le=ee==null?null:oe.find(e=>e.id===ee&&`label`in e)?.label??null,ue=S||(ee===void 0?``:Td(ne,le)),{passkeyMethods:de,widgetMethods:pe}=ce,me=j(!1),he=async()=>{if(me.current)return;me.current=!0;let e=uc(d);if(e?.kind===`app-callback`){await ve(e.url);return}else if(e){window.location.assign(z(e.path));return}let t=hc(u);t?window.location.assign(z(t)):c(m,{replace:!0})},[ge,_e]=f(null),ve=async e=>{_e({callbackBase:e,mintedUrl:null,failed:!1});try{let t=rm()??cc();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=lc(e,n,t.state);_e({callbackBase:e,mintedUrl:r,failed:!1}),window.location.assign(r)}catch(t){if(nm(t)){me.current=!1,_e(null),C(`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(),C(``),te(void 0),T(!0);try{let e=await t(h,_);if(e.kind===`second-factor`){A(e.challengeToken),F(e.factors),O(`second-factor`);return}_===`changeme`?c(`/change-password`,{replace:!0}):await he()}catch(e){C(e instanceof Error?e.message:`Login failed`)}finally{T(!1)}},we=async e=>{e.preventDefault(),C(``),T(!0);try{await n(k,I.trim()),await he()}catch(e){C(e instanceof Error?e.message:`TOTP verification failed`),L(``)}finally{T(!1)}},Te=async(e,t)=>{try{await r(e,t),await he()}catch(e){C(e instanceof Error?e.message:`Passkey sign-in failed`)}},Ee=j(null);s(()=>()=>Ee.current?.(),[]);let De=async e=>{if(e.target!==`login`)return;let t=Us(new URLSearchParams(e.fragment));if(t!==null){try{await r(t.token,t),await he()}catch(e){C(e instanceof Error?e.message:`Sign-in failed`)}return}let n=wd(`#${e.fragment}`);if(n!==null){if(n.kind===`challenge`){ke({challengeToken:n.challengeToken,factors:n.factors});return}re(n.code),te(n.provider)}},Oe=e=>{if(tc(d)?.kind===`app-callback`)return!1;let t=Rd(z(Id(e.startUrl)));return t===null?!1:(C(``),te(void 0),Ee.current?.(),Ee.current=Xd(t,{onReturn:e=>{Ee.current?.(),Ee.current=null,De(e)},onDone:e=>{if(Ee.current?.(),Ee.current=null,e.target!==`login`)return;let t=$p()===null?null:Bs();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`);A(e.challengeToken),F(t),L(``),C(``),O(`second-factor`)};return ge===null?N(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:y(`div`,{className:`w-full max-w-sm`,children:[N(`div`,{className:`flex justify-center mb-8`,children:N(`img`,{src:o?.resolvedMode===`light`?z(`/brand/logo-horizontal-light.svg`):z(`/brand/logo-horizontal-dark.svg`),alt:e(`login.camstackAdmin`,`CamStack Admin`),className:`h-12`})}),R!==void 0&&!R.isDefault&&N(`p`,{"data-testid":`login-server-name`,className:`-mt-4 mb-6 text-center text-sm text-foreground-muted`,children:N(Xo,{i18nKey:`login.signInTo`,values:{name:R.name},components:{b:N(`span`,{className:`font-semibold text-foreground`})}})}),D===`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&&N(`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:[N(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`login.username`,`Username`)}),N(`input`,{"data-testid":`login-username`,type:`text`,placeholder:e(`login.username`,`Username`),value:h,onChange:e=>g(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:[N(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`login.password`,`Password`)}),y(`div`,{className:`relative`,children:[N(`input`,{"data-testid":`login-password`,type:b?`text`:`password`,placeholder:e(`login.password`,`Password`),value:_,onChange:e=>v(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`}),N(`button`,{type:`button`,onClick:()=>x(!b),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground transition-colors`,tabIndex:-1,children:N(b?et:fe,{className:`h-4 w-4`})})]})]}),N(`button`,{"data-testid":`login-submit`,type:`submit`,disabled:w||!h||!_,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:w?y(`span`,{className:`flex items-center justify-center gap-2`,children:[N(`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:[N(P,{className:`h-4 w-4 text-primary`}),N(`div`,{className:`text-sm font-medium text-foreground`,children:e(`login.twoFactorAuthentication`,`Two-factor authentication`)})]}),N(`p`,{className:`text-xs text-foreground-subtle`,children:h?N(E,{children:N(Xo,{i18nKey:`login.finishSigningInAs`,values:{username:h},components:{mono:N(`span`,{className:`font-mono text-foreground`})}})}):e(`login.finishSigningInAs`,`Finish signing in.`)}),S&&N(`div`,{className:`rounded-md bg-danger/10 border border-danger/20 px-3 py-2 text-xs text-danger`,children:S}),M.includes(`passkey`)&&de.map(e=>N(jp,{method:e,challengeToken:k,onComplete:Te},e.id)),M.includes(`passkey`)&&pe.map(e=>N(Rp,{method:e,config:{challengeToken:k,onComplete:Te}},e.id)),Fp(M,ce)&&N(`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.`)}),M.includes(`passkey`)&&M.includes(`totp`)&&y(`div`,{className:`flex items-center gap-3`,children:[N(`div`,{className:`h-px flex-1 bg-border`}),N(`span`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:`or`}),N(`div`,{className:`h-px flex-1 bg-border`})]}),M.includes(`totp`)&&y(`form`,{onSubmit:we,className:`space-y-4`,children:[y(`div`,{className:`space-y-1.5`,children:[N(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`login.authenticationCode`,`Authentication code`)}),N(`input`,{"data-testid":`login-totp`,type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,placeholder:`123456`,value:I,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})]}),N(`button`,{"data-testid":`login-totp-submit`,type:`submit`,disabled:w||I.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:w?y(`span`,{className:`flex items-center justify-center gap-2`,children:[N(`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:()=>{O(`credentials`),A(``),F([]),L(``),C(``)},className:`w-full flex items-center justify-center gap-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:[N(ye,{className:`h-3 w-3`}),e(`login.backToUsernamePassword`,`Back to username + password`)]})]}),D===`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:[N(`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...`)]}),D===`credentials`&&N(Lp,{methods:se,widgetConfig:{onComplete:Te,onSecondFactor:ke,locale:a.language},onRedirect:Oe}),N(`p`,{className:`mt-6 text-center text-[10px] text-foreground-subtle/50`,children:e(`login.version`,{version:`1.2.440`})})]})}):N(`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:[N(`h1`,{className:`text-sm font-semibold text-foreground`,children:e(`login.returningToTheApp`,`Returning to the app…`)}),ge.failed?y(E,{children:[N(`p`,{className:`text-xs text-danger`,children:e(`login.couldNotPrepareTheSign`,`Could not prepare the sign-in handoff. You are logged in — retry below.`)}),N(`button`,{onClick:()=>void ve(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?N(`p`,{className:`text-xs text-foreground-subtle`,children:e(`login.preparingAOneTimeSign`,`Preparing a one-time sign-in code…`)}):y(E,{children:[N(`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).`)}),N(`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 om(){let{pathname:e,search:t,hash:n}=q();return N(J,{to:`${fp(e)}${t}${n}`,replace:!0})}function sm(){return N(J,{to:Bf()??`/devices`,replace:!0})}var cm=m(()=>i(()=>import(`./Devices-CtivG8K9.js`).then(e=>({default:e.DevicesPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url)),lm=m(()=>i(()=>import(`./Integrations-C7Ptcn3c.js`).then(e=>({default:e.IntegrationsPage})),__vite__mapDeps([9,1,2,3,4,10,5,6,11,12,13,7,8]),import.meta.url)),um=m(()=>i(()=>import(`./IntegrationDetail-CzEG-I4B.js`).then(e=>({default:e.IntegrationDetailPage})),__vite__mapDeps([14,1,2,3,4,15,5,16,11,12,13,7,17]),import.meta.url)),dm=m(()=>i(()=>import(`./ClusterStepModel-DPmlzTfm.js`).then(e=>e.r).then(e=>({default:e.PipelinePage})),__vite__mapDeps([18,1,2,3,4,10,5,19,20,21,22,16,23,8]),import.meta.url)),fm=m(()=>i(()=>import(`./DeviceDetail-g2esa6u-.js`).then(e=>({default:e.DeviceDetailPage})),__vite__mapDeps([24,1,2,3,4,10,5,25,26,27,28,19,29,22,30,31,32,33,18,20,21,16,23,8,34,13]),import.meta.url)),pm=m(()=>i(()=>import(`./Showroom-PlFtcQrL.js`).then(e=>({default:e.ShowroomPage})),__vite__mapDeps([35,1,2,3,4]),import.meta.url)),mm=m(()=>i(()=>import(`./EmbedPlayerPage-BD-Z7zz-.js`).then(e=>({default:e.EmbedPlayerPage})),__vite__mapDeps([36,1,2,3,4,5]),import.meta.url)),hm=m(()=>i(()=>import(`./Library-ToUHY4O3.js`).then(e=>({default:e.LibraryPage})),__vite__mapDeps([37,1,2,3,4,10,5,38,19,21,39,40,31,41,34,13]),import.meta.url)),gm=m(()=>i(()=>import(`./Recordings-g1Jxg_Lr.js`).then(e=>({default:e.RecordingsPage})),__vite__mapDeps([42,1,2,3,4,10,5,43,40,44,25,45,46,47,34,13]),import.meta.url)),_m=m(()=>i(()=>import(`./Viewer-CRLD_tt7.js`).then(e=>({default:e.ViewerPage})),__vite__mapDeps([48,2,3,4,49,5,13,1]),import.meta.url)),vm=m(()=>i(()=>import(`./Build-BArewEF3.js`).then(e=>({default:e.BuildPage})),__vite__mapDeps([50,1,2,3,4,10,5,28,51,19,40,30,52,53]),import.meta.url)),ym=m(()=>i(()=>import(`./CompositionEditorPage-BwqVkeY-.js`).then(e=>({default:e.CompositionEditorPage})),__vite__mapDeps([54,1,2,3,4,28,5,6,30,10]),import.meta.url)),bm=m(()=>i(()=>import(`./Locations-CPFCvUKd.js`).then(e=>({default:e.LocationsPage})),__vite__mapDeps([55,1,2,3,4,10,5,28,56,39,40,32,33]),import.meta.url)),xm=m(()=>i(()=>import(`./Addons-CrSVEbe3.js`).then(e=>({default:e.AddonsPage})),__vite__mapDeps([57,1,2,3,4,19,5,6,16,58,13]),import.meta.url)),Sm=m(()=>i(()=>import(`./AiProfiles-D8mKo1K9.js`).then(e=>({default:e.AiProfilesPage})),__vite__mapDeps([59,1,2,3,4,10,5,60,61,6,40,13]),import.meta.url)),Cm=m(()=>i(()=>import(`./MyAccess-2mSUBp14.js`).then(e=>({default:e.MyAccessPage})),__vite__mapDeps([62,1,2,3,4,10,5,19,63,64,65,6,66,13]),import.meta.url)),wm=m(()=>i(()=>import(`./Logs-Ds6SPC6o.js`).then(e=>({default:e.LogsPage})),__vite__mapDeps([67,1,2,3,4,68,22,5,6,40,69,70,16,71,17,13,72]),import.meta.url)),Tm=m(()=>i(()=>import(`./Identity-BQNP0wku.js`).then(e=>({default:e.IdentityPage})),__vite__mapDeps([73,1,2,3,4,10,5,74,19,75,63,64,65,6,40,69,70,16,71,17,13,66,72]),import.meta.url)),Em=m(()=>i(()=>import(`./Network-BddKO6B1.js`).then(e=>({default:e.NetworkPage})),__vite__mapDeps([76,1,2,3,4,10,5,28,19,77,6,40,69,70,16,71,17,13,72]),import.meta.url)),Dm=m(()=>i(()=>import(`./Integrations-GZm_SrQK.js`).then(e=>({default:e.IntegrationsPage})),__vite__mapDeps([78,1,2,3,4,10,5,19,77,64,79,40,69,70,6,16,71,17,13,12]),import.meta.url)),Om=m(()=>i(()=>import(`./Data-BvY-zVHv.js`).then(e=>({default:e.DataPage})),__vite__mapDeps([80,1,2,3,4,10,5,81,29,46,6,40,44,25,45,47,34,13]),import.meta.url)),km=m(()=>i(()=>import(`./System-DxszqVYV.js`).then(e=>({default:e.SystemPage})),__vite__mapDeps([82,1,2,3,4,10,5,19,63,6,40,16,71,17,13]),import.meta.url)),Am=m(()=>i(()=>import(`./Cluster-Bn5YZafT.js`).then(e=>({default:e.ClusterPage})),__vite__mapDeps([83,1,2,3,4,10,5,46,84,65,6,16,23,58,47]),import.meta.url)),jm=m(()=>i(()=>import(`./Terminal-BMG2w8DZ.js`).then(e=>({default:e.TerminalPage})),__vite__mapDeps([85,1,2,3,4,19,5,6,16,86]),import.meta.url)),Mm=m(()=>i(()=>import(`./Notifications-DWJcnXvV.js`).then(e=>({default:e.NotificationsPage})),__vite__mapDeps([87,1,2,3,4,10,5,27,19,75,88,61,6,40,52,53,41,13,33]),import.meta.url)),Nm=m(()=>i(()=>import(`./Calendars-BdN8ZQmv.js`).then(e=>({default:e.CalendarsPage})),__vite__mapDeps([89,1,2,3,4,10,5,19,6]),import.meta.url)),Pm=new D({defaultOptions:{queries:{gcTime:0,staleTime:0,retry:!1,refetchOnWindowFocus:!1}}});Qt(Pm);function Fm({field:e,value:t,onChange:n,disabled:r}){return N(Hl,{field:e,value:t,onChange:n,disabled:r})}var Im={"model-selector":Fm};function Lm({children:e}){let{t}=V(),{user:n,logout:r}=Nc(),[i,a]=f(0),o=j(n?.username??null);s(()=>{let e=n?.username??null;e!==o.current&&(o.current=e,Q(),a(e=>e+1))},[n]);let c=d(()=>Z(),[i]),l=p(()=>{Z().reconnect(),a(e=>e+1),Pm.invalidateQueries()},[]);du(p(()=>Qs(l),[l])),s(()=>Js(()=>{Z().isSocketTokenStale()&&l()}),[l]);let u=p(async()=>{let e=await $s();return e&&l(),e},[l]),{bootReady:m,bootError:h}=lu(c,n??null,r,u);return N(ou,{children:N(Pe,{system:c,children:N(en.Provider,{client:c.trpcClient,queryClient:Pm,children:y(on,{children:[N(yn,{children:m?e:N(Rm,{})}),m&&N(Jl,{}),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 Rm(){let{t:e}=V();return N(`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:[N(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-primary/30 border-t-primary`}),e(`app.connecting`,`Connecting…`)]})})}function zm(){return N(`div`,{className:`flex min-h-screen items-center justify-center bg-background`,children:N(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-primary/30 border-t-primary`})})}function Bm(){return N(kt,{defaultMode:`dark`,children:N(M,{client:Pm,children:N(Mc,{children:N(Lm,{children:N(dn,{children:N(ql,{children:y(Zn,{renderers:Im,children:[N(ao,{basename:We(),children:N(Il,{children:N(w,{fallback:N(zm,{}),children:y(ga,{children:[N(Y,{path:`/login`,element:N(am,{})}),N(Y,{path:`/admin/*`,element:N(om,{})}),N(Y,{path:`/admin`,element:N(om,{})}),N(Y,{path:`/change-password`,element:N($,{children:N(hp,{})})}),N(Y,{path:`/showroom`,element:N(pm,{})}),N(Y,{path:`/embed/player`,element:N(mm,{})}),y(Y,{element:N($,{children:N(yr,{children:N(qf,{})})}),children:[N(Y,{index:!0,element:N(sm,{})}),N(Y,{path:`/access-denied`,element:N(pp,{})}),N(Y,{path:`/dashboard`,element:N(J,{to:`/devices`,replace:!0})}),N(Y,{path:`/devices`,element:N(cm,{})}),N(Y,{path:`/cameras`,element:N(J,{to:`/devices`,replace:!0})}),N(Y,{path:`/integrations`,element:N(lm,{})}),N(Y,{path:`/integrations/:integrationId`,element:N(um,{})}),N(Y,{path:`/system/pipeline`,element:N(dm,{})}),N(Y,{path:`/pipeline`,element:N(J,{to:`/system/pipeline`,replace:!0})}),N(Y,{path:`/live`,element:N(_m,{})}),N(Y,{path:`/devices/:deviceId`,element:N(fm,{})}),N(Y,{path:`/system/logs`,element:N($,{requireAdmin:!0,children:N(wm,{})})}),N(Y,{path:`/system/addons`,element:N($,{requireAdmin:!0,children:N(xm,{})})}),N(Y,{path:`/system/ai`,element:N($,{requireAdmin:!0,children:N(Sm,{})})}),N(Y,{path:`/system/settings`,element:N($,{requireAdmin:!0,children:N(km,{})})}),N(Y,{path:`/system/nodes`,element:N($,{requireAdmin:!0,children:N(Am,{})})}),N(Y,{path:`/system/notifications`,element:N($,{requireAdmin:!0,children:N(Mm,{})})}),N(Y,{path:`/system/calendars`,element:N($,{requireAdmin:!0,children:N(Nm,{})})}),N(Y,{path:`/system/identity`,element:N($,{requireAdmin:!0,children:N(Tm,{})})}),N(Y,{path:`/system/my-access`,element:N(Cm,{})}),N(Y,{path:`/system/network`,element:N($,{requireAdmin:!0,children:N(Em,{})})}),N(Y,{path:`/system/integrations`,element:N($,{requireAdmin:!0,children:N(Dm,{})})}),N(Y,{path:`/system/data`,element:N($,{requireAdmin:!0,children:N(Om,{})})}),N(Y,{path:`/system`,element:N(J,{to:Zl,replace:!0})}),N(Y,{path:`/system/terminal`,element:N($,{requireAdmin:!0,children:N(jm,{})})}),Ql.map(e=>N(Y,{path:e.path,element:N(eu,{tab:e.tab})},e.path)),N(Y,{path:`/system/users`,element:N(J,{to:`/system/identity?tab=users`,replace:!0})}),N(Y,{path:`/system/api-keys`,element:N(J,{to:`/system/identity?tab=api-keys`,replace:!0})}),N(Y,{path:`/system/authentication`,element:N(J,{to:lp(`authentication`),replace:!0})}),N(Y,{path:`/system/linked-sessions`,element:N(J,{to:`/system/identity?tab=linked-sessions`,replace:!0})}),N(Y,{path:`/system/remote-access`,element:N(J,{to:lp(`remoteAccess`),replace:!0})}),N(Y,{path:`/system/turn`,element:N(J,{to:lp(`turn`),replace:!0})}),N(Y,{path:`/system/storage`,element:N(J,{to:`/system/data?tab=storage`,replace:!0})}),N(Y,{path:`/system/backup`,element:N(J,{to:`/system/data?tab=backup`,replace:!0})}),N(Y,{path:`/library`,element:N($,{requireAdmin:!0,children:N(hm,{})})}),N(Y,{path:`/retrain`,element:N(J,{to:`/addon/training`,replace:!0})}),N(Y,{path:`/recordings`,element:N($,{requireAdmin:!0,children:N(gm,{})})}),N(Y,{path:`/build`,element:N($,{requireAdmin:!0,children:N(vm,{})})}),N(Y,{path:Zf,element:N($,{requireAdmin:!0,children:N(ym,{})})}),N(Y,{path:Qf,element:N($,{requireAdmin:!0,children:N(ym,{})})}),N(Y,{path:`/locations`,element:N($,{requireAdmin:!0,children:N(bm,{})})}),N(Y,{path:`/automation`,element:N(Ul,{to:`/build`})}),N(Y,{path:`/addon/:pagePath`,element:N($,{requireAdmin:!0,children:N(vu,{})})}),N(Y,{path:`*`,element:N(J,{to:`/devices`,replace:!0})})]})]})})})}),N(ru,{})]})})})})})})})}a(),window.__camstackUiLibrary=Rn,window.__camstackSdk=On,window.__camstackTypes=dt;var Vm=cr(document.getElementById(`root`));nf(window.location.pathname,We())?em(Vm):Vm.render(N(S,{children:N(Bm,{})}));export{J as $,Pl as A,Fc as B,Dd as C,au as D,Lu as E,Qc as F,cs as G,_s as H,el as I,X as J,ss as K,Jc as L,ol as M,il as N,Zl as O,Zc as P,so as Q,qc as R,Id as S,Hu as T,ls as U,Nc as V,fs as W,$o as X,as as Y,Xo as Z,tp as _,op as a,Rd as b,sp as c,dp as d,Vi as et,$f as f,np as g,Jf as h,ap as i,xl as j,Kl as k,lp as l,Yf as m,Dp as n,go as nt,rp as o,Xf as p,os as q,cp as r,ip as s,kp as t,Gi as tt,up as u,ep as v,cd as w,Xd as x,uf as y,Kc as z};
4
+ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=q(),d;if(t){let e=typeof t==`string`?jr(t):t;H(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})):Pr(e,{pathname:p});U(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),U(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=ta(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:W([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:W([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?k(ki.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function Yi(){let e=ua(),t=mi(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=k(b,null,k(`p`,null,`💿 Hey developer 👋`),k(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,k(`code`,{style:a},`ErrorBoundary`),` or`,` `,k(`code`,{style:a},`errorElement`),` prop on your route.`)),k(b,null,k(`h2`,null,`Unexpected Application Error!`),k(`h3`,{style:{fontStyle:`italic`}},t),n?k(`pre`,{style:i},n):null,o)}var Xi=k(Yi,null),Zi=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=Fi(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:k(K.Provider,{value:this.props.routeContext},k(Ai.Provider,{value:e,children:this.props.component}));return this.context?k($i,{error:e},t):t}};Zi.contextType=wi;var Qi=new WeakMap;function $i({children:e,error:t}){let{basename:n}=v(G);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Pi(t.digest);if(e){let r=Qi.get(t);if(r)throw r;let i=_i(e.location,n),a=i.absoluteURL||i.to;if(xi(a))throw Error(`Invalid redirect location`);if(gi&&!Qi.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 Qi.set(t,n),n}return k(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function ea({routeContext:e,match:t,children:n}){let r=v(Si);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),k(K.Provider,{value:e},n)}function ta(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);H(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:hi(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||Xi,o&&(s<0&&c===0?(pa(`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?k(n.route.Component,null):n.route.element?n.route.element:e,k(ea,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?k(Zi,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function na(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ra(e){let t=v(Si);return H(t,na(e)),t}function ia(e){let t=v(Ci);return H(t,na(e)),t}function aa(e){let t=v(K);return H(t,na(e)),t}function oa(e){let t=aa(e),n=t.matches[t.matches.length-1];return H(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function sa(){return oa(`useRouteId`)}function ca(){let e=ia(`useNavigation`);return d(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function la(){let{matches:e,loaderData:t}=ia(`useMatches`);return d(()=>e.map(e=>Ir(e,t)),[e,t])}function ua(){let e=v(Ai),t=ia(`useRouteError`),n=oa(`useRouteError`);return e===void 0?t.errors?.[n]:e}function da(){let{router:e}=ra(`useNavigate`),t=oa(`useNavigate`),n=j(!1);return Bi(()=>{n.current=!0}),p(async(r,i={})=>{U(n.current,zi),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var fa={};function pa(e,t,n){!t&&!fa[e]&&(fa[e]=!0,U(!1,n))}h(ma);function ma({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Ji(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function J({to:e,replace:t,state:n,relative:r}){H(Li(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=v(G);U(!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=Vi(),l=si(e,oi(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){H(!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 ha({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){H(!Li(),`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=jr(n));let{pathname:l=`/`,search:u=``,hash:f=``,state:p=null,key:m=`default`,mask:h}=n,g=d(()=>{let e=ti(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 U(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:k(G.Provider,{value:c},k(ki.Provider,{children:t,value:g}))}function ga({children:e,location:t}){return qi(_a(e),t)}function _a(e,t=[]){let n=[];return l.forEach(e,(e,r)=>{if(!O(e))return;let i=[...t,r];if(e.type===b){n.push.apply(n,_a(e.props.children,i));return}H(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>`),H(!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=_a(e.props.children,i)),n.push(a)}),n}var va=`get`,ya=`application/x-www-form-urlencoded`;function ba(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function xa(e){return ba(e)&&e.tagName.toLowerCase()===`button`}function Sa(e){return ba(e)&&e.tagName.toLowerCase()===`form`}function Ca(e){return ba(e)&&e.tagName.toLowerCase()===`input`}function wa(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ta(e,t){return e.button===0&&(!t||t===`_self`)&&!wa(e)}function Ea(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 Da(e,t){let n=Ea(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Oa=null;function ka(){if(Oa===null)try{new FormData(document.createElement(`form`),0),Oa=!1}catch{Oa=!0}return Oa}var Aa=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function ja(e){return e!=null&&!Aa.has(e)?(U(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ya}"`),null):e}function Ma(e,t){let n,r,i,a,o;if(Sa(e)){let o=e.getAttribute(`action`);r=o?ti(o,t):null,n=e.getAttribute(`method`)||va,i=ja(e.getAttribute(`enctype`))||ya,a=new FormData(e)}else if(xa(e)||Ca(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?ti(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||va,i=ja(e.getAttribute(`formenctype`))||ja(o.getAttribute(`enctype`))||ya,a=new FormData(o,e),!ka()){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(ba(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=va,r=null,i=ya,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 Na={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Pa=/[&><\u2028\u2029]/g;function Fa(e){return e.replace(Pa,e=>Na[e])}function Ia(e,t){if(e===!1||e==null)throw Error(t)}function La(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&&ti(i.pathname,t)===`/`?i.pathname=`${li(t)}/_root.${r}`:i.pathname=`${li(i.pathname)}.${r}`,i}async function Ra(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 za(e){return e!=null&&typeof e.page==`string`}function Ba(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 Va(e,t,n){return Ka((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Ra(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Ba).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Ha(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 Ua(e,t,{includeHydrateFallback:n}={}){return Wa(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 Wa(e){return[...new Set(e)]}function Ga(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Ka(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!za(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Ga(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function qa(){let e=v(Si);return Ia(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Ja(){let e=v(Ci);return Ia(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Ya=g(void 0);Ya.displayName=`FrameworkContext`;function Xa(){let e=v(Ya);return Ia(e,`You must render this element inside a <HydratedRouter> element`),e}function Za(e,t){let n=v(Ya),[r,i]=f(!1),[a,o]=f(!1),{onFocus:c,onBlur:l,onMouseEnter:u,onMouseLeave:d,onTouchStart:p}=t,m=j(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:Qa(c,h),onBlur:Qa(l,g),onMouseEnter:Qa(u,h),onMouseLeave:Qa(d,g),onTouchStart:Qa(p,h)}]:[a,m,{}]:[!1,m,{}]}function Qa(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function $a({page:e,...t}){let n=Ti(),{nonce:r}=Xa(),{router:i}=qa(),a=d(()=>Pr(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),k(n?to:no,{page:e,matches:a,...t})):null}function eo(e){let{manifest:t,routeModules:n}=Xa(),[r,i]=f([]);return s(()=>{let r=!1;return Va(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function to({page:e,matches:t,...n}){let r=q(),{future:i}=Xa(),{basename:a}=qa();return k(b,null,d(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=La(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=>k(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function no({page:e,matches:t,...n}){let r=q(),{future:i,manifest:a,routeModules:o}=Xa(),{basename:s}=qa(),{loaderData:c,matches:l}=Ja(),u=d(()=>Ha(e,t,l,a,r,`data`),[e,t,l,a,r]),f=d(()=>Ha(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=La(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(()=>Ua(f,a),[f,a]),h=eo(f);return k(b,null,p.map(e=>k(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),m.map(e=>k(`link`,{key:e,rel:`modulepreload`,href:e,...n})),h.map(({key:e,link:t})=>k(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function ro(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var io=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{io&&(window.__reactRouterVersion=`7.18.0`)}catch{}function ao({basename:e,children:t,useTransitions:n,window:r}){let i=j();i.current??=Er({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]),k(ha,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function oo({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]),k(ha,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}oo.displayName=`unstable_HistoryRouter`;var so=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`&&xr.test(l),x=_i(l,h);l=x.to;let S=Ii(l,{relative:r}),C=q(),w=null;if(o){let e=si(o,[],C.mask?C.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:W([h,e.pathname])),w=g.createHref(e)}let[T,E,D]=Za(n,p),O=ho(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function A(t){e&&e(t),t.defaultPrevented||O(t)}let j=!(x.isExternal||i),M=k(`a`,{...p,...D,href:(j?w:void 0)||x.absoluteURL||S,onClick:j?A:e,ref:ro(m,E),target:c,"data-discover":!y&&t===`render`?`true`:void 0});return T&&!y?k(b,null,M,k($a,{page:S})):M});so.displayName=`Link`;var co=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=Ki(a,{relative:c.relative}),d=q(),f=v(Ci),{navigator:p,basename:m}=v(G),h=f!=null&&Eo(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=ti(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 k(so,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});co.displayName=`NavLink`;var lo=o(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=va,action:s,onSubmit:c,relative:l,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h)=>{let{useTransitions:g}=v(G),_=yo(),y=bo(s,{relative:l}),b=o.toLowerCase()===`get`?`get`:`post`,x=typeof s==`string`&&xr.test(s);return k(`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})});lo.displayName=`Form`;function uo({getKey:e,storageKey:t,...n}){let r=v(Ya),{basename:i}=v(G),a=q(),o=la();wo({getKey:e,storageKey:t});let s=d(()=>{if(!r||!e)return null;let t=Co(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),k(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Fa(JSON.stringify(t||xo))}, ${Fa(JSON.stringify(s))})`}})}uo.displayName=`ScrollRestoration`;function fo(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function po(e){let t=v(Si);return H(t,fo(e)),t}function mo(e){let t=v(Ci);return H(t,fo(e)),t}function ho(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let d=Vi(),f=q(),m=Ki(e,{relative:o});return p(p=>{if(Ta(p,t)){p.preventDefault();let t=n===void 0?Ar(f)===Ar(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 go(e){U(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=j(Ea(e)),n=j(!1),r=q(),i=d(()=>Da(r.search,n.current?null:t.current),[r.search]),a=Vi();return[i,p((e,t)=>{let r=Ea(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var _o=0,vo=()=>`__${String(++_o)}__`;function yo(){let{router:e}=po(`useSubmit`),{basename:t}=v(G),n=sa(),r=e.fetch,i=e.navigate;return p(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Ma(e,t);a.navigate===!1?await r(a.fetcherKey||vo(),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 bo(e,{relative:t}={}){let{basename:n}=v(G),r=v(K);H(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Ki(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:W([n,a.pathname])),Ar(a)}var xo=`react-router-scroll-positions`,So={};function Co(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:ti(e.pathname,n)||e.pathname},t)),i??=e.key,i}function wo({getKey:e,storageKey:t}={}){let{router:n}=po(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=mo(`useScrollRestoration`),{basename:a}=v(G),o=q(),c=la(),l=ca();s(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),To(p(()=>{if(l.state===`idle`){let t=Co(o,c,a,e);So[t]=window.scrollY}try{sessionStorage.setItem(t||xo,JSON.stringify(So))}catch(e){U(!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||xo);e&&(So=JSON.parse(e))}catch{}},[t]),x(()=>{let t=n?.enableScrollRestoration(So,()=>window.scrollY,e?(t,n)=>Co(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{U(!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 To(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 Eo(e,{relative:t}={}){let n=v(Ei);H(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=po(`useViewTransitionState`),i=Ki(e,{relative:t});if(!n.isTransitioning)return!1;let a=ti(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=ti(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Zr(i.pathname,o)!=null||Zr(i.pathname,a)!=null}var Do=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}}))()),Oo=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function ko(e){var t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(Do.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(Oo),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 Ao=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,jo=/^\s*$/,Mo=Object.create(null);function No(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(No,``)+`</`+t.name+`>`;case`comment`:return e+`<!--`+t.comment+`-->`}}var Po={parse:function(e,t){t||={},t.components||=Mo;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(Ao,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=ko(s);return a<0?(r.push(m),r):((l=i[a]).children.push(m),r)}if(u&&(a++,(n=ko(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);jo.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+No(``,t)},``)}};a();var Fo=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},Io=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?Ro(t):t},Lo=e=>Array.isArray(e)&&e.every(O),Ro=e=>Array.isArray(e)?e:[e],zo=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},Bo=e=>{let t={};if(!e)return t;let n=e=>{Ro(e).forEach(e=>{dr(e)||(Fo(e)?n(Io(e)):gr(e)&&!O(e)&&Object.assign(t,e))})};return n(e),t},Vo=(e,t,n,r)=>{if(!e)return``;let i=``,a=Ro(e),o=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return a.forEach((e,a)=>{if(dr(e)){i+=`${e}`;return}if(O(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=dr(d)?d:Vo(d,t,n,r);i+=`<${c}>${e}</${c}>`;return}let f=Vo(d,t,n,r);i+=`<${a}>${f}</${a}>`;return}if(e===null){pr(n,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:r});return}if(gr(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}pr(n,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:r,child:e});return}pr(n,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:r,child:e})}),i},Ho=(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},Uo=(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=>{Ro(e).forEach(e=>{dr(e)||(Fo(e)?f(Io(e)):gr(e)&&!O(e)&&Object.assign(d,e))})};f(e);let p=Ho(n,s,d),m=Po.parse(`<0>${p}</0>`),h={...d,...a},g=(e,t,n)=>{let r=Io(e),i=v(r,t.children,n);return Lo(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])}),k(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=Ro(e),l=Ro(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];dr(t)&&(m[e]=hr(t))});let y=Object.keys(m).length===0?p:zo({props:m},p),b=O(y),x=b&&Fo(n,!0)&&!n.voidElement,S=u&&gr(y)&&y.dummy&&!b,C=gr(t)&&Object.hasOwnProperty.call(t,n.name);if(dr(y)){let t=r.services.interpolator.interpolate(y,h,r.language);e.push(t)}else if(Fo(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(k(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(O(a)&&a.type===n.name){if(i===t){r=a;break}i+=1}}let o=v(r?Ro(Io(r)):c,n.children,a);e.push(k(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(gr(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:ur().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(k(t,{key:`${n.name}-${l}`},s)):e.push(s)}return e},[])};return Io(v([{dummy:!0,children:e||[]}],m,Ro(e||[]))[0])},Wo=(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 k(b,null,i)}return k(a,{key:r})},Go=(e,t)=>e.map((e,n)=>Wo(e,n,t)),Ko=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:Wo(e[r],r,t)})}),n},qo=(e,t,n,r)=>e?Array.isArray(e)?Go(e,t):gr(e)?Ko(e,t):(_r(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,Jo=e=>!gr(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function Yo({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||fr();if(!m)return _r(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={...ur(),...m.options?.react},_=l||h.ns||m.options?.defaultNS;_=dr(_)?[_]:_||[`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=Vo(e,g,m,r),w=s||y?.defaultValue||C||g.transEmptyNodeValue||(typeof r==`function`?lr(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=Bo(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:`?$#`}},A={...y,context:i||y.context,count:t,...o,...O,defaultValue:w,ns:_},j=E?h(E,A):w;j===E&&w&&(j=w);let M=qo(S,j,m,r),N=M||e,P=null;Jo(M)&&(P=M,N=e);let F=Uo(N,P,j,m,g,A,b),I=n??g.defaultTransParent;return I?k(I,p,F):F}a();function Xo({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(mr)||{},g=u||m||fr(),_=d||g?.t.bind(g);return Yo({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})}var Zo={streaming:{icon:Et,labelKey:`capabilityBadges.streaming`},detection:{icon:fe,labelKey:`capabilityBadges.detection`},recording:{icon:ke,labelKey:`capabilityBadges.recording`},audio:{icon:_e,labelKey:`capabilityBadges.audio`},snapshot:{icon:te,labelKey:`capabilityBadges.snapshot`},motion:{icon:Ye,labelKey:`capabilityBadges.motion`},ptz:{icon:Je,labelKey:`capabilityBadges.ptz`},webrtc:{icon:Ze,labelKey:`capabilityBadges.webrtc`},onvif:{icon:Ce,labelKey:`capabilityBadges.onvif`},analytics:{icon:ve,labelKey:`capabilityBadges.analytics`},"battery-operated":{icon:ae,labelKey:`capabilityBadges.battery`},"native-snapshot":{icon:te,labelKey:`capabilityBadges.nativeSnapshot`},"pan-tilt-zoom":{icon:Je,labelKey:`capabilityBadges.ptz`},"two-way-audio":{icon:_e,labelKey:`capabilityBadges.twoWayAudio`},"doorbell-button":{icon:oe,labelKey:`capabilityBadges.doorbell`},rebootable:{icon:Te,labelKey:`capabilityBadges.rebootable`},"vacuum-has-map":{icon:St,labelKey:`capabilityBadges.map`},"vacuum-has-ai":{icon:xe,labelKey:`capabilityBadges.aiObstacle`},"mower-has-map":{icon:St,labelKey:`capabilityBadges.map`},"mower-has-targeted-mowing":{icon:ge,labelKey:`capabilityBadges.targetedMowing`}},Qo=F;function $o({capabilities:e,showLabels:t=!1}){let{t:n}=V();return N(`div`,{className:`flex items-center gap-1 flex-wrap`,children:e.map(e=>{let r=Zo[e],i=r?.icon??Qo,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:[N(i,{className:`h-3 w-3`}),t&&N(`span`,{children:a})]},e)})})}a();var es={amcrest:{icon:bt,color:`#3b82f6`,label:`Amcrest`},hikvision:{icon:Ee,color:`#a855f7`,label:`Hikvision`},reolink:{icon:Ze,color:`#06b6d4`,label:`Reolink`},homeassistant:{icon:Xe,color:`#22d3ee`,label:`Home Assistant`},rtsp:{icon:Ne,color:`#78716c`,label:`RTSP`},onvif:{icon:Ne,color:`#78716c`,label:`ONVIF`}},ts={sm:`h-4 w-4`,md:`h-5 w-5`,lg:`h-6 w-6`},ns={sm:`h-7 w-7`,md:`h-8 w-8`,lg:`h-10 w-10`};function rs(e){let t=e.toLowerCase();return t.startsWith(`provider-`)?t.slice(9):t}function is(e){return es[rs(e)]??{icon:bt,color:`#78716c`,label:e}}function as({type:e,size:t=`md`,showLabel:n}){let r=is(e),i=r.icon,[a,o]=f(!1),s=vr(e);return y(`div`,{className:`flex items-center gap-2`,children:[N(`div`,{className:`flex items-center justify-center rounded-lg ${ns[t]}`,style:{backgroundColor:`${r.color}15`},children:a||!s?N(i,{className:ts[t],style:{color:r.color}}):N(`img`,{src:s,alt:r.label,className:ts[t],onError:()=>o(!0)})}),n&&N(`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:[N(`span`,{className:`text-[11px] text-foreground-subtle`,children:e}),N(`div`,{className:`min-w-0 text-[11px] text-foreground`,children:t})]}):y(`div`,{className:`${me} flex items-start gap-2 sm:gap-3`,children:[N(`span`,{className:`w-20 sm:w-28 flex-shrink-0 text-[11px] text-foreground-subtle`,children:e}),N(`div`,{className:`flex-1 min-w-0 text-[11px] text-foreground`,children:t})]})}a();function os({deviceId:e,initialName:t,label:n=`Name`,layout:r=`inline`,onError:i,onSaved:a,onCancel:o}){let{t:c}=V(),l=A(),[u,d]=f(!1),[p,m]=f(t),[h,g]=f(!1),_=j(null);s(()=>{u||m(t)},[t,u]),s(()=>{u&&_.current?.focus()},[u]);let v=Ut({onSuccess:()=>{l.invalidateQueries({queryKey:[[`deviceManager`,`getDevice`]]}),l.invalidateQueries({queryKey:[[`deviceManager`,`listAll`]]}),l.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]})}}),b=async()=>{let n=p.trim();if(n.length===0||n===t){d(!1),m(t),a?.();return}g(!0);try{await v.mutateAsync({deviceId:e,name:n}),d(!1),a?.()}catch(e){i?.(e instanceof Error?e.message:String(e))}finally{g(!1)}},x=()=>{m(t),d(!1),o?.()};return u?N(X,{label:n,layout:r,value:y(`div`,{className:`flex items-center gap-1`,children:[N(`input`,{ref:_,type:`text`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`?b():e.key===`Escape`&&x()},disabled:h,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`}),N(`button`,{type:`button`,onClick:()=>void b(),disabled:h,className:`p-0.5 rounded hover:bg-success/10 text-success disabled:opacity-50`,"aria-label":c(`inlineEdit.save`),children:N(pe,{className:`h-3 w-3`})}),N(`button`,{type:`button`,onClick:x,disabled:h,className:`p-0.5 rounded hover:bg-danger/10 text-danger disabled:opacity-50`,"aria-label":c(`inlineEdit.cancel`),children:N(De,{className:`h-3 w-3`})})]})}):N(X,{label:n,layout:r,value:y(`div`,{className:`flex items-center gap-2 group`,children:[N(`span`,{className:`truncate`,children:t}),N(`button`,{type:`button`,onClick:()=>d(!0),className:`p-0.5 rounded text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,"aria-label":c(`inlineEdit.editName`),children:N(re,{className:`h-3.5 w-3.5`})})]})})}a();function ss({deviceId:e,initialLocation:t,label:n=`Location`,layout:r=`inline`,onError:i,onSaved:a,onCancel:o}){let{t:c}=V(),l=A(),[u,p]=f(!1),[m,h]=f(t??``),[g,_]=f(!1),v=j(null),{data:b}=rr(void 0,{enabled:u}),x=b??[];s(()=>{u||h(t??``)},[t,u]),s(()=>{u&&v.current?.focus()},[u]);let S=Jt({onSuccess:()=>{l.invalidateQueries({queryKey:[[`deviceManager`,`getDevice`]]}),l.invalidateQueries({queryKey:[[`deviceManager`,`listAll`]]}),l.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]}),l.invalidateQueries({queryKey:[[`deviceManager`,`listLocations`]]})}}),C=d(()=>{let e=m.trim().toLowerCase();return e.length===0?x:x.filter(t=>t.toLowerCase()!==e&&t.toLowerCase().includes(e))},[x,m]),w=m.trim().length>0&&!x.some(e=>e.toLowerCase()===m.trim().toLowerCase()),T=async n=>{let r=(n??m).trim(),o=r.length===0?null:r;if(o===(t??null)){p(!1),a?.();return}_(!0);try{await S.mutateAsync({deviceId:e,location:o}),p(!1),a?.()}catch(e){i?.(e instanceof Error?e.message:String(e))}finally{_(!1)}},E=()=>{h(t??``),p(!1),o?.()};return u?N(X,{label:n,layout:r,value:y(`div`,{className:`relative`,children:[y(`div`,{className:`flex items-center gap-1`,children:[N(`input`,{ref:v,type:`text`,value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`?T():e.key===`Escape`&&E()},disabled:g,placeholder:c(`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`}),N(`button`,{type:`button`,onClick:()=>void T(),disabled:g,className:`p-0.5 rounded hover:bg-success/10 text-success disabled:opacity-50`,"aria-label":c(`inlineEdit.save`),children:N(pe,{className:`h-3 w-3`})}),N(`button`,{type:`button`,onClick:E,disabled:g,className:`p-0.5 rounded hover:bg-danger/10 text-danger disabled:opacity-50`,"aria-label":c(`inlineEdit.cancel`),children:N(De,{className:`h-3 w-3`})})]}),(C.length>0||w)&&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:[C.map(e=>y(`button`,{type:`button`,onClick:()=>{h(e),T(e)},className:`w-full flex items-center gap-2 px-2 py-1 text-left text-[11px] hover:bg-surface-hover`,children:[N(qe,{className:`h-3 w-3 text-foreground-subtle flex-shrink-0`}),N(`span`,{className:`truncate`,children:e})]},e)),w&&y(`button`,{type:`button`,onClick:()=>void T(),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:[N(`span`,{className:`text-foreground-subtle`,children:c(`shared.locationRow.create`,`Create`)}),y(`span`,{className:`font-medium truncate`,children:[`"`,m.trim(),`"`]})]})]})]})}):N(X,{label:n,layout:r,value:y(`div`,{className:`flex items-center gap-2 group`,children:[t?N(`span`,{className:`truncate`,children:t}):N(`span`,{className:`italic text-foreground-subtle`,children:c(`common.unset`)}),N(`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":c(`inlineEdit.editLocation`),children:N(re,{className:`h-3.5 w-3.5`})})]})})}a();function cs(e){return fn({addonId:e,projection:`slim`})}function ls(e){return Vn({deviceId:e},{enabled:Number.isFinite(e)})}var us=3e4,ds=2e3;function fs(e){let t=j(0);return t.current===0&&(t.current=Date.now()),hn({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>=us?!1:ds}})}a();function ps({deviceId:e}){let{t}=V(),n=A(),{data:r}=ls(e),{data:i}=fs(e),[a,o]=f(null),s=$t({onSuccess:()=>{o(null),n.invalidateQueries({queryKey:[[`deviceManager`]]})},onError:e=>{o(`Could not change primary child: ${e.message}`)}});if(r==null||String(r.type??``)!==rt.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=er(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:[N(X,{label:t(`shared.primaryChildRow.primaryChild`,`Primary child`),value:N(xn,{childrenList:c,selectedId:u,onSetPrimary:t=>s.mutate({deviceId:e,primaryChildEntityId:t}),disabled:s.isPending})}),a!==null&&N(`p`,{role:`alert`,className:`px-3 sm:px-4 py-1.5 text-[11px] text-danger`,children:a})]})}a();var ms=[`manufacturer`,`model`,`hardware`,`firmware`,`serialNumber`,`uid`,`mac`,`itemNo`];function hs(e){return e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/^./,e=>e.toUpperCase())}function gs(e){return e==null?`—`:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e)}function _s(){let{t:e}=V(),t=un(),n=ln(),{data:r}=Vn({deviceId:t??0},{enabled:t!==null}),{data:i}=Qn({deviceId:t??0},{enabled:t!==null}),a=r??n??null,[o,s]=f(`identity`);if(t===null||!a)return null;let c=String(a.stableId??``),l=String(a.name??``),u=String(a.type??``),d=String(a.addonId??``),p=a.features??[],m=new Set([`device-status`,`feature-probe`,`device-ops`]),h=(i?.entries??[]).filter(e=>e.kind===`native`&&!m.has(e.capName)).map(e=>e.capName),g=p.length>0?p:h,_=a.location??null,v=a.metadata??null,b=v!==null&&Object.keys(v).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:[N(`h2`,{className:`text-[11px] font-semibold text-foreground uppercase tracking-wider`,children:e(`overviewAdapters.deviceInfoAdapter.deviceInfo`,`Device Info`)}),b&&y(`div`,{className:`flex items-center gap-1 rounded-md bg-surface-hover p-0.5`,children:[N(vs,{active:o===`identity`,onClick:()=>s(`identity`),label:e(`overviewAdapters.deviceInfoAdapter.identity`,`Identity`)}),N(vs,{active:o===`hardware`,onClick:()=>s(`hardware`),label:e(`overviewAdapters.deviceInfoAdapter.hardware`,`Hardware`)})]})]}),(!b||o===`identity`)&&y(`div`,{className:`divide-y divide-border`,children:[N(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:[`(`,c,`)`]})]})}),N(os,{deviceId:t,initialName:l}),N(ss,{deviceId:t,initialLocation:_}),N(ps,{deviceId:t}),N(X,{label:e(`overviewAdapters.deviceInfoAdapter.type`,`Type`),value:u}),N(X,{label:e(`overviewAdapters.deviceInfoAdapter.provider`,`Provider`),value:N(as,{type:d,size:`sm`,showLabel:!0})}),N(X,{label:e(`overviewAdapters.deviceInfoAdapter.capabilities`,`Capabilities`),value:g.length>0?N($o,{capabilities:g,showLabels:!0}):N(`span`,{className:`text-[11px] text-foreground-subtle`,children:e(`overviewAdapters.deviceInfoAdapter.none`,`None`)})})]}),b&&o===`hardware`&&N(ys,{metadata:v})]})}function vs({active:e,onClick:t,label:n}){return N(`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 ys({metadata:e}){let{t}=V(),n=ms.filter(t=>t in e),r=Object.keys(e).filter(e=>!ms.includes(e)).toSorted(),i=[...n,...r];return y(`div`,{children:[N(`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.`)}),N(`div`,{className:`divide-y divide-border`,children:i.map(t=>N(X,{label:hs(t),value:N(`span`,{className:`font-mono text-[11px] text-foreground break-all`,children:gs(e[t])})},t))})]})}function bs(e){return e.hubReachable?e.authOk===!1?{kind:`auth-expired`}:{kind:`cluster-degraded`,offlineAgents:e.offlineAgents,offlineAgentIds:e.offlineAgentIds}:{kind:`hub-unreachable`}}function xs(e){switch(e.kind){case`connected`:return null;case`reconnecting`:return{severity:`warning`,message:B.t(`connection.reconnecting`),i18nKey:`connection.reconnecting`,showSpinner:!0};case`cluster-degraded`:{let t=e.offlineAgentIds??[];return t.length>0?{severity:`warning`,message:B.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:B.t(`connection.degradedCount`,{count:e.offlineAgents}),i18nKey:`connection.degradedCount`,i18nParams:{count:e.offlineAgents},showSpinner:!0}:{severity:`warning`,message:B.t(`connection.degraded`),i18nKey:`connection.degraded`,showSpinner:!0}}case`hub-unreachable`:return{severity:`danger`,message:B.t(`connection.disconnected`),i18nKey:`connection.disconnected`,showSpinner:!0};case`auth-expired`:return{severity:`danger`,message:B.t(`connection.sessionExpired`),i18nKey:`connection.sessionExpired`,showSpinner:!1,action:`sign-in`}}}var Ss=4e3,Cs=5e3;function ws(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 Ts(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 Es(e){let t=e.fetchFn??fetch,n=e.timeoutMs??Ss,r=e.origin.replace(/\/+$/,``),i;try{i=await Ts(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 Ts(t,`${r}/health/details`,n,{Authorization:`Bearer ${o}`});e.ok&&(a=await e.json())}catch{}let s;try{s=ws(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 Ts(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 Ds={kind:`connected`},Os={kind:`reconnecting`};function ks(e){let t=e.probeIntervalMs??Cs,n=new Set,r=Ds,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(bs(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(Ds);return}if(e===`connecting`){c(),s(Os);return}(r.kind===`connected`||r.kind===`reconnecting`)&&s(Os),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 As=null;function js(){return As===null&&(As=ks({probe:()=>Es({origin:be(),getToken:()=>localStorage.getItem(`camstack_admin_token`)})})),As}function Ms(e){js().onSdkConnectionState(e)}var Ns=null,Ps=0;function Z(){if(!Ns){let e=Ps;Ns=qt({serverUrl:be(),token:localStorage.getItem(`camstack_admin_token`)??void 0,getLanguage:()=>B.language,refreshCredential:async e=>{e===`rejected`?await Xs().refreshNow():await Xs().ensureFresh()},onConnectionChange:t=>{e===Ps&&Ms(t)}})}return Ns}function Q(){let e=Ns;Ns=null,Ps+=1,e?.close()}var Fs=`camstack_admin_token`,Is=`camstack_admin_refresh`,Ls=`camstack_admin_token_expires`;function Rs(e){try{let t=localStorage.getItem(e);return t!==null&&t.length>0?t:null}catch{return null}}function zs(e,t){try{t===null?localStorage.removeItem(e):localStorage.setItem(e,t)}catch{}}function Bs(){let e=Rs(Fs);if(e===null)return null;let t=Rs(Is),n=Number(Rs(Ls));return{token:e,...t===null?{}:{refreshToken:t},...Number.isFinite(n)&&n>0?{expiresAt:n}:{}}}function Vs(e){zs(Fs,e.token),zs(Is,e.refreshToken??null),zs(Ls,e.expiresAt===void 0?null:String(e.expiresAt))}function Hs(){zs(Fs,null),zs(Is,null),zs(Ls,null)}function Us(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 Ws(e){await fetch(z(`/api/auth/session`),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({token:e})}).catch(()=>{})}var Gs=new Set;function Ks(e){return Gs.add(e),()=>Gs.delete(e)}var qs=new Set;function Js(e){return qs.add(e),()=>qs.delete(e)}var Ys=null;function Xs(){return Ys===null&&(Ys=new Xt({refresh:async e=>{let t=Bs();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=>{Vs(e),Z().setToken(e.token),Ws(e.token);for(let e of qs)e()},onExpired:()=>{Hs();for(let e of Gs)e()}})),Ys}function Zs(e){Vs(e),Xs().adopt(e)}async function Qs(e){try{await Xs().ensureFresh()}catch(e){console.warn(`[admin-session] pre-reconnect refresh failed; reconnecting anyway`,e)}e()}async function $s(){return await Xs().refreshNow()!==null}var ec=512;function tc(e){if(!e||e.length>ec)return null;let t=tt(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 nc=/^[A-Za-z0-9_-]{43,128}$/,rc=/^[A-Za-z0-9._~-]{1,256}$/;function ic(e){let{codeChallenge:t,state:n}=e;return!t||!nc.test(t)||(e.codeChallengeMethod??`S256`)!==`S256`||!n||!rc.test(n)?null:{codeChallenge:t,state:n,purpose:e.purpose===`step-up`?`step-up`:`new-session`}}var ac=`camstack:login-app-handoff`;function oc(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 ic({codeChallenge:n(`codeChallenge`),state:n(`state`),purpose:n(`purpose`)})}catch{return null}}function sc(e,t=Date.now()){e!==null&&yc(ac,JSON.stringify(e),oc,t)}function cc(e=Date.now()){return bc(ac,oc,e)}function lc(e,t,n){return`${e}?${`code=${encodeURIComponent(t)}`}${n===void 0?``:`&state=${encodeURIComponent(n)}`}`}function uc(e,t=Date.now()){return Cc(t)??tc(e)}var dc=2048;function fc(e){return!e||e.length>dc||!e.startsWith(`/`)||e.startsWith(`//`)||e.includes(`\\`)||e.includes(`://`)||e.includes(`..`)||e===`/login`||e.startsWith(`/login?`)||e.startsWith(`/login/`)?null:e}function pc(e,t=Date.now()){yc(_c,e,fc,t)}function mc(e=Date.now()){return bc(_c,fc,e)}function hc(e,t=Date.now()){return mc(t)??fc(e)}var gc=`camstack:login-redirect`,_c=`camstack:login-next`,vc=10*6e4;function yc(e,t,n,r){let i=xc();if(!i||!n(t))return;let a={raw:t??``,at:r};try{i.setItem(e,JSON.stringify(a))}catch{}}function bc(e,t,n){let r=xc();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>vc?null:t(a)}catch{return null}}function xc(){if(typeof window>`u`)return null;try{return window.sessionStorage}catch{return null}}function Sc(e,t=Date.now()){yc(gc,e,tc,t)}function Cc(e=Date.now()){return bc(gc,tc,e)}function wc(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:Tc(n.scopes)}}catch{return null}}function Tc(e){return ut(e)}function Ec(e){let t=wc(e);return t?t.exp*1e3<Date.now():!0}a();var Dc=`changeme`;function Oc(e){return{token:e.token,...e.refreshToken===void 0?{}:{refreshToken:e.refreshToken},...e.expiresAt===void 0?{}:{expiresAt:e.expiresAt}}}async function kc(e,t){if(await Ws(e),t.kind===`path`){window.location.replace(z(t.path));return}try{Q();let e=cc();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(lc(t.url,n,e.state))}catch{window.location.replace(z(`/`))}}async function Ac(e,t){await Ws(e),window.location.replace(z(t))}var jc=g(null);function Mc({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=Us(e),n=t?.token??null;if(t!==null&&n!==null){Zs(t);let r=Cc();if(r){kc(n,r);return}let i=mc()??fc(e.get(`next`));if(i){Ac(n,i);return}window.history.replaceState({},``,z(`/`))}}c()},[]);let c=async()=>{let e=Bs();if(e===null){i(!1);return}let t=e.token;if(e.refreshToken!==void 0){let n=Xs();n.adopt(e),await n.ensureFresh();let r=Bs();if(r===null){console.warn(`[auth] session restore: signed out — the hub refused the refresh token`),Q(),i(!1);return}t=r.token}if(Ec(t)){console.warn(`[auth] session restore: signed out — access token expired and no refresh recovered it`),Hs(),Q(),i(!1);return}let r=wc(t);if(!r){console.warn(`[auth] session restore: signed out — the stored access token is unreadable`),Hs(),Q(),i(!1);return}Ws(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 $s()){a.reconnect();try{await Z().trpcClient.system.info.query();let e=Bs();n(e&&wc(e.token)||r);return}catch{}}console.warn(`[auth] session restore: logout, probe UNAUTHORIZED and refresh did not recover it`),Xs().stop(),Hs(),Q()}else n(r)}).finally(()=>i(!1))};s(()=>Ks(()=>{Q(),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 Zs(Oc(r)),await Ws(a),Q(),n(wc(a)),o(t===Dc),{kind:`ok`}},[]),u=p(async(e,t)=>{let r=await Z().loginVerifyTotp(e,t,{refreshable:!0}),i=r.token;Zs(Oc(r)),await Ws(i),Q(),n(wc(i)),o(!1)},[]),d=p(async(e,t)=>{Zs({token:e,...t}),await Ws(e),Q(),n(wc(e)),o(!1)},[]),m=p(()=>{Z().logout().catch(()=>{}),Xs().stop(),Hs(),fetch(z(`/api/auth/session`),{method:`DELETE`}).catch(()=>{}),Q(),n(null),o(!1)},[]),h=p(()=>{o(!1)},[]);return N(jc.Provider,{value:{user:t,loading:r,mustChangePassword:a,login:l,verifyTotp:u,finalizePasskeyLogin:d,logout:m,clearMustChangePassword:h},children:e})}function Nc(){let e=v(jc);if(!e)throw Error(`useAuth must be used within AuthProvider`);return e}a();function Pc(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 Fc({schema:e,serverValues:t,onImmediateSave:n,onDeferredSave:r}){let[i,a]=f({}),[o,c]=f({}),[l,u]=f(!1),m=j(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&&(Pc(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 Ic(e){return e>=8}a();function Lc(e){if(typeof e!=`object`||!e)return;let t=Reflect.get(e,`windows`);if(!(!Array.isArray(t)||t.length===0))return e}function Rc(e){return e.type===`multiselect`}function zc(e){let t=e.suggestions;return t===void 0||t.length===0?[]:t.map(e=>({value:e,label:e}))}function Bc(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 Vc(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Hc({field:e,values:t,onChange:n,onChangeMany:r,disabled:i,translationFn:a,onTestField:o,externalProbe:s,allFields:c,onAction:l}){let{t:u}=V();if(e.type===`tags`){if(!tr(e,t,c))return null;let r=e.creatable!==!1;return N(Gn,{mode:`multi`,options:zc(e),value:Vc(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:Wc(e.label,a),description:e.description===void 0?void 0:Wc(e.description,a),placeholder:e.placeholder??u(`formBuilder.formBuilder.searchOrAdd`,`Search or add…`),testId:`config-tags-${e.key}`})}if(e.type===`schedule`){if(!tr(e,t,c))return null;let r=Wc(e.label,a),i=e.description===void 0?void 0:Wc(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&&N(`label`,{className:`block text-[11px] font-medium text-foreground-subtle`,children:r}),i!==void 0&&N(`p`,{className:`text-[10px] text-foreground-subtle`,children:i}),N(br,{mode:o,value:Lc(t[e.key]),onChange:t=>n(e.key,t)})]})}return Rc(e)&&(Ic(e.options.length)||e.creatable===!0)?tr(e,t,c)?N(Gn,{mode:`multi`,options:Bc(e.options),value:Vc(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:Wc(e.label,a),description:e.description===void 0?void 0:Wc(e.description,a),placeholder:e.placeholder??u(`formBuilder.formBuilder.searchToAdd`,`Search to add…`),testId:`config-multiselect-${e.key}`,listboxId:`msel-${e.key}`}):null:N(Mt,{field:e,values:t,onChange:n,onChangeMany:r,disabled:i,translationFn:a,onTestField:o,externalProbe:s,allFields:c,onAction:l})}function Uc(e){return/^[a-zA-Z0-9_]+(\.[a-zA-Z0-9_]+)+$/.test(e)}function Wc(e,t){if(e!==void 0)return t&&Uc(e)?t(e):e}function Gc({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+ +!!tr(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&&N(`h3`,{className:`text-[11px] font-semibold text-foreground-subtle uppercase tracking-wider`,children:Wc(e.title,a)}),e.description&&N(`p`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:Wc(e.description,a)})]}),d&&N(`span`,{className:`text-foreground-subtle text-xs ml-2`,children:l?`▸`:`▾`})]}),!(l&&!_)&&(g===void 0?N(E,{children:N(`div`,{className:`grid ${h} gap-x-3 gap-y-2.5`,children:p.map(l=>N(Hc,{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))})}):N(Mt,{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 Kc({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 N(`div`,{className:`space-y-4`,children:e.sections.map((e,t)=>N(Gc,{section:e,values:u,onChange:d,onChangeMany:f,disabled:r,translationFn:i,onTestField:a,probeResults:o,onAction:c},`${e.id}-${t}`))})}function qc({pendingCount:e,onSave:t,onDiscard:n,saving:r=!1,saveLabel:i=`Save`,discardLabel:a=`Discard`}){let{t:o}=V();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:[N(`span`,{className:`text-xs text-foreground`,children:o(`formBuilder.saveBar.unsavedChanges`,{count:e})}),y(`div`,{className:`flex items-center gap-2`,children:[N(`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}),N(`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 Jc({tabs:e,activeId:t,onChange:n,countByTab:r,pendingByTab:i}){return e.length===0?null:N(`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&&N(`span`,{className:`ml-1.5 inline-flex h-1.5 w-1.5 rounded-full bg-primary`})]},e.id)})})}a();function Yc({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}){let m=e.tabs??[],h=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]),g=new Set(m.map(e=>e.id)),_=[...m,...[...h.keys()].filter(e=>!g.has(e)).map(e=>({id:e,label:e,icon:`wrench`,order:100}))],v=_[0]?.id??`general`,[b,x]=f(v),S=l!==void 0,C=new Set(_.map(e=>e.id)),w=j(new Set);for(let e of C)w.current.add(e);let T=w.current,E=(e=>e&&(C.has(e)||T.has(e))?e:v)(S?c:b),D=e=>{S?l(e):x(e)},O=h.get(E)??[],k={sections:O.length<=1?O.length===1?[{...O[0],title:``}]:O:O.every(e=>!e.title)?[{...O[0],title:``,fields:O.flatMap(e=>e.fields)}]:O},A=N(qc,{pendingCount:n.length,onSave:()=>a(n),onDiscard:()=>o(n),saving:s});if(u||_.length<=1)return y(`div`,{className:`flex flex-col gap-3`,children:[N(Kc,{schema:e,values:t,onChange:r,onAction:i,disabled:s,visibilityContext:p}),A]});let M=new Map,P=new Map;for(let[e,t]of h){M.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&&P.set(e,a)}return y(`div`,{className:`flex flex-col gap-3`,children:[N(Jc,{tabs:_.map(e=>({id:e.id,label:e.label})),activeId:E,onChange:D,countByTab:M,pendingByTab:P}),N(nn,{tabKey:E,children:N(Kc,{schema:k,values:t,onChange:r,onAction:i,disabled:s,visibilityContext:p})}),A]})}var Xc=`device-export`,Zc=`export`,Qc=`Export`;function $c(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($c):e.type===`sub-tabs`?e.tabs.some(e=>e.fields.some($c)):e.writerCapName===Xc}function el(e){return e.tab===`export`?!0:e.fields.some($c)}var tl=`host/extensions-panel`;function nl(e){return e.type===`widget`?e.widgetId===tl:e.type===`group`?e.fields.some(nl):e.type===`sub-tabs`?e.tabs.some(e=>e.fields.some(nl)):!1}function rl(e){return e.fields.some(nl)}function il(e,t){return!t&&e!==void 0&&it.includes(e)}function al(e){return e.location!==`top-tab`&&!el(e)&&!rl(e)}function ol(e,t,n,r){return!r||il(t,n)?!0:(e??[]).some(al)}function sl(e,t){for(let n of e){if(n.type===`group`){sl(n.fields,t);continue}if(n.type===`sub-tabs`){for(let e of n.tabs)sl(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 cl(e){let t={};for(let n of e)sl(n.fields,t);return t}a();function ll(e,t){return t&&t===`admin`?e:!0}function ul(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?el(e)&&el(t)?e.id.localeCompare(t.id):(e.order??0)-(t.order??0):n.localeCompare(r)})};return e.tabs?{...t,tabs:e.tabs}:t}function dl(e){return e.type===`separator`||e.type===`info`||e.type===`button`||e.type===`widget`||e.type===`addon-action-button`||e.type===`device-action-button`}function fl(e){return e.key}function pl(e){if(!dl(e))return e.value}function ml(e){return dl(e)?null:e}function hl(e,t){for(let n of e)if(t(n),n.type===`group`)hl(n.fields,t);else if(n.type===`sub-tabs`)for(let e of n.tabs)hl(e.fields,t)}function gl(e){if(!e)return{};let t={};for(let n of e.sections)hl(n.fields,e=>{let n=fl(e);n!==null&&(t[n]=pl(e))});return t}function _l(e,t){if(!e)return null;let n=null;for(let r of e.sections)if(hl(r.fields,e=>{if(n!==null||fl(e)!==t)return;let r=ml(e);r&&r.writerCapName&&r.writerAddonId&&(n={capName:r.writerCapName,addonId:r.writerAddonId})}),n!==null)break;return n}function vl(e){return{...e,fields:e.fields.map(yl)}}function yl(e){return e.type===`separator`||e.type===`info`||e.type===`button`||e.type===`object-array`?e:{...e,readonlyField:!0}}function bl(e,t){return e&&{...e,sections:e.sections.map(e=>({...e,fields:e.fields.map(e=>{let n=ml(e);return n?ll(t,n.minRole)?e:yl(e):e})}))}}function xl({deviceId:e,sectionFilter:t,activeSubTab:n,onSubTabChange:r,flattenSubTabs:i,subTabGrouping:a}){let{t:o}=V(),s=A(),{user:c}=Nc(),l=c?.isAdmin===!0,u=j(!1),{data:f,isLoading:m}=Fn({deviceId:e},{refetchInterval:()=>u.current?!1:2500,enabled:Number.isFinite(e)}),{data:h}=Vn({deviceId:e},{enabled:Number.isFinite(e)}),g=f?.settings??null,_=f?.live??null,v=d(()=>{if(!g&&!_)return null;let e=g?.sections??[],n=(_?.sections??[]).map(vl),r=[...e,...n],i=t?r.filter(t):r.filter(al);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=[...g?.tabs??[],...(_?.tabs??[]).filter(e=>!(g?.tabs??[]).some(t=>t.id===e.id))].filter(e=>o.has(e.id));return s.length>0?{tabs:s,sections:i}:{sections:i}},[g,_,t,a]),b=d(()=>cl([...g?.sections??[],..._?.sections??[]]),[g,_]),x=d(()=>ul(v),[v]),S=d(()=>bl(x,l),[x,l]),C=d(()=>gl(S),[S]),w=Yn(),T=Bn(),E=rn(),D=En(),O=an({onSuccess:()=>{s.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]})}}),k={isPending:O.isPending,mutate:t=>{O.mutate({deviceId:e,changes:[...t]})}},M=Fc({schema:S,serverValues:C,onImmediateSave:p(e=>{let t=Object.entries(e).map(([e,t])=>{let n=_l(S,e);return n?{writerCapName:n.capName,writerAddonId:n.addonId,key:e,value:t}:null}).filter(e=>e!==null);t.length>0&&k.mutate(t)},[S,k]),onDeferredSave:p(async t=>{let n=Object.entries(t).map(([e,t])=>{let n=_l(S,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 O.mutateAsync({deviceId:e,changes:n});if(t.failures.length>0)throw Error(t.failures.map(e=>e.error).join(`; `))}finally{await s.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]})}},[S,O,e,s])}),{values:P,pendingKeys:F,handleChange:I,handleSave:L,handleDiscard:ee}=M;if(u.current=M.editingPaused,m)return y(`div`,{className:`flex items-center justify-center py-12 text-foreground-subtle`,children:[N(ze,{className:`h-4 w-4 animate-spin mr-2`}),N(`span`,{className:`text-xs`,children:o(`device.deviceAggregateSection.loadingDeviceAggregate`,`Loading device aggregate…`)})]});if(!S||S.sections.length===0)return N(`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 te(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=at(e,r);await w.mutateAsync({brokerId:i}),s.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]});return}if(t===`test-probe`){if(!h)return{status:`error`,error:o(`device.deviceAggregateSection.metadataNotLoaded`)};try{return await E.mutateAsync({addonId:h.addonId,type:h.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=at(e,t),i=await T.mutateAsync({brokerId:r});return s.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]}),i}if(t===`device-custom-action`){let t=await D.mutateAsync({deviceId:e,action:n,input:r});return s.invalidateQueries({queryKey:[[`deviceManager`,`getDeviceAggregate`]]}),t}throw Error(`[device-aggregate] unknown action "${t}"`)}return N(Yc,{schema:S,values:P,pendingKeys:F,onChange:I,onAction:te,onSave:L,onDiscard:ee,disabled:k.isPending,activeSubTab:n,onSubTabChange:r,flattenTabs:i,visibilityContext:b})}var Sl=`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`,Cl=0,wl=10;function Tl(e){if(e.trim()===``)return``;let t=Number.parseInt(e,10);return Number.isFinite(t)?String(t<Cl?Cl:t>wl?wl:t):``}function El({value:e,onChange:t,disabled:n=!1,placeholder:r,className:i,id:a,"aria-label":o}){return N(`input`,{type:`number`,min:Cl,max:wl,step:1,id:a,className:i??Sl,"aria-label":o,placeholder:r,value:e,onChange:e=>{t(Tl(e.target.value))},disabled:n})}function Dl({deviceName:e,value:t,inheritedIcon:n,inheritedLabel:r,disabled:i,onChange:a}){let{t:o}=V(),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:[N(Tn,{value:t===``?null:t,onPick:e=>a(e??``),categoryLabel:e=>o(`deviceDisplay.iconCategory.${e}`,{defaultValue:st(e)}),fallbackGlyph:n,labels:s,disabled:i}),N(`span`,{className:`text-[11px] text-foreground-subtle`,children:t===``?r:t})]})}a();var Ol=`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`,kl={icon:``,label:``,unit:``,precision:``,hidden:!1};function Al(e){return{icon:e?.icon??``,label:e?.label??``,unit:e?.unit??``,precision:e?.precision===void 0?``:String(e.precision),hidden:e?.hidden===!0}}function jl(e){if(typeof e!=`object`||!e)return;let t=e.unit;return typeof t==`string`?t:void 0}function Ml(e){if(e.trim()===``)return;let t=Number.parseInt(e,10);return Number.isFinite(t)?t:void 0}function Nl(e,t){let n=Ml(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 Pl({deviceId:e}){let t=Re();bn();let{t:n}=V(),r=Be(),i=A(),{data:a}=Vn({deviceId:e},{enabled:e>0}),o=typeof a?.role==`string`&&a.role.length>0?a.role:null,s=o===null?void 0:nr[o],c=s?.kind===`numeric`,l=String(a?.type??``),u=o!==null||a?.parentDeviceId!==null&&a?.parentDeviceId!==void 0,d=Jn(r.trpcClient,e,o??``),p=s?.kind===`numeric`?s.canonicalUnit:void 0,m=jl(d)??p,h=m===void 0?void 0:ft(m)??m,g=h===void 0?void 0:lt(h),[_,v]=f(null),b=_??Al(a?.display),x=Wt({onSuccess:()=>{i.invalidateQueries({queryKey:[[`deviceManager`]]})}}),{data:S}=Cn({},{staleTime:6e4,enabled:o!==null}),C=At({onSuccess:()=>{i.invalidateQueries({queryKey:[[`deviceManager`]]})}});if(a==null)return null;let w=e=>{v({...b,...e})},T=()=>{x.mutate({deviceId:e,display:Nl(b,a.display)})},D=()=>{v(kl),x.mutate({deviceId:e,display:null})},O=()=>{if(o===null)return;let e=Ml(b.precision),t={...b.icon===``?{}:{icon:b.icon},...b.unit===``?{}:{unit:b.unit},...e===void 0?{}:{precision:e}},n={...S?.defaults,[o]:t};C.mutate({defaults:n})},k=o===null?void 0:S?.defaults[o]?.icon,j=k===void 0?void 0:_n(k),M=o===null?Sn(l,t):Ln(o,t),P={icon:j??M.icon,label:j===void 0?M.label:String(k)},F=o===null&&l===rt.Container?n(`deviceDisplay.inheritedContainer`):j===void 0?n(`deviceDisplay.inherited`,{name:P.label}):n(`deviceDisplay.inheritedRoleDefault`,{icon:P.label,role:M.label}),I=typeof a.name==`string`?a.name:`#${String(e)}`,L=o===null?``:Ln(o,t).label;return y(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[N(`div`,{className:`border-b border-border px-3 sm:px-4 py-2`,children:N(`h2`,{className:`text-[11px] font-semibold text-foreground uppercase tracking-wider`,children:n(`deviceDisplay.title`)})}),y(`div`,{className:`divide-y divide-border`,children:[N(X,{label:n(`deviceDisplay.icon`),value:N(Dl,{deviceName:I,value:b.icon,inheritedIcon:P.icon,inheritedLabel:F,disabled:x.isPending,onChange:e=>w({icon:e})})}),u&&N(X,{label:n(`deviceDisplay.label`),value:N(`input`,{type:`text`,className:Ol,"aria-label":n(`deviceDisplay.label`),placeholder:o===null?I:L,value:b.label,onChange:e=>w({label:e.target.value})})}),c&&y(E,{children:[N(X,{label:n(`deviceDisplay.unit`),value:N(Mn,{dimension:g,value:b.unit,onChange:e=>w({unit:e}),disabled:x.isPending,"aria-label":n(`deviceDisplay.unit`),inheritLabel:n(`deviceDisplay.unitSource`,{unit:h===void 0?``:` (${h})`}),emptyReason:n(`deviceDisplay.unitSource`,{unit:``})})}),N(X,{label:n(`deviceDisplay.precision`),value:N(El,{"aria-label":n(`deviceDisplay.precision`),placeholder:n(`deviceDisplay.precisionInherit`),value:b.precision,onChange:e=>w({precision:e}),disabled:x.isPending})})]}),N(X,{label:n(`deviceDisplay.hidden`),value:y(`label`,{className:`flex items-center gap-2`,children:[N(`input`,{type:`checkbox`,checked:b.hidden,onChange:e=>w({hidden:e.target.checked})}),N(`span`,{className:`text-[11px] text-foreground`,children:n(`deviceDisplay.hideFromLists`)})]})})]}),y(`div`,{className:`border-t border-border px-3 sm:px-4 py-2 flex flex-wrap items-center gap-2`,children:[N(`button`,{type:`button`,className:`rounded bg-primary px-3 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-50`,onClick:T,disabled:x.isPending,children:n(`common.save`)}),N(`button`,{type:`button`,className:`rounded border border-border px-3 py-1 text-[11px] text-foreground-subtle`,onClick:D,disabled:x.isPending,children:n(`common.reset`)}),o!==null&&N(`button`,{type:`button`,className:`rounded border border-border px-3 py-1 text-[11px] text-foreground-subtle`,onClick:O,disabled:C.isPending,title:n(`deviceDisplay.setRoleDefaultTitle`,{role:L}),children:n(`deviceDisplay.setRoleDefault`,{role:L})})]})]})}a();function Fl({deviceId:e,onClose:t}){let{t:n}=V(),[r,i]=f(`info`),{data:a}=Vn({deviceId:e},{enabled:e>0});return N(Nt,{open:!0,onOpenChange:e=>!e&&t(),children:y(An,{width:`lg`,scroll:`body`,children:[y(Gt,{children:[N(Yt,{children:typeof a?.name==`string`&&a.name.length>0?a.name:`#${String(e)}`}),y(Ot,{children:[n(`deviceQuickDetail.description`,{defaultValue:`Device info, display and export — same surfaces as the detail page.`}),` `,N(so,{to:`/devices/${String(e)}`,className:`text-primary hover:underline`,onClick:t,children:n(`deviceQuickDetail.openFull`,{defaultValue:`Open full detail`})})]})]}),N(`div`,{className:`mt-3 flex items-center gap-1 rounded-md bg-surface-hover p-0.5 w-fit`,children:[[`info`,n(`deviceQuickDetail.tabInfo`,{defaultValue:`Device info`})],[`display`,n(`deviceQuickDetail.tabDisplay`,{defaultValue:`Display`})],[`export`,n(`deviceQuickDetail.tabExport`,{defaultValue:`Export`})]].map(([e,t])=>N(`button`,{type:`button`,onClick:()=>i(e),className:`px-2.5 py-1 rounded text-[11px] font-medium transition-colors ${r===e?`bg-surface text-foreground shadow-sm`:`text-foreground-subtle hover:text-foreground`}`,children:t},e))}),N(Zt,{className:`mt-3`,children:y(zt,{deviceId:e,device:a??void 0,children:[r===`info`&&N(_s,{}),r===`display`&&N(Pl,{deviceId:e}),r===`export`&&N(xl,{deviceId:e,sectionFilter:el})]})})]})})}function Il({children:e}){let[t,n]=f(null),r=p(e=>n(e),[]),i=p(()=>n(null),[]);return y(Nn,{open:r,children:[e,t===null?null:N(Fl,{deviceId:t,onClose:i})]})}a();function Ll({tabs:e,active:t,onChange:n}){return N(`div`,{className:`flex rounded-lg border border-border bg-surface p-0.5 gap-0.5`,children:e.map(e=>N(`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 Rl(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 zl(e){return`${e.inputSize.width}x${e.inputSize.height}`}function Bl(e){return e.formats?Object.keys(e.formats).filter(t=>e.formats[t]!==void 0):[]}function Vl({entry:e,selected:t,onSelect:n,disabled:r}){let{t:i}=V(),a=Rl(e),o=zl(e),s=Bl(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:[N(`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:[N(`span`,{className:`text-xs font-semibold text-foreground truncate`,children:e.name}),t&&N(pe,{className:`h-3.5 w-3.5 text-primary shrink-0`})]}),N(`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:[N(ve,{className:`h-3 w-3`}),o]}),a&&N(`span`,{className:`text-[10px] text-foreground-subtle`,children:a}),s.length>0&&N(`div`,{className:`flex gap-1`,children:s.map(e=>N(`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&&N(`span`,{className:`text-[10px] text-foreground-subtle`,children:i(`common.labels`,{count:e.labels.length})})]})]})}function Hl({field:e,value:t,onChange:n,disabled:r}){let{t:i}=V(),a=e.catalog??[],o=a.length>0,s=nt(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&&N(Ll,{tabs:l,active:u,onChange:d}),u===`catalog`&&o&&s&&N($n,{catalog:a,value:p,onChange:e=>n(e),disabled:r||e.disabled}),u===`catalog`&&o&&!s&&N(`div`,{className:`space-y-1.5 max-h-[320px] overflow-y-auto pr-1`,children:a.filter(e=>e.legacy!==!0).map(t=>N(Vl,{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:[N(Ie,{className:`h-3.5 w-3.5 text-info shrink-0 mt-0.5`}),N(`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:[N(`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:[N(Ie,{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`),N(I,{className:`h-3 w-3`})]})]})]})}function Ul({to:e}){let{search:t}=q();return N(J,{to:`${e}${t}`,replace:!0})}a();function Wl(){return B.t(`helpers.keychainRevealHost.forbidden`)}function Gl(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 Kl(e){let t=Gl(e);if(t===`FORBIDDEN`||t===`UNAUTHORIZED`)return Wl();let n=e instanceof Error?e.message:String(e);return n.length>0?B.t(`helpers.keychainRevealHost.failedWith`,{message:n}):B.t(`helpers.keychainRevealHost.failed`)}function ql({children:e}){let t=Ft();return N(cn,{reveal:p(async e=>{try{return(await t.mutateAsync({ref:e})).value}catch(e){throw Error(Kl(e))}},[t]),children:e})}a();function Jl(){let e=Be(),t=A(),[n,r]=f(()=>e.isConnected()?`connected`:`disconnected`),i=j(!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}=tn(void 0,{enabled:n===`connected`&&a>0,staleTime:0,refetchOnMount:!1,refetchOnWindowFocus:!1}),d=j(null);return s(()=>{if(u==null||u.requestedAt===d.current)return;d.current=u.requestedAt;let e=Xl(u);l(t=>[...t,e]);let t=window.setTimeout(()=>{l(t=>t.filter(t=>t.id!==e.id))},6e3);return()=>window.clearTimeout(t)},[u]),N(E,{children:c.length>0&&N(Yl,{toasts:c})})}function Yl({toasts:e}){return N(`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:[N(Ve,{className:`w-4 h-4 shrink-0 mt-0.5 text-green-400`}),y(`div`,{children:[N(`div`,{className:`text-[11px] font-semibold text-foreground`,children:e.title}),N(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5`,children:e.message})]})]},e.id))})}function Xl(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:B.t(`system.reconnectOverlay.frameworkUpdated`,`Framework updated`),message:B.t(`system.reconnectOverlay.isNow`,`{{packageName}} is now {{fromTo}}.`,{packageName:e.packageName,fromTo:n})}}return{id:t,title:B.t(`system.reconnectOverlay.serverRestarted`,`Server restarted`),message:e.requestedBy===void 0?B.t(`system.reconnectOverlay.manualRestartCompleted`,`Manual restart completed.`):B.t(`system.reconnectOverlay.manualRestartByCompleted`,`Manual restart by {{requestedBy}} completed.`,{requestedBy:e.requestedBy})}}var Zl=`/system/settings`,Ql=[{path:`/system/secrets`,tab:`secrets`},{path:`/system/capabilities`,tab:`capabilities`}];function $l(e,t=``){let n=new URLSearchParams(t);return n.delete(`tab`),n.set(`tab`,e),`${Zl}?${n.toString()}`}function eu({tab:e}){let{search:t,hash:n}=q();return N(J,{to:`${$l(e,t)}${n}`,replace:!0})}a();var tu={info:{bg:`bg-info/10`,border:`border-info/30`,icon:Ie},warning:{bg:`bg-warning/10`,border:`border-warning/30`,icon:le},critical:{bg:`bg-danger/10`,border:`border-danger/30`,icon:Me}};function nu({toast:e,onDismiss:t}){let n=tu[e.severity]??tu.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:[N(r,{className:`h-4 w-4 shrink-0 mt-0.5 text-foreground-subtle`}),y(`div`,{className:`flex-1 min-w-0`,children:[N(`div`,{className:`text-xs font-semibold text-foreground`,children:e.title}),N(`div`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:e.message})]}),N(`button`,{type:`button`,onClick:()=>t(e.id),className:`shrink-0 p-0.5 rounded hover:bg-surface-hover transition-colors`,children:N(De,{className:`h-3.5 w-3.5 text-foreground-subtle`})})]})}function ru(){let[e,t]=f([]),n=p(e=>{t(t=>t.filter(t=>t.id!==e))},[]);return kn(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:N(`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=>N(`div`,{className:`pointer-events-auto`,children:N(nu,{toast:e,onDismiss:n})},e.id))})}function iu(e){return(t,n,r)=>e(t,{...typeof n==`string`?{defaultValue:n}:{defaultValue_one:n.one,defaultValue_other:n.other},...r})}var au=(e,t,n)=>iu(B.t.bind(B))(e,t,n);a();function ou({children:e}){let{t}=V();return N(Le,{t:d(()=>iu(t),[t]),children:e})}a();function su(e){if(typeof e!=`object`||!e)return;let{data:t}=e;return t?.code}function cu(e,t){let n=su(e);return n===`UNAUTHORIZED`||n===`FORBIDDEN`?!0:/UNAUTHORIZED|FORBIDDEN/.test(t)}function lu(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(cu(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 uu=3e4;function du(e){let t=j(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>=uu&&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 fu(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 pu=new Map,mu=new Map,hu=new Set;function gu(e){return!e||typeof e!=`object`?!1:typeof e.default==`function`}async function _u(e,t){let i=pu.get(e);if(i)return i;let a=mu.get(e);if(a)return a;hu.has(e)||(Un(),r([{name:e,entry:z(t),type:`module`}],{force:!1}),hu.add(e));let o=n(`${e}/page`).then(n=>{if(!gu(n))throw Error(`Addon page remote ${e} (${t}) does not expose a default React component on './page'`);return pu.set(e,n.default),mu.delete(e),n.default}).catch(t=>{throw mu.delete(e),t});return mu.set(e,o),o}function vu(){let{t:e}=V(),{pagePath:t}=Gi(),n=Vi(),r=Be(),{data:i}=In(void 0),a=d(()=>i?fu(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=pu.get(c);if(e){p(()=>e);return}p(null);let t=!1;return _u(c,l).then(e=>{t||p(()=>e)}).catch(e=>{t||h(`Failed to load addon page: ${e instanceof Error?e.message:String(e)}`)}),()=>{t=!0}},[c,l]),a?o?m?N(`div`,{className:`flex items-center justify-center h-full text-danger text-sm`,children:m}):u?N(u,{trpc:r.trpcClient,theme:{isDark:document.documentElement.classList.contains(`dark`)},navigate:e=>{n(e.startsWith(`/`)?e:`/${e}`)}}):N(`div`,{className:`flex items-center justify-center h-full`,children:N(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}):N(`div`,{className:`flex items-center justify-center h-full text-foreground-subtle`,children:e(`layouts.addonPageLoader.addonPageNotFound`,`Addon page not found`)}):N(`div`,{className:`flex items-center justify-center h-full`,children:N(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})})}or();var yu=/\p{Mn}/gu;function bu(e){return e.normalize(`NFD`).replace(yu,``).toLowerCase().trim()}var xu=[`device`,`page`,`integration`],Su=0,Cu=1,wu=2,Tu=3,Eu=4,Du=5,Ou=6,ku=7;function Au(e,t,n,r){return n.includes(r)?Su:e===r?Cu:e.startsWith(r)?wu:e.split(/\s+/).some(e=>e.startsWith(r))?Tu:e.includes(r)?Eu:t.some(e=>e.includes(r))?Du:null}function ju(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 Mu(e){return e<4?0:e<=7?1:e<=12?2:3}function Nu(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 Pu(e,t){if(ju(e,t))return Ou;let n=Mu(t.length);if(n>0){for(let r of e.split(/\s+/))if(Nu(r,t,n)!==null)return ku}return null}function Fu(e,t,n=200){let r=bu(t);if(r.length===0)return{groups:[],totalMatched:0,truncated:!1};let i=new Map;for(let t of e){let e=bu(t.label),n=Au(e,(t.keywords??[]).map(bu),(t.identifiers??[]).map(bu),r)??Pu(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 xu){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 Iu(e){return e.flatMap(e=>e.items)}function Lu(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 Ru(e,t){return e.filter(e=>!e.adminOnly||t)}function zu({t:e,isAdmin:t}){let n=Ru([{label:e(`nav.devices`,`Devices`),icon:te,path:`/devices`},{label:e(`nav.integrations`),icon:ue,path:`/integrations`},{label:e(`nav.build`,`Build-your-self`),icon:L,path:`/build`,adminOnly:!0},{label:e(`nav.locations`,`Locations`),icon:qe,path:`/locations`,adminOnly:!0},{label:e(`nav.viewer`,`Viewer`),icon:pt,path:`/live`}],t),r=Ru([{label:e(`nav.library`,`Library`),icon:mt,path:`/library`,adminOnly:!0,keywords:[`People`,`Vehicles`,`Events`,`Scenes`,`plates`,`faces`,`detection-intelligence`]},{label:e(`nav.recordings`,`Recordings`),icon:ie,path:`/recordings`,adminOnly:!0}],t),i=Ru([{label:e(`nav.nodes`,`Nodes`),icon:$e,path:`/system/nodes`,adminOnly:!0},{label:e(`nav.pipeline`,`Pipeline`),icon:Dt,path:`/system/pipeline`},{label:e(`system.addons`),icon:he,path:`/system/addons`,adminOnly:!0},{label:e(`system.ai`,`AI`),icon:xe,path:`/system/ai`,adminOnly:!0}],t),a=Ru([{label:e(`system.identity`,`Identity & Access`),icon:Ue,path:`/system/identity`,adminOnly:!0},{label:e(`system.network`,`Network`),icon:yt,path:`/system/network`,adminOnly:!0},{label:e(`system.integrations`,`Connectivity`),icon:ue,path:`/system/integrations`,adminOnly:!0},{label:e(`system.data`,`Data`),icon:R,path:`/system/data`,adminOnly:!0},{label:e(`system.notifications`,`Notifications`),icon:oe,path:`/system/notifications`,adminOnly:!0},{label:e(`system.calendars`,`Calendars`),icon:_t,path:`/system/calendars`,adminOnly:!0},{label:e(`system.systemNav`,`System`),icon:Je,path:Zl,adminOnly:!0},{label:e(`system.logs`,`Logs`),icon:He,path:`/system/logs`,adminOnly:!0},{label:e(`system.terminal`,`Terminal`),icon:xt,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 Bu={gauge:ee,puzzle:he,bot:Fe,cpu:ve,terminal:xt,box:F,boxes:F,monitor:pt,wrench:je,activity:Oe,plug:ue,"graduation-cap":ne};function Vu(e){return Bu[e]??he}function Hu(e,t){for(let n of zu(t))for(let t of n.items)if(t.path===e)return{icon:t.icon,title:t.label,path:t.path};return null}var Uu=` · `;function Wu(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(Uu)}function Gu(e,t=null){let n=Lu(e),r=Kn(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:Wu(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:wn(e.type).icon}})}function Ku(e){return e.map(e=>({key:`integration:${e.id}`,domain:`integration`,label:e.name||e.addonId,subtitle:e.enabled?e.addonId:B.t(`helpers.searchItems.disabled`,{addonId:e.addonId}),keywords:[e.addonId,e.processState],path:`/integrations/${e.id}`}))}function qu(e,t,n){let r=e.section?.trim();return r?t[r]??e.sectionLabel?.trim()??r:n}function Ju(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:qu(e,i,n.ungrouped),keywords:[e.addonId],path:e.path,icon:Vu(e.icon)}));return[...r,...a]}a();var Yu={device:{labelKey:`search.resultsList.devices`,icon:te},page:{labelKey:`search.resultsList.pages`,icon:gt},integration:{labelKey:`search.resultsList.integrations`,icon:ue}};function Xu({groups:e,activeKey:t,query:n,totalMatched:r,truncated:i,onSelect:a,onHover:o}){let{t:c}=V(),l=j(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 N(`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:[N(`div`,{ref:l,role:`listbox`,className:`max-h-[60vh] overflow-y-auto py-1`,children:e.map(e=>{let n=Yu[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:[N(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:[N(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:[N(`span`,{className:`block truncate font-medium`,children:e.label}),e.subtitle&&N(`span`,{className:`block truncate text-[10px] text-foreground-subtle`,children:e.subtitle})]})]},e.key)})]},e.domain)})}),i&&N(`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 Zu({navSections:e,addonPages:t,compact:n,onNavigated:r}){let{t:i}=V(),a=Vi(),o=j(null),c=j(null),l=j(null),[u,m]=f(null),[h,g]=f(``),[_,v]=f(0),[b,x]=f(!1),{data:S}=fn({projection:`slim`}),{data:C}=gn(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[...Gu(S??[],C??null),...Ju(e,t,n),...Ku(C??[])]},[S,C,e,t,i]),{groups:T,totalMatched:E,truncated:D}=d(()=>Fu(w,h),[w,h]),O=d(()=>Iu(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 M=b&&h.trim().length>0;s(()=>{if(!M){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)}},[M]);let P=O[_]?.key??null,F=i(`search.placeholder`,`Search devices, pages, integrations…`),I=y(`div`,{className:`relative`,children:[N(Ae,{className:`pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-foreground-subtle`}),N(`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&&N(`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:N(De,{className:`h-3 w-3`})}),M&&u!==null&&sr(N(`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:N(Xu,{groups:T,activeKey:P,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?N(`div`,{ref:c,className:`px-1.5 pb-1.5`,children:b?N(`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}):N(`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:N(Ae,{className:`h-3.5 w-3.5 shrink-0`})})}):N(`div`,{ref:c,className:`px-2 pb-2`,children:I})}var Qu=/^(\d{1,3}\.){3}\d{1,3}$/;function $u(e){let t=e.startsWith(`[`)&&e.endsWith(`]`)?e.slice(1,-1):e;return!!(Qu.test(t)||t.includes(`:`))}function ed(e,t){return!t||$u(e)?!1:e===t||e.endsWith(`.${t}`)}a();var td=`auth-webauthn/passkey-enrollment`,nd=`camstack_passkey_prompt_dismissed:`,rd=720*60*60*1e3;function id(e){try{let t=localStorage.getItem(`${nd}${e}`);if(!t)return!1;let n=Number(t);return Number.isFinite(n)?Date.now()-n<rd:!1}catch{return!1}}function ad(e){try{localStorage.setItem(`${nd}${e}`,String(Date.now()))}catch{}}function od(){let{user:e}=Nc(),{t}=V(),n=Be(),r=Vt(td),[i,a]=f(!1),[o,s]=f(!1),c=d(()=>e?id(e.id):!0,[e]),l=en.auth.listLoginMethods.useQuery().data?.find(e=>e.kind===`passkey`),u=l!==void 0&&ed(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&&ad(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:[N(ht,{className:`h-4 w-4 text-primary shrink-0`}),N(`span`,{className:`flex-1 min-w-0`,children:t(`passkeyPrompt.message`,`Save a passkey for faster sign-in?`)}),N(`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`)}),N(`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`)}),N(`button`,{onClick:g,"aria-label":t(`passkeyPrompt.notNow`,`Not now`),className:`p-1 rounded text-foreground-subtle hover:text-foreground`,children:N(De,{className:`h-3.5 w-3.5`})})]}),o&&N(`div`,{className:`px-3 pb-3`,children:y(`div`,{className:`max-w-xl`,children:[N(Pt,{widgetId:td,host:`dashboard`}),N(`div`,{className:`mt-2 flex justify-end`,children:N(`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 sd=6e4;function cd(){let e=vn(void 0,{staleTime:sd});return{info:e.data?.serverName??null,isLoading:e.isLoading}}a();var ld=`system-config`,ud=`hub`,dd=`camstack_server_name_prompt_dismissed`;function fd(){try{return sessionStorage.getItem(dd)===`1`}catch{return!1}}function pd(){try{sessionStorage.setItem(dd,`1`)}catch{}}function md(e){return e.isAdmin&&e.info!==null&&e.info.isDefault&&!e.dismissed}function hd(){let{user:e}=Nc(),{info:t}=cd(),[n,r]=f(fd);return md({isAdmin:e?.isAdmin===!0,info:t,dismissed:n})?N(gd,{suggestion:t?.name??``,onLater:()=>{pd(),r(!0)}}):null}function gd({suggestion:e,onLater:t}){let{t:n}=V(),r=A(),i=ar(),[a,o]=f(e),[c,l]=f(null),u=j(null);s(()=>u.current?.focus(),[]);let d=p(async()=>{let e=ot.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:ld,nodeId:ud,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 N(Nt,{open:!0,onOpenChange:e=>!e&&t(),children:N(An,{children:y(`form`,{onSubmit:e=>{e.preventDefault(),i.isPending||d()},children:[y(Gt,{children:[N(Yt,{children:n(`serverName.title`,`Name this server`)}),N(Ot,{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.`)})]}),N(Zt,{children:N(Hn,{label:n(`serverName.label`,`Server name`),...c===null?{}:{error:c},children:N(zn,{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(Dn,{children:[N(Rt,{type:`button`,variant:`ghost`,onClick:t,disabled:i.isPending,children:n(`serverName.later`,`Later`)}),y(Rt,{type:`submit`,disabled:i.isPending||a.trim().length===0,children:[i.isPending&&N(ze,{className:`h-4 w-4 animate-spin`}),n(`common.save`,`Save`)]})]})]})})})}var _d=4,vd=160,yd=320,bd=`env(safe-area-inset-top)`,xd=`env(safe-area-inset-bottom)`;function Sd(e){let{rect:t,viewportWidth:n,viewportHeight:r}=e,i=Math.min(yd,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+_d}px, calc(${bd} + 8px))`;return{...a,top:e,maxHeight:`max(${vd}px, calc(100dvh - ${e} - ${xd} - 8px))`}}let o=`max(${r-t.top+_d}px, calc(${xd} + 8px))`;return{...a,bottom:o,maxHeight:`max(${vd}px, calc(100dvh - ${o} - ${bd} - 8px))`}}function Cd(e){return e===`totp`||e===`passkey`}function wd(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(Cd);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 Td(e,t){switch(e){case`sso-not-linked`:return B.t(`helpers.ssoReturn.notLinked`,{provider:t??B.t(`helpers.ssoReturn.signInFallback`)});case`sso-state`:return B.t(`helpers.ssoReturn.state`)}}var Ed={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 Dd(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:B.t(Ed[r]??`helpers.ssoReturn.link.failed`)}}var Od=`camstack:sso-return`,kd=`camstack:sso-ack`,Ad=`/sso-complete`,jd=1500,Md=520,Nd=680;function Pd(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 Fd(e){return e.target===`login`?`/login#${e.fragment}`:`/system/my-access?${e.query}`}function Id(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 Ld(e=window){let t=Math.max(0,Math.round(e.screenX+(e.outerWidth-Md)/2)),n=Math.max(0,Math.round(e.screenY+(e.outerHeight-Nd)/2));return[`popup=yes`,`width=${Md}`,`height=${Nd}`,`left=${t}`,`top=${n}`,`toolbar=no`,`menubar=no`,`location=no`,`status=no`,`resizable=yes`,`scrollbars=yes`].join(`,`)}function Rd(e){try{return window.open(e??`about:blank`,`camstack-sso`,Ld())??null}catch{return null}}function zd(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 Bd(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`camstack:sso-return`&&zd(t.completion)}function Vd(e,t,n){return t===null||e.source!==t||e.origin!==n?null:Bd(e.data)?e.data.completion:null}var Hd=`camstack-sso`,Ud=`camstack:sso-done`;function Wd(e,t){return e.target===`profile`?{target:`profile`,query:e.query}:t?{target:`login`}:null}function Gd(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 Kd(e){return typeof e==`object`&&!!e&&e.type===`camstack:sso-done-ack`}function qd(e){try{let t=e.location.origin;return typeof t==`string`?t:null}catch{return null}}function Jd(){if(typeof BroadcastChannel>`u`)return null;try{let e=new BroadcastChannel(Hd);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 Yd=500;function Xd(e,t,n=window,r={}){let i=n.location.origin,a=r.channel===void 0?Jd():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=Vd(r,e,i);a===null||l||(l=!0,n.removeEventListener(`message`,d),e.postMessage({type:kd},i),t.onReturn(a))};n.addEventListener(`message`,d);let f=o?.subscribe(e=>{let n=Gd(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?.())},Yd);return()=>{n.removeEventListener(`message`,d),f?.(),a?.close(),c(p)}}function Zd(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 Qd(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))},jd)})}function $d(e,t,n){let r=Qd(n,e=>{let r=r=>{Zd(r,t,n.origin)&&e()};return n.addEventListener(`message`,r),()=>n.removeEventListener(`message`,r)});try{let r={type:Od,completion:e};t.postMessage(r,n.origin)}catch{}return r}function ef(e,t,n){let r=Qd(n,e=>t.subscribe(t=>{Kd(t)&&e()}));return t.post({type:Ud,...e}),r}async function tf(e,t){let n=t.opener!==null&&!t.opener.closed?t.opener:null;if(n!==null&&qd(n)===t.origin&&await $d(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=Wd(e,i);if(a!==null&&t.channel!==null&&(r!==null&&i&&await t.persistSession(r),await ef(a,t.channel,t))){t.close();return}if(n!==null&&e.target===`profile`){let n=Dd(`?${e.query}`);if(n?.kind===`error`){t.showResult({kind:`link-error`,message:n.message});return}t.close();return}t.continueAt(Fd(e))}function nf(e,t){return(t.length>0&&e.startsWith(t)?e.slice(t.length):e).replace(/\/+$/,``)===Ad}var rf=`camstack:broker-oauth`;function af(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`camstack:broker-oauth`&&typeof t.ok==`boolean`}function of(e,t){return e.split(`{{brokerId}}`).join(encodeURIComponent(t))}function sf(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||af(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 cf={open:e=>Rd(e),assign:e=>window.location.assign(e),watch:(e,t)=>sf(e,t)};function lf(e,t,n=cf){let r=z(Id(e)),i=n.open(r);if(i===null){n.assign(r);return}n.watch(i,e=>{t?.(e)})}function uf(e,t,n){lf(of(e,t),n)}var df=!1;function ff(){return df}function pf(){df=!0}function mf(e){return!e.read&&e.severity===`critical`}function hf(e){return e.filter(mf)}function gf(e){return e!==void 0&&typeof e.href==`string`&&e.href.length>0}var _f=/^\/addon\/[^/?#]+\/oauth\//;function vf(e){return e.navigation===void 0?_f.test(e.href):e.navigation===`server`}function yf({action:e,className:t,onActivate:n}){let r=A();return vf(e)?N(`a`,{href:z(e.href),className:t,onClick:t=>{t.preventDefault(),n?.(t),lf(e.href,()=>{r.invalidateQueries({queryKey:[[`alerts`]]}),r.invalidateQueries({queryKey:[[`broker`]]}),r.invalidateQueries({queryKey:[[`recordEntries`]]})})},children:e.label}):N(so,{to:e.href,className:t,onClick:n,children:e.label})}a(),or();var bf={info:Ie,success:Ve,warning:le,error:Me,critical:vt},xf={info:`text-info`,success:`text-success`,warning:`text-warning`,error:`text-danger`,critical:`text-danger`},Sf={active:`border-l-info`,"in-progress":`border-l-warning`,completed:`border-l-success`,failed:`border-l-danger`,dismissed:`border-l-foreground-subtle/30`};function Cf(e){let t=Math.floor((Date.now()-e)/1e3);if(t<60)return B.t(`helpers.relativeTime.justNow`);let n=Math.floor(t/60);if(n<60)return B.t(`helpers.relativeTime.minutesAgo`,{count:n});let r=Math.floor(n/60);if(r<24)return B.t(`helpers.relativeTime.hoursAgo`,{count:r});let i=Math.floor(r/24);return B.t(`helpers.relativeTime.daysAgo`,{count:i})}function wf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Tf(e){return typeof e==`string`&&e.length>0?e:void 0}function Ef(e){if(wf(e.metadata)){let t=Tf(e.metadata.nodeId)??Tf(e.metadata.agentId);if(t!==void 0)return t}let t=e.source;if(t!==void 0&&!(t.type!==`node`&&t.type!==`agent`))return Tf(t.id)}function Df({alert:e,onMarkRead:t,onDismiss:n}){let{t:r}=V(),i=e.severity in bf?e.severity:`info`,a=gf(e.action)?e.action:void 0,o=e.status in Sf?e.status:`active`,s=bf[i],c=xf[i],l=Sf[o],{nodes:u}=pn(),d=Ef(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:[N(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:[N(`span`,{className:`text-[11px] font-semibold ${e.read?`text-foreground-subtle`:`text-foreground`}`,children:e.title}),!e.read&&N(`span`,{className:`h-1.5 w-1.5 rounded-full bg-primary shrink-0`})]}),p!==void 0&&N(`div`,{className:`text-foreground-subtle text-[10px] mt-0.5 truncate`,children:p}),N(`div`,{className:`text-[10px] text-foreground-subtle mt-0.5 line-clamp-2`,children:e.message}),a!==void 0&&N(yf,{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:[N(`div`,{className:`flex-1 h-1 bg-surface-hover rounded-full overflow-hidden`,children:N(`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)),`%`]})]}),N(`div`,{className:`text-[9px] text-foreground-subtle/60 mt-1`,children:Cf(e.updatedAt)})]}),y(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[!e.read&&N(`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:N(pe,{className:`h-3 w-3 text-foreground-subtle`})}),e.status!==`in-progress`&&N(`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:N(De,{className:`h-3 w-3 text-foreground-subtle`})})]})]})}function Of({variant:e=`icon`,compact:t=!1}={}){let{t:n}=V(),[r,i]=f(!1),[a,o]=f(!1),c=j(null),l=j(null),u=A(),{data:d=0}=Lt(void 0,{refetchInterval:3e4}),{data:m=[],isLoading:h}=Ht({limit:50},{enabled:r}),g=a?m:m.filter(e=>!e.read),_=m.filter(e=>e.read).length,v=()=>{u.invalidateQueries({queryKey:[[`alerts`]]})},b=Bt({onSuccess:v}),x=Wn({onSuccess:v}),S=sn({onSuccess:v});ir(`alert.created`,()=>{u.invalidateQueries({queryKey:[[`alerts`]]})}),ir(`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(mf),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)),[M,P]=f({}),F=p(()=>{let e=l.current;e&&P(Sd({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:[N(He,{className:`h-3.5 w-3.5`}),t&&d>0&&N(`span`,{className:`absolute -top-1 -right-1 h-2 w-2 rounded-full bg-primary`})]}),!t&&N(`span`,{className:`flex-1 text-left`,children:n(`ui.alertBell.alerts`,`Alerts`)}),!t&&d>0&&N(`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:[N(He,{className:`h-4.5 w-4.5`}),d>0&&N(`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&&sr(y(`div`,{ref:c,style:M,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:[N(`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:[N(`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:[N(Ct,{className:`h-3 w-3`}),n(`ui.alertBell.markAllRead`,`Mark all read`)]})]})]}),y(`div`,{className:`flex-1 overflow-y-auto`,children:[h&&N(`div`,{className:`flex items-center justify-center py-8`,children:N(ze,{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:[N(He,{className:`h-6 w-6 mb-2 opacity-40`}),N(`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&&N(`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:[N(`div`,{className:`px-3 py-1.5 bg-danger/5`,children:N(`span`,{className:`text-[9px] font-semibold uppercase tracking-widest text-danger`,children:n(`ui.alertBell.urgent`,`Urgent`)})}),E.map(e=>N(Df,{alert:e,onMarkRead:C,onDismiss:w},e.id))]}),O.length>0&&y(`div`,{className:`border-b border-border`,children:[N(`div`,{className:`px-3 py-1.5 bg-surface-hover/50`,children:N(`span`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60`,children:n(`ui.alertBell.inProgress`,`In Progress`)})}),O.map(e=>N(Df,{alert:e,onMarkRead:C,onDismiss:w},e.id))]}),k.map(e=>N(Df,{alert:e,onMarkRead:C,onDismiss:w},e.id))]})]}),document.body)]})}a(),or();function kf({alert:e,onMarkRead:t}){let{t:n}=V(),r=gf(e.action)?e.action:void 0;return y(`div`,{className:`border-b border-border last:border-b-0 px-3 py-2.5`,children:[N(`div`,{className:`text-[12px] font-semibold text-foreground`,children:e.title}),N(`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&&N(yf,{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`}),N(Rt,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>t(e.id),children:n(`ui.alertBell.markAsRead`,`Mark as read`)})]})]})}function Af(){let{t:e}=V(),t=A(),[n,r]=f(ff()),{data:i=[],isLoading:a}=Ht({limit:50}),o=d(()=>hf(i),[i]),s=Bt({onSuccess:p(()=>{t.invalidateQueries({queryKey:[[`alerts`]]})},[t])}),c=p(e=>{s.mutate({alertId:e})},[s]),l=p(()=>{pf(),r(!0)},[]);return a||n||o.length===0?null:sr(N(`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:[N(`h2`,{id:`critical-alerts-panel-title`,className:`text-[12px] font-semibold text-foreground`,children:e(`ui.criticalAlertsPanel.title`,`Urgent alerts`)}),N(`p`,{className:`text-[10px] text-foreground-muted mt-0.5`,children:e(`ui.criticalAlertsPanel.subtitle`,`These need your attention.`)})]}),N(qn,{type:`button`,variant:`ghost`,onClick:l,"aria-label":e(`ui.criticalAlertsPanel.close`,`Close`),"data-testid":`critical-alerts-panel-close`,icon:De})]}),N(`div`,{className:`flex-1 overflow-y-auto`,children:o.map(e=>N(kf,{alert:e,onMarkRead:c},e.id))})]})}),document.body)}a();function jf(){let e=js();return C(e.subscribe,e.getSnapshot,e.getSnapshot)}var Mf=[`detection`,`cluster`,`administration`];function Nf(e){return Mf.includes(e)}function Pf(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(Nf(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 Ff=`camstack:last-path`,If=512,Lf=[`/login`,`/change-password`,`/access-denied`,`/logout`];function Rf(e){return!e.startsWith(`/`)||e.startsWith(`//`)||e.length>If?!1:!Lf.some(t=>e===t||e.startsWith(t+`/`))}function zf(e){if(!(typeof window>`u`)&&Rf(e))try{window.localStorage.setItem(Ff,e)}catch{}}function Bf(){if(typeof window>`u`)return null;try{let e=window.localStorage.getItem(Ff);return e===null?null:Rf(e)?e:null}catch{return null}}a();var Vf=g(!0);function Hf(e){return e===`/addon`||e.startsWith(`/addon/`)}function Uf(e,t,n){let r=[...e.filter(e=>e!==t),t];return r.length<=n?r:r.slice(r.length-n)}function Wf({maxCached:e=6}){let t=Wi(),n=q(),r=Ri(),i=v(K),a=n.pathname,o=Hf(a),s=j(new Map),c=j([]);if(o){s.current.set(a,{key:a,outlet:t,location:n,navigationType:r,routeContext:i});let o=Uf(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 N(`div`,{className:n?`h-full min-h-0`:void 0,style:n?void 0:{display:`none`},hidden:!n,"aria-hidden":!n,children:N(Vf.Provider,{value:n,children:N(ki.Provider,{value:{location:t.location,navigationType:t.navigationType},children:N(K.Provider,{value:t.routeContext,children:t.outlet})})})},e)}),!o&&t!=null?N(`div`,{className:`h-full min-h-0`,children:t},a):null]})}a();var Gf={dark:se,light:ce,system:pt};function Kf(){return N(`div`,{className:`flex h-full min-h-[50vh] items-center justify-center`,children:N(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-primary/30 border-t-primary`})})}function qf(){let e=q(),t=Vi(),{user:n,logout:r}=Nc(),i=jn(),{t:a}=V(),o=Pn(),c=mn(),{info:l}=cd();s(()=>{document.title=l===null?`CamStack Admin`:`${l.name} \u00b7 CamStack Admin`},[l]);let u=xs(jf()),[p,m]=f(!1);s(()=>{zf(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=[]}=Kt({nodeId:`hub`},{refetchInterval:3e4}),b=v.length,x=A(),S=j(Date.now()),{data:C}=In(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?fu(C):[],[C,n?.isAdmin]),D=d(()=>Pf(T),[T]),O=D.known.get(`detection`)??[],k=D.known.get(`cluster`)??[],M=D.known.get(`administration`)??[];ir(`addon.page-ready`,()=>{x.invalidateQueries({queryKey:[[`addonPages`,`listPages`]]})});let P=()=>{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+`/`)),L=n?.isAdmin===!0,ee=d(()=>zu({t:a,isAdmin:L}),[a,L]),te=ee[0]?.items??[],ne=ee[1]?.items??[],re=ee[2]?.items??[],ie=ee[3]?.items??[],ae=i?.mode??`system`,oe={dark:a(`theme.dark`),light:a(`theme.light`),system:a(`theme.system`)},R=h&&!o,se=(e,t=`md`)=>`flex w-full items-center gap-2.5 rounded-md ${R?`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`}`,ce=(e,t)=>e===0?null:R?N(`div`,{className:`pt-3 mb-1 mx-2 border-t border-border/60`},`sep-${t}`):N(`div`,{className:`pt-4 pb-1.5 px-2.5`,children:N(`span`,{className:`text-[10px] font-semibold uppercase tracking-widest text-foreground-subtle/60`,children:t})},`hdr-${t}`),le=e=>{let n=F(e.path),r=Vu(e.icon);return y(`button`,{onClick:()=>{t(e.path),m(!1)},className:se(n),title:R?e.label:void 0,children:[N(r,{className:`h-3.5 w-3.5 shrink-0 ${n?`text-primary`:``}`}),!R&&e.label]},`${e.addonId}::${e.id}`)},ue=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:se(r),title:R?e.label:void 0,children:[N(n,{className:`h-3.5 w-3.5 shrink-0 ${r?`text-primary`:``}`}),!R&&y(E,{children:[N(`span`,{className:`flex-1 text-left`,children:e.label}),i&&b>0&&N(`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})]}),R&&i&&b>0&&N(`span`,{className:`absolute mt-[-14px] ml-3 h-2 w-2 rounded-full bg-primary`})]},e.path)},fe=y(E,{children:[y(`div`,{className:`flex h-14 items-center border-b border-border ${R?`justify-center px-1`:`pl-3 pr-4 gap-2`}`,children:[!R&&N(`img`,{src:i?.resolvedMode===`light`?z(`/brand/logo-horizontal-light.svg`):z(`/brand/logo-horizontal-dark.svg`),alt:a(`layouts.appLayout.camstackAdmin`,`CamStack Admin`),className:`h-9 flex-1 min-w-0`}),!o&&N(`button`,{onClick:()=>g(e=>!e),className:`p-1.5 rounded-md hover:bg-surface-hover text-foreground-subtle transition-colors flex-shrink-0 ${R?``:`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:N(h?Qe:we,{className:`h-4 w-4`})})]}),!R&&l!==null&&N(`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}),N(`div`,{className:`border-b border-border pt-2`,children:N(Zu,{navSections:ee,addonPages:T,compact:R,onNavigated:()=>m(!1)})}),y(`nav`,{className:`flex-1 overflow-y-auto py-3 ${R?`px-1.5`:`px-2`} space-y-0.5`,children:[te.map(e=>ue(e)),ce(ne.length+O.length,a(`nav.detectionSection`,`Detection`)),ne.map(e=>ue(e)),O.map(e=>le(e)),ce(re.length+k.length,a(`nav.clusterSection`,`Cluster`)),re.map(e=>ue(e)),k.map(e=>le(e)),ce(ie.length+M.length,a(`system.title`,`Administration`)),ie.map(e=>ue(e)),M.map(e=>le(e)),D.custom.map(e=>y(`div`,{className:`contents`,children:[ce(e.pages.length,e.label),e.pages.map(e=>le(e))]},`custom-${e.id}`)),ce(D.ungrouped.length,a(`nav.addonPages`,`Addon Pages`)),D.ungrouped.map(e=>le(e))]}),y(`div`,{className:`border-t border-border ${R?`p-1.5`:`p-2`} space-y-0.5`,children:[y(`button`,{onClick:()=>i?.toggleMode(),className:se(!1),title:R?oe[ae]:void 0,children:[(()=>{let e=Gf[ae];return N(e,{className:`h-3.5 w-3.5 shrink-0`})})(),!R&&N(`span`,{children:oe[ae]})]}),N(Of,{variant:`sidebar`,compact:R}),y(`button`,{type:`button`,onClick:()=>t(`/system/my-access`),className:se(F(`/system/my-access`)),title:R?a(`system.myAccess`,`My access`):void 0,children:[N(Ke,{className:`h-3.5 w-3.5 shrink-0`}),!R&&N(`span`,{className:`truncate`,children:a(`system.myAccess`,`My access`)})]}),y(`button`,{onClick:P,className:se(!1).replace(`hover:text-foreground`,`hover:text-danger`),title:R?n?.username??a(`layouts.appLayout.logout`,`Logout`):void 0,children:[N(Tt,{className:`h-3.5 w-3.5 shrink-0`}),!R&&N(`span`,{className:`truncate`,children:n?.username??a(`layouts.appLayout.user`,`User`)})]}),N(`div`,{className:`pt-1 text-[10px] text-foreground-disabled select-none ${R?`text-center`:`px-2`}`,title:a(`layouts.appLayout.adminUiV`,`admin-ui v{{__APP_VERSION__}}`,{__APP_VERSION__:`1.2.441`}),children:R?`1.2.441`:`v1.2.441`})]})]});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&&N(`aside`,{className:`flex flex-col border-r border-border bg-surface/80 backdrop-blur-sm shrink-0 transition-[width] duration-150 ease-out ${R?`w-12`:`w-48`}`,children:fe}),o&&N(Xn,{open:p,onClose:()=>m(!1),width:`w-64`,children:fe}),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`?N(Se,{className:`h-3.5 w-3.5`}):N(Oe,{className:`h-3.5 w-3.5`}),N(`span`,{children:a(u.i18nKey,{defaultValue:u.message,...u.i18nParams})}),u.action===`sign-in`&&N(`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&&N(ze,{className:`h-3.5 w-3.5 animate-spin`})]}),N(od,{}),N(hd,{}),N(Af,{}),o&&y(`header`,{className:`flex items-center h-12 border-b border-border px-3 shrink-0 bg-surface/80 backdrop-blur-sm`,children:[N(`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:N(de,{className:`h-5 w-5`})}),N(`div`,{className:`flex-1 flex justify-center`,children:N(`img`,{src:i?.resolvedMode===`light`?z(`/brand/logo-horizontal-light.svg`):z(`/brand/logo-horizontal-dark.svg`),alt:a(`layouts.appLayout.camstack`,`CamStack`),className:`h-7`})}),N(Of,{})]}),N(`main`,{className:`relative flex-1 min-h-0 overscroll-contain bg-background ${I?`overflow-hidden`:`overflow-auto`}`,children:N(w,{fallback:N(Kf,{}),children:N(Wf,{})})})]})]})}function $({children:e,requireAdmin:t}){let{t:n}=V(),{user:r,loading:i,mustChangePassword:a}=Nc(),o=q();return i?N(`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`?N(J,{to:`/change-password`,replace:!0}):t&&!r.isAdmin?N(J,{to:`/access-denied`,replace:!0}):N(E,{children:e}):N(J,{to:`/login`,replace:!0,state:{from:o.pathname+o.search}})}var Jf=`customize`,Yf=`main`,Xf=`advanced`,Zf=`/build/compositions/new`,Qf=`/build/compositions/:blockId`,$f=`/build?tab=custom-device`;function ep(e){return`/devices/${e}?tab=${Jf}`}function tp(e){return`${ep(e)}&sub=${Xf}`}function np(e){return`/build/compositions/${encodeURIComponent(e)}`}var rp=`integration`,ip=`section`,ap=[rp,ip],op={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`}},sp=`settings`,cp=`activity`;function lp(e,t={}){let{path:n,tab:r}=op[e],i=new URLSearchParams;r!==null&&i.set(`tab`,r),t.integration!==void 0&&i.set(rp,t.integration),t.section!==void 0&&i.set(ip,t.section);let a=i.toString();return a.length>0?`${n}?${a}`:n}function up(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 dp(e,t,n=null,r=null){let i=new URLSearchParams(e);return i.set(rp,t),r===null?i.delete(ip):i.set(ip,r),n!==null&&i.delete(n),i}function fp(e){return e===`/admin`||e===`/admin/`?`/`:e.startsWith(`/admin/`)?e.slice(6):e}function pp(){let{t:e}=V(),t=Vi();return y(`div`,{className:`flex flex-col items-center justify-center text-foreground py-16 px-4`,children:[N(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-2xl bg-danger/10 mb-4`,children:N(wt,{className:`h-8 w-8 text-danger`})}),N(`h1`,{className:`text-xl font-bold`,children:e(`accessDenied.accessDenied`,`Access Denied`)}),N(`p`,{className:`mt-2 text-sm text-foreground-subtle`,children:e(`accessDenied.youDonTHavePermission`,`You don't have permission to access this page.`)}),N(`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`)})]})}a();var mp=8;function hp(){let{t:e}=V(),{user:t,mustChangePassword:n,clearMustChangePassword:r,logout:i}=Nc(),a=jn(),o=Vi(),[s,c]=f(``),[l,u]=f(``),[d,p]=f(!1),[m,h]=f(``),g=jt({onSuccess:()=>{r(),o(`/devices`,{replace:!0})},onError:e=>{h(e instanceof Error?e.message:`Could not change password`)}});return N(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:y(`div`,{className:`w-full max-w-sm`,children:[N(`div`,{className:`flex justify-center mb-8`,children:N(`img`,{src:a?.resolvedMode===`light`?z(`/brand/logo-horizontal-light.svg`):z(`/brand/logo-horizontal-dark.svg`),alt:e(`changePassword.camstackAdmin`,`CamStack Admin`),className:`h-12`})}),y(`form`,{onSubmit:async e=>{if(e.preventDefault(),h(``),!t){h(`Not signed in`);return}if(s.length<mp){h(`Password must be at least ${mp} characters`);return}if(s!==l){h(`The two passwords do not match`);return}if(s===`changeme`){h(`Choose a password different from the seed default`);return}g.mutate({id:t.id,newPassword:s})},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:[N(`h1`,{className:`text-sm font-semibold text-foreground`,children:e(`changePassword.setANewPassword`,`Set a new password`)}),N(`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.`)})]}),m&&N(`div`,{className:`rounded-md bg-danger/10 border border-danger/20 px-3 py-2 text-xs text-danger`,children:m}),y(`div`,{className:`space-y-1.5`,children:[N(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`changePassword.newPassword`,`New password`)}),y(`div`,{className:`relative`,children:[N(`input`,{"data-testid":`change-password-new`,type:d?`text`:`password`,value:s,onChange:e=>c(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`,autoFocus:!0}),N(`button`,{type:`button`,onClick:()=>p(!d),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground transition-colors`,tabIndex:-1,children:N(d?et:fe,{className:`h-4 w-4`})})]})]}),y(`div`,{className:`space-y-1.5`,children:[N(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`changePassword.confirmNewPassword`,`Confirm new password`)}),N(`input`,{"data-testid":`change-password-confirm`,type:d?`text`:`password`,value:l,onChange:e=>u(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`})]}),N(`button`,{"data-testid":`change-password-submit`,type:`submit`,disabled:g.isPending||!s||!l,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:g.isPending?e(`changePassword.saving`,`Saving…`):e(`changePassword.saveAndContinue`,`Save and continue`)}),n&&N(`button`,{type:`button`,onClick:()=>{i(),o(`/login`,{replace:!0})},className:`w-full text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:e(`changePassword.signOutInstead`,`Sign out instead`)})]})]})})}function gp(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 _p(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 vp(){return window?.PublicKeyCredential!==void 0&&typeof window.PublicKeyCredential==`function`}function yp(e){let{id:t}=e;return{...e,id:_p(t),transports:e.transports}}function bp(e){return e===`localhost`||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}var xp=class extends Error{constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),this.name=r??n.name,this.code=t}},Sp=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}}},Cp=[`cross-platform`,`platform`];function wp(e){if(e&&!(Cp.indexOf(e)<0))return e}function Tp(){if(!vp())return new Promise(e=>e(!1));let e=window.PublicKeyCredential;return e.isConditionalMediationAvailable===void 0?new Promise(e=>e(!1)):e.isConditionalMediationAvailable()}function Ep({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 xp({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new xp({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=window.location.hostname;if(!bp(t))return new xp({message:`${window.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new xp({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 xp({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 Dp(e){let{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:r=!0}=e;if(!vp())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(yp));let a={...t,challenge:_p(t.challenge),allowCredentials:i},o={};if(n){if(!await Tp())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=Sp.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw Ep({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=gp(u.userHandle)),{id:c,rawId:gp(l),response:{authenticatorData:gp(u.authenticatorData),clientDataJSON:gp(u.clientDataJSON),signature:gp(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:wp(s.authenticatorAttachment)}}function Op(e){return typeof e==`object`&&!!e}function kp(e){return Op(e)&&typeof e.challenge==`string`}a();async function Ap(e){if(!kp(e))throw Error(`passkey authentication options missing challenge`);let t=await Dp({optionsJSON:e});return Object.fromEntries(Object.entries(t))}function jp({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 Ap((await e.loginBeginPasskey(t)).optionsJSON),i=await e.loginVerifyPasskey(t,r,{refreshable:!0});n(i.token,i);return}let a=await Ap((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?N(ze,{className:`h-4 w-4 animate-spin text-primary`}):N(ht,{className:`h-4 w-4 text-primary`}),e.label]}),s&&N(`div`,{className:`rounded-md bg-danger/10 border border-danger/20 px-3 py-2 text-xs text-danger`,children:s})]})}var Mp=()=>window.location.hostname;function Np(e,t=Mp){return vp()&&ed(t(),e.rpId)}function Pp(e,t=Mp){let n=e.filter(e=>e.kind===`passkey`&&e.stage===`second-factor`).filter(e=>Np(e,t));return{passkeyMethods:n,widgetMethods:n.length>0?[]:e.filter(e=>e.kind===`widget`&&e.stage===`second-factor`)}}function Fp(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 Ip(e){let t=e.onComplete,n=e.onSecondFactor;return typeof t==`function`?{onComplete:t,onSecondFactor:typeof n==`function`?n:void 0}:null}function Lp({methods:e,widgetConfig:t,onRedirect:n}){let{t:r}=V();bn();let i=e.filter(e=>e.kind!==`passkey`||Np(e));return i.length===0?null:y(`div`,{className:`mt-6 space-y-3`,children:[y(`div`,{className:`flex items-center gap-3`,children:[N(`div`,{className:`h-px flex-1 bg-border`}),N(`span`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:r(`login.primaryLoginMethods.orContinueWith`,`Or continue with`)}),N(`div`,{className:`h-px flex-1 bg-border`})]}),N(`div`,{className:`space-y-2`,children:i.map(e=>{if(e.kind===`redirect`){let t=(e.icon===void 0?void 0:_n(e.icon))??Ke;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:[N(t,{className:`h-4 w-4 text-primary`}),e.label]},e.id)}if(e.kind===`passkey`){let n=Ip(t);return n?N(jp,{method:e,onComplete:n.onComplete,onSecondFactor:n.onSecondFactor},e.id):null}return N(Rp,{method:e,config:t},e.id)})})]})}function Rp({method:e,config:t}){let{t:n}=V(),r=It(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:[N(ze,{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:[N(Me,{className:`h-3.5 w-3.5 shrink-0`}),n(`login.primaryMethods.loadFailed`)]}):N(r,{instanceId:e.id,host:`dashboard`,config:t})}var zp=4e3,Bp=/^[A-Za-z0-9._-]{1,64}$/;function Vp(e){let t=e.addonId!==void 0&&Bp.test(e.addonId)?e.addonId:null,n=e.integration!==void 0&&Bp.test(e.integration)?e.integration:null;if(t!==null&&e.brokerId!==void 0)return`/system/integrations?tab=brokers&integration=${t}`;let r=n??t;return r===null?`/system/integrations`:`/system/integrations?integration=${r}`}function Hp(e,t){let n=t.opener;if(n===null||n.closed||qd(n)!==t.origin)return!1;try{return n.postMessage({type:rf,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 Up=500;function Wp(e){let{t}=V();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 Gp({outcome:e}){let{t}=V(),n=Wp(e.reason??`unknown`);if(e.status===`error`)return y(E,{children:[N(Ge,{className:`mx-auto h-8 w-8 text-danger`,"aria-hidden":!0}),N(`h1`,{"data-testid":`oauth-landing-title`,className:`text-sm font-semibold text-foreground`,children:t(`oauthLanding.errorTitle`,`Sign-in did not finish`)}),N(`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:[N(Ve,{className:`mx-auto h-8 w-8 text-success`,"aria-hidden":!0}),N(`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`)}),N(`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 Kp({outcome:e,closable:t,onContinue:n,onClose:r}){let{t:i}=V(),a=Vp(e);return s(()=>{if(e.status!==`success`)return;let t=window.setTimeout(()=>n(a),zp);return()=>window.clearTimeout(t)},[e.status,n,a]),N(`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:[N(`div`,{className:`flex justify-center`,children:y(`picture`,{children:[N(`source`,{media:`(prefers-color-scheme: dark)`,srcSet:z(`/brand/logo-horizontal-dark.svg`)}),N(`img`,{src:z(`/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:[N(Gp,{outcome:e}),y(`div`,{className:`flex flex-col gap-2`,children:[N(Rt,{type:`button`,variant:`primary`,onClick:()=>n(a),children:i(`oauthLanding.back`,`Back to CamStack`)}),t&&N(Rt,{type:`button`,variant:`ghost`,onClick:r,children:i(`oauthLanding.close`,`Close this window`)})]})]})]})})}function qp(e,t){window.history.replaceState(null,``,window.location.pathname);let n=window.opener,r=Hp(t,{opener:n,origin:window.location.origin}),i=()=>e.render(N(Kp,{outcome:t,closable:r,onContinue:e=>window.location.replace(z(e)),onClose:()=>window.close()}));if(r&&t.status===`success`){window.close(),window.setTimeout(i,Up);return}i()}function Jp(e){return ct(e)}var Yp=`Done — you can close this window.`,Xp=500,Zp=`camstack_admin_token`;async function Qp(e,t=``){try{let n=Us(new URLSearchParams(t));n!==null&&n.token===e?Vs(n):localStorage.setItem(Zp,e)}catch{}await fetch(z(`/api/auth/session`),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({token:e})}).catch(()=>{})}function $p(){try{let e=localStorage.getItem(Zp);return e!==null&&e.length>0?e:null}catch{return null}}function em(e){let t=Jp(window.location.hash);if(t!==null){qp(e,t);return}let n=Pd(window.location.hash);window.history.replaceState(null,``,window.location.pathname);let r=t=>e.render(N(tm,{completion:n,result:t}));if(r(null),n===null)return;let i=Jd();tf(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:Yp}),Xp)},continueAt:e=>window.location.replace(z(e)),persistSession:e=>Qp(e,n.target===`login`?n.fragment:``),showResult:r,setTimeout:(e,t)=>window.setTimeout(e,t)})}function tm({completion:e,result:t}){let{t:n}=V();return N(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:N(`div`,{className:`flex flex-col items-center gap-3 text-sm text-foreground-subtle`,children:e===null?N(`a`,{className:`text-primary underline`,href:z(`/login`),children:n(`ssoComplete.nothingToFinishHereGo`,`Nothing to finish here — go to sign-in`)}):t===null?y(`span`,{className:`flex items-center gap-3`,children:[N(`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:[N(`span`,{"data-testid":`sso-complete-result`,className:t.kind===`link-error`?`text-danger`:`text-foreground`,children:t.message}),N(`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 nm(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 rm(){let e=new URLSearchParams(window.location.search);return ic({codeChallenge:e.get(`code_challenge`),codeChallengeMethod:e.get(`code_challenge_method`),state:e.get(`state`),purpose:e.get(`purpose`)})}function im(e){return Math.min(1e3*2**e,15e3)}function am(){let{t:e}=V(),{login:t,verifyTotp:n,finalizePasskeyLogin:r,user:i}=Nc(),{i18n:a}=V(),o=jn(),c=Vi(),l=q(),u=new URLSearchParams(window.location.search).get(`next`);s(()=>{pc(u)},[u]);let d=new URLSearchParams(window.location.search).get(`redirect`);s(()=>{Sc(d)},[d]);let p=rm();s(()=>{sc(p)},[p?.codeChallenge,p?.state,p?.purpose]);let m=l.state?.from??Bf()??`/devices`,[h,g]=f(``),[_,v]=f(``),[b,x]=f(!1),[S,C]=f(``),[w,T]=f(!1),[D,O]=f(`credentials`),[k,A]=f(``),[M,F]=f([]),[I,L]=f(``),[ee,te]=f(void 0),[ne,re]=f(`sso-not-linked`),ie=en.auth.listLoginMethods.useQuery(void 0,{retry:!0,retryDelay:im}),ae=ie.data===void 0,oe=(ie.data??[]).filter(e=>e.kind!==`device-certificate`),R=en.auth.getServerName.useQuery().data,se=oe.filter(e=>e.stage===`primary`),ce=Pp(oe);s(()=>{let e=wd(window.location.hash);if(e!==null){if(window.history.replaceState({},``,window.location.pathname+window.location.search),e.kind===`challenge`){A(e.challengeToken),F(e.factors),L(``),O(`second-factor`);return}re(e.code),te(e.provider)}},[]);let le=ee==null?null:oe.find(e=>e.id===ee&&`label`in e)?.label??null,ue=S||(ee===void 0?``:Td(ne,le)),{passkeyMethods:de,widgetMethods:pe}=ce,me=j(!1),he=async()=>{if(me.current)return;me.current=!0;let e=uc(d);if(e?.kind===`app-callback`){await ve(e.url);return}else if(e){window.location.assign(z(e.path));return}let t=hc(u);t?window.location.assign(z(t)):c(m,{replace:!0})},[ge,_e]=f(null),ve=async e=>{_e({callbackBase:e,mintedUrl:null,failed:!1});try{let t=rm()??cc();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=lc(e,n,t.state);_e({callbackBase:e,mintedUrl:r,failed:!1}),window.location.assign(r)}catch(t){if(nm(t)){me.current=!1,_e(null),C(`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(),C(``),te(void 0),T(!0);try{let e=await t(h,_);if(e.kind===`second-factor`){A(e.challengeToken),F(e.factors),O(`second-factor`);return}_===`changeme`?c(`/change-password`,{replace:!0}):await he()}catch(e){C(e instanceof Error?e.message:`Login failed`)}finally{T(!1)}},we=async e=>{e.preventDefault(),C(``),T(!0);try{await n(k,I.trim()),await he()}catch(e){C(e instanceof Error?e.message:`TOTP verification failed`),L(``)}finally{T(!1)}},Te=async(e,t)=>{try{await r(e,t),await he()}catch(e){C(e instanceof Error?e.message:`Passkey sign-in failed`)}},Ee=j(null);s(()=>()=>Ee.current?.(),[]);let De=async e=>{if(e.target!==`login`)return;let t=Us(new URLSearchParams(e.fragment));if(t!==null){try{await r(t.token,t),await he()}catch(e){C(e instanceof Error?e.message:`Sign-in failed`)}return}let n=wd(`#${e.fragment}`);if(n!==null){if(n.kind===`challenge`){ke({challengeToken:n.challengeToken,factors:n.factors});return}re(n.code),te(n.provider)}},Oe=e=>{if(tc(d)?.kind===`app-callback`)return!1;let t=Rd(z(Id(e.startUrl)));return t===null?!1:(C(``),te(void 0),Ee.current?.(),Ee.current=Xd(t,{onReturn:e=>{Ee.current?.(),Ee.current=null,De(e)},onDone:e=>{if(Ee.current?.(),Ee.current=null,e.target!==`login`)return;let t=$p()===null?null:Bs();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`);A(e.challengeToken),F(t),L(``),C(``),O(`second-factor`)};return ge===null?N(`div`,{className:`flex min-h-screen items-center justify-center bg-background p-4`,children:y(`div`,{className:`w-full max-w-sm`,children:[N(`div`,{className:`flex justify-center mb-8`,children:N(`img`,{src:o?.resolvedMode===`light`?z(`/brand/logo-horizontal-light.svg`):z(`/brand/logo-horizontal-dark.svg`),alt:e(`login.camstackAdmin`,`CamStack Admin`),className:`h-12`})}),R!==void 0&&!R.isDefault&&N(`p`,{"data-testid":`login-server-name`,className:`-mt-4 mb-6 text-center text-sm text-foreground-muted`,children:N(Xo,{i18nKey:`login.signInTo`,values:{name:R.name},components:{b:N(`span`,{className:`font-semibold text-foreground`})}})}),D===`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&&N(`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:[N(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`login.username`,`Username`)}),N(`input`,{"data-testid":`login-username`,type:`text`,placeholder:e(`login.username`,`Username`),value:h,onChange:e=>g(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:[N(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`login.password`,`Password`)}),y(`div`,{className:`relative`,children:[N(`input`,{"data-testid":`login-password`,type:b?`text`:`password`,placeholder:e(`login.password`,`Password`),value:_,onChange:e=>v(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`}),N(`button`,{type:`button`,onClick:()=>x(!b),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-foreground-subtle hover:text-foreground transition-colors`,tabIndex:-1,children:N(b?et:fe,{className:`h-4 w-4`})})]})]}),N(`button`,{"data-testid":`login-submit`,type:`submit`,disabled:w||!h||!_,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:w?y(`span`,{className:`flex items-center justify-center gap-2`,children:[N(`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:[N(P,{className:`h-4 w-4 text-primary`}),N(`div`,{className:`text-sm font-medium text-foreground`,children:e(`login.twoFactorAuthentication`,`Two-factor authentication`)})]}),N(`p`,{className:`text-xs text-foreground-subtle`,children:h?N(E,{children:N(Xo,{i18nKey:`login.finishSigningInAs`,values:{username:h},components:{mono:N(`span`,{className:`font-mono text-foreground`})}})}):e(`login.finishSigningInAs`,`Finish signing in.`)}),S&&N(`div`,{className:`rounded-md bg-danger/10 border border-danger/20 px-3 py-2 text-xs text-danger`,children:S}),M.includes(`passkey`)&&de.map(e=>N(jp,{method:e,challengeToken:k,onComplete:Te},e.id)),M.includes(`passkey`)&&pe.map(e=>N(Rp,{method:e,config:{challengeToken:k,onComplete:Te}},e.id)),Fp(M,ce)&&N(`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.`)}),M.includes(`passkey`)&&M.includes(`totp`)&&y(`div`,{className:`flex items-center gap-3`,children:[N(`div`,{className:`h-px flex-1 bg-border`}),N(`span`,{className:`text-[10px] uppercase tracking-wider text-foreground-subtle`,children:`or`}),N(`div`,{className:`h-px flex-1 bg-border`})]}),M.includes(`totp`)&&y(`form`,{onSubmit:we,className:`space-y-4`,children:[y(`div`,{className:`space-y-1.5`,children:[N(`label`,{className:`text-xs font-medium text-foreground-subtle`,children:e(`login.authenticationCode`,`Authentication code`)}),N(`input`,{"data-testid":`login-totp`,type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,placeholder:`123456`,value:I,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})]}),N(`button`,{"data-testid":`login-totp-submit`,type:`submit`,disabled:w||I.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:w?y(`span`,{className:`flex items-center justify-center gap-2`,children:[N(`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:()=>{O(`credentials`),A(``),F([]),L(``),C(``)},className:`w-full flex items-center justify-center gap-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:[N(ye,{className:`h-3 w-3`}),e(`login.backToUsernamePassword`,`Back to username + password`)]})]}),D===`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:[N(`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...`)]}),D===`credentials`&&N(Lp,{methods:se,widgetConfig:{onComplete:Te,onSecondFactor:ke,locale:a.language},onRedirect:Oe}),N(`p`,{className:`mt-6 text-center text-[10px] text-foreground-subtle/50`,children:e(`login.version`,{version:`1.2.441`})})]})}):N(`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:[N(`h1`,{className:`text-sm font-semibold text-foreground`,children:e(`login.returningToTheApp`,`Returning to the app…`)}),ge.failed?y(E,{children:[N(`p`,{className:`text-xs text-danger`,children:e(`login.couldNotPrepareTheSign`,`Could not prepare the sign-in handoff. You are logged in — retry below.`)}),N(`button`,{onClick:()=>void ve(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?N(`p`,{className:`text-xs text-foreground-subtle`,children:e(`login.preparingAOneTimeSign`,`Preparing a one-time sign-in code…`)}):y(E,{children:[N(`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).`)}),N(`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 om(){let{pathname:e,search:t,hash:n}=q();return N(J,{to:`${fp(e)}${t}${n}`,replace:!0})}function sm(){return N(J,{to:Bf()??`/devices`,replace:!0})}var cm=m(()=>i(()=>import(`./Devices-BacO9x6N.js`).then(e=>({default:e.DevicesPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url)),lm=m(()=>i(()=>import(`./Integrations-Bf2SzcCT.js`).then(e=>({default:e.IntegrationsPage})),__vite__mapDeps([9,1,2,3,4,10,5,6,11,12,13,7,8]),import.meta.url)),um=m(()=>i(()=>import(`./IntegrationDetail-CFsboI2-.js`).then(e=>({default:e.IntegrationDetailPage})),__vite__mapDeps([14,1,2,3,4,15,5,16,11,12,13,7,17]),import.meta.url)),dm=m(()=>i(()=>import(`./ClusterStepModel-BbVbEWqh.js`).then(e=>e.r).then(e=>({default:e.PipelinePage})),__vite__mapDeps([18,1,2,3,4,10,5,19,20,21,22,16,23,8]),import.meta.url)),fm=m(()=>i(()=>import(`./DeviceDetail-Ry7b522t.js`).then(e=>({default:e.DeviceDetailPage})),__vite__mapDeps([24,1,2,3,4,10,5,25,26,27,28,19,29,22,30,31,32,33,18,20,21,16,23,8,34,13]),import.meta.url)),pm=m(()=>i(()=>import(`./Showroom-ChGRG_dB.js`).then(e=>({default:e.ShowroomPage})),__vite__mapDeps([35,1,2,3,4]),import.meta.url)),mm=m(()=>i(()=>import(`./EmbedPlayerPage-DgFNOUrt.js`).then(e=>({default:e.EmbedPlayerPage})),__vite__mapDeps([36,1,2,3,4,5]),import.meta.url)),hm=m(()=>i(()=>import(`./Library-yKp-qGfV.js`).then(e=>({default:e.LibraryPage})),__vite__mapDeps([37,1,2,3,4,10,5,38,19,21,39,40,31,41,34,13]),import.meta.url)),gm=m(()=>i(()=>import(`./Recordings-CkHyBhqh.js`).then(e=>({default:e.RecordingsPage})),__vite__mapDeps([42,1,2,3,4,10,5,43,40,44,25,45,46,47,34,13]),import.meta.url)),_m=m(()=>i(()=>import(`./Viewer-DWdf6_8H.js`).then(e=>({default:e.ViewerPage})),__vite__mapDeps([48,2,3,4,49,5,13,1]),import.meta.url)),vm=m(()=>i(()=>import(`./Build-RW9SjiCM.js`).then(e=>({default:e.BuildPage})),__vite__mapDeps([50,1,2,3,4,10,5,28,51,19,40,30,52,53]),import.meta.url)),ym=m(()=>i(()=>import(`./CompositionEditorPage-D3LiFLq4.js`).then(e=>({default:e.CompositionEditorPage})),__vite__mapDeps([54,1,2,3,4,28,5,6,30,10]),import.meta.url)),bm=m(()=>i(()=>import(`./Locations-BCY7diBp.js`).then(e=>({default:e.LocationsPage})),__vite__mapDeps([55,1,2,3,4,10,5,28,56,39,40,32,33]),import.meta.url)),xm=m(()=>i(()=>import(`./Addons-CUPFTOFz.js`).then(e=>({default:e.AddonsPage})),__vite__mapDeps([57,1,2,3,4,19,5,6,16,58,13]),import.meta.url)),Sm=m(()=>i(()=>import(`./AiProfiles-CEZqx-Sw.js`).then(e=>({default:e.AiProfilesPage})),__vite__mapDeps([59,1,2,3,4,10,5,60,61,6,40,13]),import.meta.url)),Cm=m(()=>i(()=>import(`./MyAccess-DmuNu2nC.js`).then(e=>({default:e.MyAccessPage})),__vite__mapDeps([62,1,2,3,4,10,5,19,63,64,65,6,66,13]),import.meta.url)),wm=m(()=>i(()=>import(`./Logs-DWz6dVJo.js`).then(e=>({default:e.LogsPage})),__vite__mapDeps([67,1,2,3,4,68,22,5,6,40,69,70,16,71,17,13,72]),import.meta.url)),Tm=m(()=>i(()=>import(`./Identity-BPWd0o-B.js`).then(e=>({default:e.IdentityPage})),__vite__mapDeps([73,1,2,3,4,10,5,74,19,75,63,64,65,6,40,69,70,16,71,17,13,66,72]),import.meta.url)),Em=m(()=>i(()=>import(`./Network-CMlIm20D.js`).then(e=>({default:e.NetworkPage})),__vite__mapDeps([76,1,2,3,4,10,5,28,19,77,6,40,69,70,16,71,17,13,72]),import.meta.url)),Dm=m(()=>i(()=>import(`./Integrations-CBqnh8t8.js`).then(e=>({default:e.IntegrationsPage})),__vite__mapDeps([78,1,2,3,4,10,5,19,77,64,79,40,69,70,6,16,71,17,13,12]),import.meta.url)),Om=m(()=>i(()=>import(`./Data-TI1fXQ8e.js`).then(e=>({default:e.DataPage})),__vite__mapDeps([80,1,2,3,4,10,5,81,29,46,6,40,44,25,45,47,34,13]),import.meta.url)),km=m(()=>i(()=>import(`./System-GfppoElu.js`).then(e=>({default:e.SystemPage})),__vite__mapDeps([82,1,2,3,4,10,5,19,63,6,40,16,71,17,13]),import.meta.url)),Am=m(()=>i(()=>import(`./Cluster-DdgLAQcF.js`).then(e=>({default:e.ClusterPage})),__vite__mapDeps([83,1,2,3,4,10,5,46,84,65,6,16,23,58,47]),import.meta.url)),jm=m(()=>i(()=>import(`./Terminal-C7azorOj.js`).then(e=>({default:e.TerminalPage})),__vite__mapDeps([85,1,2,3,4,19,5,6,16,86]),import.meta.url)),Mm=m(()=>i(()=>import(`./Notifications-B0nD4977.js`).then(e=>({default:e.NotificationsPage})),__vite__mapDeps([87,1,2,3,4,10,5,27,19,75,88,61,6,40,52,53,41,13,33]),import.meta.url)),Nm=m(()=>i(()=>import(`./Calendars-CVnE0N6y.js`).then(e=>({default:e.CalendarsPage})),__vite__mapDeps([89,1,2,3,4,10,5,19,6]),import.meta.url)),Pm=new D({defaultOptions:{queries:{gcTime:0,staleTime:0,retry:!1,refetchOnWindowFocus:!1}}});Qt(Pm);function Fm({field:e,value:t,onChange:n,disabled:r}){return N(Hl,{field:e,value:t,onChange:n,disabled:r})}var Im={"model-selector":Fm};function Lm({children:e}){let{t}=V(),{user:n,logout:r}=Nc(),[i,a]=f(0),o=j(n?.username??null);s(()=>{let e=n?.username??null;e!==o.current&&(o.current=e,Q(),a(e=>e+1))},[n]);let c=d(()=>Z(),[i]),l=p(()=>{Z().reconnect(),a(e=>e+1),Pm.invalidateQueries()},[]);du(p(()=>Qs(l),[l])),s(()=>Js(()=>{Z().isSocketTokenStale()&&l()}),[l]);let u=p(async()=>{let e=await $s();return e&&l(),e},[l]),{bootReady:m,bootError:h}=lu(c,n??null,r,u);return N(ou,{children:N(Pe,{system:c,children:N(en.Provider,{client:c.trpcClient,queryClient:Pm,children:y(on,{children:[N(yn,{children:m?e:N(Rm,{})}),m&&N(Jl,{}),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 Rm(){let{t:e}=V();return N(`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:[N(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-primary/30 border-t-primary`}),e(`app.connecting`,`Connecting…`)]})})}function zm(){return N(`div`,{className:`flex min-h-screen items-center justify-center bg-background`,children:N(`span`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-primary/30 border-t-primary`})})}function Bm(){return N(kt,{defaultMode:`dark`,children:N(M,{client:Pm,children:N(Mc,{children:N(Lm,{children:N(dn,{children:N(ql,{children:y(Zn,{renderers:Im,children:[N(ao,{basename:We(),children:N(Il,{children:N(w,{fallback:N(zm,{}),children:y(ga,{children:[N(Y,{path:`/login`,element:N(am,{})}),N(Y,{path:`/admin/*`,element:N(om,{})}),N(Y,{path:`/admin`,element:N(om,{})}),N(Y,{path:`/change-password`,element:N($,{children:N(hp,{})})}),N(Y,{path:`/showroom`,element:N(pm,{})}),N(Y,{path:`/embed/player`,element:N(mm,{})}),y(Y,{element:N($,{children:N(yr,{children:N(qf,{})})}),children:[N(Y,{index:!0,element:N(sm,{})}),N(Y,{path:`/access-denied`,element:N(pp,{})}),N(Y,{path:`/dashboard`,element:N(J,{to:`/devices`,replace:!0})}),N(Y,{path:`/devices`,element:N(cm,{})}),N(Y,{path:`/cameras`,element:N(J,{to:`/devices`,replace:!0})}),N(Y,{path:`/integrations`,element:N(lm,{})}),N(Y,{path:`/integrations/:integrationId`,element:N(um,{})}),N(Y,{path:`/system/pipeline`,element:N(dm,{})}),N(Y,{path:`/pipeline`,element:N(J,{to:`/system/pipeline`,replace:!0})}),N(Y,{path:`/live`,element:N(_m,{})}),N(Y,{path:`/devices/:deviceId`,element:N(fm,{})}),N(Y,{path:`/system/logs`,element:N($,{requireAdmin:!0,children:N(wm,{})})}),N(Y,{path:`/system/addons`,element:N($,{requireAdmin:!0,children:N(xm,{})})}),N(Y,{path:`/system/ai`,element:N($,{requireAdmin:!0,children:N(Sm,{})})}),N(Y,{path:`/system/settings`,element:N($,{requireAdmin:!0,children:N(km,{})})}),N(Y,{path:`/system/nodes`,element:N($,{requireAdmin:!0,children:N(Am,{})})}),N(Y,{path:`/system/notifications`,element:N($,{requireAdmin:!0,children:N(Mm,{})})}),N(Y,{path:`/system/calendars`,element:N($,{requireAdmin:!0,children:N(Nm,{})})}),N(Y,{path:`/system/identity`,element:N($,{requireAdmin:!0,children:N(Tm,{})})}),N(Y,{path:`/system/my-access`,element:N(Cm,{})}),N(Y,{path:`/system/network`,element:N($,{requireAdmin:!0,children:N(Em,{})})}),N(Y,{path:`/system/integrations`,element:N($,{requireAdmin:!0,children:N(Dm,{})})}),N(Y,{path:`/system/data`,element:N($,{requireAdmin:!0,children:N(Om,{})})}),N(Y,{path:`/system`,element:N(J,{to:Zl,replace:!0})}),N(Y,{path:`/system/terminal`,element:N($,{requireAdmin:!0,children:N(jm,{})})}),Ql.map(e=>N(Y,{path:e.path,element:N(eu,{tab:e.tab})},e.path)),N(Y,{path:`/system/users`,element:N(J,{to:`/system/identity?tab=users`,replace:!0})}),N(Y,{path:`/system/api-keys`,element:N(J,{to:`/system/identity?tab=api-keys`,replace:!0})}),N(Y,{path:`/system/authentication`,element:N(J,{to:lp(`authentication`),replace:!0})}),N(Y,{path:`/system/linked-sessions`,element:N(J,{to:`/system/identity?tab=linked-sessions`,replace:!0})}),N(Y,{path:`/system/remote-access`,element:N(J,{to:lp(`remoteAccess`),replace:!0})}),N(Y,{path:`/system/turn`,element:N(J,{to:lp(`turn`),replace:!0})}),N(Y,{path:`/system/storage`,element:N(J,{to:`/system/data?tab=storage`,replace:!0})}),N(Y,{path:`/system/backup`,element:N(J,{to:`/system/data?tab=backup`,replace:!0})}),N(Y,{path:`/library`,element:N($,{requireAdmin:!0,children:N(hm,{})})}),N(Y,{path:`/retrain`,element:N(J,{to:`/addon/training`,replace:!0})}),N(Y,{path:`/recordings`,element:N($,{requireAdmin:!0,children:N(gm,{})})}),N(Y,{path:`/build`,element:N($,{requireAdmin:!0,children:N(vm,{})})}),N(Y,{path:Zf,element:N($,{requireAdmin:!0,children:N(ym,{})})}),N(Y,{path:Qf,element:N($,{requireAdmin:!0,children:N(ym,{})})}),N(Y,{path:`/locations`,element:N($,{requireAdmin:!0,children:N(bm,{})})}),N(Y,{path:`/automation`,element:N(Ul,{to:`/build`})}),N(Y,{path:`/addon/:pagePath`,element:N($,{requireAdmin:!0,children:N(vu,{})})}),N(Y,{path:`*`,element:N(J,{to:`/devices`,replace:!0})})]})]})})})}),N(ru,{})]})})})})})})})}a(),window.__camstackUiLibrary=Rn,window.__camstackSdk=On,window.__camstackTypes=dt;var Vm=cr(document.getElementById(`root`));nf(window.location.pathname,We())?em(Vm):Vm.render(N(S,{children:N(Bm,{})}));export{J as $,Pl as A,Fc as B,Dd as C,au as D,Lu as E,Qc as F,cs as G,_s as H,el as I,X as J,ss as K,Jc as L,ol as M,il as N,Zl as O,Zc as P,so as Q,qc as R,Id as S,Hu as T,ls as U,Nc as V,fs as W,$o as X,as as Y,Xo as Z,tp as _,op as a,Rd as b,sp as c,dp as d,Vi as et,$f as f,np as g,Jf as h,ap as i,xl as j,Kl as k,lp as l,Yf as m,Dp as n,go as nt,rp as o,Xf as p,os as q,cp as r,ip as s,kp as t,Gi as tt,up as u,ep as v,cd as w,Xd as x,uf as y,Kc as z};