@camstack/addon-admin-ui 1.2.622 → 1.2.624

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 (126) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/assets/{Addons-B0-JHWDN.js → Addons-D9_oXciB.js} +1 -1
  3. package/dist/assets/{AdminPage-C6Nfjqwk.js → AdminPage-CjU3Qym-.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-qDgtM4yK.js → AdminSectionedPage-LULz7C3_.js} +1 -1
  5. package/dist/assets/{AiProfiles-BuQvWBCk.js → AiProfiles-B2Pqa3a7.js} +1 -1
  6. package/dist/assets/{Authentication-BgS7NhZX.js → Authentication-gZeEIiCJ.js} +1 -1
  7. package/dist/assets/{Build-Blu_Rek1.js → Build-CpiTrCbQ.js} +3 -3
  8. package/dist/assets/{Calendars-D1HqtZRO.js → Calendars-DclOLLCN.js} +1 -1
  9. package/dist/assets/{CameraGrids-CTVWt5In.js → CameraGrids-WUfNL6ST.js} +1 -1
  10. package/dist/assets/{Cluster-CiamsdEf.js → Cluster-CP2CoYke.js} +1 -1
  11. package/dist/assets/{CompositionBlockEditor-C-77HSpC.js → CompositionBlockEditor-DKBOCxVr.js} +1 -1
  12. package/dist/assets/{CompositionEditorPage-2bkol2ck.js → CompositionEditorPage-BUUQqQOo.js} +1 -1
  13. package/dist/assets/{Data-BKLSNpfc.js → Data-Dz-E4akc.js} +1 -1
  14. package/dist/assets/{DeviceDetail-GJkHbY0h.js → DeviceDetail-DrLi8nYZ.js} +1 -1
  15. package/dist/assets/{DeviceDoActionFields-DeEzCG7W.js → DeviceDoActionFields-HEC7yYzf.js} +1 -1
  16. package/dist/assets/{Devices-DnnB5-0E.js → Devices-DjFRDFOP.js} +1 -1
  17. package/dist/assets/{EditTemplateButton-BhYRcPAZ.js → EditTemplateButton-CDWvPMbz.js} +1 -1
  18. package/dist/assets/{EmbedPlayerPage-Fv2jvgXD.js → EmbedPlayerPage-Dz0ThiJO.js} +1 -1
  19. package/dist/assets/{History-sL1i9hpN.js → History-DR_06KaD.js} +1 -1
  20. package/dist/assets/{Identity-DWLT_K89.js → Identity-BDR1TOR3.js} +1 -1
  21. package/dist/assets/{InstancesTable-Bd3Q_rDK.js → InstancesTable-CjKHvk50.js} +1 -1
  22. package/dist/assets/{IntegrationDetail-Culq1Ni9.js → IntegrationDetail-DZgCMWiP.js} +1 -1
  23. package/dist/assets/{IntegrationHub-dC2c-gZh.js → IntegrationHub-CfofBRon.js} +1 -1
  24. package/dist/assets/Integrations-D9yP6yzP.js +1 -0
  25. package/dist/assets/{Integrations-B1KxBrwc.js → Integrations-Q42WYHHG.js} +1 -1
  26. package/dist/assets/{Library-CDrsfdbN.js → Library-C6tHqw32.js} +1 -1
  27. package/dist/assets/{Locations-8ETbKpeR.js → Locations-07eSvEIU.js} +1 -1
  28. package/dist/assets/{Logs-DaigxSX8.js → Logs-CdwRDasW.js} +1 -1
  29. package/dist/assets/{MaskShapeCanvas-CWvoDF7d.js → MaskShapeCanvas-Cdd-VtkN.js} +1 -1
  30. package/dist/assets/{MotionZonesSettings-BGdLFhDm.js → MotionZonesSettings-DLejOdp6.js} +1 -1
  31. package/dist/assets/{MyAccess-yDg5ZUb3.js → MyAccess-Db0DJKX-.js} +1 -1
  32. package/dist/assets/{Network-4RdFqBxG.js → Network-Bh6FEQrB.js} +1 -1
  33. package/dist/assets/{NodeAddonsSettingsPanel-IP_pDLF5.js → NodeAddonsSettingsPanel-o-ykaRNH.js} +1 -1
  34. package/dist/assets/{Notifications-nPHvnL47.js → Notifications-Bl5golQS.js} +1 -1
  35. package/dist/assets/{Pipeline-DrZixiLL.js → Pipeline-DSQKBqRo.js} +1 -1
  36. package/dist/assets/{PrivacyMaskSettings-DaxBCWbY.js → PrivacyMaskSettings-D6upVDCO.js} +1 -1
  37. package/dist/assets/{Recordings-xllrAH4z.js → Recordings-BnE73Fzq.js} +1 -1
  38. package/dist/assets/{ScanSubnetEditor-CRSiRPeu.js → ScanSubnetEditor-IaqiW7y-.js} +1 -1
  39. package/dist/assets/{SceneMonitorEditor-DGT86wag.js → SceneMonitorEditor-B9efTbgK.js} +1 -1
  40. package/dist/assets/{SessionsList-Dsi9j6a5.js → SessionsList-7r1RdGCD.js} +1 -1
  41. package/dist/assets/{Showroom-Cy61Met3.js → Showroom-783xHdUL.js} +1 -1
  42. package/dist/assets/{StorageLocationsTable-BIWNuKSZ.js → StorageLocationsTable-DKHWC9nh.js} +1 -1
  43. package/dist/assets/{System-IFiHQlVG.js → System-Bx9kJ2Vx.js} +1 -1
  44. package/dist/assets/{Templates-CI8sfkWl.js → Templates-7WYPtw3p.js} +1 -1
  45. package/dist/assets/{Terminal-CLVwElWa.js → Terminal-D7L1JyUx.js} +1 -1
  46. package/dist/assets/{TrainingProviders-CGnhynXm.js → TrainingProviders-I5H6sEuq.js} +1 -1
  47. package/dist/assets/{Viewer-DAzWPu1t.js → Viewer-1Blv7Ztf.js} +1 -1
  48. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-C0elo_dQ.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DmpAM1mu.js} +1 -1
  49. package/dist/assets/{addon-icons-context-DqoJ5IMg.js → addon-icons-context-BEfxHNMO.js} +1 -1
  50. package/dist/assets/{archive-BeVgBgkN.js → archive-Djs_JYv3.js} +1 -1
  51. package/dist/assets/{assignment-candidates-D8UC0IoK.js → assignment-candidates-CmqGReT0.js} +1 -1
  52. package/dist/assets/{authed-media-C4mHNO6d.js → authed-media-BpqhukLe.js} +1 -1
  53. package/dist/assets/{bell-off-DkGKDKAc.js → bell-off-Ct98laYU.js} +1 -1
  54. package/dist/assets/{boxes-BPVZkV90.js → boxes-B29vzWV6.js} +1 -1
  55. package/dist/assets/{calendar-clock-CjQG8xEz.js → calendar-clock-CBwyNflj.js} +1 -1
  56. package/dist/assets/circle-slash-JQ7haXmS.js +1 -0
  57. package/dist/assets/client-wsT1qo5a.js +809 -0
  58. package/dist/assets/{create-composition-mIiTaJQn.js → create-composition-BjzhtLA0.js} +1 -1
  59. package/dist/assets/crop-DhVFvaTE.js +1 -0
  60. package/dist/assets/{database-zap-BuOgAYwR.js → database-zap-BSNprl1e.js} +1 -1
  61. package/dist/assets/{device-integration-icon-BiD2ooYo.js → device-integration-icon-CVQW3uUx.js} +1 -1
  62. package/dist/assets/device-picker-model-DOA_AHBE.js +1 -0
  63. package/dist/assets/dist-Bh55Njjh.js +809 -0
  64. package/dist/assets/{dist-CVgm2V5y.js → dist-BtWxYt15.js} +1 -1
  65. package/dist/assets/{eraser-UP1ptJ_D.js → eraser-B2SV94Kf.js} +1 -1
  66. package/dist/assets/{file-up-BejsNlHS.js → file-up-BY1FyH2Q.js} +1 -1
  67. package/dist/assets/{grip-vertical-DotKiQvj.js → grip-vertical-BWxAjsXl.js} +1 -1
  68. package/dist/assets/{hard-drive-download-_b0JXZNX.js → hard-drive-download-BTrg390i.js} +1 -1
  69. package/dist/assets/{hostInit-CWlv6NTe.js → hostInit-BDNMYuMC.js} +1 -1
  70. package/dist/assets/{icons-DiWpMBOB.js → icons-ZjiGL3Qs.js} +1 -1
  71. package/dist/assets/{index-CrUUqNNL.js → index-0zF1qyaf.js} +3 -3
  72. package/dist/assets/{key-DRR-Ggvt.js → key-VMD0Nojq.js} +1 -1
  73. package/dist/assets/{key-square-BlorbeI7.js → key-square-DYDS2ySy.js} +1 -1
  74. package/dist/assets/{layers-DQIEg2Bq.js → layers-B5Q59zGJ.js} +1 -1
  75. package/dist/assets/{link-2-off-HbwYwcoz.js → link-2-off-D2FSHUkT.js} +1 -1
  76. package/dist/assets/{linked-devices-model-oxPM2lDe.js → linked-devices-model-DdQpLGk3.js} +1 -1
  77. package/dist/assets/{list-ordered-D2_q30rO.js → list-ordered-Dcctov2f.js} +1 -1
  78. package/dist/assets/{memory-stick-Kr65AHO7.js → memory-stick-C7K-tKSa.js} +1 -1
  79. package/dist/assets/{message-square-plus-CGcfLb4n.js → message-square-plus-mVoh3HdQ.js} +1 -1
  80. package/dist/assets/{mf-entry-bootstrap-0-aafe4c56.js → mf-entry-bootstrap-0-137671ea.js} +2 -2
  81. package/dist/assets/{mic-off-B-YLSqUh.js → mic-off-DtLUWxtz.js} +1 -1
  82. package/dist/assets/{monitor-off-dhLiqvAE.js → monitor-off-DyTKg8lR.js} +1 -1
  83. package/dist/assets/{monitor-smartphone-D68gh_0x.js → monitor-smartphone-gg9swCyF.js} +1 -1
  84. package/dist/assets/mount-DOA_AHBE.js +1 -0
  85. package/dist/assets/{player-overlays-DRXPDzoq.js → player-overlays-nsKWep_b.js} +1 -1
  86. package/dist/assets/remoteEntry-CmIIKd59.js +1 -0
  87. package/dist/assets/{ruler-CE2hOxvv.js → ruler-B1CteblT.js} +1 -1
  88. package/dist/assets/{scissors-BOlEHQ2s.js → scissors-CaA205Yl.js} +1 -1
  89. package/dist/assets/{search-x-Basn6vad.js → search-x-DFRNlPyV.js} +1 -1
  90. package/dist/assets/{send-snsa07qR.js → send-CPG04w86.js} +1 -1
  91. package/dist/assets/{settings-2-D42zZvIi.js → settings-2-BFvRIHHf.js} +1 -1
  92. package/dist/assets/{shapes-DzuZ0aqU.js → shapes-Cv8yN5GQ.js} +1 -1
  93. package/dist/assets/{sigma-BRwCaWxw.js → sigma-CGh2ukye.js} +1 -1
  94. package/dist/assets/{speaker-Oma9Nd4V.js → speaker-CiFv1--z.js} +1 -1
  95. package/dist/assets/src-C8Zf9Q7y.js +100 -0
  96. package/dist/assets/{step-inspector-model-Qusf3gxD.js → step-inspector-model-DeHccH5q.js} +1 -1
  97. package/dist/assets/{table-2-CLSgkWSh.js → table-2-Cgy92RuE.js} +1 -1
  98. package/dist/assets/{timer-reset-XJzcf-X9.js → timer-reset-BtNgj9Cs.js} +1 -1
  99. package/dist/assets/{tv-DHoz7k2K.js → tv-DXjaCKCw.js} +1 -1
  100. package/dist/assets/{unlink-TvpkDUay.js → unlink-CK0jpIZO.js} +1 -1
  101. package/dist/assets/{usb-CYYF7-XT.js → usb-CDcQOKbY.js} +1 -1
  102. package/dist/assets/{use-device-bound-caps-BmCkwmRR.js → use-device-bound-caps-CvYPEjf_.js} +1 -1
  103. package/dist/assets/{use-scenes-feed-B68kNFHc.js → use-scenes-feed-tId-2Z23.js} +1 -1
  104. package/dist/assets/{use-stationary-objects-DMEbWObh.js → use-stationary-objects-Bx6JK5H8.js} +1 -1
  105. package/dist/assets/{useAdminDeviceRemoval-B9K8nXpf.js → useAdminDeviceRemoval-ScXvVZYj.js} +1 -1
  106. package/dist/assets/useEventInvalidation-DOA_AHBE.js +1 -0
  107. package/dist/assets/{useNodeUrlSelection-Be7DWORE.js → useNodeUrlSelection-ArB2g5FQ.js} +1 -1
  108. package/dist/assets/user-round-BtQRG_UD.js +1 -0
  109. package/dist/assets/{user-x-B8bBQJXA.js → user-x-Y72N_IkT.js} +1 -1
  110. package/dist/assets/{variable-BrE4WL4D.js → variable-CEsk8LrD.js} +1 -1
  111. package/dist/assets/{video-BM2xBahl.js → video-CUSTu3rp.js} +1 -1
  112. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-B08zgLKv.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-DvhyKcT_.js} +2 -2
  113. package/dist/index.html +8 -8
  114. package/dist/server/addon.js +5900 -3452
  115. package/package.json +2 -2
  116. package/dist/assets/Integrations-BSA9HPyd.js +0 -1
  117. package/dist/assets/circle-slash-CGfofQoY.js +0 -1
  118. package/dist/assets/client-Dee-0euI.js +0 -809
  119. package/dist/assets/crop-B2RwKMNG.js +0 -1
  120. package/dist/assets/device-picker-model-CEFYlq6I.js +0 -1
  121. package/dist/assets/dist-DbWYJIOK.js +0 -809
  122. package/dist/assets/mount-CEFYlq6I.js +0 -1
  123. package/dist/assets/remoteEntry-BClVE4J6.js +0 -1
  124. package/dist/assets/src-CrkcMdUT.js +0 -100
  125. package/dist/assets/useEventInvalidation-CEFYlq6I.js +0 -1
  126. package/dist/assets/user-round-JSt6qUOY.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-admin-ui",
