@camstack/addon-admin-ui 1.2.71 → 1.2.77

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 (109) hide show
  1. package/dist/assets/{AddLocationWizard-DHDPErNf.js → AddLocationWizard-bFdr1waj.js} +1 -1
  2. package/dist/assets/{AddonCollectionPage-CVQw4J0u.js → AddonCollectionPage-CG0nZ1B7.js} +1 -1
  3. package/dist/assets/Addons-DM_164F-.js +1 -0
  4. package/dist/assets/{AdminTabs-pF1-A-KE.js → AdminTabs-EBl4IL8v.js} +1 -1
  5. package/dist/assets/{AiProfiles-GRKxgX35.js → AiProfiles-DAvq-svk.js} +1 -1
  6. package/dist/assets/{BrokerForm-VxSsRip5.js → BrokerForm-D-HZ_g5O.js} +1 -1
  7. package/dist/assets/{Build-O3uVgjNh.js → Build-DFIHvJgo.js} +3 -3
  8. package/dist/assets/{Capabilities-CQxxUapl.js → Capabilities-C3DimRww.js} +1 -1
  9. package/dist/assets/{CapabilityBadges-_oHvazCd.js → CapabilityBadges-Ht7LfxO8.js} +1 -1
  10. package/dist/assets/{Cluster-Kkl7uw72.js → Cluster-DBRktCVy.js} +1 -1
  11. package/dist/assets/{Data-DBDi9mvj.js → Data-fohBfLY0.js} +1 -1
  12. package/dist/assets/{DetectionIntelligence-av4nRGRE.js → DetectionIntelligence-Bkcjw6bF.js} +1 -1
  13. package/dist/assets/{DeviceAggregateSection-Wr_kfytd.js → DeviceAggregateSection-D2lQzb-j.js} +1 -1
  14. package/dist/assets/DeviceDetail-Cmfpxc_j.js +2 -0
  15. package/dist/assets/{Devices-C_MbmSJ4.js → Devices-Crs8_r88.js} +1 -1
  16. package/dist/assets/{EmbedPlayerPage-fkZaw1mk.js → EmbedPlayerPage-DHci7SWE.js} +1 -1
  17. package/dist/assets/Events-B6UrQUKl.js +1 -0
  18. package/dist/assets/{FormBuilder-D2RrNSU_.js → FormBuilder-DSPep_Sy.js} +1 -1
  19. package/dist/assets/Identity-DeawhLct.js +1 -0
  20. package/dist/assets/IntegrationDetail-t7kahQ32.js +1 -0
  21. package/dist/assets/{Integrations-DdvDPknh.js → Integrations-4rJzRhN2.js} +1 -1
  22. package/dist/assets/Integrations-B_tecXqC.js +1 -0
  23. package/dist/assets/{Logs-igCqcpC6.js → Logs-Bq5NhqD-.js} +1 -1
  24. package/dist/assets/{MotionZonesSettings-BPZsMeIR.js → MotionZonesSettings-B86zxXyT.js} +1 -1
  25. package/dist/assets/{MyAccess-beomxYFE.js → MyAccess-B1oodzlt.js} +1 -1
  26. package/dist/assets/{Network-JO3K8mwy.js → Network-ic-cNox7.js} +1 -1
  27. package/dist/assets/{NodeAddonsSettingsPanel-_3VgKCYz.js → NodeAddonsSettingsPanel-DxbcgkhM.js} +1 -1
  28. package/dist/assets/{NodeInferenceDevices-C0nb4Opn.js → NodeInferenceDevices-BbK9nEVK.js} +1 -1
  29. package/dist/assets/Notifications-DWfVSoCi.js +1 -0
  30. package/dist/assets/Pipeline-ofIlJkPQ.js +1 -0
  31. package/dist/assets/{Plates-_EwaGk0h.js → Plates-C10GxOXD.js} +1 -1
  32. package/dist/assets/{PrivacyMaskSettings-DvnqxaXE.js → PrivacyMaskSettings-DAVBUcvK.js} +1 -1
  33. package/dist/assets/{ProviderIcon-Dupar-28.js → ProviderIcon-MeyvBfDK.js} +1 -1
  34. package/dist/assets/Recordings-BmTYyF0n.js +1 -0
  35. package/dist/assets/{ScanNetworkModal-Bcp3-HGX.js → ScanNetworkModal-BmyUu_Ow.js} +1 -1
  36. package/dist/assets/{SceneMonitorEditor-Byq4EaI6.js → SceneMonitorEditor-2PLSYxGp.js} +1 -1
  37. package/dist/assets/{Scenes-BpQ2wcG1.js → Scenes-CvDBm0aP.js} +1 -1
  38. package/dist/assets/{Settings-BVcHPqsS.js → Settings-DMNSSsEV.js} +1 -1
  39. package/dist/assets/{Showroom-C8FV0gXO.js → Showroom-DHdE_cjf.js} +1 -1
  40. package/dist/assets/{Terminal-dazFgbKN.js → Terminal-CBilzxtk.js} +2 -2
  41. package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-DV5OHDzt.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CmCkuVgG.js} +1 -1
  42. package/dist/assets/{bell-ring-CcxrN_iN.js → bell-ring-BxCSa6T_.js} +1 -1
  43. package/dist/assets/{boxes-DsUqcFyl.js → boxes-CUMgbsCn.js} +1 -1
  44. package/dist/assets/{build-cluster-graph-DuaRJrmK.js → build-cluster-graph-C-pb6WoW.js} +2 -2
  45. package/dist/assets/circle-check-big-L-JJrMXu.js +1 -0
  46. package/dist/assets/{circle-x-BmQS0KmF.js → circle-x-CLx38hRv.js} +1 -1
  47. package/dist/assets/clock-DRB5EPRE.js +1 -0
  48. package/dist/assets/{copy-CwI0y35L.js → copy-Cs6oXmoj.js} +1 -1
  49. package/dist/assets/{debounced-invalidate-DbIi5r2U.js → debounced-invalidate-Cn_Bd1Ha.js} +1 -1
  50. package/dist/assets/dist-aNS_lInJ.js +345 -0
  51. package/dist/assets/{dist-DHndrvsq.js → dist-qGmJ9foS.js} +1 -1
  52. package/dist/assets/{download-GhxgQuVb.js → download-Bu_GZNFi.js} +1 -1
  53. package/dist/assets/{face-bbox-BvFF5wo_.js → face-bbox-CBSEzQ8o.js} +1 -1
  54. package/dist/assets/{hard-drive-8M4xd0gL.js → hard-drive-Dd1189LH.js} +1 -1
  55. package/dist/assets/{hostInit-C8N2FrQZ.js → hostInit-BKlIDpJl.js} +1 -1
  56. package/dist/assets/index-DTdWIUPk.js +4 -0
  57. package/dist/assets/{key-round-jjwiThl-.js → key-round-CpnbO7cw.js} +1 -1
  58. package/dist/assets/{mf-entry-bootstrap-0-02557f9b.js → mf-entry-bootstrap-0-d065ca54.js} +2 -2
  59. package/dist/assets/{pencil-BC4xFPPI.js → pencil-CuZhEa70.js} +1 -1
  60. package/dist/assets/play-DdUPLgSR.js +1 -0
  61. package/dist/assets/{player-overlays-DQkaycbj.js → player-overlays-CkPOL5Mg.js} +1 -1
  62. package/dist/assets/plus-BQRKTtGy.js +1 -0
  63. package/dist/assets/power-CJmsINHg.js +1 -0
  64. package/dist/assets/{radio-CuFaCHVR.js → radio-CI8-Lq8T.js} +1 -1
  65. package/dist/assets/{refresh-cw-CIsDaMr7.js → refresh-cw-pZ66WdKo.js} +1 -1
  66. package/dist/assets/remoteEntry-CBfmxZ3j.js +1 -0
  67. package/dist/assets/rotate-ccw-DbbggbpM.js +1 -0
  68. package/dist/assets/rotate-cw-462QXXeM.js +1 -0
  69. package/dist/assets/search-DAkICGwh.js +1 -0
  70. package/dist/assets/{send-Bk0nhfPV.js → send-B7D_NWXI.js} +1 -1
  71. package/dist/assets/{server-CHhr0nc3.js → server-rS4oeFZm.js} +1 -1
  72. package/dist/assets/{square-check-big-DtFtxAKr.js → square-check-big-BC6Isjib.js} +1 -1
  73. package/dist/assets/square-sE-cDGyO.js +1 -0
  74. package/dist/assets/{src-Dke0Hyis.js → src-BsaFkO2a.js} +10 -10
  75. package/dist/assets/src-CsczofNQ.js +345 -0
  76. package/dist/assets/{star-DA-MbzZ5.js → star-iVPLkrXz.js} +1 -1
  77. package/dist/assets/{undo-2-FdTAJw9k.js → undo-2-BpEYP6yb.js} +1 -1
  78. package/dist/assets/{upload-CFeYziNH.js → upload-DfCM6ROd.js} +1 -1
  79. package/dist/assets/{use-scenes-feed-DefnMmD9.js → use-scenes-feed-Bz5gH-Vy.js} +1 -1
  80. package/dist/assets/{useEventInvalidation-CVopBRz3.js → useEventInvalidation-CH33jBET.js} +1 -1
  81. package/dist/assets/{video-ClKGJxy8.js → video-CgcaVRAS.js} +1 -1
  82. package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-D4zIYxz6.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-Ipj6p6xQ.js} +2 -2
  83. package/dist/assets/{wifi-B1oDK3Wx.js → wifi-B87yTi2l.js} +1 -1
  84. package/dist/assets/{zap-D8QzxlxE.js → zap-Dsudx6B4.js} +1 -1
  85. package/dist/index.html +5 -5
  86. package/dist/server/addon.js +77 -5
  87. package/package.json +1 -1
  88. package/dist/assets/Addons-sYTMrK-J.js +0 -1
  89. package/dist/assets/DeviceDetail-eNEkb8_m.js +0 -2
  90. package/dist/assets/Events-D7JFLtdm.js +0 -1
  91. package/dist/assets/Identity-fgQCEPfW.js +0 -1
  92. package/dist/assets/IntegrationDetail-C-xpeTBn.js +0 -1
  93. package/dist/assets/Integrations-aOxmxqz2.js +0 -1
  94. package/dist/assets/Notifications-Dr3_MOBK.js +0 -1
  95. package/dist/assets/Pipeline-B0ixO03m.js +0 -1
  96. package/dist/assets/Recordings-BxrqJepv.js +0 -1
  97. package/dist/assets/circle-check-big-DUGsHUSS.js +0 -1
  98. package/dist/assets/clock-Bh4t9kpX.js +0 -1
  99. package/dist/assets/dist-BKexxSA1.js +0 -345
  100. package/dist/assets/index-Cuk54oGv.js +0 -4
  101. package/dist/assets/play-BfElPdNV.js +0 -1
  102. package/dist/assets/plus-DWlX1Elu.js +0 -1
  103. package/dist/assets/power-DngdttbL.js +0 -1
  104. package/dist/assets/remoteEntry-DZUTMZoM.js +0 -1
  105. package/dist/assets/rotate-ccw-zVZ9g59u.js +0 -1
  106. package/dist/assets/rotate-cw-BO0OJOrs.js +0 -1
  107. package/dist/assets/search-JUKgJIWO.js +0 -1
  108. package/dist/assets/square-C6g9glTu.js +0 -1
  109. package/dist/assets/src-C0bBvS2n.js +0 -345
