@camstack/addon-admin-ui 1.2.632 → 1.2.634

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 (141) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/assets/{Addons-BT7bHTan.js → Addons-Cng9jF6c.js} +3 -3
  3. package/dist/assets/{AdminPage-DukjVgyy.js → AdminPage-CPPoleZA.js} +1 -1
  4. package/dist/assets/{AdminSectionedPage-BJPMt494.js → AdminSectionedPage-C_DLslGH.js} +1 -1
  5. package/dist/assets/{AiProfiles-BEzTAEwr.js → AiProfiles-B6Xt0CM1.js} +2 -2
  6. package/dist/assets/{Authentication-A0rZl8n_.js → Authentication-CkLg9Az9.js} +1 -1
  7. package/dist/assets/Build-DMEXJqf9.js +39 -0
  8. package/dist/assets/{Calendars-Cp3QTvHZ.js → Calendars-BHc1dbvk.js} +1 -1
  9. package/dist/assets/{CameraGrids-F-c0rQnS.js → CameraGrids-CIJubNTN.js} +1 -1
  10. package/dist/assets/{Cluster-BPubGaV-.js → Cluster-CSTB-np5.js} +1 -1
  11. package/dist/assets/CompositionBlockEditor-B4WN_aXq.js +2 -0
  12. package/dist/assets/{CompositionEditorPage-CtND1Icl.js → CompositionEditorPage-jP0e8vX8.js} +1 -1
  13. package/dist/assets/{Data-CcpoZfHM.js → Data-DJFzG2dC.js} +2 -2
  14. package/dist/assets/DeviceDetail-3P3i5bd9.js +2 -0
  15. package/dist/assets/{Devices-Dg1sA-xP.js → Devices-Ddhmovvw.js} +1 -1
  16. package/dist/assets/{EmbedPlayerPage-BenDk7Gh.js → EmbedPlayerPage-B9wkgcPc.js} +1 -1
  17. package/dist/assets/{History-aloN-aqn.js → History-Cv6TryZt.js} +1 -1
  18. package/dist/assets/{Identity-B_yFjW2V.js → Identity-Dmwp8J7o.js} +1 -1
  19. package/dist/assets/{InstanceSwitchCell-BboEA1K9.js → InstanceSwitchCell-xSu6VGOy.js} +1 -1
  20. package/dist/assets/{InstancesTable-DXUpAcJZ.js → InstancesTable-dSeWjA48.js} +1 -1
  21. package/dist/assets/IntegrationDetail-oEpvT757.js +1 -0
  22. package/dist/assets/{IntegrationHub-B5bQNj_0.js → IntegrationHub-CIVmSeKd.js} +1 -1
  23. package/dist/assets/{Integrations-vpeNxy4B.js → Integrations-C5BzsIy2.js} +2 -2
  24. package/dist/assets/{Integrations-DVHLLuX5.js → Integrations-zlHqQ0X9.js} +1 -1
  25. package/dist/assets/{Library-CrnrNYJv.js → Library-COZVDG1J.js} +1 -1
  26. package/dist/assets/{Locations-OJ7ibNjp.js → Locations-CpG6tIMC.js} +1 -1
  27. package/dist/assets/{Logs-BxPxV1qL.js → Logs-_Lymv-hK.js} +1 -1
  28. package/dist/assets/{MaskShapeCanvas-f8Ot4FwU.js → MaskShapeCanvas-Dkn9mTx5.js} +1 -1
  29. package/dist/assets/{MotionZonesSettings-CNCPmAdx.js → MotionZonesSettings-DbJd1q0y.js} +1 -1
  30. package/dist/assets/{MyAccess-BFE8d6ZR.js → MyAccess-3IH5sTuq.js} +1 -1
  31. package/dist/assets/{Network-Cg63gJCR.js → Network-DNJ2W_md.js} +1 -1
  32. package/dist/assets/{NodeAddonsSettingsPanel-CJ9Q5NFQ.js → NodeAddonsSettingsPanel-BleYmajR.js} +1 -1
  33. package/dist/assets/Notifications-C5S8_cBI.js +1 -0
  34. package/dist/assets/{Pipeline-gEdCbMYl.js → Pipeline-CBIucM6P.js} +1 -1
  35. package/dist/assets/{PrivacyMaskSettings-CJ1adeiq.js → PrivacyMaskSettings-B7mOaiDG.js} +1 -1
  36. package/dist/assets/{Recordings-BXEOwON0.js → Recordings-Dzfu0JHh.js} +1 -1
  37. package/dist/assets/{ScanSubnetEditor-GZYgp4WY.js → ScanSubnetEditor-g4rMYaaa.js} +1 -1
  38. package/dist/assets/{SceneMonitorEditor-CdOav4NE.js → SceneMonitorEditor-B99BtkWG.js} +1 -1
  39. package/dist/assets/{SessionsList-CM7QkwsQ.js → SessionsList-DB9t5c5h.js} +1 -1
  40. package/dist/assets/{Showroom-ChgpRtnE.js → Showroom-BlMJHK6P.js} +1 -1
  41. package/dist/assets/{StorageLocationsTable-Ch9fTls7.js → StorageLocationsTable-BCc20Y-P.js} +1 -1
  42. package/dist/assets/{System-BrbYsqjP.js → System-_om1Qy_Z.js} +1 -1
  43. package/dist/assets/{Templates-BPPPDyxv.js → Templates-ClUtf6zo.js} +1 -1
  44. package/dist/assets/{Terminal-D1wU2v2O.js → Terminal-CK-OPJi8.js} +1 -1
  45. package/dist/assets/{TrainingProviders-Dmz54UM4.js → TrainingProviders-CMfEG1p0.js} +1 -1
  46. package/dist/assets/{Viewer-C9Ny-xX5.js → Viewer-D8ErfEDa.js} +1 -1
  47. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BvfhnhUm.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-D5EjGbog.js} +1 -1
  48. package/dist/assets/{action-draft-Rt5OrTBb.js → action-draft-BF1Yv5wJ.js} +1 -1
  49. package/dist/assets/{ai-page.helpers-D9kjLVBH.js → ai-page.helpers-7-YKMWA7.js} +1 -1
  50. package/dist/assets/{archive-DQhBHdGb.js → archive-WByIhorf.js} +1 -1
  51. package/dist/assets/{assignment-candidates-D_WnsDC9.js → assignment-candidates-CerZJluZ.js} +1 -1
  52. package/dist/assets/{authed-media-Ctq5fLNa.js → authed-media-vTZUQ8BO.js} +1 -1
  53. package/dist/assets/{bell-off-CQw8KePi.js → bell-off-HUbueWAa.js} +1 -1
  54. package/dist/assets/{board-model-pkgjhYhn.js → board-model-BeY6U40R.js} +1 -1
  55. package/dist/assets/{boxes-DLyI_XjT.js → boxes-Sn1wqpgK.js} +1 -1
  56. package/dist/assets/{calendar-clock-D3y-UzBd.js → calendar-clock-TWIEL7Fd.js} +1 -1
  57. package/dist/assets/{circle-arrow-up-CrgC-GoF.js → circle-arrow-up-BZb1tft0.js} +1 -1
  58. package/dist/assets/circle-slash-Yb1HMMEU.js +1 -0
  59. package/dist/assets/client-BT1qTuWk.js +839 -0
  60. package/dist/assets/create-composition-BCz5rteK.js +2 -0
  61. package/dist/assets/crop-Rp-pMXj8.js +1 -0
  62. package/dist/assets/{database-zap-ebRczSES.js → database-zap-DDQJWo1I.js} +1 -1
  63. package/dist/assets/{device-integration-icon-D1SlG8pf.js → device-integration-icon-BEojiV6j.js} +1 -1
  64. package/dist/assets/device-picker-model-DxRFIJt2.js +1 -0
  65. package/dist/assets/{dist-1IPGakxD.js → dist-BAkSt7-o.js} +1 -1
  66. package/dist/assets/dist-MZVzWw2Y.js +839 -0
  67. package/dist/assets/{eraser-CrU_ylHX.js → eraser-BXfY9g0S.js} +1 -1
  68. package/dist/assets/{file-up-C83TYV5g.js → file-up-CGHZOKg0.js} +1 -1
  69. package/dist/assets/{format-DZv3Xcae.js → format-C6WZEo_1.js} +1 -1
  70. package/dist/assets/{hard-drive-download-DY8-G97Q.js → hard-drive-download-B12jnOmz.js} +1 -1
  71. package/dist/assets/{hostInit-CFIHZoF5.js → hostInit-DvgZnKz2.js} +1 -1
  72. package/dist/assets/i18n-DO003gOw.js +1 -0
  73. package/dist/assets/{icons-H9CAnhlN.js → icons-CSB91nWL.js} +1 -1
  74. package/dist/assets/index-BtIAcMod.js +4 -0
  75. package/dist/assets/index-W6guS92q.css +2 -0
  76. package/dist/assets/{key-Daxu-jCc.js → key-C7vcpiqV.js} +1 -1
  77. package/dist/assets/{key-square-Cf7qU2ZZ.js → key-square-wAKOa45w.js} +1 -1
  78. package/dist/assets/{languages-CLBA0iF5.js → languages-NIG6fIsC.js} +1 -1
  79. package/dist/assets/{layers-B40flYJz.js → layers-igKznkhu.js} +1 -1
  80. package/dist/assets/{link-2-off-BAaoRwqF.js → link-2-off-ViXG09ia.js} +1 -1
  81. package/dist/assets/{linked-devices-model-YbEDMapY.js → linked-devices-model-Coihabk7.js} +1 -1
  82. package/dist/assets/{memory-stick-DrFcuZNk.js → memory-stick-Cb3rfsma.js} +1 -1
  83. package/dist/assets/{message-square-plus-CRRBCpat.js → message-square-plus-MY_vmmYC.js} +1 -1
  84. package/dist/assets/{mf-entry-bootstrap-0-701864ce.js → mf-entry-bootstrap-0-bf765b1e.js} +2 -2
  85. package/dist/assets/{mic-off-DahXL35O.js → mic-off-DQbHj0Dp.js} +1 -1
  86. package/dist/assets/{monitor-off-BHpXVdMV.js → monitor-off-KvLmRgXm.js} +1 -1
  87. package/dist/assets/{monitor-smartphone-Cg7zkb3G.js → monitor-smartphone-wbkRUoUy.js} +1 -1
  88. package/dist/assets/mount-DxRFIJt2.js +1 -0
  89. package/dist/assets/{notification-rule-status-B2ehhYuJ.js → notification-rule-status-DSPA2LGi.js} +1 -1
  90. package/dist/assets/{player-overlays-C-LR1t7f.js → player-overlays-D2iM_dnq.js} +1 -1
  91. package/dist/assets/remoteEntry-CjzR4ng6.js +1 -0
  92. package/dist/assets/{ruler-BD7pcHku.js → ruler-Cnh0qH1K.js} +1 -1
  93. package/dist/assets/{scan-eye-Dml5chSK.js → scan-eye-B57MjUsN.js} +1 -1
  94. package/dist/assets/{scissors-DTLZipNa.js → scissors-jk6_pSRI.js} +1 -1
  95. package/dist/assets/{search-x-DwLc6xe6.js → search-x-KiZ1cgFX.js} +1 -1
  96. package/dist/assets/{send-5UFl-2T3.js → send-DAC8bZ9x.js} +1 -1
  97. package/dist/assets/{settings-2-BJUbGqt2.js → settings-2-B5Wblm0D.js} +1 -1
  98. package/dist/assets/{shapes-B-j95JHo.js → shapes-C877FMvu.js} +1 -1
  99. package/dist/assets/{sigma-5DS4fXRu.js → sigma-48mqbKtS.js} +1 -1
  100. package/dist/assets/src-Djs5D3BM.js +169 -0
  101. package/dist/assets/{sso-popup-BlGNnn2N.js → sso-popup-zJECU9yL.js} +1 -1
  102. package/dist/assets/{step-inspector-model-CqZ7Al9q.js → step-inspector-model-flcREGWU.js} +1 -1
  103. package/dist/assets/{table-2-CuiUfVZm.js → table-2-Dcc8x9NW.js} +1 -1
  104. package/dist/assets/{timer-reset-CVNI_AD_.js → timer-reset-DPB7Vi_P.js} +1 -1
  105. package/dist/assets/{ungroup-3yNBWxK2.js → ungroup-CaRYV5oo.js} +1 -1
  106. package/dist/assets/{unlink-B4jJ0_4g.js → unlink-B1jawH2n.js} +1 -1
  107. package/dist/assets/{usb-Bwbj9iy6.js → usb-B566yDR8.js} +1 -1
  108. package/dist/assets/{use-scenes-feed-B9WLQRks.js → use-scenes-feed-Cv3Lv9tp.js} +1 -1
  109. package/dist/assets/{use-stationary-objects-BGK7EW6B.js → use-stationary-objects-DPdFLI4G.js} +1 -1
  110. package/dist/assets/{useAdminDeviceRemoval-Be9ZUjP5.js → useAdminDeviceRemoval-CK79vXvY.js} +1 -1
  111. package/dist/assets/useEventInvalidation-DxRFIJt2.js +1 -0
  112. package/dist/assets/{useNodeUrlSelection-BtSZ8rlx.js → useNodeUrlSelection-B4V72DKj.js} +1 -1
  113. package/dist/assets/useTemplateSave-sDhvqUj4.js +1 -0
  114. package/dist/assets/user-round-gyXn4SEe.js +1 -0
  115. package/dist/assets/{user-x-DD7eWvk5.js → user-x-Dalx5dz-.js} +1 -1
  116. package/dist/assets/{variable-BsLCDfoM.js → variable-CxFXQLx9.js} +1 -1
  117. package/dist/assets/{video-BkZKS0Zo.js → video-DFWp1_fo.js} +1 -1
  118. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Byutlh7W.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Dbfg8wPM.js} +2 -2
  119. package/dist/index.html +10 -10
  120. package/dist/server/addon.js +188 -179
  121. package/package.json +2 -2
  122. package/dist/assets/Build-DbU7PhfN.js +0 -39
  123. package/dist/assets/CompositionBlockEditor-CZ4dd1Rg.js +0 -2
  124. package/dist/assets/DeviceDetail-DV6x3JB9.js +0 -2
  125. package/dist/assets/IntegrationDetail-Dt0JMO5X.js +0 -1
  126. package/dist/assets/Notifications-DVMvQvKq.js +0 -1
  127. package/dist/assets/circle-slash-DKDb5qiu.js +0 -1
  128. package/dist/assets/client-CTS6i8uH.js +0 -839
  129. package/dist/assets/create-composition-DqVl0ikx.js +0 -2
  130. package/dist/assets/crop-CPkFD20y.js +0 -1
  131. package/dist/assets/device-picker-model-nucY7hW2.js +0 -1
  132. package/dist/assets/dist-UoPJIOk2.js +0 -839
  133. package/dist/assets/i18n-DQKduBul.js +0 -1
  134. package/dist/assets/index-CYCJ_V8d.css +0 -2
  135. package/dist/assets/index-DWkBV3yo.js +0 -4
  136. package/dist/assets/mount-nucY7hW2.js +0 -1
  137. package/dist/assets/remoteEntry-Dap0eXDy.js +0 -1
  138. package/dist/assets/src-BjGJ_toP.js +0 -169
  139. package/dist/assets/useEventInvalidation-nucY7hW2.js +0 -1
  140. package/dist/assets/useTemplateSave-BfJqrrQS.js +0 -1
  141. package/dist/assets/user-round-rhUA6kJq.js +0 -1