3
- "version": "1.2.622",
3
+ "version": "1.2.624",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin UI — Vite frontend build and server-side addon",
@@ -50,7 +50,7 @@
50
50
  }
51
51
  ],
52
52
  "requires": {
53
- "server": ">=1.2.815"
53
+ "server": ">=1.2.817"
54
54
  }
55
55
  },
56
56
  "scripts": {
@@ -1 +0,0 @@
1
- import{C as e,J as t,K as n,R as r,S as i,V as a,Y as o,et as s,o as c,x as l}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Cn as u,Er as d,Fi as f,Hn as p,Ii as m,Ln as h,Ni as g,Pi as _,Pn as v,Un as y,Ut as b,V as x,Vi as S,br as C,dt as w,ht as T,ii as E,xn as D}from"./player-overlays-DRXPDzoq.js";import{As as O,Os as k}from"./client-Dee-0euI.js";import{t as ee}from"./table-2-CLSgkWSh.js";import{Br as A,Fo as te,Fr as ne,G as re,Go as ie,Gs as j,Gt as ae,Io as oe,Ir as M,Jo as se,Lr as ce,Mo as le,No as ue,Po as de,Qi as fe,Us as pe,Vr as me,Wt as he,Xs as ge,Yr as _e,Zs as ve,ns as ye,o as N,oa as be,qi as P,qs as xe,qt as Se,sf as F,ur as I,vt as Ce,xo as L,yi as R}from"./src-CrkcMdUT.js";import{t as z}from"./i18n-DFz3VmFc.js";import{t as B}from"./useTranslation-BJr-n0es.js";import{Br as we,K as V,Lr as H,Rr as Te,W as U,b as Ee,ct as De,lt as Oe,ut as W}from"./index-CrUUqNNL.js";import{t as ke}from"./AdminPage-C6Nfjqwk.js";import"./useEventInvalidation-CEFYlq6I.js";import{t as Ae}from"./device-integration-icon-BiD2ooYo.js";import{a as G,i as je,n as K,o as q,r as J,s as Y,t as Me}from"./ScanSubnetEditor-CRSiRPeu.js";import{t as Ne}from"./framework-packages-DoBKjjer.js";s();function X(e){return e.some(e=>e.status===`running`)?`running`:e.some(e=>e.status===`stopped`)?`stopped`:`disabled`}function Pe(e,t){let n=new Map;for(let t of e){let e=n.get(t.addonId);e===void 0?n.set(t.addonId,[t]):e.push(t)}return[...n.entries()].map(([e,n])=>{let r=t.get(e)?.trim()??``;return{addonId:e,name:r.length>0?r:n[0]?.name??e,instances:n,instanceCount:n.length,deviceCount:n.reduce((e,t)=>e+t.deviceCount,0),status:X(n)}})}function Fe(e){return e.integrationSection===void 0?Ne(e.packageName)?`system`:`providers`:e.integrationSection}function Ie(e){let t=new Set;for(let n of e??[])Fe(n.manifest)===`system`&&t.add(n.manifest.id);return t}function Le(e,t){return{providers:e.filter(e=>!t.has(e.addonId)),system:e.filter(e=>t.has(e.addonId))}}function Re(e,t){return[...e].sort((e,n)=>e.name.localeCompare(n.name,t,{sensitivity:`base`}))}var ze=3e3,Be=new Set([`no-provider`,`node-offline`,`transport-failed`]),Ve=[`provider not available`,`failed to fetch`,`networkerror`,`load failed`];function He(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,`capRouteReason`);return typeof n==`string`?n:null}function Ue(e,t){if(e==null||t>10)return!1;let n=He(e);if(n!==null)return Be.has(n);let r=(e instanceof Error?e.message:String(e)).toLowerCase();return Ve.some(e=>r.includes(e))}function We(e){return Ue(e.state.error,e.state.errorUpdateCount)?ze:!1}function Z({kind:t,children:n}){let{t:r}=B(),a=`integrations-section-${t}`;return e(`section`,{"aria-labelledby":a,"data-testid":a,className:`min-w-0 space-y-2`,children:[i(`h2`,{id:a,className:x,children:t===`providers`?r(`integrations.sections.providers`,`Providers`):r(`integrations.sections.system`,`System`)}),n]})}function Ge({children:e}){return i(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2 sm:gap-3 lg:grid-cols-3`,children:e})}function Ke({addonId:t,name:n,openLabel:r,onOpen:a,body:o,footer:s,disabled:c=!1,testId:l,buttonTestId:u}){return e(`article`,{"data-testid":l,className:`relative flex min-w-0 items-stretch gap-3 overflow-x-clip rounded-lg border border-border bg-surface p-3`,children:[i(R,{type:`button`,variant:`ghost`,"aria-label":r,disabled:c,"data-testid":u,onClick:a,className:`absolute inset-0 z-0 h-auto w-auto rounded-lg p-0 focus-visible:ring-2 focus-visible:ring-primary`}),i(`div`,{className:`pointer-events-none relative z-10 flex w-20 shrink-0 items-center justify-center`,children:i(U,{type:t,size:`xl`})}),e(`div`,{className:`pointer-events-none relative z-10 grid min-w-0 flex-1 grid-rows-[1fr_auto_1fr] gap-1`,children:[i(`p`,{className:`min-w-0 self-start truncate text-sm font-semibold text-foreground`,children:n}),o,i(`div`,{className:`self-end justify-self-start`,children:s})]})]})}function qe({providers:t,system:r,onOpen:a,searchPlaceholder:s,emptyLabel:c}){let[l,d]=o(``),f=n(()=>{let e=l.trim().toLowerCase(),n=t=>e.length===0||`${t.name} ${t.addonId} ${t.instances.map(e=>e.name).join(` `)}`.toLowerCase().includes(e);return{providers:t.filter(n),system:r.filter(n)}},[l,t,r]),p=f.providers.length===0&&f.system.length===0;return e(`div`,{className:`space-y-3`,children:[e(`div`,{className:`relative`,children:[i(u,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-foreground-subtle`,"aria-hidden":!0}),i(F,{type:`search`,value:l,onChange:e=>d(e.target.value),placeholder:s,"aria-label":s,className:`pl-8`})]}),p?i(`p`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:c}):e(`div`,{className:`space-y-4`,children:[f.providers.length>0&&i(Z,{kind:`providers`,children:i(Q,{groups:f.providers,onOpen:a})}),f.system.length>0&&i(Z,{kind:`system`,children:i(Q,{groups:f.system,onOpen:a})})]})]})}function Q({groups:e,onOpen:t}){let{t:r,i18n:a}=B();return i(Ge,{children:n(()=>Re(e,a.language),[e,a.language]).map(e=>i(Ke,{testId:`integration-card-${e.addonId}`,addonId:e.addonId,name:e.name,openLabel:r(`integrations.openNamed`,{name:e.name,defaultValue:`Open {{name}}`}),onOpen:()=>t(e),body:i(`p`,{className:`text-xs text-foreground-muted`,children:r(`integrations.addonCard.summary`,{integrations:r(`integrations.addonCard.integrationCount`,{count:e.instanceCount}),devices:r(`integrations.integrationColumns.deviceCount`,{count:e.deviceCount}),defaultValue:`{{integrations}} · {{devices}}`})}),footer:i(Ce,{status:e.status,className:`shrink-0`})},e.addonId))})}s();var $=`camstack.admin.integrations.view`;function Je(e){return e===`table`||e===`grid`}function Ye(){try{return typeof window>`u`?null:window.localStorage}catch{return null}}function Xe(e=Ye()){if(e===null)return`table`;try{let t=e.getItem($);return Je(t)?t:`table`}catch{return`table`}}function Ze(e,t=Ye()){if(t!==null)try{t.setItem($,e)}catch{}}function Qe(){let[e,t]=o(()=>Xe());return[e,r(e=>{t(e),Ze(e)},[])]}s();function $e(e=!0){a(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e])}s();function et(e,t){let[n,r]=o(!1);return a(()=>{if(!e){r(!1);return}r(!1);let n=setTimeout(()=>r(!0),t);return()=>clearTimeout(n)},[e,t]),n}s();function tt({kind:t,onResolved:n,onBack:r}){let{t:a}=B(),[s,c]=o(null);return e(`div`,{className:`space-y-4`,children:[e(R,{variant:`ghost`,size:`sm`,onClick:r,children:[i(_,{className:`h-3.5 w-3.5`}),` `,a(`common.back`)]}),i(V,{kind:t,value:s,onChange:c}),i(`div`,{className:`flex justify-end pt-1`,children:i(R,{variant:`primary`,size:`sm`,disabled:s===null,onClick:()=>s!==null&&n(s),children:a(`integrations.brokerStep.useThisBroker`,`Use this broker`)})})]})}s();function nt({providerId:t,onImport:n,onSkip:r}){let{t:s}=B(),[c,l]=o(new Set),u=ue(),d=u.data,f=u.isPending||!u.data&&!u.isError;a(()=>{t&&(u.isPending||u.data||u.mutate({addonId:t}))},[t,u]);function p(e){l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}if(f)return e(`div`,{className:`flex flex-col items-center py-12`,children:[i(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-primary border-t-transparent`}),i(`p`,{className:`mt-3 text-xs text-foreground-subtle`,children:s(`integrations.searchingDevices`)})]});let h=d??[];return e(`div`,{className:`space-y-4`,children:[i(`p`,{className:`text-xs text-foreground-subtle`,children:h.length>0?s(`integrations.foundDevices`,{count:h.length}):s(`integrations.noDevicesFound`)}),h.length>0&&i(`div`,{className:`space-y-1.5 max-h-64 overflow-y-auto`,children:h.map(t=>{let n=t.stableId,r=t.suggestedName??n,a=c.has(n),o=t.alreadyOnboarded===!0;return e(R,{variant:`unstyled`,onClick:()=>{o||p(n)},disabled:o,title:o?s(`integrations.alreadyAddedHint`,{defaultValue:`Already added as "{{name}}" — re-adding would overwrite its settings.`,name:t.onboardedName??r}):void 0,className:`flex w-full items-center gap-3 rounded-lg border p-3 text-left transition-colors ${o?`border-border bg-surface opacity-60 cursor-not-allowed`:a?`border-primary/40 bg-primary/5`:`border-border bg-surface hover:border-foreground-subtle/30`}`,children:[i(`div`,{className:`flex h-5 w-5 items-center justify-center rounded border flex-shrink-0 ${a&&!o?`border-primary bg-primary`:`border-border`}`,children:a&&!o&&i(m,{className:`h-3 w-3 text-primary-foreground`})}),i(S,{className:`h-3.5 w-3.5 text-foreground-subtle flex-shrink-0`}),i(`span`,{className:`text-xs font-medium text-foreground truncate`,children:r}),o&&i(`span`,{className:`ml-auto flex-shrink-0 rounded bg-surface-muted px-1.5 py-0.5 text-[10px] font-medium text-foreground-subtle`,children:s(`integrations.alreadyAdded`,{defaultValue:`Already added`})})]},n)})}),e(`div`,{className:`flex items-center justify-between pt-2`,children:[i(R,{variant:`unstyled`,onClick:r,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:s(`integrations.skip`)}),h.length>0&&e(R,{variant:`unstyled`,onClick:()=>n(Array.from(c)),disabled:c.size===0,className:`rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50`,children:[s(`integrations.importSelected`),` (`,c.size,`)`]})]})]})}s();function rt({addonId:t,configSchema:n,canTest:r=!0,instanceKind:a,initialName:s,initialConfig:c,submitLabel:l,hideName:u=!1,saving:d=!1,onScan:f,onSave:p,onBack:m}){let{t:g}=B(),[_,v]=o(s??``),[y,b]=o(c??{}),[x,S]=o(null),C=j({onSuccess:e=>S(Oe(e)),onError:e=>S({status:`inconclusive`,error:String(e)})}),w=fe(),T=!r||x?.status===`validated`,E=!u&&_.trim().length===0,D=!E&&T;return e(`div`,{className:`space-y-4`,children:[!u&&e(`div`,{children:[i(`label`,{htmlFor:`integration-name`,className:`block text-[11px] font-medium text-foreground mb-1`,children:g(`integrations.integrationName`)}),i(F,{id:`integration-name`,type:`text`,value:_,onChange:e=>v(e.target.value),placeholder:g(`integrations.integrationNamePlaceholder`),"aria-invalid":E,"aria-describedby":E?`integration-name-error`:void 0,className:`w-full rounded-lg border bg-surface px-3 py-2 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none ${E?`border-danger focus:border-danger`:`border-border focus:border-primary/50`}`}),E&&i(`p`,{id:`integration-name-error`,"data-testid":`integration-name-error`,className:`mt-1 text-xs text-danger`,children:g(`integrations.nameRequired`,`Name is required`)})]}),n&&i(W,{schema:n,values:y,onChange:e=>{b(e),S(null)},onAction:async(e,i,o)=>{let s=await w.mutateAsync({addonId:t,action:e,input:o??{}});if(r&&typeof s==`object`&&s){let e=s;if(!(typeof e.token==`string`||typeof e.sslCertificate==`string`||typeof e.host==`string`))return s;let r={...y};for(let[t,n]of Object.entries(e))typeof n==`string`&&t!==`summary`&&(r[t]=n);let i=O(n,r);b(i),S(null),C.mutate({addonId:t,id:null,values:i,...a===void 0?{}:{kind:a}})}return s}}),x&&i(De,{verdict:x}),e(`div`,{className:`flex items-center justify-between pt-2`,children:[i(R,{variant:`unstyled`,onClick:m,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:g(`integrations.back`)}),e(`div`,{className:`flex items-center gap-2`,children:[f&&e(R,{variant:`outline`,size:`sm`,onClick:f,"data-testid":`integration-scan`,children:[i(h,{className:`h-3.5 w-3.5`}),g(`integrations.scanFromForm`,`Scan the network`)]}),i(R,{variant:`unstyled`,onClick:()=>C.mutate({addonId:t,id:null,values:O(n,y),...a===void 0?{}:{kind:a}}),disabled:C.isPending||!r,title:r?void 0:g(`integrations.connectionUntestable`,{defaultValue:`This integration cannot be tested before it is created.`}),className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:C.isPending?g(`integrations.testing`):g(`integrations.testConnection`)}),e(`div`,{className:`flex flex-col items-end gap-1`,children:[E&&i(`p`,{"data-testid":`integration-name-submit-error`,className:`text-xs text-danger`,children:g(`integrations.nameRequiredSubmit`,`Enter a name before continuing.`)}),i(R,{variant:`unstyled`,onClick:()=>{E||p({name:_,config:O(n,y),secretKeys:[...k(n)]})},disabled:!D||d,className:`rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50`,children:d?g(`integrations.saving`,{defaultValue:`Saving…`}):l??g(`integrations.forward`)})]})]})]})]})}var it=`(hover: none) and (pointer: coarse)`;function at(){if(typeof window>`u`||typeof window.matchMedia!=`function`)return!0;try{return!window.matchMedia(it).matches}catch{return!0}}s();function ot({onSelect:r,onClose:s,pendingAddonId:c=null}){let{t:l,i18n:d}=B(),f=Te(),[p,m]=o(``),h=t(null),{data:g,isLoading:_}=ge();a(()=>{_||!at()||h.current?.focus()},[_]);let v=n(()=>{let e=g??[],t=p.trim().toLowerCase();return t.length===0?e:e.filter(e=>`${e.name} ${e.description??``} ${e.addonId}`.toLowerCase().includes(t))},[g,p]),{data:y}=be(void 0),b=n(()=>{let e=Le(v,Ie(y));return{providers:Re(e.providers,d.language),system:Re(e.system,d.language)}},[v,y,d.language]);if(_)return i(`div`,{className:`grid grid-cols-1 gap-2 p-2 sm:grid-cols-2 lg:grid-cols-3`,children:[1,2,3,4].map(e=>i(`div`,{className:`h-24 rounded-lg bg-surface animate-pulse`},e))});let x=c!==null,S=t=>i(Ge,{children:t.map(t=>{let n=t.instanceMode===`unique`&&t.existingInstances.length>0,a=c===t.addonId;return i(Ke,{testId:`provider-card-${t.addonId}`,buttonTestId:`provider-pick-${t.addonId}`,addonId:t.addonId,name:t.name,openLabel:t.name,disabled:x,onOpen:()=>{if(n){let e=t.existingInstances[0].id;s(),f(Ee(t.addonId,e))}else r(t.addonId,t.instanceMode,t.discoveryMode,t.name,t.kind,t.brokerKind,t.mode,t.canTest)},body:t.description?i(`p`,{className:`line-clamp-2 text-xs text-foreground-muted`,children:t.description}):i(`span`,{}),footer:a?i(C,{className:`h-4 w-4 animate-spin text-primary`}):n?e(`span`,{className:`flex items-center gap-1 text-xs font-medium text-foreground-subtle`,children:[i(D,{className:`h-3 w-3`}),l(`integrations.manage`)]}):null},t.addonId)})});return e(`div`,{className:`space-y-3`,"data-testid":`provider-picker`,children:[e(`div`,{className:`relative`,children:[i(u,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-foreground-subtle`,"aria-hidden":!0}),i(F,{ref:h,type:`search`,value:p,onChange:e=>m(e.target.value),placeholder:l(`integrations.searchProviders`,`Search integrations…`),className:`pl-8`,"data-testid":`provider-picker-search`,"aria-label":l(`integrations.searchProviders`,`Search integrations…`)})]}),b.providers.length>0&&i(Z,{kind:`providers`,children:S(b.providers)}),b.system.length>0&&i(Z,{kind:`system`,children:S(b.system)}),v.length===0&&i(`div`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:(g??[]).length===0?l(`integrations.noProviders`):l(`integrations.noProvidersMatch`,`No integrations match your search.`)})]})}s();function st({open:t,onClose:a,scope:s,onSetupIntegration:c,pickMode:l=`adopt`}){let{t:u}=B(),d=L(),[f,p]=o(new Set),[m,g]=o(new Set),[_,v]=o(new Set),{data:y}=ie({projection:`slim`}),b=n(()=>new Set((y??[]).map(e=>e.stableId)),[y]),x=r(async(e,t)=>{g(e=>new Set(e).add(t.stableId));try{await d.mutateAsync({addonId:e,candidate:t}),p(e=>new Set(e).add(t.stableId)),v(e=>{let n=new Set(e);return n.delete(t.stableId),n})}catch{}finally{g(e=>{let n=new Set(e);return n.delete(t.stableId),n})}},[d]),S=r(async(e,t)=>{let n=l===`fill`?G(e,t):K(e,t);if(n!==null){c?.(n),a();return}await x(e,t)},[x,a,c,l]),C=r(e=>{v(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),w=r(()=>{p(new Set),v(new Set)},[]),T=n(()=>({existingStableIds:b,adopted:f,adopting:m,selection:{selected:_,toggle:C},pick:S,adoptOne:x,fill:l===`fill`}),[b,f,m,_,C,S,l]),E=s?u(`integrations.scanNetworkModal.titleScoped`,`Scan network — {{label}}`,{label:s.label}):u(`integrations.scanNetworkModal.title`,`Scan network for devices`);return i(ne,{open:t,onOpenChange:e=>!e&&a(),children:e(ce,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[i(A,{children:i(me,{children:e(`span`,{className:`flex items-center gap-2`,children:[i(h,{className:`h-4 w-4 text-primary`}),E]})})}),e(M,{className:`space-y-4`,children:[i(Me,{}),s?i(mt,{scope:s,row:T,onReset:w}):i(pt,{row:T,onReset:w})]})]})})}function ct(e,t){return!t&&e.selectable!==!1&&!J(e)}function lt({addonId:t,nodes:n,row:r,depth:a}){return i(`div`,{className:a===0?`space-y-1.5`:`ml-4 space-y-1.5 border-l border-border pl-3`,"data-testid":a===0?void 0:`scan-children`,children:n.map(n=>e(`div`,{className:`space-y-1.5`,children:[i(ut,{addonId:t,candidate:n.candidate,row:r}),n.children.length>0&&i(lt,{addonId:t,nodes:n.children,row:r,depth:a+1})]},n.candidate.stableId))})}function ut({addonId:t,candidate:n,row:r}){let{t:a}=B(),o=n.prefilledConfig.host,s=typeof o==`string`?o:null,c=r.existingStableIds.has(n.stableId)||n.alreadyOnboarded===!0||n.onboardedDeviceId!==void 0,l=r.adopted.has(n.stableId)||c,u=r.adopting.has(n.stableId),d=r.fill||J(n),f=!l&&(d||n.selectable!==!1),p=f&&ct(n,r.fill);return e(`div`,{className:`flex items-center gap-3 rounded-lg border border-border bg-surface px-3 py-2`,"data-testid":`scan-row-${n.stableId}`,children:[p&&i(I,{checked:r.selection.selected.has(n.stableId),onChange:()=>r.selection.toggle(n.stableId),disabled:u,"aria-label":a(`integrations.scanNetworkModal.select`,`Select {{name}}`,{name:n.suggestedName})}),e(`div`,{className:`min-w-0 flex-1`,children:[i(`p`,{className:`truncate text-xs font-medium text-foreground`,children:n.suggestedName}),s&&i(`p`,{className:`truncate font-mono text-[10px] text-foreground-subtle`,children:s}),c&&n.onboardedName!==void 0&&i(`p`,{className:`truncate text-[10px] text-foreground-subtle`,children:n.onboardedName})]}),l?e(`span`,{className:`flex items-center gap-1 text-[11px] text-foreground-subtle`,children:[i(m,{className:`h-3.5 w-3.5`}),` `,c?a(`integrations.scanNetworkModal.alreadyAdded`,`Already added`):a(`integrations.scanNetworkModal.added`,`Added`)]}):f?e(R,{size:`sm`,variant:d?`outline`:`primary`,onClick:()=>void r.pick(t,n),disabled:u,children:[u?i(C,{className:`h-3.5 w-3.5 animate-spin`}):d?null:i(E,{className:`h-3.5 w-3.5`}),d?r.fill?a(`integrations.scanNetworkModal.use`,`Use`):a(`integrations.scanNetworkModal.setUp`,`Set up`):a(`common.add`,`Add`)]}):null]})}function dt({addonId:t,label:r,candidates:a,row:o}){let s=n(()=>q(a),[a]);return e(`section`,{className:`space-y-2`,"data-testid":`scan-group-${t}`,children:[e(`h3`,{className:`flex items-center gap-2`,children:[i(U,{type:t,size:`sm`}),i(`span`,{className:x,children:r}),e(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`(`,a.length,`)`]})]}),i(lt,{addonId:t,nodes:s,row:o,depth:0})]})}function ft(e,t){return e.flatMap(e=>Y(q(e.candidates)).filter(e=>ct(e,t)).map(t=>({addonId:e.addonId,candidate:t})))}function pt({row:t,onReset:o}){let{t:s}=B(),c=le(),l=r(()=>{o(),c.mutate({})},[c,o]);a(()=>{!c.isPending&&!c.data&&l()},[]);let u=n(()=>(c.data?.groups??[]).filter(e=>e.candidates.length>0),[c.data]),d=n(()=>u.reduce((e,t)=>e+t.candidates.length,0),[u]),f=n(()=>ft(u,t.fill),[u,t.fill]);return e(`div`,{className:`space-y-4`,children:[e(`div`,{className:`flex items-center justify-between gap-2`,children:[i(`p`,{className:`text-xs text-foreground-subtle`,children:!c.isPending&&u.length>0?s(`integrations.scanNetworkModal.found`,{count:d}):null}),e(`div`,{className:`flex items-center gap-2`,children:[i(ht,{entries:f,row:t}),e(R,{variant:`outline`,size:`sm`,onClick:l,disabled:c.isPending,children:[i(v,{className:`h-3.5 w-3.5 ${c.isPending?`animate-spin`:``}`}),s(`integrations.scanNetworkModal.reScan`,`Re-scan`)]})]})]}),c.isPending&&i(_t,{label:s(`integrations.scanNetworkModal.scanningTheLocalNetwork`,`Scanning the local network…`)}),!c.isPending&&c.isError&&i(vt,{}),!c.isPending&&c.data&&u.length===0&&i(gt,{}),!c.isPending&&u.map(e=>i(dt,{addonId:e.addonId,label:e.label,candidates:e.candidates,row:t},e.addonId))]})}function mt({scope:t,row:a,onReset:s}){let{t:c}=B(),l=ye({addonId:t.addonId}).data??null,[u,d]=o({}),f=de(),p=r(()=>{s(),f.mutate({addonId:t.addonId,params:u})},[f,t.addonId,u,s]),m=n(()=>f.data?.candidates??[],[f.data]),g=n(()=>ft([{addonId:t.addonId,candidates:m}],a.fill),[t.addonId,m,a.fill]);return e(`div`,{className:`space-y-4`,children:[l&&i(W,{schema:l,values:u,onChange:d}),e(R,{onClick:p,disabled:f.isPending,children:[f.isPending?i(C,{className:`h-3.5 w-3.5 animate-spin`}):i(h,{className:`h-3.5 w-3.5`}),f.isPending?c(`integrations.scanNetworkModal.scanning`,`Scanning…`):c(`integrations.scanNetworkModal.scan`,`Scan`)]}),i(ht,{entries:g,row:a}),f.isError&&i(vt,{}),!f.isPending&&f.data&&m.length===0&&i(gt,{}),!f.isPending&&m.length>0&&e(`div`,{className:`space-y-2`,children:[i(`p`,{className:`text-xs text-foreground-subtle`,children:c(`integrations.scanNetworkModal.foundShort`,{count:m.length})}),i(dt,{addonId:t.addonId,label:t.label,candidates:m,row:a})]})]})}function ht({entries:t,row:n}){let{t:r}=B(),a=t.filter(e=>n.selection.selected.has(e.candidate.stableId));if(a.length===0)return null;let o=async()=>{for(let e of a)await n.adoptOne(e.addonId,e.candidate)};return e(R,{size:`sm`,onClick:()=>void o(),"data-testid":`scan-add-selected`,children:[i(E,{className:`h-3.5 w-3.5`}),r(`integrations.scanNetworkModal.addSelected`,`Add selected ({{count}})`,{count:a.length})]})}function gt(){let{t:e}=B();return i(`p`,{className:`py-6 text-center text-xs text-foreground-subtle`,children:e(`integrations.scanNetworkModal.noDevicesRespondedToThe`,`No devices responded to the scan.`)})}function _t({label:t}){return e(`div`,{className:`flex flex-col items-center py-12`,children:[i(C,{className:`h-6 w-6 animate-spin text-primary`}),i(`p`,{className:`mt-3 text-xs text-foreground-subtle`,children:t})]})}function vt(){let{t}=B();return e(`div`,{className:`flex items-start gap-3 rounded-lg border border-danger/40 bg-danger/10 px-4 py-3`,children:[i(b,{className:`mt-0.5 h-4 w-4 shrink-0 text-danger`}),i(`p`,{className:`text-xs text-danger`,children:t(`integrations.scanNetworkModal.theScanFailedTryAgain`,`The scan failed. Try again.`)})]})}s();function yt(e){let t=e=>{if(e.type===`separator`||e.type===`info`||e.type===`button`)return e;if(e.type===`group`)return{...e,fields:e.fields.map(e=>t(e))};let{value:n,...r}=e;return r};return{...e.tabs?{tabs:e.tabs}:{},sections:e.sections.map(e=>({...e,fields:e.fields.map(t)}))}}var bt=2e4;function xt({open:t,onClose:r,seed:s=null}){let{t:u}=B(),d=Te(),f=c(),[p,m]=o(`picker`),[h,g]=o(null),[_,v]=o(null),[y,b]=o(`manual`),[x,S]=o(null),[w,T]=o(``),[E,D]=o(null),[O,k]=o(null),[ee,re]=o(!1),[ie,j]=o({}),[ae,oe]=o(``),[se,le]=o(!1),[de,fe]=o(0),[he,_e]=o(``),ve=te({},{enabled:t&&p===`config`}),ye=(pe({addonId:h??``},{enabled:t&&p===`config`&&h!==null}).data?.kinds??[]).filter(e=>e.canTest!==!1),N=ye.length===1?ye[0]?.id:void 0,be=h!==null&&(ve.data?.providers??[]).some(e=>e.addonId===h),Se=s?.config.host,F=s===null?``:`${s.addonId}\0${s.name}\0${typeof Se==`string`?Se:``}`;t&&s!==null&&ae!==F&&(oe(F),g(s.addonId),T(s.name),j({...s.config}),m(`config`));let I=ge(void 0,{enabled:t&&s!==null}),Ce=I.data?.find(e=>e.addonId===h)?.mode??`account`,{data:z}=P({addonId:h??``,nodeId:`hub`,instance:{integrationId:null,mode:Ce,...s?.originStableId===void 0?{}:{candidateStableId:s.originStableId}}},{enabled:h!=null}),we=n(()=>z?yt(z):null,[z]),V=xe({onSuccess:()=>f.invalidateQueries({queryKey:[[`integrations`]]})}),H=ue(),U=H.data;a(()=>{if(!t||s===null)return;let e=I.data?.find(e=>e.addonId===s.addonId);e&&(re(e.canTest),b(e.discoveryMode))},[t,s,I.data]),a(()=>{p!==`discovery`||!_||!h||H.isPending||H.data||H.mutate({addonId:h})},[p,_,h,H]);let De=L({onSuccess:()=>f.invalidateQueries({queryKey:[[`deviceManager`]]})});function Oe(e,t,n,r,i,a,o,s){if(!V.isPending){if(g(e),re(s),b(n),T(r),k(null),V.reset(),o===`broker`){if(!a){k(`Addon '${e}' declares mode 'broker' but no brokerKind in its manifest`);return}S(a),m(`broker`);return}if(o===`account`){m(`config`);return}W(e,r)}}async function W(e,t){try{let n=await V.mutateAsync({addonId:e,name:t,settings:{}});r(),K(),d(`${Ee(e,n.id)}&add=1`)}catch{}}async function ke(e){if(h)try{let t=await V.mutateAsync({addonId:h,name:e.name,settings:e.config,secretKeys:[...e.secretKeys],...N===void 0?{}:{kind:N},...s!==null&&s.addonId===h&&s.originStableId!==void 0?{originStableId:s.originStableId}:{}});v(t.id),D(t.id),y===`auto`||y===`both`?m(`discovery`):je(t.id,{openAdd:!0})}catch{}}async function Ae(e){if(h)try{let t=await V.mutateAsync({addonId:h,name:w,settings:{brokerId:e}});D(t.id),v(t.id),je(t.id)}catch{}}async function G(e){if(h){for(let t of e){let e=U?.find(e=>e.stableId===t);e&&await De.mutateAsync({addonId:h,candidate:e,...E===null?{}:{integrationId:E}})}je()}}function je(e,t){let n=e??_??h;if(r(),K(),n&&h){let e=Ee(h,n);d(t?.openAdd===!0?`${e}&add=1`:e)}}function K(){m(`picker`),g(null),v(null),b(`manual`),S(null),T(``),D(null),k(null),V.reset(),re(!1),j({}),oe(``)}function q(){r(),K()}$e(t);let J=V.isPending,Y=et(J,bt);if(!t)return null;let Me={picker:u(`integrations.newIntegration`),config:u(`integrations.configureIntegration`),discovery:u(`integrations.importDevices`),broker:u(`integrations.connectBroker`,{defaultValue:`Connect a broker`})},Ne=J?h:null,X=V.error,Pe=J&&!Y;return e(l,{children:[i(ne,{open:!0,onOpenChange:e=>{!e&&!Pe&&q()},children:e(ce,{width:p===`picker`?`xl`:`lg`,scroll:`body`,onCancel:e=>{Pe&&e.preventDefault()},children:[i(A,{children:i(me,{children:Me[p]})}),e(M,{children:[X&&!J&&i(`div`,{className:`mb-3 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:X instanceof Error?X.message:String(X)}),p===`picker`&&e(l,{children:[O&&i(`div`,{className:`mb-3 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:O}),i(ot,{onSelect:Oe,onClose:q,pendingAddonId:Ne})]}),p===`config`&&h&&i(rt,{addonId:h,configSchema:we??null,canTest:ee,...N===void 0?{}:{instanceKind:N},initialName:w.length>0&&Object.keys(ie).length>0?w:void 0,initialConfig:{...ie},onScan:be?()=>{_e(w.length>0?w:h),le(!0)}:void 0,onSave:ke,onBack:()=>{j({}),m(`picker`)}},`${F.length>0?F:h}:${de}`),p===`broker`&&x&&i(tt,{kind:x,onResolved:e=>{Ae(e)},onBack:()=>m(`picker`)}),p===`discovery`&&_&&i(nt,{providerId:_,onImport:G,onSkip:je})]}),J&&e(`div`,{className:`absolute inset-0 z-20 flex flex-col items-center justify-center gap-2 rounded-lg bg-background/85 backdrop-blur-sm px-6 text-center`,children:[i(C,{className:`h-6 w-6 animate-spin text-primary`}),i(`p`,{className:`text-xs font-medium text-foreground`,children:u(`integrations.creating`,{defaultValue:`Creating integration…`})}),!Y&&i(`p`,{className:`text-[10px] text-foreground-subtle`,children:u(`integrations.creatingHint`,{defaultValue:`Waiting for the addon to restart and register`})}),Y&&e(l,{children:[i(`p`,{className:`text-[10px] text-foreground-subtle max-w-xs`,children:u(`integrations.creatingOverdue`,{defaultValue:`This is taking longer than expected. The integration may already have been created — close this dialog and refresh to check.`})}),i(R,{variant:`unstyled`,onClick:q,className:`mt-1 rounded-md border border-border bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground hover:bg-surface-hover transition-colors`,children:u(`integrations.closeAndRefresh`,{defaultValue:`Close`})})]})]})]})}),se&&h!==null&&i(st,{open:se,scope:{addonId:h,label:he},pickMode:`fill`,onClose:()=>le(!1),onSetupIntegration:e=>{T(e.name),j({...e.config}),fe(e=>e+1)}})]})}function St({integration:t,expanded:n,onToggleExpand:r}){let{t:a}=B();return e(`div`,{className:`flex items-center gap-2.5`,children:[i(R,{variant:`unstyled`,type:`button`,onClick:e=>{e.stopPropagation(),r(t.addonId)},"aria-label":n?a(`integrations.integrationColumns.collapse`,`Collapse`):a(`integrations.integrationColumns.expand`,`Expand`),"aria-expanded":n,className:`flex h-5 w-5 flex-shrink-0 items-center justify-center rounded text-foreground-subtle transition-colors hover:bg-surface-hover hover:text-foreground`,children:i(n?f:g,{className:`h-3.5 w-3.5`})}),i(U,{type:t.addonId,size:`sm`}),e(`div`,{className:`flex min-w-0 flex-col`,children:[i(`span`,{className:`truncate text-xs font-semibold text-foreground`,children:t.name}),i(`span`,{className:`truncate text-[10px] text-foreground-subtle`,children:t.addonId})]})]})}function Ct(e){let{isExpanded:t,onToggleExpand:n}=e;return[{key:`name`,header:z.t(`integrations.integrationColumns.integration`,`Integration`),headerClassName:`w-[55%]`,cell:e=>i(St,{integration:e,expanded:t(e),onToggleExpand:n})},{key:`devices`,header:z.t(`integrations.integrationColumns.devices`,`Devices`),headerClassName:`w-[15%]`,cellClassName:`text-[11px] text-foreground-subtle`,cell:e=>z.t(`integrations.integrationColumns.deviceCount`,{count:e.deviceCount})},{key:`status`,header:z.t(`integrations.integrationColumns.status`,`Status`),headerClassName:`w-[15%]`,cell:e=>i(Ce,{status:e.status})}]}s();var wt=6e4;function Tt({onSetupIntegration:t}){let{t:n}=B(),[r,a]=o(!1),s=se({},{refetchInterval:wt}),c=s.data?.proposals??[];return c.length===0?null:e(l,{children:[e(`div`,{role:`status`,"data-testid":`discovery-banner`,className:`flex flex-wrap items-center gap-2 rounded-lg border border-info/30 bg-info/10 px-3 py-2 text-xs text-foreground`,children:[i(h,{className:`h-3.5 w-3.5 text-info`,"aria-hidden":!0}),i(`span`,{className:`flex-1`,children:n(`integrations.discoveryBanner.count`,{defaultValue_one:`{{count}} new device found`,defaultValue_other:`{{count}} new devices found`,count:c.length})}),i(R,{variant:`secondary`,size:`sm`,onClick:()=>a(!0),children:n(`integrations.discoveryBanner.review`,`Review`)})]}),i(Et,{open:r,onClose:()=>a(!1),proposals:c,onChanged:()=>void s.refetch(),onSetupIntegration:e=>{a(!1),t(e)}})]})}function Et({open:t,onClose:n,proposals:a,onChanged:s,onSetupIntegration:c}){let{t:u}=B(),d=L(),f=oe(),[p,g]=o(new Set),_=r(async(e,t)=>{g(t=>new Set(t).add(e));try{await t(),s()}catch{}finally{g(t=>{let n=new Set(t);return n.delete(e),n})}},[s]),v=r(async e=>{let t=K(e.addonId,e.candidate);if(t!==null){c(t);return}await _(e.id,()=>d.mutateAsync({addonId:e.addonId,candidate:e.candidate}))},[d,c,_]),y=r(e=>_(e.id,()=>f.mutateAsync({id:e.id})),[f,_]);return i(ne,{open:t,onOpenChange:e=>!e&&n(),children:e(ce,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[i(A,{children:i(me,{children:e(`span`,{className:`flex items-center gap-2`,children:[i(h,{className:`h-4 w-4 text-primary`}),u(`integrations.discoveryBanner.title`,`New devices found`)]})})}),i(M,{className:`space-y-1.5`,children:a.map(t=>e(`div`,{"data-testid":`discovery-proposal`,className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-2`,children:[e(`div`,{className:`min-w-0 flex-1`,children:[i(`p`,{className:`truncate text-sm font-medium text-foreground`,children:t.candidate.suggestedName}),i(`p`,{className:`truncate text-xs text-foreground-muted`,children:t.addonId})]}),p.has(t.id)?i(C,{className:`h-4 w-4 animate-spin text-foreground-muted`,"aria-hidden":!0}):e(l,{children:[i(R,{variant:`secondary`,size:`sm`,onClick:()=>void y(t),children:u(`integrations.discoveryBanner.dismiss`,`Dismiss`)}),e(R,{size:`sm`,onClick:()=>void v(t),children:[i(m,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),u(`integrations.discoveryBanner.adopt`,`Adopt`)]})]})]},t.id))})]})})}s();function Dt(e){if(!e.enabled)return`disabled`;switch(e.processState){case`running`:return`running`;default:return`stopped`}}var Ot=`expand`;function kt(){let{t}=B(),s=Te(),c=H(),u=T(),[f]=we(),[m,g]=Qe(),[_,b]=o(!1),[x,S]=o(null),C=r(()=>{S(null),b(!0)},[]),E=r(()=>{b(!1),S(null)},[]),D=r(e=>{k(!1),S(e),b(!0)},[]),[O,k]=o(!1);a(()=>{let e=je(c.state);e!==null&&(S(e),b(!0),s(`/integrations`,{replace:!0,state:null}))},[c.state,s]);let A=f.get(`setup`);a(()=>{A===null||A.length===0||(S({addonId:A,name:A,config:{}}),b(!0))},[A]);let te=r(()=>k(!0),[]),ne=r(()=>k(!1),[]);N([`integrations`],[`integration.enabled`,`integration.disabled`,`integration.deleted`,`provider.started`,`provider.stopped`,`addon.installed`,`addon.uninstalled`,`addon.started`,`addon.stopped`,`addon.updated`]),N([`deviceManager`],[`device.registered`,`device.unregistered`,`device.online`,`device.offline`,`device.disabled`,`device.enabled`]);let{data:j,isLoading:oe,isError:M,error:se,errorUpdateCount:ce,refetch:le}=ve(void 0,{refetchInterval:We}),{data:ue,isLoading:de,isError:fe,error:pe,errorUpdateCount:me,refetch:ye}=ie({projection:`slim`},{refetchInterval:We}),P=n(()=>ue??[],[ue]),xe=n(()=>j??[],[j]),F=n(()=>{let e=new Map;for(let t of P)e.set(t.id,{id:t.id,name:t.name??t.stableId??`#${String(t.id)}`});return e},[P]),I=n(()=>ae(j),[j]),Ce=n(()=>{let e=new Map;for(let t of Se(P)){let n=I(t);if(n.kind!==`resolved`)continue;let r=n.integration.id;e.set(r,(e.get(r)??0)+1)}return e},[P,I]),L=n(()=>xe.map(e=>({id:e.id,addonId:e.addonId,name:e.name,enabled:e.enabled,status:Dt(e),deviceCount:Ce.get(e.id)??0})),[xe,Ce]),{data:z}=ge(),V=n(()=>new Map((z??[]).map(e=>[e.addonId,e.name])),[z]),U=f.get(Ot),De=r(e=>{let t=new URLSearchParams(window.location.search);t.get(Ot)===e?t.delete(Ot):t.set(Ot,e);let n=t.toString(),r=`${window.location.pathname}${n?`?${n}`:``}${window.location.hash}`;window.history.replaceState(window.history.state,``,r),window.dispatchEvent(new PopStateEvent(`popstate`))},[]),{data:Oe}=be(void 0),W=n(()=>Ie(Oe),[Oe]),G=n(()=>Le(L,W),[L,W]),K=n(()=>Le(Pe(L,V),W),[L,V,W]),q=r(e=>s(Ee(e.addonId)),[s]),J=r(e=>s(Ee(e.addonId,e.id)),[s]),Y=r(e=>F.get(e)??null,[F]),Me=r(e=>s(`/devices/${String(e)}`),[s]),Ne=r(e=>i(he,{context:`integration-detail`,devices:P,trpc:u.trpcClient,integrationOf:I,forceIntegrationId:e.id,urlScope:`nested`,lsKey:`integrations:nested:${e.addonId}`,resolveIntegrationIcon:Ae,resolveParent:Y,onNavigate:Me}),[P,u.trpcClient,I,Y,Me]),X=r(e=>U===e.addonId,[U]),Fe=n(()=>Ct({isExpanded:X,onToggleExpand:De}),[X,De]),Re=r(e=>`${e.name} ${e.addonId}`,[]),ze=r(e=>e.id,[]),Be=e=>i(he,{mode:`generic`,items:e,getKey:ze,getSearchText:Re,columns:Fe,onRowClick:J,isExpanded:X,renderExpanded:Ne,searchPlaceholder:t(`integrations.search`,{defaultValue:`Search integrations…`}),emptyLabel:t(`integrations.empty`,{defaultValue:`No integrations found.`})}),Ve=r(()=>{le(),ye()},[le,ye]),He=M===!0&&Ue(se,ce),Ge=fe===!0&&Ue(pe,me),Ke=He||Ge,Q=M===!0&&!He||fe===!0&&!Ge,$=!Q&&!Ke&&(oe||de||j===void 0||ue===void 0),Je=xe.length>0,Ye=[{id:`table`,label:t(`integrations.viewTable`,`Table`),icon:ee},{id:`grid`,label:t(`integrations.viewGrid`,`Grid`),icon:d}];return e(ke,{icon:p,title:t(`nav.integrations`,`Integrations`),actions:e(l,{children:[i(re,{ariaLabel:t(`integrations.viewLabel`,`Layout`),value:m,onChange:g,options:Ye,testId:`integrations-view`}),i(R,{variant:`unstyled`,onClick:Ve,disabled:$,className:`flex items-center gap-1 rounded-lg border border-border bg-surface px-2.5 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,title:t(`common.refresh`,`Refresh`),children:i(v,{className:w(`h-3.5 w-3.5`,$&&`animate-spin`)})}),e(R,{variant:`unstyled`,onClick:te,className:`flex items-center gap-1.5 rounded-lg border border-border bg-surface px-2.5 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,title:t(`integrations.scanTheLocalNetworkFor`,`Scan the local network for devices`),children:[i(h,{className:`h-3.5 w-3.5`}),t(`integrations.scanNetwork`,`Scan network`)]}),e(R,{variant:`unstyled`,onClick:C,className:`flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground shadow-sm`,children:[i(y,{className:`h-3.5 w-3.5`}),t(`integrations.newIntegration`,`New Integration`)]})]}),children:[i(Tt,{onSetupIntegration:D}),Q&&i(_e,{message:t(`integrations.loadFailed`,`Integrations could not be loaded.`),onRetry:Ve}),Ke&&!Q&&e(`div`,{role:`status`,"data-testid":`integrations-reconnecting`,className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-2 text-xs text-foreground-subtle`,children:[i(v,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),t(`integrations.reconnecting`,`An integration is restarting. The list will refresh on its own.`)]}),$&&i(`div`,{className:`space-y-2`,"data-testid":`integrations-pending`,children:[1,2,3].map(e=>i(`div`,{className:`h-12 rounded-lg border border-border bg-surface animate-pulse`},e))}),!Q&&!$&&!Ke&&!Je&&e(`div`,{className:`flex flex-col items-center py-20 text-foreground-subtle`,children:[i(`p`,{className:`text-sm`,children:t(`integrations.noIntegrationsConfigured`,`No integrations configured.`)}),i(`p`,{className:`text-xs mt-1`,children:t(`integrations.clickNewIntegrationToConnect`,`Click "New Integration" to connect cameras and devices.`)})]}),!Q&&!$&&Je&&m===`table`&&e(`div`,{className:`space-y-4`,children:[G.providers.length>0&&i(Z,{kind:`providers`,children:Be(G.providers)}),G.system.length>0&&i(Z,{kind:`system`,children:Be(G.system)})]}),!Q&&!$&&Je&&m===`grid`&&i(qe,{providers:K.providers,system:K.system,onOpen:q,searchPlaceholder:t(`integrations.search`,{defaultValue:`Search integrations…`}),emptyLabel:t(`integrations.empty`,{defaultValue:`No integrations found.`})}),i(xt,{open:_,onClose:E,seed:x}),i(st,{open:O,onClose:ne,onSetupIntegration:D})]})}export{kt as IntegrationsPage};
@@ -1 +0,0 @@
1
- import{ga as e}from"./player-overlays-DRXPDzoq.js";var t=e(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]);export{t};