@@ -1 +0,0 @@
1
- import{I as e,K as t,Q as n,S as r,W as i,b as a,o,q as s,x as c,z as l}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Z as u}from"./player-overlays-DQkaycbj.js";import{Br as d,Cr as f,E as p,Gt as m,Hr as h,I as g,Lr as _,Mr as v,Mt as y,Or as b,P as x,Sr as S,T as ee,Xr as C,Y as te,_r as w,bi as T,br as E,fi as D,gi as O,gr as k,kn as A,kr as j,mi as ne,mn as M,ot as N,pi as re,rt as P,vi as F,vr as ie,wr as I,yr as L}from"./src-Dke0Hyis.js";import{et as R}from"./src-C0bBvS2n.js";import{t as z}from"./ProviderIcon-Dupar-28.js";import{t as B}from"./circle-x-BmQS0KmF.js";import{t as V}from"./FormBuilder-D2RrNSU_.js";import{t as H}from"./plus-DWlX1Elu.js";import{i as ae,n as U,r as W,t as oe}from"./ScanNetworkModal-Bcp3-HGX.js";import{t as se}from"./refresh-cw-CIsDaMr7.js";import{t as G}from"./rotate-cw-BO0OJOrs.js";import{t as ce}from"./wifi-B1oDK3Wx.js";import{A as le,C as K,I as q,J as ue,K as J,P as de,R as fe,W as pe,X as me,Y as he,i as ge,k as _e,m as ve,o as Y,p as ye,s as be,t as xe,z as Se}from"./index-Cuk54oGv.js";var Ce=J(`search-x`,[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]);n();function we(e){let t=[];for(let n of e)n.type===`probe`&&t.push(n.key),n.type===`group`&&`fields`in n&&t.push(...we(n.fields));return t}function Te(t,n,r){let[a,o]=s(`idle`),[c,l]=s({}),u=i(()=>{let e=[];for(let n of t.sections)e.push(...we(n.fields));return e},[t]),d=u.length>0&&r!==void 0,f=e(e=>{l(t=>{if(!t[e])return t;let n={...t};return delete n[e],n})},[]);return{testAllStatus:a,hasProbeFields:d,probeResults:c,handleTestAll:e(async()=>{if(!r)return;let e=u.filter(e=>{let t=n[e];return t!=null&&String(t).trim()!==``});if(e.length===0)return;o(`testing`);let t={};for(let n of e)t[n]={status:`probing`};l(t);let i=await Promise.allSettled(e.map(async e=>{try{return{key:e,result:await r(e,n[e])}}catch(t){return{key:e,result:{status:`error`,error:t instanceof Error?t.message:String(t)}}}})),a={};for(let e of i)if(e.status===`fulfilled`){let{key:t,result:n}=e.value;a[t]={status:n.status===`ok`?`ok`:`error`,result:n}}l(a),o(`idle`)},[r,u,n]),clearProbeResult:f}}n();function X(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(...X(n.fields));return t}function Z(e){return e==null?!0:typeof e==`string`?e.trim()===``:!1}function Q(e,t={}){for(let n of e){if(n.type===`group`&&`fields`in n){Q(n.fields,t);continue}`key`in n&&n.key&&`default`in n&&n.default!==void 0&&(t[n.key]=n.default)}return t}function Ee(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`probe-${crypto.randomUUID()}`:`probe-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function De({open:t,integrationId:n,addonId:a,onClose:u}){let{t:p}=xe(),m=o(),[h,g]=s({}),[_,y]=s(!1),[b,x]=s(null),[S,ee]=s(Ee),w=d({addonId:a},{enabled:t}),T=w.data?.deviceType??null,E=v({addonId:a,type:T??R.Camera},{enabled:t&&w.isSuccess&&T!==null}),D=E.data??null;l(()=>{t&&(g(D?Q(D.sections.flatMap(e=>e.fields)):{}),ee(Ee()),y(!1),x(null))},[t,n,D]);let O=i(()=>({...h,_probeRequestId:S}),[h,S]),k=f({onSuccess:()=>{m.invalidateQueries({queryKey:[[`deviceManager`]]})}}),A=C(),j=e(async(e,t)=>{y(!0);let n=await A.mutateAsync({addonId:a,type:T??R.Camera,key:e,value:t,formValues:O});return n.status===`ok`&&n.suggestedValues&&g(e=>{let t=!1,r={...e};for(let[i,a]of Object.entries(n.suggestedValues??{}))Z(e[i])&&!Z(a)&&(r[i]=a,t=!0);return t?r:e}),n},[A,a,O,T]),{testAllStatus:ne,hasProbeFields:M,probeResults:N,handleTestAll:re,clearProbeResult:P}=Te(D??{sections:[]},h,j);async function F(e){x(null);try{await k.mutateAsync({addonId:a,type:T??R.Camera,config:h,integrationId:n}),e?g(D?Q(D.sections.flatMap(e=>e.fields)):{}):u()}catch(e){x(e instanceof Error?e.message:String(e))}}if(!t)return null;let ie=X((D?.sections??[]).flatMap(e=>e.fields)).filter(e=>Z(h[e])),I=ie.length===0,L=w.isLoading||T!==null&&E.isLoading,z=w.isError||w.isSuccess&&T===null||E.isError||E.isSuccess&&D===null;return r(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[c(`div`,{className:`absolute inset-0 bg-black/60`,onClick:u}),r(`div`,{className:`relative z-10 flex w-full max-w-2xl flex-col max-h-[calc(90dvh-2*max(env(safe-area-inset-top),env(safe-area-inset-bottom)))] rounded-xl border border-border bg-background shadow-2xl`,children:[r(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[c(`h2`,{className:`text-sm font-semibold text-foreground`,children:p(`integrations.addDevice`)}),c(`button`,{onClick:u,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:c(ge,{className:`h-4 w-4`})})]}),c(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-3`,children:L?c(`div`,{className:`flex items-center justify-center py-8`,children:c(K,{className:`h-5 w-5 animate-spin text-primary`})}):z?r(`div`,{className:`flex items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3`,children:[c(Y,{className:`h-4 w-4 text-destructive mt-0.5 shrink-0`}),r(`div`,{className:`space-y-1`,children:[c(`p`,{className:`text-xs font-medium text-destructive`,children:`Provider unavailable`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:[`The addon `,c(`span`,{className:`font-mono`,children:a}),` is not ready or does not support manual device creation. Check that the integration is online and try again.`]})]})]}):c(V,{schema:D,values:h,onChange:g,onTestField:j,probeResults:N,onClearProbe:P})}),!z&&!L&&r(`div`,{className:`border-t border-border bg-surface/50 shrink-0`,children:[r(`button`,{type:`button`,onClick:()=>y(e=>!e),className:`flex w-full items-center justify-between px-5 py-2 text-[11px] text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:[r(`span`,{className:`flex items-center gap-2`,children:[c(ve,{className:`h-3.5 w-3.5`}),`Test logs`,c(`span`,{className:`font-mono text-[9px] opacity-60`,children:S.slice(0,14)})]}),c(fe,{className:`h-3.5 w-3.5 transition-transform ${_?`rotate-180`:``}`})]}),_&&c(`div`,{className:`border-t border-border max-h-64 overflow-hidden`,children:c(te,{addonId:a,requestId:S,limit:50,maxHeight:`max-h-64`,showFilters:!1,showScope:!1,className:`border-0 rounded-none`})})]}),!z&&!L&&(b||ie.length>0)&&c(`div`,{className:`border-t border-destructive/30 bg-destructive/5 px-5 py-2 shrink-0`,children:r(`div`,{className:`flex items-start gap-2`,children:[c(Y,{className:`h-3.5 w-3.5 text-destructive mt-0.5 shrink-0`}),c(`p`,{className:`text-[11px] text-destructive`,children:b||`Required: ${ie.join(`, `)}`})]})}),r(`div`,{className:`flex items-center justify-between border-t border-border px-5 py-3 shrink-0`,children:[r(`div`,{className:`flex items-center gap-2`,children:[c(`button`,{onClick:u,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:p(`integrations.cancel`)}),!z&&M&&r(`button`,{type:`button`,onClick:re,disabled:ne===`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:[ne===`testing`?c(K,{className:`h-3.5 w-3.5 animate-spin`}):c(ce,{className:`h-3.5 w-3.5`}),`Test All`]})]}),r(`div`,{className:`flex items-center gap-2`,children:[c(`button`,{onClick:()=>F(!0),disabled:z||!I||k.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:p(`integrations.saveAndNew`)}),c(`button`,{onClick:()=>F(!1),disabled:z||!I||k.isPending,className:`rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50`,children:k.isPending?p(`integrations.saving`):p(`integrations.save`)})]})]})]})]})}var Oe=1500;function ke({addonId:e,integrationId:t,jobId:n,onFinished:i}){let{t:a}=xe(),o=k(),s=(L({addonId:e,integrationId:t},{refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`running`)?Oe:!1}).data??[]).find(e=>e.jobId===n);if(!s)return null;let l=s.state===`running`,u=s.processed,d=s.total>0?Math.round(u/s.total*100):0;!l&&s.finishedAt!==null&&i();let f=[`${u}/${s.total} ${a(`integrations.adoptJobProcessed`,{defaultValue:`processed`})}`];s.adopted>0&&f.push(`${s.adopted} ${a(`integrations.adoptJobAdded`,{defaultValue:`added`})}`),s.alreadyAdopted>0&&f.push(`${s.alreadyAdopted} ${a(`integrations.adoptJobSkipped`,{defaultValue:`already there`})}`),s.failed>0&&f.push(`${s.failed} ${a(`integrations.adoptJobFailed`,{defaultValue:`failed`})}`);let p=f.join(` · `);return r(`div`,{className:`border-t border-border px-5 py-3 shrink-0 space-y-2`,children:[r(`div`,{className:`flex items-center gap-2`,children:[l?c(K,{className:`h-3.5 w-3.5 animate-spin text-primary shrink-0`}):s.failed>0?c(Y,{className:`h-3.5 w-3.5 text-destructive shrink-0`}):s.state===`cancelled`?c(B,{className:`h-3.5 w-3.5 text-foreground-subtle shrink-0`}):c(de,{className:`h-3.5 w-3.5 text-primary shrink-0`}),c(`p`,{className:`text-[11px] text-foreground`,children:p}),l&&c(`button`,{onClick:()=>o.mutate({jobId:n}),className:`ml-auto rounded-lg border border-border px-2 py-1 text-[11px] text-foreground-subtle hover:text-foreground transition-colors`,children:a(`integrations.adoptJobCancel`,{defaultValue:`Stop`})})]}),c(`div`,{className:`h-1 w-full rounded-full bg-border overflow-hidden`,children:c(`div`,{className:`h-full bg-primary transition-all`,style:{width:`${d}%`},role:`progressbar`,"aria-valuenow":d,"aria-valuemin":0,"aria-valuemax":100})}),s.results.filter(e=>e.outcome===`failed`).slice(0,5).map(e=>r(`p`,{className:`text-[11px] text-destructive`,children:[e.childNativeId,`: `,e.error]},e.childNativeId))]})}function Ae(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(` `)}n();var $=`devices`,je={id:$,label:`Devices`,isDefault:!0},Me=2e4,Ne=100;function Pe({addonId:n,integrationId:i,onClose:a}){let{t:o}=xe(),[u,d]=s(new Set),[f,p]=s(new Set),[m,h]=s(new Map),[_,v]=s(null),{data:y}=ne(),b=(y??[]).find(e=>e.addonId===n)?.supportsLocationImport??!1,[C,te]=s(!0),T=w({addonId:n,integrationId:i}).data?.filters,D=T&&T.length>0?T:[je],[O,k]=s(D.find(e=>e.isDefault)?.id??(D.some(e=>e.id===$)?$:D[0].id)),A=O!==$,j=E(),M=ie({addonId:n,integrationId:i,page:1,pageSize:Me,filter:O}),N=M.refetch,re=j.mutate,P=e(()=>{re({addonId:n,integrationId:i},{onSettled:()=>{N()}})},[re,n,i,N]),F=t(null);l(()=>{let e=`${n}::${i}`;F.current===e||M.isLoading||(F.current=e,(M.data?.candidates.length??0)===0&&P())},[n,i,M.isLoading,M.data,P]);let I=j.isPending,L=j.isError?j.error instanceof Error?j.error.message:String(j.error):null,R=typeof j.data?.lastError==`string`&&j.data.lastError.length>0?j.data.lastError:null,z=M.data?.candidates??[],B=M.isError?M.error instanceof Error?M.error.message:String(M.error):null,V=S(),[H,ae]=s(null),U=e(e=>{e.alreadyAdopted||d(t=>{let n=new Set(t);return n.has(e.childNativeId)?n.delete(e.childNativeId):n.add(e.childNativeId),n})},[]),W=e(e=>{p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),oe=e((e,t)=>{h(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})},[]),se=e(e=>{let t={};for(let n of e){let e=m.get(n);e&&e.hiddenChildIds.size>0&&(t[n]={hiddenChildIds:[...e.hiddenChildIds]})}return Object.keys(t).length>0?t:void 0},[m]),ce=e(async()=>{v(null);let e=[...u];if(e.length!==0)try{let t=se(e),{jobId:r}=await V.mutateAsync({addonId:n,integrationId:i,filter:O,childNativeIds:e,...t?{perCandidate:t}:{},...b?{importLocations:C}:{}});ae(r),d(new Set),h(new Map)}catch(e){v(e instanceof Error?e.message:String(e))}},[u,se,V,n,i,O,b,C]),le=t(null),q=e(()=>{H===null||le.current===H||(le.current=H,N())},[H,N]),ue=e(e=>{k(e),d(new Set),p(new Set),h(new Map),v(null)},[]),J=u.size;return r(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[c(`div`,{className:`absolute inset-0 bg-black/60`,onClick:a}),r(`div`,{className:`relative z-10 flex w-full max-w-3xl flex-col h-[85vh] rounded-xl border border-border bg-background shadow-2xl`,children:[r(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[r(`div`,{className:`min-w-0`,children:[c(`h2`,{className:`text-sm font-semibold text-foreground`,children:o(`integrations.adoptDevices`,{defaultValue:`Adopt devices`})}),c(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:o(`integrations.adoptDevicesHint`,{defaultValue:`Preview the candidate devices and add the ones you want.`})})]}),r(`div`,{className:`flex items-center gap-3 shrink-0`,children:[b&&r(`label`,{className:`flex items-center gap-1.5 cursor-pointer text-[11px] text-foreground-subtle hover:text-foreground transition-colors`,children:[c(`input`,{type:`checkbox`,checked:C,onChange:e=>te(e.target.checked),className:`accent-primary`}),o(`integrations.importLocations`,{defaultValue:`Import locations from the integration`})]}),c(`button`,{onClick:a,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,"aria-label":`Close`,children:c(ge,{className:`h-4 w-4`})})]})]}),r(`div`,{className:`flex-1 min-h-0 px-5 py-3 flex flex-col gap-2 overflow-hidden`,children:[(L??B??R)&&z.length===0&&c(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 px-4 py-3 shrink-0`,children:r(`div`,{className:`flex items-start gap-2`,children:[c(Y,{className:`h-3.5 w-3.5 text-destructive mt-0.5 shrink-0`}),r(`div`,{className:`min-w-0`,children:[c(`p`,{className:`text-xs font-medium text-destructive`,children:o(`integrations.adoptRefreshFailed`,{defaultValue:`Could not discover devices.`})}),c(`p`,{className:`text-[11px] text-destructive/90 mt-0.5`,children:L??B??R})]})]})}),D.length>1&&c(Fe,{filters:D,activeFilter:O,onSelect:ue}),c(`div`,{className:`flex-1 min-h-0`,children:c(ee,{mode:`generic`,items:z,pageSize:Ne,getKey:e=>e.childNativeId,getSearchText:Ae,getFilterType:e=>e.type,filterOptions:x(),filterLabel:o(`integrations.adoptColType`,{defaultValue:`Type`}),isLoading:M.isLoading||I&&z.length===0,searchPlaceholder:o(`integrations.adoptSearch`,{defaultValue:`Search candidates…`}),emptyLabel:(L??B??R)&&z.length===0?``:o(`integrations.adoptNoCandidates`,{defaultValue:`No candidate devices found.`}),toolbar:r(`button`,{type:`button`,onClick:P,disabled:I,title:o(`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:[c(G,{className:`h-3.5 w-3.5 ${I?`animate-spin`:``}`}),o(`integrations.adoptRefresh`,{defaultValue:`Refresh`})]}),columns:[{key:`name`,header:o(`integrations.adoptColName`,{defaultValue:`Name`}),headerClassName:`w-[55%]`,cell:e=>c(Ie,{candidate:e,expandable:!A,expanded:f.has(e.childNativeId),onToggleExpand:()=>W(e.childNativeId),adoptedLabel:o(`integrations.adoptAlready`,{defaultValue:`Adopted`})})},{key:`type`,header:o(`integrations.adoptColType`,{defaultValue:`Type`}),headerClassName:`w-[30%] hidden sm:table-cell`,cellClassName:`hidden sm:table-cell`,cell:e=>{let t=g(e.type),n=t.icon;return r(`span`,{className:`inline-flex items-center gap-1.5 text-[10px] text-foreground-subtle`,children:[c(n,{className:`h-3.5 w-3.5 shrink-0`}),t.label]})}},{key:`select`,header:``,headerClassName:`w-[15%] text-right`,cellClassName:`text-right`,cell:e=>c(`div`,{className:`flex items-center justify-end`,children:c(`button`,{onClick:()=>U(e),disabled:e.alreadyAdopted,"aria-label":u.has(e.childNativeId)?`Deselect`:`Select`,className:`inline-flex h-5 w-5 items-center justify-center rounded border ${u.has(e.childNativeId)?`border-primary bg-primary`:`border-border`} ${e.alreadyAdopted?`cursor-not-allowed opacity-50`:``}`,children:u.has(e.childNativeId)&&c(Se,{className:`h-3 w-3 text-primary-foreground`})})})}],isExpanded:e=>!A&&f.has(e.childNativeId),renderExpanded:A?void 0:e=>c(Le,{candidate:e,hiddenChildIds:m.get(e.childNativeId)?.hiddenChildIds??new Set,onToggleChildHidden:t=>oe(e.childNativeId,t)}),rowClassName:e=>e.alreadyAdopted?`opacity-60`:u.has(e.childNativeId)?`bg-primary/5`:``})})]}),_&&c(`div`,{className:`border-t border-destructive/30 bg-destructive/5 px-5 py-2 shrink-0`,children:r(`div`,{className:`flex items-start gap-2`,children:[c(Y,{className:`h-3.5 w-3.5 text-destructive mt-0.5 shrink-0`}),c(`p`,{className:`text-[11px] text-destructive`,children:_})]})}),H!==null&&c(ke,{addonId:n,integrationId:i,jobId:H,onFinished:q}),r(`div`,{className:`flex items-center justify-between border-t border-border px-5 py-3 shrink-0`,children:[c(`div`,{}),r(`div`,{className:`flex items-center gap-2`,children:[c(`button`,{onClick:a,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:o(`integrations.cancel`,{defaultValue:`Cancel`})}),r(`button`,{onClick:ce,disabled:J===0||V.isPending,className:`inline-flex items-center gap-1.5 rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50 disabled:cursor-not-allowed`,children:[V.isPending&&c(K,{className:`h-3.5 w-3.5 animate-spin`}),o(`integrations.addSelected`,{defaultValue:`Add selected`}),J>0?` (${J})`:``]})]})]})]})]})}function Fe({filters:e,activeFilter:t,onSelect:n}){return c(`div`,{role:`tablist`,"aria-label":`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 c(`button`,{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 Ie({candidate:e,expandable:t,expanded:n,onToggleExpand:i,adoptedLabel:a}){let o=(e.children??[]).length;return r(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[t&&o>0?r(`button`,{type:`button`,onClick:i,"aria-label":n?`Collapse`:`Expand`,"aria-expanded":n,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:[c(n?fe:q,{className:`h-3.5 w-3.5`}),o]}):c(`span`,{className:`flex h-5 w-5 flex-shrink-0 items-center justify-center text-foreground-subtle/40`,children:`—`}),c(`span`,{className:`truncate text-xs font-medium text-foreground`,children:e.name}),e.alreadyAdopted&&c(`span`,{className:`rounded-full bg-success/10 px-2 py-0.5 text-[9px] font-medium text-success shrink-0`,children:a})]})}function Le({candidate:e,hiddenChildIds:t,onToggleChildHidden:n}){let i=e.children??[];return i.length===0?null:c(`div`,{className:`space-y-1 py-1`,children:i.map(e=>{let i=t.has(e.childNativeId),a=e.capabilities??[];return r(`div`,{className:`flex items-center gap-2 rounded px-2 py-1 ${i?`opacity-50`:``}`,children:[c(`span`,{className:`text-[11px] text-foreground truncate flex-1 min-w-0`,children:e.name}),a.length>0&&c(`span`,{className:`text-[9px] text-foreground-subtle truncate`,children:a.join(`, `)}),c(`button`,{onClick:()=>n(e.childNativeId),"aria-label":i?`Show child`:`Hide child`,title:i?`Show after adopt`:`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:c(i?le:_e,{className:`h-3 w-3`})})]},e.childNativeId)})})}n();function Re(e){let t=[];for(let n of e){if(n.type===`group`){t.push(...Re(n.fields));continue}`key`in n&&typeof n.key==`string`&&t.push(n.key)}return t}function ze(e,t){if(!e)return{};let n=new Set(e.sections.flatMap(e=>Re(e.fields))),r={};for(let e of n)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r}function Be(e){return{...e.tabs?{tabs:e.tabs}:{},sections:e.sections.map(e=>({...e,fields:e.fields.map(e=>{if(`value`in e){let{value:t,...n}=e;return n}return e})}))}}function Ve({integrationId:e,addonId:t,name:n,kind:a,mode:s,brokerKind:l,canTest:u=!1,trpc:d,onClose:f}){let{t:p}=xe(),h=o(),{data:g,isLoading:_}=O({id:e},{enabled:s===`account`||s===`broker`}),v=i(()=>{let e=g?.brokerId;return typeof e==`string`?e:null},[g]),{data:y,isLoading:b}=M({addonId:t,nodeId:`hub`},{enabled:s===`account`}),x=i(()=>y?Be(y):null,[y]),S=F(),ee=t=>{S.mutate({id:e,settings:t},{onSuccess:()=>{h.invalidateQueries(),f()}})};return c(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,onClick:f,children:r(`div`,{className:`max-h-[85vh] w-full max-w-lg overflow-y-auto rounded-xl border border-border bg-surface p-5 shadow-xl`,onClick:e=>e.stopPropagation(),children:[r(`div`,{className:`mb-3 flex items-center justify-between`,children:[r(`h2`,{className:`text-sm font-semibold text-foreground`,children:[p(`integrations.editConfig`,{defaultValue:`Edit configuration`}),` — `,n]}),c(`button`,{onClick:f,className:`rounded-md p-1 text-foreground-subtle hover:bg-surface-hover hover:text-foreground`,"aria-label":p(`common.close`,{defaultValue:`Close`}),children:c(ge,{className:`h-4 w-4`})})]}),s===`broker`?l?r(`div`,{className:`space-y-3`,children:[c(`p`,{className:`text-[11px] text-foreground-subtle`,children:p(`integrations.relinkBrokerHelp`,{defaultValue:`Choose the broker this integration connects through. Picking a different broker re-points it and restarts the addon.`})}),v&&r(`p`,{className:`text-[11px] text-foreground`,children:[p(`integrations.currentBroker`,{defaultValue:`Current broker`}),`:`,` `,c(`span`,{className:`font-mono text-foreground-subtle`,children:v})]}),S.isPending?r(`div`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[c(K,{className:`h-3 w-3 animate-spin`}),p(`integrations.saving`,{defaultValue:`Saving…`})]}):c(W,{kind:l,onResolved:e=>{ee({brokerId:e})},onBack:f}),S.isError&&c(`p`,{className:`text-[11px] text-danger`,children:p(`integrations.relinkFailed`,{defaultValue:`Failed to update broker link.`})})]}):c(`p`,{className:`text-[11px] text-danger`,children:p(`integrations.noBrokerKind`,{defaultValue:`This integration declares device-adoption but its addon manifest has no brokerKind.`})}):s===`account`?_||b?r(`div`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[c(K,{className:`h-3 w-3 animate-spin`}),p(`integrations.loading`,{defaultValue:`Loading…`})]}):c(U,{addonId:t,configSchema:x,canTest:u,initialName:n,initialConfig:ze(x,g??{}),submitLabel:p(`integrations.save`,{defaultValue:`Save`}),hideName:!0,onSave:({config:e})=>ee(e),onBack:f}):c(m,{trpc:d,addonId:t,nodeId:`hub`,title:n})]})})}n();function He(){let{t}=xe(),{integrationId:n}=he(),d=o(),f=ue(),[m,g]=me(),v=u(),[x,S]=s(!1),[C,w]=s(!1),[E,O]=s(!1),[k,F]=s(!1),[ie,L]=s(!1),{data:R,isLoading:B}=re({id:n??``},{enabled:!!n}),{data:V}=M({addonId:R?.addonId??``,nodeId:`hub`},{enabled:!!R?.addonId}),{data:U,isSuccess:W}=ne(),G=i(()=>{let e=R?.addonId;return!e||!W?null:(U??[]).find(t=>t.addonId===e)?.kind===`device-adoption`?`device-adoption`:`device-provider`},[U,R?.addonId,W]),{data:ce}=b({}),le=i(()=>(ce?.providers??[]).some(e=>e.addonId===R?.addonId),[ce,R?.addonId]),q=G!==null,J=R?.info?.fixed===!0,de=q?G===`device-adoption`?t(`integrations.adoptDevices`,{defaultValue:`Adopt devices`}):t(`integrations.addDevice`):t(`integrations.addDeviceLoading`,{defaultValue:`Loading…`}),fe=i(()=>{let e=R?.addonId;return!e||!W?null:(U??[]).find(t=>t.addonId===e)?.brokerKind??null},[U,R?.addonId,W]),_e=i(()=>{let e=R?.addonId;return!e||!W?!1:(U??[]).find(t=>t.addonId===e)?.canTest===!0},[U,R?.addonId,W]),Se=i(()=>{let e=R?.addonId;return!e||!W?null:(U??[]).find(t=>t.addonId===e)?.mode??null},[U,R?.addonId,W]);l(()=>{m.get(`add`)===`1`&&q&&(S(!0),g(e=>{let t=new URLSearchParams(e);return t.delete(`add`),t},{replace:!0}))},[m,q,g]);let we=V!=null&&Array.isArray(V.sections)&&V.sections.some(e=>e.fields.length>0),{data:Te}=_({},{refetchInterval:5e3}),X=[[`integrations`,`get`],{input:{id:n??``},type:`query`}],Z=T({onMutate:async e=>{await d.cancelQueries({queryKey:X});let t=d.getQueryData(X);return t!=null&&d.setQueryData(X,{...t,enabled:e.enabled}),{previous:t}},onError:(e,t,n)=>{let r=n;r?.previous!=null&&d.setQueryData(X,r.previous)},onSettled:()=>{d.invalidateQueries({queryKey:[[`integrations`]]}),d.invalidateQueries({queryKey:[[`deviceManager`]]})}}),Q=D({onSuccess:()=>{d.invalidateQueries({queryKey:[[`integrations`]]}),d.invalidateQueries({queryKey:[[`deviceManager`]]}),F(!1),f(`/integrations`)}}),Ee=A({onSuccess:()=>{d.invalidateQueries({queryKey:[[`integrations`]]}),d.invalidateQueries({queryKey:[[`deviceManager`]]})}}),Oe=h({onSuccess:()=>{d.invalidateQueries({queryKey:[[`deviceManager`]]})}}),ke=I({onSuccess:()=>{d.invalidateQueries({queryKey:[[`deviceManager`]]})}}),Ae=j({onSuccess:()=>{d.invalidateQueries({queryKey:[[`deviceManager`]]})}}),$=i(()=>Te??[],[Te]),je=i(()=>{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},[$]),Me=e(e=>je.get(e)??null,[je]),Ne=e(e=>c(z,{type:e,size:`sm`}),[]),Fe=e(e=>f(`/devices/${String(e)}`),[f]),Ie=i(()=>{let e=R?.addonId;return e?$.filter(t=>t.addonId===e):[]},[$,R?.addonId]),Le=i(()=>p(Ie).length,[Ie]);return B?r(`div`,{className:`p-4`,children:[c(`div`,{className:`h-16 rounded-lg bg-surface animate-pulse mb-4`}),c(`div`,{className:`h-40 rounded-lg bg-surface animate-pulse`})]}):R?r(`div`,{className:`p-4 space-y-4 overflow-x-hidden`,children:[c(N,{items:[{label:`Integrations`,onClick:()=>f(`/integrations`)},{label:R.name}]}),r(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[r(`div`,{className:`flex items-center gap-3 min-w-0`,children:[c(`img`,{src:`/api/addon-assets/${R.addonId}/assets/icon.svg`,alt:``,className:`h-8 w-8 rounded-lg shrink-0`,onError:e=>{e.target.style.display=`none`}}),r(`div`,{className:`min-w-0`,children:[c(`h1`,{className:`text-lg font-semibold text-foreground truncate`,children:R.name}),r(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5 truncate`,children:[R.addonId,` · `,Le,` `,t(`integrations.devices`)]})]})]}),r(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[le&&r(`button`,{onClick:()=>w(!0),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:`Scan the network for devices (incl. a different subnet)`,children:[c(ae,{className:`h-3.5 w-3.5`}),`Scan network`]}),!J&&r(`button`,{onClick:()=>S(!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:[c(H,{className:`h-3.5 w-3.5`}),de]}),r(`div`,{className:`inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 transition-colors ${Z.isPending?`opacity-60`:``} ${R.enabled?`border-success/30 bg-success/5`:`border-border bg-surface`}`,title:t(`integrations.toggleHint`,{defaultValue:`Click to toggle`}),children:[c(y,{checked:R.enabled,onCheckedChange:e=>Z.mutate({id:n,enabled:e}),disabled:Z.isPending,"aria-label":R.enabled?`Disable integration`:`Enable integration`}),c(`span`,{className:`text-[11px] font-medium ${R.enabled?`text-success`:`text-foreground-subtle`}`,children:R.enabled?`Enabled`:`Disabled`}),Z.isPending&&c(K,{className:`h-3 w-3 animate-spin text-foreground-subtle`})]}),Se!==`standalone`&&(we||G===`device-adoption`)&&r(`button`,{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`,children:[c(ye,{className:`h-3 w-3`}),t(`integrations.config`)]}),r(`button`,{onClick:()=>L(!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:t(`integrations.logs`,{defaultValue:`View logs`}),children:[c(ve,{className:`h-3 w-3`}),t(`integrations.logs`,{defaultValue:`Logs`})]}),c(P,{label:`Restart`,icon:se,title:`Restart "${R.name}"?`,description:`Restarting the addon will briefly disconnect every device backed by it (${Le} active). Streams will reconnect automatically.`,confirmLabel:`Restart`,triggerVariant:`outline`,confirmVariant:`danger`,disabled:Ee.isPending,action:()=>Ee.mutateAsync({addonId:R.addonId})}),!J&&r(`button`,{onClick:()=>F(!0),className:`flex items-center gap-1.5 rounded-lg border border-danger bg-danger/10 px-3 py-1.5 text-[11px] font-medium text-danger hover:bg-danger hover:text-background transition-colors`,title:t(`integrations.delete`,{defaultValue:`Delete integration`}),children:[c(be,{className:`h-3 w-3`}),t(`integrations.delete`,{defaultValue:`Delete`})]})]})]}),c(ee,{context:`integration-detail`,devices:$,trpc:v.trpcClient,defaultView:`cards`,forceAddon:R.addonId,urlScope:`root`,lsKey:`integration-detail:${R.addonId}`,resolveIntegrationIcon:Ne,resolveParent:Me,onNavigate:Fe,batchActions:{remove:Oe.mutate,disable:ke.mutate,enable:Ae.mutate},...J?{}:{onDeleteDevice:e=>Oe.mutate({deviceId:e.id})}}),x&&n&&G===`device-adoption`&&c(Pe,{addonId:R.addonId,integrationId:n,onClose:()=>S(!1)}),x&&n&&G===`device-provider`&&c(De,{open:x,integrationId:n,addonId:R.addonId,onClose:()=>S(!1)}),C&&R&&c(oe,{open:C,scope:{addonId:R.addonId,label:R.name},onClose:()=>w(!1)}),E&&n&&G!==null&&Se!==null&&c(Ve,{integrationId:n,addonId:R.addonId,name:R.name,kind:G,mode:Se,brokerKind:fe,canTest:_e,trpc:v.trpcClient,onClose:()=>O(!1)}),ie&&c(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-6`,onClick:()=>L(!1),children:r(`div`,{className:`flex flex-col rounded-xl border border-border bg-surface shadow-xl w-full max-w-5xl h-[80vh]`,onClick:e=>e.stopPropagation(),children:[r(`div`,{className:`flex items-center justify-between border-b border-border px-4 py-2.5`,children:[r(`div`,{className:`flex items-center gap-2 min-w-0`,children:[c(ve,{className:`h-4 w-4 text-primary shrink-0`}),c(`h2`,{className:`text-sm font-semibold text-foreground truncate`,children:R.name}),r(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate`,children:[R.addonId,n?` · ${n}`:``]})]}),c(`button`,{onClick:()=>L(!1),className:`flex h-7 w-7 items-center justify-center rounded text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,"aria-label":`Close logs`,children:c(ge,{className:`h-4 w-4`})})]}),c(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:c(te,{addonId:R.addonId,limit:200,maxHeight:`max-h-full`,showScope:!1,className:`h-full border-0 rounded-none`})})]})}),k&&c(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,onClick:()=>!Q.isPending&&F(!1),children:r(`div`,{className:`rounded-xl border border-border bg-background p-5 shadow-2xl w-96 space-y-3`,onClick:e=>e.stopPropagation(),children:[r(`div`,{className:`flex items-start gap-3`,children:[c(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg bg-danger/10 shrink-0`,children:c(Y,{className:`h-4 w-4 text-danger`})}),r(`div`,{className:`min-w-0`,children:[c(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`integrations.deleteTitle`,{defaultValue:`Delete integration?`})}),c(`p`,{className:`mt-1 text-[11px] text-foreground-subtle`,children:t(`integrations.deleteWarning`,{defaultValue:`This removes the integration "{{name}}" and its {{count}} device(s). The addon will restart. This cannot be undone.`,name:R.name,count:Le})})]})]}),Q.error&&c(`div`,{className:`rounded-lg border border-danger/40 bg-danger/10 px-3 py-2 text-[11px] text-danger`,children:Q.error instanceof Error?Q.error.message:String(Q.error)}),r(`div`,{className:`flex items-center justify-end gap-2 pt-1`,children:[c(`button`,{onClick:()=>F(!1),disabled:Q.isPending,className:`rounded-lg border border-border px-3 py-1.5 text-[11px] text-foreground-subtle hover:text-foreground transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:t(`integrations.cancel`,{defaultValue:`Cancel`})}),c(`button`,{onClick:()=>Q.mutate({id:n}),disabled:Q.isPending,className:`inline-flex items-center gap-1.5 rounded-lg bg-danger px-3 py-1.5 text-[11px] font-medium text-background hover:bg-danger/90 transition-colors disabled:opacity-60 disabled:cursor-not-allowed`,children:Q.isPending?r(a,{children:[c(K,{className:`h-3 w-3 animate-spin`}),t(`integrations.deleting`,{defaultValue:`Deleting…`})]}):r(a,{children:[c(be,{className:`h-3 w-3`}),t(`integrations.confirmDelete`,{defaultValue:`Delete integration`})]})})]})]})})]}):r(`div`,{className:`flex flex-col items-center justify-center py-20 px-6 text-center gap-4`,children:[c(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full bg-foreground-subtle/10`,children:c(Ce,{className:`h-6 w-6 text-foreground-subtle`})}),r(`div`,{className:`space-y-1 max-w-sm`,children:[c(`h2`,{className:`text-sm font-semibold text-foreground`,children:t(`integrations.integrationNotFound`,{defaultValue:`Integration not found`})}),c(`p`,{className:`text-[11px] text-foreground-subtle`,children:t(`integrations.integrationNotFoundHint`,{defaultValue:`The integration "{{id}}" does not exist. It may have been deleted, or the URL may be wrong.`,id:n??``})})]}),r(`button`,{onClick:()=>f(`/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:[c(pe,{className:`h-3 w-3`}),t(`integrations.backToList`,{defaultValue:`Back to integrations`})]})]})}export{He as IntegrationDetailPage};
@@ -1 +0,0 @@
1
- import{Q as e,S as t,W as n,b as r,o as i,q as a,x as o}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Z as s}from"./player-overlays-DQkaycbj.js";import{ar as c,cr as l,ir as u,lr as d,mr as f,nr as p,or as m,sr as h,tr as ee,un as g,w as _,wn as v}from"./src-Dke0Hyis.js";import{O as y,Z as b,q as x}from"./src-C0bBvS2n.js";import{t as S}from"./pencil-BC4xFPPI.js";import{t as te}from"./plus-DWlX1Elu.js";import{t as C}from"./radio-CuFaCHVR.js";import{t as w}from"./wifi-B1oDK3Wx.js";import{C as T,J as E,K as D,i as O,s as k,v as A}from"./index-Cuk54oGv.js";import{t as j}from"./AdminPage-CCD07UMs.js";import{t as M}from"./AdminTabs-pF1-A-KE.js";import{t as N}from"./BrokerForm-VxSsRip5.js";import{t as P}from"./useBodyScrollLock-BDocajQE.js";import{t as F}from"./AddonCollectionPage-CVQw4J0u.js";var I=D(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),L=D(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]);e();var R={"home-assistant":`Home Assistant`,mqtt:`MQTT`};function z(e){return R[e]??e}function B(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.addonId==`string`&&Array.isArray(e.kinds)):[]}var V={connected:`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`,connecting:`bg-amber-500/15 text-amber-700 dark:text-amber-300`,disconnected:`bg-foreground-subtle/15 text-foreground-subtle`,"auth-failed":`bg-danger/15 text-danger`,unreachable:`bg-danger/15 text-danger`,error:`bg-danger/15 text-danger`};function H({status:e}){return o(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${V[e]}`,children:e})}function U(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function W({title:e,subtitle:n,onClose:r,children:i}){return P(),o(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,onClick:r,children:t(`div`,{className:`w-full max-w-md rounded-xl border border-border bg-surface shadow-2xl`,onClick:e=>e.stopPropagation(),children:[t(`div`,{className:`flex items-start justify-between border-b border-border px-4 py-3`,children:[t(`div`,{className:`space-y-0.5`,children:[o(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),n&&o(`p`,{className:`text-xs text-foreground-subtle`,children:n})]}),o(`button`,{onClick:r,className:`text-foreground-subtle hover:text-foreground`,children:o(O,{className:`h-4 w-4`})})]}),o(`div`,{className:`p-4 max-h-[70vh] overflow-y-auto overscroll-contain`,children:i})]})})}function G({kinds:e,onClose:n,onDone:s}){let c=i(),l=e=>`${e.addonId??``}::${e.kind}`,[u,d]=a(e[0]?l(e[0]):``),[f,p]=a(``),[m,h]=a(!1),[g,_]=a(``),v=e.find(e=>l(e)===u)??e[0],y=v?.kind??``,b=v?.addonId,x=ee({onSuccess:()=>{c.invalidateQueries({queryKey:[[`broker`,`list`]]}),s()}}),S=e=>{if(!y||f.trim().length===0)return;let t=m?g.trim():``;m&&t===``||x.mutate({kind:y,name:f.trim(),settings:e,...t===``?{}:{id:t},...b===void 0?{}:{addonId:b}})};return o(W,{title:`Add broker`,subtitle:`Register a message broker for exporters and automations.`,onClose:x.isPending?()=>{}:n,children:t(`div`,{className:`space-y-3`,children:[t(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Kind`}),o(`select`,{value:u,onChange:e=>d(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,children:e.map(e=>o(`option`,{value:l(e),children:e.label},l(e)))})]}),t(`div`,{className:`space-y-1`,children:[o(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Name`}),o(`input`,{type:`text`,value:f,onChange:e=>p(e.target.value),placeholder:`My Home Assistant`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),t(`div`,{className:`space-y-1 rounded border border-border px-3 py-2`,children:[t(`label`,{className:`flex items-center gap-2 text-[11px] text-foreground`,children:[o(`input`,{type:`checkbox`,checked:m,onChange:e=>h(e.target.checked)}),`Restore a broker that was removed, under its original id`]}),m&&t(r,{children:[o(`input`,{type:`text`,value:g,onChange:e=>_(e.target.value),placeholder:`ha_004`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`}),o(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Devices remember the broker id they were discovered under, so restoring the original id reconnects them instead of needing re-discovery. An id that is still in use is refused.`})]})]}),x.isError&&o(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:x.error instanceof Error?x.error.message:String(x.error)}),y&&o(N,{kind:y,...b===void 0?{}:{addonId:b},onSubmit:S,onCancel:n,submitLabel:x.isPending?`Adding…`:`Add broker`,disabled:x.isPending}),f.trim().length===0&&o(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Enter a name before saving.`}),m&&g.trim().length===0&&o(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Enter the original id, or clear the checkbox to create a new broker.`})]})})}function K({broker:e,onClose:r,onDone:a}){let s=i(),c=p({id:e.id,addonId:e.addonId}),u=l({onSuccess:()=>{s.invalidateQueries({queryKey:[[`broker`,`list`]]}),s.invalidateQueries({queryKey:[[`broker`,`getSettings`],{input:{id:e.id,addonId:e.addonId}}]}),a()}}),d=n(()=>{let e=c.data;return e&&typeof e==`object`?{...e}:{}},[c.data]);return o(W,{title:`Edit ${e.name}`,subtitle:`${z(e.kind)} · ${e.id}`,onClose:u.isPending?()=>{}:r,children:c.isLoading?t(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[o(T,{className:`h-3.5 w-3.5 animate-spin`}),` Loading settings…`]}):c.isError?t(`div`,{className:`space-y-3`,children:[t(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:[`Failed to load settings:`,` `,c.error instanceof Error?c.error.message:`Unknown error`]}),o(`div`,{className:`flex justify-end`,children:o(`button`,{type:`button`,onClick:r,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:`Close`})})]}):t(`div`,{className:`space-y-3`,children:[u.isError&&o(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:u.error instanceof Error?u.error.message:String(u.error)}),o(N,{kind:e.kind,addonId:e.addonId,initialValues:d,onSubmit:t=>{u.mutate({id:e.id,settings:t,addonId:e.addonId})},onCancel:r,submitLabel:u.isPending?`Saving…`:`Save`,disabled:u.isPending})]})})}function q({broker:e,onEdit:n}){let r=i(),s=g(),[c,l]=a(null),u=d({onSuccess:e=>l(e.ok?{ok:!0}:{ok:!1,error:e.error}),onError:e=>l({ok:!1,error:e instanceof Error?e.message:String(e)})}),f=h({onSuccess:()=>{r.invalidateQueries({queryKey:[[`broker`,`list`]]})}}),p=async()=>{await s({title:`Delete broker`,message:`Delete broker "${e.name}"? Integrations that depend on it will stop working.`,confirmLabel:`Delete`,variant:`danger`})&&f.mutate({id:e.id,addonId:e.addonId})};return t(`tr`,{className:`border-b border-border last:border-0`,children:[o(`td`,{className:`px-3 py-2 text-xs text-foreground font-medium`,children:e.name}),o(`td`,{className:`px-3 py-2 text-xs text-foreground-subtle`,children:z(e.kind)}),t(`td`,{className:`px-3 py-2`,children:[o(H,{status:e.status}),c&&o(`span`,{className:`ml-2 text-[10px] ${c.ok?`text-success`:`text-danger`}`,children:c.ok?`OK`:c.error??`failed`})]}),o(`td`,{className:`px-3 py-2`,children:t(`div`,{className:`flex items-center justify-end gap-1.5`,children:[t(`button`,{type:`button`,onClick:()=>u.mutate({id:e.id,addonId:e.addonId}),disabled:u.isPending,title:`Test connection`,className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-[11px] text-foreground hover:bg-primary/10 disabled:opacity-50`,children:[u.isPending?o(T,{className:`h-3 w-3 animate-spin`}):o(w,{className:`h-3 w-3`}),`Test`]}),t(`button`,{type:`button`,onClick:()=>n(e),title:`Edit`,className:`inline-flex items-center gap-1 rounded border border-border px-2 py-1 text-[11px] text-foreground hover:bg-primary/10`,children:[o(S,{className:`h-3 w-3`}),` Edit`]}),t(`button`,{type:`button`,onClick:()=>{p()},disabled:f.isPending,title:`Delete`,className:`inline-flex items-center gap-1 rounded border border-danger/40 px-2 py-1 text-[11px] text-danger hover:bg-danger/10 disabled:opacity-50`,children:[f.isPending?o(T,{className:`h-3 w-3 animate-spin`}):o(k,{className:`h-3 w-3`}),`Delete`]})]})})]})}function J(){let e=c({}),r=m(),i=n(()=>U(e.data),[e.data]),[s,l]=a(!1),[u,d]=a(null),f=n(()=>{let e=new Map;for(let t of B(r.data))for(let n of t.kinds)e.set(`${t.addonId}::${n.kind}`,{addonId:t.addonId,kind:n.kind,label:n.label});for(let t of i)[...e.values()].some(e=>e.kind===t.kind)||e.set(`::${t.kind}`,{kind:t.kind,label:z(t.kind)});return[...e.values()]},[i,r.data]);return t(`div`,{className:`space-y-3`,children:[o(`div`,{className:`flex items-center justify-end`,children:t(`button`,{type:`button`,onClick:()=>l(!0),disabled:f.length===0,title:f.length===0?`No broker providers available`:void 0,className:`inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed`,children:[o(te,{className:`h-3.5 w-3.5`}),` Add broker`]})}),o(`div`,{className:`rounded-lg border border-border bg-surface overflow-x-auto`,children:t(`table`,{className:`w-full min-w-[36rem] border-collapse`,children:[o(`thead`,{children:t(`tr`,{className:`border-b border-border bg-background/50`,children:[o(`th`,{className:`px-3 py-2 text-left text-[10px] font-semibold uppercase tracking-wider text-foreground-subtle`,children:`Name`}),o(`th`,{className:`px-3 py-2 text-left text-[10px] font-semibold uppercase tracking-wider text-foreground-subtle`,children:`Kind`}),o(`th`,{className:`px-3 py-2 text-left text-[10px] font-semibold uppercase tracking-wider text-foreground-subtle`,children:`Status`}),o(`th`,{className:`px-3 py-2 text-right text-[10px] font-semibold uppercase tracking-wider text-foreground-subtle`,children:`Actions`})]})}),t(`tbody`,{children:[e.isLoading&&o(`tr`,{children:t(`td`,{colSpan:4,className:`px-3 py-6 text-center text-xs text-foreground-subtle`,children:[o(T,{className:`inline h-4 w-4 animate-spin`}),` Loading brokers…`]})}),e.isError&&o(`tr`,{children:t(`td`,{colSpan:4,className:`px-3 py-4 text-center text-xs text-danger`,children:[`Failed to load brokers:`,` `,e.error instanceof Error?e.error.message:`Unknown error`]})}),!e.isLoading&&!e.isError&&i.length===0&&o(`tr`,{children:o(`td`,{colSpan:4,className:`px-3 py-6 text-center text-xs text-foreground-subtle`,children:`No brokers registered yet. Add one to publish device events for downstream automations.`})}),i.map(e=>o(q,{broker:e,onEdit:d},e.id))]})]})}),s&&o(G,{kinds:f,onClose:()=>l(!1),onDone:()=>l(!1)}),u&&o(K,{broker:u,onClose:()=>d(null),onDone:()=>d(null)})]})}var Y=[{kind:`device-export`,tabId:`device-export`,title:`Device export`,subtitle:`Outbound exporters that publish CamStack devices to other ecosystems (HomeAssistant, HomeKit, Alexa, …).`,icon:L,emptyTitle:`No device-export providers installed`,emptyDescription:`Install an export addon (e.g. @camstack/addon-export-ha-mqtt) to surface your CamStack devices in HomeAssistant, HomeKit, …`,addLabel:`Add export`},{kind:`email`,tabId:`email`,title:`Email providers`,subtitle:`Outbound email relays used for magic-link login, notifications, and alerts (SMTP today, future SendGrid, …).`,icon:I,emptyTitle:`No email providers installed`,emptyDescription:`Install an email-provider addon (e.g. @camstack/addon-smtp) so the hub can deliver magic-link logins and notifications.`,addLabel:`Add email provider`},{kind:`broker`,tabId:`broker`,title:`Brokers`,subtitle:`Message brokers consumed by exporters and downstream automations (MQTT today, future Kafka, …).`,icon:C,emptyTitle:`No brokers installed`,emptyDescription:`Install a broker addon (e.g. @camstack/addon-mqtt-broker) to publish device events for downstream automations.`,addLabel:`Add broker`}];function X(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e.name;if(typeof t==`string`)return t}return null}function Z(e){let t=e,n=t?.manifest;if(!n?.id)return null;let r=[];for(let e of n.capabilities??[]){let t=X(e);t!==null&&r.push(t)}let i=n.packageDisplayName??n.name??n.id,a=t?.process?.state??null;return{addonId:n.id,displayName:i,isActive:a===`running`,packageName:n.packageName??`@camstack/addon-${n.id}`,capNames:r,processState:a}}function Q(e,t){let n=new Set(t);return e.filter(e=>e.capNames.some(e=>n.has(e)))}function ne(e){for(let[t,n]of Object.entries(y))if(n===e)return t;return null}function re(e){return e===`running`?{label:`Running`,className:`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`}:e===`crashed`||e===`failed`?{label:e===`failed`?`Failed`:`Crashed`,className:`bg-danger/15 text-danger`}:e===`stopped`||e===`disabled`?{label:`Stopped`,className:`bg-foreground-subtle/15 text-foreground-subtle`}:{label:e??`Unknown`,className:`bg-foreground-subtle/15 text-foreground-subtle`}}function $({label:e,className:t}){return o(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${t}`,children:e})}function ie({addonId:e}){let{data:t,isLoading:n}=u({addonId:e},{refetchInterval:1e4,retry:!1});if(n||!t)return null;let r=b.safeParse(t);if(!r.success)return null;let i=r.data;return o($,{label:`${i.brokerCount} broker${i.brokerCount===1?``:`s`}${i.connectedCount>0?` • ${i.connectedCount} connected`:``}`,className:`bg-primary/10 text-primary`})}function ae({addonId:e}){let{data:t,isLoading:n}=f({addonId:e},{refetchInterval:1e4,retry:!1});if(n||!t)return null;let r=x.safeParse(t);if(!r.success)return null;let i=r.data,a=i.linkState===`linked`?`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`:i.linkState===`error`?`bg-danger/15 text-danger`:`bg-foreground-subtle/15 text-foreground-subtle`;return o($,{label:`${i.linkState} • ${i.exposedDeviceCount} exposed`,className:a})}function oe({kind:e,addonId:t}){return e===`broker`?o(ie,{addonId:t}):e===`device-export`?o(ae,{addonId:t}):null}function se({descriptor:e,rows:n,isLoading:i}){let a=ne(e.kind),c=e.kind===`device-export`,l=s(),u=E();return o(F,{title:e.title,subtitle:e.subtitle,pageIcon:e.icon,itemIcon:e.icon,capability:a??e.kind,installButtonLabel:e.addLabel,items:n,isLoading:i,emptyTitle:e.emptyTitle,emptyDescription:e.emptyDescription,renderStatusBadges:n=>{let i=re(n.processState);return t(r,{children:[o($,{label:i.label,className:i.className}),o(oe,{kind:e.kind,addonId:n.addonId})]})},renderExpandedPanel:c?e=>o(_,{addonId:e.addonId,trpc:l.trpcClient,onOpenDevice:e=>u(`/devices/${e}`)}):void 0,showChrome:!0})}function ce(){let e=v(void 0,{refetchInterval:1e4}),t=(e.data??[]).map(Z).filter(e=>e!==null);return o(j,{icon:A,title:`External systems`,subtitle:`External systems this hub talks to — device exporters, email relays, and message brokers. Settings, Logs and Events are docked under every provider.`,children:o(M,{tabs:Y.map(n=>{let r=Object.entries(y).filter(([,e])=>e===n.kind).map(([e])=>e),i=n.kind===`broker`?o(J,{}):o(se,{descriptor:n,rows:Q(t,r),isLoading:e.isLoading});return{id:n.tabId,label:n.title,icon:n.icon,content:i}})})})}export{ce as IntegrationsPage};