@@ -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,a as s,et as c,o as l,x as u}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Di as d,En as f,Et as p,Fn as m,Hi as h,Hn as g,Jn as _,Kt as v,Ni as y,Oa as b,Tr as x,Vi as S,Yt as C,_a as w,gt as T,ii as E,kn as D,li as O,ri as k,zi as A,zn as j}from"./player-overlays-C-LR1t7f.js";import{Ho as M}from"./client-CTS6i8uH.js";import{t as N}from"./search-x-DwLc6xe6.js";import{$a as P,$o as ee,$s as F,Ao as I,Dn as L,Go as te,Gr as R,Ho as z,If as B,Io as V,Jo as H,Jr as U,Kr as W,Kt as ne,Mf as G,Mo as re,No as ie,Oi as K,Os as q,Po as ae,Ro as J,Uo as oe,Vn as se,Wr as ce,Xr as le,Yr as Y,Yt as X,Zn as ue,a as de,ac as fe,ba as pe,br as me,cc as he,dr as ge,eo as _e,fr as ve,i as Z,ii as ye,ji as be,jo as xe,ko as Se,lc as Ce,ls as we,mf as Te,mr as Ee,nc as De,ns as Oe,oc as ke,pr as Ae,qt as je,sc as Me,ur as Ne,us as Pe,yr as Fe,zo as Ie}from"./src-BjGJ_toP.js";import{t as Q}from"./useTranslation-BJr-n0es.js";import{Br as Le,K as Re,Pr as ze,Rr as Be,X as Ve,Y as He,b as Ue,ft as $,x as We,y as Ge,zr as Ke}from"./index-DWkBV3yo.js";import{t as qe}from"./useAdminDeviceRemoval-Be9ZUjP5.js";import{t as Je}from"./device-integration-icon-D1SlG8pf.js";import{n as Ye,o as Xe,t as Ze}from"./ScanSubnetEditor-GZYgp4WY.js";c();function Qe(e){let t=[];for(let n of e)n.type===`probe`&&t.push(n.key),n.type===`group`&&`fields`in n&&t.push(...Qe(n.fields));return t}function $e(e,t,i){let[a,s]=o(`idle`),[c,l]=o({}),u=n(()=>{let t=[];for(let n of e.sections)t.push(...Qe(n.fields));return t},[e]),d=u.length>0&&i!==void 0,f=r(e=>{l(t=>{if(!t[e])return t;let n={...t};return delete n[e],n})},[]);return{testAllStatus:a,hasProbeFields:d,probeResults:c,handleTestAll:r(async()=>{if(!i)return;let e=u.filter(e=>{let n=t[e];return n!=null&&String(n).trim()!==``});if(e.length===0)return;s(`testing`);let n={};for(let t of e)n[t]={status:`probing`};l(n);let r=await Promise.allSettled(e.map(async e=>{try{return{key:e,result:await i(e,t[e])}}catch(t){return{key:e,result:{status:`error`,error:t instanceof Error?t.message:String(t)}}}})),a={};for(let e of r)if(e.status===`fulfilled`){let{key:t,result:n}=e.value;a[t]={status:n.status===`ok`?`ok`:`error`,result:n}}l(a),s(`idle`)},[i,u,t]),clearProbeResult:f}}c();function et(e){let t=[];for(let n of e)`required`in n&&n.required===!0&&`key`in n&&n.key&&t.push(n.key),n.type===`group`&&`fields`in n&&t.push(...et(n.fields));return t}function tt(e){return e==null?!0:typeof e==`string`?e.trim()===``:!1}function nt(e,t={}){for(let n of e){if(n.type===`group`&&`fields`in n){nt(n.fields,t);continue}`key`in n&&n.key&&`default`in n&&n.default!==void 0&&(t[n.key]=n.default)}return t}function rt(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`probe-${crypto.randomUUID()}`:`probe-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function it(e,t){let n=we({addonId:e,integrationId:t}),r=n.data?.deviceType??null,i=H({addonId:e,integrationId:t,type:r??M.Camera},{enabled:n.isSuccess&&r!==null});return n.isError?`unavailable`:n.isLoading?`loading`:r===null||i.isError?`unavailable`:i.isLoading||!i.isSuccess?`loading`:((i.data??null)?.sections??[]).some(e=>e.fields.length>0)?`available`:`unavailable`}function at({integrationId:t,addonId:s,onClose:c}){let{t:d}=Q(),f=l(),[m,h]=o({}),[g,_]=o(!1),[y,b]=o(null),[C,w]=o(rt),T=we({addonId:s,integrationId:t},{enabled:!0}),E=T.data?.deviceType??null,O=H({addonId:s,integrationId:t,type:E??M.Camera},{enabled:T.isSuccess&&E!==null}),k=O.data??null;a(()=>{h(k?nt(k.sections.flatMap(e=>e.fields)):{}),w(rt()),_(!1),b(null)},[!0,t,k]);let A=n(()=>({...m,_probeRequestId:C}),[m,C]),j=J({onSuccess:()=>{f.invalidateQueries({queryKey:[[`deviceManager`]]})}}),N=q(),P=r(async(e,t)=>{_(!0);let n=await N.mutateAsync({addonId:s,type:E??M.Camera,key:e,value:t,formValues:A});return n.status===`ok`&&n.suggestedValues&&h(e=>{let t=!1,r={...e};for(let[i,a]of Object.entries(n.suggestedValues??{}))tt(e[i])&&!tt(a)&&(r[i]=a,t=!0);return t?r:e}),n},[N,s,A,E]),{testAllStatus:ee,hasProbeFields:F,probeResults:I,handleTestAll:te,clearProbeResult:z}=$e(k??{sections:[]},m,P);async function B(e){b(null);try{await j.mutateAsync({addonId:s,type:E??M.Camera,config:m,integrationId:t}),e?h(k?nt(k.sections.flatMap(e=>e.fields)):{}):c()}catch(e){b(e instanceof Error?e.message:String(e))}}let V=et((k?.sections??[]).flatMap(e=>e.fields)).filter(e=>tt(m[e])),W=V.length===0,ne=T.isLoading||E!==null&&O.isLoading,G=T.isError||T.isSuccess&&E===null||O.isError||O.isSuccess&&k===null;return e(u,{children:[i(R,{className:`space-y-3`,children:ne?i(`div`,{className:`flex items-center justify-center py-8`,children:i(x,{className:`h-5 w-5 animate-spin text-primary`})}):G?e(`div`,{className:`flex items-start gap-3 rounded-lg border border-danger/40 bg-danger/10 px-4 py-3`,children:[i(v,{className:`h-4 w-4 text-danger mt-0.5 shrink-0`}),e(`div`,{className:`space-y-1`,children:[i(`p`,{className:`text-xs font-medium text-danger`,children:d(`integrations.addDeviceDialog.providerUnavailable`,`Provider unavailable`)}),i(`p`,{className:`text-xs text-foreground-subtle`,children:i(ze,{i18nKey:`integrations.addDeviceDialog.notReady`,values:{addonId:s},components:{mono:i(`span`,{className:`font-mono`})}})})]})]}):i($,{schema:k,values:m,onChange:h,onTestField:P,probeResults:I,onClearProbe:z})}),!G&&!ne&&e(`div`,{className:`border-t border-border bg-surface/50 shrink-0`,children:[e(K,{variant:`unstyled`,type:`button`,onClick:()=>_(e=>!e),className:`flex w-full items-center justify-between px-3 py-2 text-[11px] text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:[e(`span`,{className:`flex items-center gap-2`,children:[i(D,{className:`h-3.5 w-3.5`}),d(`integrations.addDeviceDialog.testLogs`,`Test logs`),i(`span`,{className:`font-mono text-[9px] opacity-60`,children:C.slice(0,14)})]}),i(S,{className:`h-3.5 w-3.5 transition-transform ${g?`rotate-180`:``}`})]}),g&&i(`div`,{className:`border-t border-border max-h-64 overflow-hidden`,children:i(L,{addonId:s,requestId:C,limit:50,maxHeight:`max-h-64`,showFilters:!1,showScope:!1,className:`border-0 rounded-none`})})]}),!G&&!ne&&(y||V.length>0)&&i(`div`,{className:`border-t border-danger/30 bg-danger/5 px-3 py-2 shrink-0`,children:e(`div`,{className:`flex items-start gap-2`,children:[i(v,{className:`h-3.5 w-3.5 text-danger mt-0.5 shrink-0`}),i(`p`,{className:`text-[11px] text-danger`,children:y||d(`integrations.addDeviceDialog.required`,`Required: {{value1}}`,{value1:V.join(`, `)})})]})}),e(U,{className:`justify-between`,children:[e(`div`,{className:`flex items-center gap-2`,children:[i(K,{variant:`unstyled`,onClick:c,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:d(`integrations.cancel`)}),!G&&F&&e(K,{variant:`unstyled`,type:`button`,onClick:te,disabled:ee===`testing`,className:`inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[ee===`testing`?i(x,{className:`h-3.5 w-3.5 animate-spin`}):i(p,{className:`h-3.5 w-3.5`}),d(`integrations.addDeviceDialog.testAll`,`Test All`)]})]}),e(`div`,{className:`flex items-center gap-2`,children:[i(K,{variant:`unstyled`,onClick:()=>B(!0),disabled:G||!W||j.isPending,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:d(`integrations.saveAndNew`)}),i(K,{variant:`unstyled`,onClick:()=>B(!1),disabled:G||!W||j.isPending,className:`rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50`,children:j.isPending?d(`integrations.saving`):d(`integrations.save`)})]})]})]})}var ot=1500;function st({addonId:t,integrationId:n,jobId:r,onFinished:a}){let{t:o}=Q(),s=I(),c=(ie({addonId:t,integrationId:n},{refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`running`)?ot:!1}).data??[]).find(e=>e.jobId===r);if(!c)return null;let l=c.state===`running`,u=c.processed,f=c.total>0?Math.round(u/c.total*100):0;!l&&c.finishedAt!==null&&a();let p=[`${u}/${c.total} ${o(`integrations.adoptJobProcessed`,{defaultValue:`processed`})}`];c.adopted>0&&p.push(`${c.adopted} ${o(`integrations.adoptJobAdded`,{defaultValue:`added`})}`),c.alreadyAdopted>0&&p.push(`${c.alreadyAdopted} ${o(`integrations.adoptJobSkipped`,{defaultValue:`already there`})}`),c.failed>0&&p.push(`${c.failed} ${o(`integrations.adoptJobFailed`,{defaultValue:`failed`})}`);let m=p.join(` · `);return e(`div`,{className:`border-t border-border px-5 py-3 shrink-0 space-y-2`,children:[e(`div`,{className:`flex items-center gap-2`,children:[l?i(x,{className:`h-3.5 w-3.5 animate-spin text-primary shrink-0`}):c.failed>0?i(v,{className:`h-3.5 w-3.5 text-destructive shrink-0`}):c.state===`cancelled`?i(d,{className:`h-3.5 w-3.5 text-foreground-subtle shrink-0`}):i(y,{className:`h-3.5 w-3.5 text-primary shrink-0`}),i(`p`,{className:`text-[11px] text-foreground`,children:m}),l&&i(K,{variant:`unstyled`,onClick:()=>s.mutate({jobId:r}),className:`ml-auto rounded-lg border border-border px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground transition-colors`,children:o(`integrations.adoptJobCancel`,{defaultValue:`Stop`})})]}),i(`div`,{className:`h-1 w-full rounded-full bg-border overflow-hidden`,children:i(`div`,{className:`h-full bg-primary transition-all`,style:{width:`${f}%`},role:`progressbar`,"aria-valuenow":f,"aria-valuemin":0,"aria-valuemax":100})}),c.results.filter(e=>e.outcome===`failed`).slice(0,5).map(t=>e(`p`,{className:`text-[11px] text-destructive`,children:[t.childNativeId,`: `,t.error]},t.childNativeId))]})}function ct(e){let t=e.map(e=>({...e,stableId:e.childNativeId})),n=new Map(e.map(e=>[e.childNativeId,e])),r=(e,t,i)=>e.flatMap(e=>{let a=n.get(e.candidate.childNativeId);return a===void 0?[]:[{candidate:a,depth:t,...i===void 0?{}:{parentName:i}},...r(e.children,t+1,a.name)]});return r(Xe(t),0)}function lt(e){let t=e.metadata?.model,n=e.childNativeId.split(`:`).pop()??``;return[typeof t==`string`?t:``,n].filter(e=>e.length>0).join(` · `)}function ut(e){let t=e.metadata;return[e.name,e.childNativeId,t.model,t.manufacturer,t.integration,t.externalLocation].filter(e=>typeof e==`string`&&e.length>0).join(` `)}c();var dt=`devices`;function ft(e){return{id:dt,label:e(`integrations.adoptDevicesModal.defaultFilter`),isDefault:!0}}var pt=2e4,mt=100;function ht({addonId:s,integrationId:c,onClose:d}){let f=b(),{t:p}=Q(),g=l(),[_,y]=o(new Set),[S,C]=o(new Set),[w,T]=o(new Map),[E,D]=o(null),{data:O}=Me(),k=(O??[]).find(e=>e.addonId===s)?.supportsLocationImport??!1,[A,j]=o(!0),M=xe({addonId:s,integrationId:c}).data?.filters,N=M&&M.length>0?M:[ft(p)],[P,ee]=o(N.find(e=>e.isDefault)?.id??(N.some(e=>e.id===dt)?dt:N[0].id)),F=P!==dt,I=ae(),L=re({addonId:s,integrationId:c,page:1,pageSize:pt,filter:P}),te=L.refetch,R=I.mutate,z=r(()=>{R({addonId:s,integrationId:c},{onSettled:()=>{te()}})},[R,s,c,te]),H=t(null);a(()=>{let e=`${s}::${c}`;H.current===e||L.isLoading||(H.current=e,(L.data?.candidates.length??0)===0&&z())},[s,c,L.isLoading,L.data,z]);let W=I.isPending,ie=I.isError?I.error instanceof Error?I.error.message:String(I.error):null,q=typeof I.data?.lastError==`string`&&I.data.lastError.length>0?I.data.lastError:null,J=L.data?.candidates??[],oe=n(()=>ct(J),[J]),se=n(()=>new Map(oe.map(e=>[e.candidate.childNativeId,e.depth])),[oe]),ce=n(()=>new Map(oe.map(e=>[e.candidate.childNativeId,e.parentName])),[oe]),le=L.isError?L.error instanceof Error?L.error.message:String(L.error):null,Y=V(),[X,ue]=o(null),de=r(e=>{e.alreadyAdopted||y(t=>{let n=new Set(t);return n.has(e.childNativeId)?n.delete(e.childNativeId):n.add(e.childNativeId),n})},[]),fe=r(e=>{C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),pe=r((e,t)=>{T(n=>{let r=new Map(n),i=r.get(e)?.hiddenChildIds??new Set,a=new Set(i);return a.has(t)?a.delete(t):a.add(t),a.size===0?r.delete(e):r.set(e,{hiddenChildIds:a}),r})},[]),me=r(e=>{let t={};for(let n of e){let e=w.get(n);e&&e.hiddenChildIds.size>0&&(t[n]={hiddenChildIds:[...e.hiddenChildIds]})}return Object.keys(t).length>0?t:void 0},[w]),he=r(async()=>{D(null);let e=[..._];if(e.length!==0)try{let t=me(e),{jobId:n}=await Y.mutateAsync({addonId:s,integrationId:c,filter:P,childNativeIds:e,...t?{perCandidate:t}:{},...k?{importLocations:A}:{}});ue(n),y(new Set),T(new Map)}catch(e){D(e instanceof Error?e.message:String(e))}},[_,me,Y,s,c,P,k,A]),ge=t(null),_e=r(()=>{X===null||ge.current===X||(ge.current=X,te(),g.invalidateQueries({queryKey:[[`integrations`]]}),g.invalidateQueries({queryKey:[[`deviceManager`]]}))},[X,te,g]),ve=r(e=>{ee(e),y(new Set),C(new Set),T(new Map),D(null)},[]),Z=_.size,ye=X!==null&&Z===0&&!Y.isPending;return e(u,{children:[k&&e(`label`,{className:`flex items-center gap-1.5 cursor-pointer text-[11px] text-foreground-subtle hover:text-foreground transition-colors`,children:[i(Fe,{checked:A,onChange:e=>j(e.target.checked),className:`accent-primary`}),p(`integrations.importLocations`,{defaultValue:`Import locations from the integration`})]}),e(`div`,{className:`flex-1 min-h-0 flex flex-col gap-2 overflow-hidden`,children:[(ie??le??q)&&J.length===0&&i(`div`,{className:`rounded-lg border border-danger/30 bg-danger/5 px-4 py-3 shrink-0`,children:e(`div`,{className:`flex items-start gap-2`,children:[i(v,{className:`h-3.5 w-3.5 text-danger mt-0.5 shrink-0`}),e(`div`,{className:`min-w-0`,children:[i(`p`,{className:`text-xs font-medium text-danger`,children:p(`integrations.adoptRefreshFailed`,{defaultValue:`Could not discover devices.`})}),i(`p`,{className:`text-[11px] text-danger/90 mt-0.5`,children:ie??le??q})]})]})}),N.length>1&&i(gt,{filters:N,activeFilter:P,onSelect:ve}),i(`div`,{className:`flex-1 min-h-0`,children:i(ne,{mode:`generic`,items:oe.map(e=>e.candidate),pageSize:mt,getKey:e=>e.childNativeId,getSearchText:ut,getFilterType:e=>e.type,filterOptions:G(f),filterLabel:p(`integrations.adoptColType`,{defaultValue:`Type`}),isLoading:L.isLoading||W&&J.length===0,searchPlaceholder:p(`integrations.adoptSearch`,{defaultValue:`Search candidates…`}),emptyLabel:(ie??le??q)&&J.length===0?``:p(`integrations.adoptNoCandidates`,{defaultValue:`No candidate devices found.`}),toolbar:e(K,{variant:`unstyled`,type:`button`,onClick:z,disabled:W,title:p(`integrations.adoptRefreshTitle`,{defaultValue:`Re-scan Home Assistant for devices`}),className:`inline-flex items-center gap-1.5 rounded-lg border border-border bg-surface px-2.5 py-1.5 text-xs text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-60 shrink-0`,children:[i(m,{className:`h-3.5 w-3.5 ${W?`animate-spin`:``}`}),p(`integrations.adoptRefresh`,{defaultValue:`Refresh`})]}),columns:[{key:`name`,header:p(`integrations.adoptColName`,{defaultValue:`Name`}),headerClassName:`w-full sm:w-[55%]`,cellClassName:`max-w-0`,cell:e=>i(_t,{candidate:e,depth:se.get(e.childNativeId)??0,...ce.get(e.childNativeId)===void 0?{}:{containerName:ce.get(e.childNativeId)},expandable:!F,expanded:S.has(e.childNativeId),onToggleExpand:()=>fe(e.childNativeId),adoptedLabel:p(`integrations.adoptAlready`,{defaultValue:`Adopted`}),typeLabel:B(e.type,f).label})},{key:`type`,header:p(`integrations.adoptColType`,{defaultValue:`Type`}),headerClassName:`w-[30%] hidden sm:table-cell`,cellClassName:`hidden sm:table-cell`,cell:t=>{let n=B(t.type,f),r=n.icon;return e(`span`,{className:`inline-flex items-center gap-1.5 text-[10px] text-foreground-subtle`,children:[i(r,{className:`h-3.5 w-3.5 shrink-0`}),n.label]})}},{key:`select`,header:``,headerClassName:`w-10 sm:w-[15%] text-right`,cellClassName:`text-right`,cell:e=>i(`div`,{className:`flex items-center justify-end`,children:i(K,{variant:`unstyled`,onClick:()=>de(e),disabled:e.alreadyAdopted,"aria-label":_.has(e.childNativeId)?p(`integrations.adoptDevicesModal.deselect`,`Deselect`):p(`integrations.adoptDevicesModal.select`,`Select`),className:`inline-flex h-5 w-5 items-center justify-center rounded border ${_.has(e.childNativeId)?`border-primary bg-primary`:`border-border`} ${e.alreadyAdopted?`cursor-not-allowed opacity-50`:``}`,children:_.has(e.childNativeId)&&i(h,{className:`h-3 w-3 text-primary-foreground`})})})}],isExpanded:e=>!F&&S.has(e.childNativeId),renderExpanded:F?void 0:e=>i(vt,{candidate:e,hiddenChildIds:w.get(e.childNativeId)?.hiddenChildIds??new Set,onToggleChildHidden:t=>pe(e.childNativeId,t)}),rowClassName:e=>e.alreadyAdopted?`opacity-60`:_.has(e.childNativeId)?`bg-primary/5`:``})})]}),E&&i(`div`,{className:`border-t border-danger/30 bg-danger/5 px-3 py-2 shrink-0`,children:e(`div`,{className:`flex items-start gap-2`,children:[i(v,{className:`h-3.5 w-3.5 text-danger mt-0.5 shrink-0`}),i(`p`,{className:`text-[11px] text-danger`,children:E})]})}),X!==null&&i(st,{addonId:s,integrationId:c,jobId:X,onFinished:_e}),e(U,{children:[i(K,{variant:`outline`,size:`sm`,onClick:d,children:p(`integrations.cancel`,{defaultValue:`Cancel`})}),e(K,{variant:`primary`,size:`sm`,onClick:ye?d:he,disabled:!ye&&(Z===0||Y.isPending),children:[Y.isPending&&i(x,{className:`h-3.5 w-3.5 animate-spin`}),ye?p(`integrations.close`,{defaultValue:`Close`}):p(`integrations.addSelected`,{defaultValue:`Add selected`}),!ye&&Z>0?` (${Z})`:``]})]})]})}function gt({filters:e,activeFilter:t,onSelect:n}){let{t:r}=Q();return i(`div`,{role:`tablist`,"aria-label":r(`integrations.adoptDevicesModal.discoveryGranularity`,`Discovery granularity`),className:`inline-flex shrink-0 self-start rounded-lg border border-border bg-surface p-0.5`,children:e.map(e=>{let r=e.id===t;return i(K,{variant:`unstyled`,type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n(e.id),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${r?`bg-primary text-primary-foreground shadow-sm`:`text-foreground-subtle hover:text-foreground hover:bg-surface-hover`}`,children:e.label},e.id)})})}function _t({candidate:t,depth:n,containerName:r,expandable:a,expanded:o,onToggleExpand:s,adoptedLabel:c,typeLabel:l}){let{t:u}=Q(),d=(t.children??[]).length,f=lt(t);return e(`div`,{className:`flex items-center gap-2.5 min-w-0 ${n>0?`pl-5`:``}`,children:[a&&d>0?e(K,{variant:`unstyled`,type:`button`,onClick:s,"aria-label":o?u(`integrations.adoptDevicesModal.collapse`,`Collapse`):u(`integrations.adoptDevicesModal.expand`,`Expand`),"aria-expanded":o,className:`flex h-5 flex-shrink-0 items-center justify-center gap-0.5 rounded px-0.5 text-[10px] text-foreground-subtle transition-colors hover:bg-surface-hover hover:text-foreground`,children:[i(o?S:A,{className:`h-3.5 w-3.5`}),d]}):a?i(`span`,{className:`h-5 w-5 flex-shrink-0`,"aria-hidden":`true`}):null,e(`div`,{className:`min-w-0 flex-1`,children:[i(`div`,{className:`truncate text-xs font-medium text-foreground`,"data-testid":`candidate-name`,children:t.name}),f.length>0&&i(`div`,{className:`truncate text-[10px] text-foreground-subtle`,"data-testid":`candidate-subtitle`,children:f}),r!==void 0&&i(`div`,{className:`truncate text-[10px] text-foreground-subtle`,"data-testid":`candidate-container`,children:u(`integrations.adoptDevicesModal.inContainer`,`in {{name}}`,{name:r})}),i(`div`,{className:`truncate text-[10px] text-foreground-subtle sm:hidden`,children:l})]}),t.alreadyAdopted&&i(`span`,{className:`rounded-full bg-success/10 px-2 py-0.5 text-[9px] font-medium text-success shrink-0`,children:c})]})}function vt({candidate:t,hiddenChildIds:n,onToggleChildHidden:r}){let{t:a}=Q(),o=t.children??[];return o.length===0?null:i(`div`,{className:`space-y-1 py-1`,children:o.map(t=>{let o=n.has(t.childNativeId),s=t.capabilities??[];return e(`div`,{className:`flex items-center gap-2 rounded px-2 py-1 ${o?`opacity-50`:``}`,children:[i(`span`,{className:`text-[11px] text-foreground truncate flex-1 min-w-0`,children:t.name}),s.length>0&&i(`span`,{className:`text-[9px] text-foreground-subtle truncate`,children:s.join(`, `)}),i(K,{variant:`unstyled`,onClick:()=>r(t.childNativeId),"aria-label":o?a(`integrations.adoptDevicesModal.showChild`,`Show child`):a(`integrations.adoptDevicesModal.hideChild`,`Hide child`),title:o?a(`integrations.adoptDevicesModal.showAfterAdopt`,`Show after adopt`):a(`integrations.adoptDevicesModal.hideAfterAdopt`,`Hide after adopt`),className:`flex h-5 w-5 items-center justify-center rounded text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors flex-shrink-0`,children:i(o?E:k,{className:`h-3 w-3`})})]},t.childNativeId)})})}function yt(e){let t=e.host;return typeof t==`string`&&t.length>0?t.toLowerCase():null}function bt(e){return e===null?[]:[`host:${e}`]}function xt(e){let t=[],n=new Map,r=(e,r)=>{let i=e.map(e=>n.get(e)).find(e=>e!==void 0),a=i??r();i===void 0&&t.push(a);for(let t of e)a.ids.add(t),n.set(t,a);return a},i=(e,t)=>{e.sources.includes(t)||e.sources.push(t)};for(let t of e.adoption){let e=r([t.childNativeId],()=>({key:t.childNativeId,ids:new Set,name:t.name,address:null,sources:[],hit:null,adoptionId:t.childNativeId,proposalId:null,alreadyAdded:!1,addedName:null,needsParams:[],parentId:t.parentStableId??null}));i(e,`adoption`),e.adoptionId=t.childNativeId,t.alreadyAdopted===!0&&(e.alreadyAdded=!0)}let a=(t,n,a)=>{let o=yt(t.prefilledConfig),s=r([t.stableId,...bt(o)],()=>({key:t.stableId,ids:new Set,name:t.suggestedName,address:o,sources:[],hit:null,adoptionId:null,proposalId:null,alreadyAdded:!1,addedName:null,needsParams:[],parentId:null}));i(s,n),(s.hit===null||n===`scan`)&&(s.hit=t),s.name=t.suggestedName,s.address=o??s.address,a!==null&&(s.proposalId=a),s.parentId=t.parentStableId??s.parentId,s.needsParams=t.needsParams??s.needsParams,(t.alreadyOnboarded===!0||t.onboardedDeviceId!==void 0||e.existingStableIds.has(t.stableId))&&(s.alreadyAdded=!0,s.addedName=t.onboardedName??s.addedName)};for(let t of e.scan)a(t,`scan`,null);for(let t of e.proposals)a(t.candidate,`proposal`,t.id);for(let n of t)[...n.ids].some(t=>e.existingStableIds.has(t))&&(n.alreadyAdded=!0);return t.map(e=>{let t=e.parentId===null?void 0:n.get(e.parentId);return{key:e.key,name:e.name,address:e.address,sources:e.sources,hit:e.hit,adoptionId:e.adoptionId,proposalId:e.proposalId,alreadyAdded:e.alreadyAdded,addedName:e.addedName,needsParams:e.needsParams,parentKey:t!==void 0&&t!==e?t.key:null}})}c();var St=500;function Ct(e){return e instanceof Error?e.message:String(e)}function wt(e,t){let n={};for(let t of e?.sections??[])for(let e of t.fields)`key`in e&&e.key&&`default`in e&&e.default!==void 0&&(n[e.key]=e.default);return{...n,...t}}function Tt({addonId:t,integrationId:a,onClose:s,onSetupIntegration:c,alongsideAdoption:d=!1}){let{t:f}=Q(),p=l(),m=Pe({addonId:t}).data??null,[h,_]=o({}),v=z(),y=Oe({}),b=re({addonId:t,integrationId:a,page:1,pageSize:St},{retry:!1}),{data:S}=ee({projection:`slim`}),C=Se(),w=V(),[T,E]=o(new Set),[D,O]=o(new Set),[k,A]=o(null),[j,M]=o(null),N=n(()=>{let e=(b.data?.candidates??[]).map(e=>({childNativeId:e.childNativeId,name:e.name,alreadyAdopted:e.alreadyAdopted,parentStableId:e.parentStableId})),n=(y.data?.proposals??[]).filter(e=>e.addonId===t).map(e=>({id:e.id,candidate:e.candidate}));return xt({adoption:e,scan:v.data?.candidates??[],proposals:n,existingStableIds:new Set((S??[]).map(e=>e.stableId))})},[b.data,y.data,v.data,S,t]),P=e=>e.hit!==null&&(e.needsParams.length>0||e.hit.setupIntegration===!0),F=n(()=>d?N.filter(e=>!e.sources.includes(`adoption`)||P(e)):N,[N,d]),I=d?N.filter(e=>e.sources.includes(`adoption`)&&e.hit!==null&&!F.includes(e)).length:0,L=r(e=>{let t=new Map(F.map(e=>[e.key,e])),n=0,r=e;for(;r?.parentKey!=null&&n<8&&(r=t.get(r.parentKey),r!==void 0);)n+=1;return n},[F]),te=r(()=>{A(null),v.mutate({addonId:t,params:h})},[v,t,h]),B=r(async(e,t)=>{E(t=>new Set(t).add(e)),A(null);try{await t(),O(t=>new Set(t).add(e)),p.invalidateQueries({queryKey:[[`deviceManager`]]}),p.invalidateQueries({queryKey:[[`integrations`]]})}catch(e){A(Ct(e))}finally{E(t=>{let n=new Set(t);return n.delete(e),n})}},[p]),H=r(async(e,n)=>{let r=e.hit;if(r!==null){let i=Ye(t,r);if(i!==null){c?.(i),s();return}await B(e.key,async()=>{await C.mutateAsync({addonId:t,integrationId:a,candidate:{...r,prefilledConfig:{...r.prefilledConfig,...n}}}),M(null)});return}if(e.adoptionId!==null){let n=e.adoptionId;await B(e.key,async()=>{await w.mutateAsync({addonId:t,integrationId:a,childNativeIds:[n]})})}},[C,w,t,a,s,c,B]),W=r(e=>{if(e.needsParams.length>0&&e.hit!==null){A(null),M(e);return}H(e)},[H]);if(j!==null&&j.hit!==null)return i(Ot,{addonId:t,integrationId:a,row:j,found:j.hit.prefilledConfig,busy:T.has(j.key),error:k,embedded:d,onBack:()=>M(null),onSubmit:e=>void H(j,e)});let ne=F.length===0,G=e(u,{children:[i(Ze,{}),m&&i($,{schema:m,values:h,onChange:_}),e(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[e(`p`,{className:`text-xs text-foreground-subtle`,children:[v.isPending?f(`integrations.addDeviceModal.scanning`,`Scanning the local network…`):F.length>0?f(`integrations.addDeviceModal.found`,{defaultValue_one:`{{count}} device found`,defaultValue_other:`{{count}} devices found`,count:F.length}):``,!v.isPending&&I>0?` · ${f(`integrations.addDeviceModal.alsoAdopted`,{defaultValue_one:`{{count}} also in the adoption list`,defaultValue_other:`{{count}} also in the adoption list`,count:I})}`:``]}),e(K,{variant:`outline`,size:`sm`,onClick:te,disabled:v.isPending,children:[v.isPending?i(x,{className:`h-3.5 w-3.5 animate-spin`}):i(g,{className:`h-3.5 w-3.5`}),f(`integrations.addDeviceModal.scanNow`,`Scan now`)]})]}),v.isError&&i(Et,{text:f(`integrations.addDeviceModal.scanFailed`,`The scan failed. Try again.`)}),k!==null&&i(Et,{text:k}),ne&&!v.isPending&&i(`p`,{className:`py-6 text-center text-xs text-foreground-subtle`,children:v.data?f(`integrations.addDeviceModal.nothingFound`,`No devices responded to the scan.`):f(`integrations.addDeviceModal.scanHint`,`Scan the network to find devices to add.`)}),i(`div`,{className:d?`max-h-48 space-y-1.5 overflow-y-auto`:`space-y-1.5`,"data-testid":`network-candidates`,children:F.map(e=>i(Dt,{row:e,depth:L(e),busy:T.has(e.key),added:D.has(e.key),onPick:W},e.key))})]});return d?i(`div`,{className:`shrink-0 space-y-3 border-b border-border pb-3`,children:G}):e(u,{children:[i(R,{className:`space-y-3`,children:G}),i(U,{children:i(K,{variant:`outline`,size:`sm`,onClick:s,children:f(`integrations.close`,`Close`)})})]})}function Et({text:t}){return e(`div`,{className:`flex items-start gap-2 rounded-lg border border-danger/40 bg-danger/10 px-3 py-2`,children:[i(v,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-danger`}),i(`p`,{className:`text-xs text-danger`,children:t})]})}function Dt({row:t,depth:n,busy:r,added:a,onPick:o}){let{t:s}=Q(),c=t.alreadyAdded||a,l=t.hit!==null&&Ye(``,t.hit)!==null,u=t.hit?.selectable!==!1,d=t.needsParams.length>0;return e(`div`,{className:`flex items-center gap-3 rounded-lg border border-border bg-surface px-3 py-2 ${n>0?`ml-4`:``}`,"data-testid":`network-row-${t.key}`,children:[e(`div`,{className:`min-w-0 flex-1`,children:[i(`p`,{className:`truncate text-xs font-medium text-foreground`,children:t.name}),t.address!==null&&i(`p`,{className:`truncate font-mono text-[10px] text-foreground-subtle`,children:t.address}),c&&t.addedName!==null&&i(`p`,{className:`truncate text-[10px] text-foreground-subtle`,children:t.addedName})]}),c?e(`span`,{className:`flex items-center gap-1 text-[11px] text-foreground-subtle`,children:[i(h,{className:`h-3.5 w-3.5`}),t.alreadyAdded?s(`integrations.scanNetworkModal.alreadyAdded`,`Already added`):s(`integrations.scanNetworkModal.added`,`Added`)]}):u?e(K,{size:`sm`,variant:l||d?`outline`:`primary`,onClick:()=>o(t),disabled:r,children:[r?i(x,{className:`h-3.5 w-3.5 animate-spin`}):l||d?null:i(O,{className:`h-3.5 w-3.5`}),l?s(`integrations.scanNetworkModal.setUp`,`Set up`):d?s(`integrations.addDeviceModal.enterDetails`,`Enter details`):s(`common.add`,`Add`)]}):null]})}function Ot({addonId:t,integrationId:n,row:r,found:a,busy:s,error:c,onBack:l,onSubmit:d,embedded:f}){let{t:p}=Q(),m=we({addonId:t,integrationId:n}),h=m.data?.deviceType??null,g=H({addonId:t,integrationId:n,type:h??M.Camera},{enabled:m.isSuccess&&h!==null}),_=g.data??null,[v,y]=o(null),b=v??wt(_,a),S=m.error??g.error,C=m.isSuccess&&h===null,T=_!==null,E=T?i($,{schema:_,values:b,onChange:y}):S?i(Et,{text:Ct(S)}):C?i(`p`,{className:`text-xs text-foreground-muted`,children:p(`integrations.addDeviceModal.noCreationType`,`This integration cannot create a device from this candidate.`)}):i(x,{className:`mx-auto h-5 w-5 animate-spin text-primary`}),D=e(u,{children:[e(K,{variant:`ghost`,size:`sm`,onClick:l,children:[i(w,{className:`h-3.5 w-3.5`}),p(`integrations.addDeviceModal.back`,`Back to the list`)]}),i(`p`,{className:`text-xs font-medium text-foreground`,children:r.name}),E,c!==null&&i(Et,{text:c})]}),O=e(u,{children:[i(K,{variant:`outline`,size:`sm`,onClick:l,children:p(`integrations.cancel`,`Cancel`)}),e(K,{variant:`primary`,size:`sm`,onClick:()=>d(b),disabled:s||!T,children:[s&&i(x,{className:`h-3.5 w-3.5 animate-spin`}),p(`common.add`,`Add`)]})]});return f?e(`div`,{className:`shrink-0 space-y-3 border-b border-border pb-3`,children:[D,i(`div`,{className:`flex justify-end gap-2`,children:O})]}):e(u,{children:[i(R,{className:`space-y-3`,children:D}),i(U,{children:O})]})}c();function kt(e){return e===`manual`?`manual`:e===`pairing`?`pairing`:`network`}function At({addonId:t,integrationId:n,kind:r,canScan:a,onClose:s,pairing:c,onSetupIntegration:l}){let{t:d}=Q(),f=it(t,n),p=r===`device-adoption`&&a===null,m=r===`device-adoption`||a===!0,h=f===`available`,[g,_]=o(null),v=g??(c===void 0?m?`network`:`manual`:`pairing`),y=[m,h,c!==void 0].filter(Boolean).length,b=p?i(R,{children:i(x,{className:`mx-auto h-5 w-5 animate-spin text-primary`})}):r===`device-adoption`?e(u,{children:[a===!0&&i(Tt,{addonId:t,integrationId:n,onClose:s,alongsideAdoption:!0,...l?{onSetupIntegration:l}:{}}),i(ht,{addonId:t,integrationId:n,onClose:s})]}):i(Tt,{addonId:t,integrationId:n,onClose:s,...l?{onSetupIntegration:l}:{}}),S=i(at,{integrationId:n,addonId:t,onClose:s});return i(ce,{open:!0,onOpenChange:e=>{e||s()},children:e(W,{width:`xl`,placement:`sheet-on-mobile`,scroll:`body`,className:r===`device-adoption`?`md:h-[85vh]`:void 0,children:[i(Y,{children:i(le,{children:d(`integrations.addDevice`,`Add device`)})}),y>1?e(Ne,{value:v,onValueChange:e=>_(kt(e)),children:[e(ve,{children:[m&&i(Ae,{value:`network`,children:d(`integrations.addDeviceModal.tabNetwork`,`Found on the network`)}),h&&i(Ae,{value:`manual`,children:d(`integrations.addDeviceModal.tabManual`,`Enter parameters`)}),c!==void 0&&i(Ae,{value:`pairing`,children:c.label})]}),m&&i(ge,{value:`network`,children:b}),h&&i(ge,{value:`manual`,children:S}),c!==void 0&&i(`div`,{role:`tabpanel`,id:`tabpanel-pairing`,hidden:v!==`pairing`,className:`pt-3`,children:c.render({onPaired:()=>_(`network`)})})]}):c!==void 0&&!m&&!h?c.render({onPaired:()=>_(`network`)}):m?b:h?S:f===`loading`?i(R,{children:i(x,{className:`mx-auto h-5 w-5 animate-spin text-primary`})}):i(R,{children:i(`p`,{className:`py-6 text-center text-xs text-foreground-subtle`,children:d(`integrations.addDeviceModal.nothingToAdd`,`This integration has no way to add a device from here.`)})})]})})}c();var jt=`matter`,Mt=[`discovering`,`pase`,`commissioning`,`done`];function Nt(e){return!(typeof e!=`object`||!e||!(`phase`in e)||typeof e.phase!=`string`)}function Pt(e,t){return e===`code-expired`||t?.includes(`matter-commission:code-expired`)?{key:`integrations.addMatter.failure.expired`,defaultValue:`The pairing code expired. Share the device again and paste the new code.`}:e===`device-not-found`||t?.includes(`matter-commission:device-not-found`)?{key:`integrations.addMatter.failure.notFound`,defaultValue:`No Matter device with that code was found on the network.`}:e===`wrong-code`||t?.includes(`matter-commission:wrong-code`)?{key:`integrations.addMatter.failure.wrongCode`,defaultValue:`The pairing code was rejected.`}:e===`invalid-code`||t?.includes(`invalid pairing code`)?{key:`integrations.addMatter.failure.invalid`,defaultValue:`Enter an 11-digit or 21-digit manual code, or a code that starts with MT:.`}:{key:`integrations.addMatter.failure.unknown`,defaultValue:t??`Commissioning failed.`}}function Ft({onClose:t,onCommissioned:n}){let{t:r}=Q(),s=de({kind:jt}),[c,l]=o(null),d=Z(s.data??[],c),f=d.length,p=c??d[0]?.id??null,m=_e(),[h,g]=o(``),[_,v]=o({phase:`idle`,failure:null,message:null}),y=_.phase===`discovering`||_.phase===`pase`||_.phase===`commissioning`,b=P({brokerId:p??``,key:`commission`},{enabled:p!==null&&y,refetchInterval:y?400:!1});a(()=>{y&&Nt(b.data)&&b.data.phase!==`idle`&&v({phase:b.data.phase,failure:typeof b.data.failure==`string`?b.data.failure:null,message:typeof b.data.message==`string`?b.data.message:null})},[y,b.data]);let S=()=>{p!==null&&(v({phase:`discovering`,failure:null,message:null}),m.mutate({brokerId:p,target:{action:`commissionNode`},payload:{pairingCode:h.trim()}},{onSuccess:()=>v({phase:`done`,failure:null,message:null}),onError:e=>{let t=e instanceof Error?e.message:`Commissioning failed.`;v({phase:`failed`,failure:t.includes(`matter-commission:`)?t.split(`matter-commission:`)[1]?.split(`:`)[0]??`unknown`:t.includes(`invalid pairing code`)?`invalid-code`:`unknown`,message:t})}}))},C=_.phase===`failed`?Pt(_.failure,_.message):null,w=C===null?null:r(C.key,{defaultValue:C.defaultValue}),T=(s.isSuccess===!0||s.data!==void 0)&&p===null;return e(u,{children:[e(R,{className:`space-y-4`,children:[i(`p`,{className:`text-xs text-foreground-subtle`,children:r(`integrations.addMatter.help`,{defaultValue:`In Home Assistant, open the device and choose Share device. Paste the numeric code or the MT: code here. The device stays in Home Assistant.`})}),(T||f>1)&&!y&&_.phase!==`done`&&e(`div`,{className:`space-y-1.5`,children:[i(me,{children:r(`integrations.addMatter.broker`,{defaultValue:`Matter fabric`})}),i(He,{kind:jt,value:p,onChange:l})]}),!T&&e(`div`,{className:`space-y-1.5`,children:[i(me,{htmlFor:`matter-pairing-code`,children:r(`integrations.addMatter.code`,{defaultValue:`Pairing code`})}),i(Te,{id:`matter-pairing-code`,value:h,autoComplete:`off`,spellCheck:!1,placeholder:`34970112332`,disabled:y||_.phase===`done`,onChange:e=>g(e.target.value)})]}),_.phase!==`idle`&&i(`ol`,{className:`space-y-1`,"aria-label":r(`integrations.addMatter.progress`,{defaultValue:`Commissioning progress`}),children:Mt.map(t=>{let n=_.phase===t;return e(`li`,{className:`text-xs ${n?`text-foreground font-medium`:`text-foreground-subtle`}`,children:[n&&y?i(x,{className:`mr-1 inline h-3 w-3 animate-spin`}):null,r(`integrations.addMatter.phase.${t}`,{defaultValue:t===`discovering`?`Discovering`:t===`pase`?`PASE`:t===`commissioning`?`Commissioning`:`Done`})]},t)})}),w!==null&&i(ye,{message:w})]}),e(U,{children:[i(K,{variant:`ghost`,size:`sm`,onClick:t,children:r(`common.close`,{defaultValue:`Close`})}),_.phase===`done`?i(K,{size:`sm`,onClick:n,children:r(`integrations.adoptDevices`,{defaultValue:`Adopt devices`})}):i(K,{size:`sm`,disabled:y||T||h.trim().length===0,onClick:S,children:y?r(`integrations.addMatter.working`,{defaultValue:`Adding…`}):r(`integrations.addMatter.submit`,{defaultValue:`Add device`})})]})]})}function It({addonId:t,integrationId:n,name:r,onClose:a,onSaved:o}){let{t:c}=Q(),l=T(),u=s({queryKey:[`integration-instance-describe`,t],queryFn:()=>l.trpcClient.integrationInstances.describe.query({addonId:t})}),d=s({queryKey:[`integration-instance`,t,n],queryFn:()=>l.trpcClient.integrationInstances.getInstance.query({addonId:t,id:n})});if(u.isSuccess&&d.isSuccess&&d.data!==null)return i(Ve,{addonId:t,providerName:r,description:u.data,instance:d.data,onClose:a,onSaved:()=>o()});let f=u.isError||d.isError||d.isSuccess&&!d.data;return i(ce,{open:!0,onOpenChange:e=>!e&&a(),children:e(W,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[i(Y,{children:e(le,{children:[c(`integrations.editConfig`,{defaultValue:`Edit configuration`}),` — `,r]})}),i(R,{children:f?i(`p`,{className:`text-[11px] text-danger`,children:c(`integrations.loadFailed`,{defaultValue:`Could not load this integration.`})}):e(`div`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[i(x,{className:`h-3 w-3 animate-spin`}),c(`integrations.loading`,{defaultValue:`Loading…`})]})})]})})}c();function Lt(){let{addonId:e=``}=Ke();return i(zt,{addonId:e})}function Rt(){return e(`div`,{className:`p-4`,children:[i(`div`,{className:`h-16 rounded-lg bg-surface animate-pulse mb-4`}),i(`div`,{className:`h-40 rounded-lg bg-surface animate-pulse`})]})}function zt({addonId:t}){let{t:c}=Q(),u=l(),d=Be(),[p,m]=Le(),h=T(),[g,v]=o(!1),y=r(e=>{v(!1),d(`/integrations`,{state:{integrationSeed:e}})},[d]),[b,S]=o(!1),[E,O]=o(!1),{data:k}=he(void 0),A=n(()=>(k??[]).filter(e=>e.addonId===t),[k,t]),M=We(p.get(`instance`),A)??``,P=r(e=>{m(t=>{let n=new URLSearchParams(t);return n.set(Ge,e),n},{replace:!0})},[m]),I=n(()=>A.map(e=>({value:e.id,label:e.name})),[A]),{data:z,isLoading:B}=ke({id:M},{enabled:!!M}),{data:V,isSuccess:H}=Me(),U=n(()=>{let e=z?.addonId;return!e||!H?null:(V??[]).find(t=>t.addonId===e)?.kind===`device-adoption`?`device-adoption`:`device-provider`},[V,z?.addonId,H]),{data:G,isPending:re}=oe({}),ie=n(()=>re?null:(G?.providers??[]).some(e=>e.addonId===z?.addonId),[re,G,z?.addonId]),q=U!==null,ae=z?.info?.fixed===!0,J=n(()=>{let e=z?.addonId;return!e||!H?null:(V??[]).find(t=>t.addonId===e)?.brokerKind??null},[V,z?.addonId,H])===`matter`,de=q?c(`integrations.addDevice`,`Add device`):c(`integrations.addDeviceLoading`,{defaultValue:`Loading…`}),me=n(()=>{let e=z?.addonId;return!e||!H?null:(V??[]).find(t=>t.addonId===e)?.mode??null},[V,z?.addonId,H]);a(()=>{p.get(`add`)===`1`&&q&&(v(!0),m(e=>{let t=new URLSearchParams(e);return t.delete(`add`),t},{replace:!0}))},[p,q,m]);let{data:ge}=s({queryKey:[`integration-instance-form`,z?.addonId,z?.id],enabled:!!z?.addonId&&!!z?.id,queryFn:()=>h.trpcClient.integrationInstances.instanceFormSchema.query({addonId:z?.addonId??``,id:z?.id??``})}),_e=ge!=null&&Array.isArray(ge.sections)&&ge.sections.some(e=>e.fields.length>0),{data:ve}=ee({projection:`slim`},{refetchInterval:3e4}),Z=[[`integrations`,`get`],{input:{id:M},type:`query`}],ye={onMutate:async e=>{await u.cancelQueries({queryKey:Z});let t=u.getQueryData(Z);return t!=null&&u.setQueryData(Z,{...t,enabled:e.enabled}),{previous:t}},onError:(e,t,n)=>{let r=n;r?.previous!=null&&u.setQueryData(Z,r.previous)},onSettled:()=>{u.invalidateQueries({queryKey:[[`integrations`]]}),u.invalidateQueries({queryKey:[[`deviceManager`]]})}},xe=De(ye),Se=Ce(ye),we={isPending:xe.isPending||Se.isPending,mutate:e=>ae?Se.mutate({id:e.id,enabled:e.enabled}):xe.mutate(e)},Te=z?.switchUnknown===!0,Oe={onSuccess:()=>{u.invalidateQueries({queryKey:[[`integrations`]]}),u.invalidateQueries({queryKey:[[`deviceManager`]]}),d(A.length>1?Ue(t):`/integrations`)}},Ae=F(Oe),Ne=fe(Oe),Pe=z?.processState===`running`,Fe={isPending:Ae.isPending||Ne.isPending,mutateAsync:async e=>{Pe?await Ae.mutateAsync(e):await Ne.mutateAsync({id:e.id})}},Re=pe({onSuccess:()=>{u.invalidateQueries({queryKey:[[`integrations`]]}),u.invalidateQueries({queryKey:[[`deviceManager`]]})}}),ze=qe(),Ve=Ie({onSuccess:()=>{u.invalidateQueries({queryKey:[[`deviceManager`]]})}}),He=te({onSuccess:()=>{u.invalidateQueries({queryKey:[[`deviceManager`]]})}}),$=n(()=>ve??[],[ve]),Ke=n(()=>{let e=new Map;for(let t of $)e.set(t.id,{id:t.id,name:t.name??t.stableId??`#${String(t.id)}`});return e},[$]),Ye=r(e=>Ke.get(e)??null,[Ke]),Xe=n(()=>je(k),[k]),Ze=r(e=>d(`/devices/${String(e)}`),[d]),Qe=n(()=>$.filter(e=>{let t=Xe(e);return t.kind===`resolved`&&t.integration.id===M}),[$,M,Xe]),$e=n(()=>k===void 0?null:X(Qe).length,[k,Qe])??`…`;if(B||k===void 0)return i(Rt,{});let et=(V??[]).find(e=>e.addonId===t)?.name??z?.name??t;return z?e(`div`,{className:`p-4 space-y-4 overflow-x-hidden`,children:[i(ue,{items:[{label:c(`integrationDetail.integrations`,`Integrations`),onClick:()=>d(`/integrations`)},{label:et}]}),e(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[e(`div`,{className:`flex items-center gap-3 min-w-0`,children:[i(Bt,{addonId:z.addonId}),e(`div`,{className:`min-w-0`,children:[i(`h1`,{className:`text-lg font-semibold text-foreground truncate`,children:et}),e(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5 truncate`,children:[$e,` `,c(`integrations.devices`)]})]})]}),e(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[!ae&&e(K,{variant:`unstyled`,onClick:()=>{v(!0)},disabled:!q,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 disabled:opacity-50 disabled:cursor-not-allowed`,title:de,children:[i(_,{className:`h-3.5 w-3.5`}),de]}),e(`div`,{className:`inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 transition-colors ${we.isPending?`opacity-60`:``} ${z.enabled&&!Te?`border-success/30 bg-success/5`:`border-border bg-surface`}`,title:c(`integrations.toggleHint`,{defaultValue:`Click to toggle`}),children:[i(Ee,{checked:z.enabled&&!Te,onCheckedChange:e=>we.mutate({id:M,addonId:z?.addonId,enabled:e}),disabled:we.isPending||Te,"aria-label":Te?c(`integrationDetail.switchUnknown`,`Unknown`):z.enabled?c(`integrationDetail.disableIntegration`,`Disable integration`):c(`integrationDetail.enableIntegration`,`Enable integration`)}),i(`span`,{className:`text-[11px] font-medium ${z.enabled&&!Te?`text-success`:`text-foreground-subtle`}`,children:Te?c(`integrationDetail.switchUnknown`,`Unknown`):z.enabled?c(`integrationDetail.enabled`,`Enabled`):c(`integrationDetail.disabled`,`Disabled`)}),we.isPending&&i(x,{className:`h-3 w-3 animate-spin text-foreground-subtle`})]}),me!==`standalone`&&(_e||U===`device-adoption`)&&e(K,{variant:`unstyled`,onClick:()=>S(!0),className:`flex items-center gap-1.5 rounded-lg border border-border bg-surface px-3 py-1.5 text-[11px] text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:[i(f,{className:`h-3 w-3`}),c(`integrations.config`)]}),e(K,{variant:`unstyled`,onClick:()=>O(!0),className:`flex items-center gap-1.5 rounded-lg border border-border bg-surface px-3 py-1.5 text-[11px] text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,title:c(`integrations.logs`,{defaultValue:`View logs`}),children:[i(D,{className:`h-3 w-3`}),c(`integrations.logs`,{defaultValue:`Logs`})]}),i(se,{label:c(`integrationDetail.restart`,`Restart`),icon:j,title:c(`integrationDetail.restart2`,`Restart "{{name}}"?`,{name:z.name}),description:c(`integrationDetail.restartingTheAddonWillBriefly`,`Restarting the addon will briefly disconnect every device backed by it ({{topLevelCountLabel}} active). Streams will reconnect automatically.`,{topLevelCountLabel:$e}),confirmLabel:c(`integrationDetail.restart`,`Restart`),triggerVariant:`outline`,confirmVariant:`danger`,disabled:Re.isPending,action:()=>Re.mutateAsync({addonId:z.addonId})}),!ae&&M&&i(se,{label:c(`integrations.delete`,{defaultValue:`Delete`}),icon:C,title:c(`integrations.deleteTitle`,{defaultValue:`Delete integration?`}),description:c(`integrations.deleteWarning`,{defaultValue:`This removes the integration "{{name}}" and its {{count}} device(s). The addon will restart. This cannot be undone.`,name:z.name,count:$e}),confirmLabel:c(`integrations.confirmDelete`,{defaultValue:`Delete integration`}),triggerVariant:`outline`,confirmVariant:`danger`,className:`border-danger bg-danger/10 text-danger hover:bg-danger hover:text-background`,disabled:Fe.isPending,action:()=>Fe.mutateAsync({addonId:t,id:M})})]})]}),A.length>1&&i(`div`,{className:`max-w-sm`,children:i(be,{mode:`single`,singleDisplay:`field`,label:c(`integrationDetail.instances`,`Integration`),options:I,value:M,onChange:P,testId:`integration-instance-picker`,optionTestIdPrefix:`integration-instance`})}),i(ne,{context:`integration-detail`,devices:$,trpc:h.trpcClient,integrationOf:Xe,forceIntegrationId:M,urlScope:`root`,lsKey:`integration-detail:${z.addonId}`,resolveIntegrationIcon:Je,resolveParent:Ye,onNavigate:Ze,rowOperation:ze.rowOperation,batchActions:{remove:ze.remove,disable:Ve.mutate,enable:He.mutate},...ae?{}:{onDeleteDevice:e=>ze.remove({deviceId:e.id})}}),g&&M&&U!==null&&i(At,{addonId:z.addonId,integrationId:M,kind:U,canScan:ie,onSetupIntegration:y,...J?{pairing:{label:c(`integrations.addMatter.tab`,`Pairing code`),render:({onPaired:e})=>i(Ft,{onClose:()=>v(!1),onCommissioned:e})}}:{},onClose:()=>v(!1)}),b&&M&&i(It,{addonId:z.addonId,integrationId:M,name:z.name,onClose:()=>S(!1),onSaved:()=>{u.invalidateQueries()}}),E&&i(ce,{open:!0,onOpenChange:e=>!e&&O(!1),children:e(W,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,className:`md:max-w-5xl md:h-[80vh]`,children:[i(Y,{className:`mb-0`,children:e(le,{className:`flex items-center gap-2 min-w-0`,children:[i(D,{className:`h-4 w-4 text-primary shrink-0`}),i(`span`,{className:`truncate`,children:z.name}),e(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate font-normal`,children:[z.addonId,M?` · ${M}`:``]})]})}),i(R,{className:`min-h-0 overflow-hidden p-0`,children:i(L,{addonId:z.addonId,limit:200,maxHeight:`max-h-full`,showScope:!1,className:`h-full border-0 rounded-none`})})]})})]}):e(`div`,{className:`flex flex-col items-center justify-center py-20 px-6 text-center gap-4`,children:[i(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full bg-foreground-subtle/10`,children:i(N,{className:`h-6 w-6 text-foreground-subtle`})}),e(`div`,{className:`space-y-1 max-w-sm`,children:[i(`h2`,{className:`text-sm font-semibold text-foreground`,children:c(`integrations.integrationNotFound`,{defaultValue:`Integration not found`})}),i(`p`,{className:`text-[11px] text-foreground-subtle`,children:c(`integrations.integrationNotFoundHint`,{defaultValue:`The integration "{{id}}" does not exist. It may have been deleted, or the URL may be wrong.`,id:t})})]}),e(K,{variant:`unstyled`,onClick:()=>d(`/integrations`),className:`inline-flex items-center gap-1.5 rounded-lg border border-border bg-surface px-3 py-1.5 text-[11px] font-medium text-foreground hover:bg-surface-hover transition-colors`,children:[i(w,{className:`h-3 w-3`}),c(`integrations.backToList`,{defaultValue:`Back to integrations`})]})]})}function Bt({addonId:e}){let t=Re(e),[n,r]=o(!1);return!t||n?null:i(`img`,{src:t,alt:``,className:`h-8 w-8 rounded-lg shrink-0`,onError:()=>r(!0)})}export{Lt as IntegrationDetailPage};