@camstack/addon-admin-ui 1.2.429 → 1.2.430
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.
- package/dist/assets/{AddonAssetIcon-DR35yt0E.js → AddonAssetIcon-BWUL7eDI.js} +1 -1
- package/dist/assets/{Addons-gkGgGpTC.js → Addons-2-Q9J_R-.js} +2 -2
- package/dist/assets/{AdminPage-DAO24U0w.js → AdminPage-DMiMIHwu.js} +1 -1
- package/dist/assets/{AdminSectionedPage-B-qoE6ra.js → AdminSectionedPage-DKH0UpKh.js} +1 -1
- package/dist/assets/AiProfiles-DQ5YpTn5.js +3 -0
- package/dist/assets/{BrokerForm-B3xs9aBj.js → BrokerForm-wEqc4cpx.js} +1 -1
- package/dist/assets/{Build-DeMAJfjN.js → Build-DIaw3f01.js} +4 -4
- package/dist/assets/{Calendars-VPH-vy-o.js → Calendars-BpyELuD4.js} +1 -1
- package/dist/assets/Cluster-CfJQLikz.js +1 -0
- package/dist/assets/ClusterStepModel-B_1igjPf.js +1 -0
- package/dist/assets/{CompositionEditor-BrtLjoSu.js → CompositionEditor-DYkQHem0.js} +1 -1
- package/dist/assets/{CompositionEditorPage-D51jS9td.js → CompositionEditorPage-DDBZOcqy.js} +1 -1
- package/dist/assets/Data-7qDFkx-Q.js +2 -0
- package/dist/assets/{DeviceDetail-D1qU_p1k.js → DeviceDetail-Dy2NTHbz.js} +2 -2
- package/dist/assets/{DeviceDoActionFields-B62Nv4K7.js → DeviceDoActionFields-DmKzugUt.js} +1 -1
- package/dist/assets/{Devices-Cf5Exjsk.js → Devices-COzPWkpB.js} +1 -1
- package/dist/assets/{EmbedPlayerPage-CnEcSJ8D.js → EmbedPlayerPage-CD4jAYaX.js} +1 -1
- package/dist/assets/Identity-BnBFoIrz.js +1 -0
- package/dist/assets/IntegrationDetail-CP91fqQF.js +1 -0
- package/dist/assets/{IntegrationHub-DdjWEObX.js → IntegrationHub-DMx7fLHV.js} +1 -1
- package/dist/assets/{Integrations-CU7Ll9U_.js → Integrations-Blb_S3_f.js} +1 -1
- package/dist/assets/{Integrations-uZB2ozhn.js → Integrations-BzqzbXQ2.js} +1 -1
- package/dist/assets/{Library-DSuCaXt6.js → Library-Cqg-Y18g.js} +1 -1
- package/dist/assets/Locations-EQXaWxpY.js +3 -0
- package/dist/assets/{Logs-cm-1R2Z4.js → Logs-hQ_F2BI5.js} +1 -1
- package/dist/assets/{MaskShapeCanvas-CM9D4FOf.js → MaskShapeCanvas-BkBmWJHu.js} +1 -1
- package/dist/assets/{MotionZonesSettings-DqS8ndiK.js → MotionZonesSettings-Ctl81l__.js} +1 -1
- package/dist/assets/MyAccess-D8vfWKFy.js +2 -0
- package/dist/assets/Network-BYFc8leF.js +1 -0
- package/dist/assets/{NodeAddonsSettingsPanel-BMat4ckt.js → NodeAddonsSettingsPanel-DMEeQbDW.js} +1 -1
- package/dist/assets/{Notifications-EPQiEZ1t.js → Notifications-BtrpoxXL.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-Bis0PO01.js → PrivacyMaskSettings-DEbHPS5X.js} +1 -1
- package/dist/assets/Recordings-BrGa72HR.js +1 -0
- package/dist/assets/{ScanNetworkModal-dHWFmbFe.js → ScanNetworkModal-CTjVwV69.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-SFMMIopn.js → SceneMonitorEditor-DgNqz_fJ.js} +1 -1
- package/dist/assets/SessionsList-CzSpm8u5.js +2 -0
- package/dist/assets/{Showroom-Er-hes9K.js → Showroom-DC0Rdsfa.js} +1 -1
- package/dist/assets/{System-BDXxfgsq.js → System-ByMuYkyz.js} +1 -1
- package/dist/assets/{Terminal-B70jnm8e.js → Terminal-CLof2QSK.js} +5 -5
- package/dist/assets/{Viewer-BsGL5Dfa.js → Viewer-CLEBXqqR.js} +1 -1
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-C7iEnSHU.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CxVe8UPZ.js} +1 -1
- package/dist/assets/{addon-icons-context--6Hi3qRW.js → addon-icons-context-B6iVhWXv.js} +1 -1
- package/dist/assets/{archive-DtcjevJM.js → archive-WKa1b0o1.js} +1 -1
- package/dist/assets/{authed-media-LCmlAEZ5.js → authed-media-B0bKjjhb.js} +1 -1
- package/dist/assets/{bell-off-eQBpwamg.js → bell-off-DQeMLsEK.js} +1 -1
- package/dist/assets/{board-model-wzCmdEKJ.js → board-model-DIWD11Nh.js} +1 -1
- package/dist/assets/{boxes-DikDfAoo.js → boxes-DMqqPR7T.js} +1 -1
- package/dist/assets/circle-slash-HW5fnitA.js +1 -0
- package/dist/assets/{client-DYbvGOid.js → client-Ck3kx2Z0.js} +3 -3
- package/dist/assets/{cloud-upload-DI9XunFf.js → cloud-upload-8Rtciaox.js} +1 -1
- package/dist/assets/crop-BCuJfQIp.js +1 -0
- package/dist/assets/{device-integration-icon-D2lWVDM2.js → device-integration-icon-BRxzTJPF.js} +1 -1
- package/dist/assets/device-picker-model-DUsOqTKW.js +1 -0
- package/dist/assets/{dist-ChQzskeX.js → dist-BiqTDJU8.js} +1 -1
- package/dist/assets/{dist-CPO0KWoy.js → dist-D4jmeWXJ.js} +3 -3
- package/dist/assets/{eraser-Dl5ROV0l.js → eraser-AtBM6hp_.js} +1 -1
- package/dist/assets/{file-up-WS3s_T9x.js → file-up-DvSwIdQI.js} +1 -1
- package/dist/assets/{hard-drive-download-B1ard6ym.js → hard-drive-download-COMXm0vT.js} +1 -1
- package/dist/assets/{history-BMhP0SFG.js → history-CNH6Hwzl.js} +1 -1
- package/dist/assets/{hostInit-FCvre9AW.js → hostInit-Cn-rvYrx.js} +1 -1
- package/dist/assets/i18n-DWijAvai.js +1 -0
- package/dist/assets/{icons-DocdgFuy.js → icons-BzZe_Qg7.js} +1 -1
- package/dist/assets/{index-DvOECbab.js → index-IBVizVRk.js} +3 -3
- package/dist/assets/{key-B1M6i1mf.js → key-B62K9GgX.js} +1 -1
- package/dist/assets/{key-round-yCDTbIQb.js → key-round-DhUJVMTJ.js} +1 -1
- package/dist/assets/{layers-c960YTPf.js → layers-BNtkJA8b.js} +1 -1
- package/dist/assets/{linked-devices-model-CB7qgVjI.js → linked-devices-model-DXpryeZj.js} +1 -1
- package/dist/assets/{list-ordered-C7hEwAd1.js → list-ordered-DE6semVl.js} +1 -1
- package/dist/assets/{location-owned-usage-D28vwYJT.js → location-owned-usage-4K4CCW-I.js} +1 -1
- package/dist/assets/{log-in-DFfxcqYz.js → log-in-k_3OshGq.js} +1 -1
- package/dist/assets/{memory-stick-BBfIGrWx.js → memory-stick--pKqiId8.js} +1 -1
- package/dist/assets/{message-square-plus-D8ZUT6rz.js → message-square-plus-DD_p-LBd.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-3035e647.js → mf-entry-bootstrap-0-b5dba7ed.js} +2 -2
- package/dist/assets/{mic-off-w2mFOBi3.js → mic-off-abkMqo-Z.js} +1 -1
- package/dist/assets/{monitor-off-DPi_gm_c.js → monitor-off-Btwz3hik.js} +1 -1
- package/dist/assets/{monitor-smartphone-9Ife1Trw.js → monitor-smartphone-CewWbhfo.js} +1 -1
- package/dist/assets/mount-DUsOqTKW.js +1 -0
- package/dist/assets/{notification-schedule-field-BuLfSYLZ.js → notification-schedule-field-DALe8QBw.js} +1 -1
- package/dist/assets/{octagon-alert-C-jH7VH_.js → octagon-alert-B-H38qMt.js} +1 -1
- package/dist/assets/{player-overlays-D0U2dNvn.js → player-overlays-CTjp5_0E.js} +1 -1
- package/dist/assets/{recycle-Bbki65G2.js → recycle-om2m5njd.js} +1 -1
- package/dist/assets/remoteEntry-Dmuue8--.js +1 -0
- package/dist/assets/{scan-eye-AfIM_Dlr.js → scan-eye-RPomUFSt.js} +1 -1
- package/dist/assets/{scissors-CnL6g0BO.js → scissors-oLO0ZxF2.js} +1 -1
- package/dist/assets/{search-x-eqJd3G8u.js → search-x-By7QfPjb.js} +1 -1
- package/dist/assets/{send-B72RQ9UL.js → send-CWuZ-VHG.js} +1 -1
- package/dist/assets/{settings-2-CXZ6DVRg.js → settings-2-DrkSvhIU.js} +1 -1
- package/dist/assets/{speaker-CcCWWecW.js → speaker-Bi1HndpO.js} +1 -1
- package/dist/assets/{src-CGxdJN_f.js → src-CoNs4bys.js} +3 -3
- package/dist/assets/{timer-reset-B9Lihcw9.js → timer-reset-CX_75T7d.js} +1 -1
- package/dist/assets/{ungroup-D753owNE.js → ungroup-CQ9vK9Rb.js} +1 -1
- package/dist/assets/{unlink-DzoLNfsq.js → unlink-DRIRCsre.js} +1 -1
- package/dist/assets/{usb-CuSU-_EY.js → usb-CSAqtgKZ.js} +1 -1
- package/dist/assets/{use-scenes-feed-CZjJNxfD.js → use-scenes-feed-B3oVDWHB.js} +1 -1
- package/dist/assets/{use-stationary-objects-BoGqWyLV.js → use-stationary-objects-D8Q3fSKJ.js} +1 -1
- package/dist/assets/useEventInvalidation-DUsOqTKW.js +1 -0
- package/dist/assets/{useNodeUrlSelection-BA6CgjTU.js → useNodeUrlSelection-CbhdLJkk.js} +1 -1
- package/dist/assets/user-round-DhADiv-t.js +1 -0
- package/dist/assets/{user-x-PK8sSsso.js → user-x-fVEkryXF.js} +1 -1
- package/dist/assets/{video-BBtESt54.js → video-C9XbLIGZ.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BKfTL-9e.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-CWUvAVp2.js} +2 -2
- package/dist/index.html +10 -10
- package/dist/server/addon.js +26 -6
- package/package.json +1 -1
- package/dist/assets/AiProfiles-BXcreqZP.js +0 -3
- package/dist/assets/Cluster-B-k0M79z.js +0 -1
- package/dist/assets/ClusterStepModel-DaAc_6nI.js +0 -1
- package/dist/assets/Data-IfJuKcwc.js +0 -2
- package/dist/assets/Identity-DNE80jdX.js +0 -1
- package/dist/assets/IntegrationDetail-LKbiJFU3.js +0 -1
- package/dist/assets/Locations-BeaznsZS.js +0 -3
- package/dist/assets/MyAccess-Dxb11B6h.js +0 -2
- package/dist/assets/Network-BCDUHSB0.js +0 -1
- package/dist/assets/Recordings-BCeoXxL4.js +0 -1
- package/dist/assets/SessionsList-BRTwG3uv.js +0 -2
- package/dist/assets/circle-slash-YVgGJTpJ.js +0 -1
- package/dist/assets/crop-CxZbpOyK.js +0 -1
- package/dist/assets/device-picker-model-C4w1vbly.js +0 -1
- package/dist/assets/i18n-Vb3uBp7P.js +0 -1
- package/dist/assets/mount-C4w1vbly.js +0 -1
- package/dist/assets/remoteEntry-DYVoozgD.js +0 -1
- package/dist/assets/useEventInvalidation-C4w1vbly.js +0 -1
- package/dist/assets/user-round-CMg3Ndlt.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,B as t,G as n,J as r,L as i,S as a,a as o,b as s,o as c,q as l,t as u,x as d}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{Hi as f,Hr as p,Ir as m,It as h,Nt as g,On as _,Pn as v,Qt as y,Tt as b,_i as x,ar as S,cn as C,cr as w,dt as T,fi as E,fn as D,ia as O,nr as k,on as A,ot as j,pr as M,sn as N,un as P,yi as F,yn as I}from"./player-overlays-D0U2dNvn.js";import{n as L,r as R,t as ee}from"./key-B1M6i1mf.js";import{c as z,o as B,u as V}from"./video-BBtESt54.js";import{t as H}from"./history-BMhP0SFG.js";import{t as te}from"./key-round-yCDTbIQb.js";import{t as ne}from"./monitor-smartphone-9Ife1Trw.js";import{t as re}from"./unlink-DzoLNfsq.js";import{Si as ie,a as ae,bi as oe,i as se,o as ce,s as le,xi as ue}from"./client-DYbvGOid.js";import{Al as de,An as fe,Bl as pe,Bn as U,Cn as me,Dl as he,Dn as ge,Dr as _e,En as ve,Er as ye,Fl as be,Ft as xe,G as Se,Hl as Ce,Ht as W,Il as we,Jl as Te,L as Ee,Ll as De,Ln as Oe,Ml as ke,N as Ae,Nl as je,Ol as Me,P as Ne,Pl as Pe,Ql as Fe,Qn as Ie,Rl as Le,Rn as Re,Tn as ze,Ut as Be,Vl as Ve,Wt as He,X as Ue,Xl as We,Yl as Ge,Z as Ke,Zl as qe,Zn as G,ar as K,bn as Je,en as Ye,ha as Xe,in as Ze,jl as Qe,jn as $e,jo as et,kl as tt,kn as nt,nn as rt,on as it,ql as at,rn as ot,vu as q,z as st,zl as ct,zn as lt}from"./src-CGxdJN_f.js";import{t as J}from"./i18n-Vb3uBp7P.js";import{t as Y}from"./useTranslation-D3Is_4B6.js";import{C as ut,Q as dt,X as ft,Y as pt,Z as mt,c as ht,et as gt,f as _t,m as vt,s as yt,z as bt}from"./index-DvOECbab.js";import{t as xt}from"./AdminSectionedPage-B-qoE6ra.js";import{t as St}from"./AdminPage-DAO24U0w.js";import{A as Ct,C as wt,D as Tt,E as Et,F as Dt,M as Ot,N as X,O as kt,P as Z,S as At,T as jt,_ as Mt,a as Nt,b as Pt,c as Ft,d as It,f as Lt,h as Rt,i as zt,j as Bt,k as Vt,l as Ht,m as Ut,n as Wt,o as Gt,p as Kt,s as qt,t as Jt,u as Yt,v as Xt,w as Zt,x as Qt,y as $t}from"./SessionsList-BRTwG3uv.js";import{i as en,n as tn,r as nn,t as rn}from"./IntegrationHub-DdjWEObX.js";import{n as an,t as on}from"./addon-display-names-BkwMrExv.js";e();function sn(){let{t:e}=Y(),t=G(),i=q.useUtils(),a=Dt(),{data:o,isLoading:s}=be(),c=n(()=>o??[],[o]),l=q.useQueries(e=>c.map(t=>e.userManagement.listExternalIdentities({userId:t.id}))),u=q.auth.listLoginMethods.useQuery(),[f,p]=r(null),m=Ve({onSuccess:()=>void i.userManagement.listExternalIdentities.invalidate(),onError:e=>p(`Remove failed: ${e.message}`)}),h=n(()=>new Map((u.data??[]).flatMap(e=>e.kind===`redirect`?[[e.id,e.label]]:[])),[u.data]),g=c.flatMap((e,t)=>l[t]?.data??[]),_=g.map(e=>({...jt(e,a),kind:h.get(e.provider)??e.provider})),v=async n=>{let r=g.find(e=>Zt(e)===n.id);r!==void 0&&await t({title:e(`access.externalIdentitiesSection.removeSignInLink`,`Remove sign-in link`),message:e(`access.externalIdentitiesSection.willNoLongerBeAble`,`"{{ownerName}}" will no longer be able to sign in with this {{kind}} account.`,{ownerName:n.ownerName,kind:n.kind}),confirmLabel:e(`common.remove`,`Remove`),variant:`danger`})&&(p(null),m.mutate({userId:r.userId,provider:r.provider,subject:r.subject}))};return d(X,{notice:Z(f),onDismissNotice:()=>{p(null)},id:`external-identities`,title:e(`access.externalIdentitiesSection.signInLinks`,`Sign-in links`),icon:V,description:e(`access.externalIdentitiesSection.externalAccountsSingleSignOn`,`External accounts (single sign-on) each user linked to their CamStack account. Only the owner can link one, from their profile; an admin can remove it.`),children:d(Vt,{rows:_,label:`sign-in links`,isLoading:s||l.some(e=>e.isLoading),loadError:l.find(e=>e.isError)?.error?.message??null,emptyText:`No user has linked a sign-in account.`,expiresNone:`—`,action:{label:e(`common.remove`,`Remove`),icon:re,isAvailable:()=>!0,onRun:e=>void v(e),busyId:null,disabled:m.isPending}})})}e();function cn(){let{t:e}=Y(),t=G(),i=c(),a=Dt(),o=ke(),[s,l]=r(null),u=De({onSuccess:()=>void i.invalidateQueries({queryKey:[[`userManagement`,`listApiKeys`]]}),onError:e=>l(`Revoke failed: ${e.message}`)}),f=n(()=>(o.data??[]).map(e=>wt(e,a)),[o.data,a]),p=async n=>{await t({title:e(`access.legacyApiKeysSection.revoke`,`Revoke "{{name}}"?`,{name:n.name}),message:e(`access.legacyApiKeysSection.anyClientUsingThisKey`,`Any client using this key loses access immediately. This cannot be undone.`),confirmLabel:e(`access.legacyApiKeysSection.revoke2`,`Revoke`),variant:`danger`})&&(l(null),u.mutate({id:n.id}))};return d(X,{notice:Z(s),onDismissNotice:()=>{l(null)},id:`legacy-api-keys`,title:e(`access.legacyApiKeysSection.legacyApiKeys`,`Legacy API keys`),icon:H,description:e(`access.legacyApiKeysSection.keysFromBeforeScopedTokens`,`Keys from before scoped tokens. Nothing creates them any more; revoke them and issue a scoped token instead.`),children:d(Vt,{rows:f,label:e(`access.legacyApiKeysSection.legacyApiKeys2`,`legacy API keys`),isLoading:o.isLoading,loadError:o.isError?o.error?.message??`Request failed`:null,emptyText:`No legacy API keys.`,action:{label:e(`access.legacyApiKeysSection.revoke2`,`Revoke`),icon:h,isAvailable:()=>!0,onRun:e=>void p(e),busyId:u.isPending?u.variables?.id??null:null,disabled:u.isPending}})})}e();var ln={key:`access.nouns.linkedApp`};function un(e){if(e.type===`category`){let t=e.target??``;return t===`device`?J.t(`access.linkedAppsSection.allDevices`):J.t(`access.linkedAppsSection.allTarget`,{target:t})}if(e.type===`device`)return`device:[${(e.targets??[]).join(`,`)}]`;let t=e;return`${t.type}:${t.target??``}`}function dn(){let{t:e}=Y(),t=G(),i=c(),a=Pe(),[o,s]=r(null),l=()=>void i.invalidateQueries({queryKey:[[`userManagement`,`listOauthSessions`]]}),u=Le({onSuccess:l,onError:e=>s(`Revoke failed: ${e.message}`)}),f=Ct(`oauth-session`,ln,l),p=n(()=>(a.data??[]).map(e=>Et(e,e.scopes.map(un).join(`, `))),[a.data]),m=async n=>{await t({title:e(`access.linkedAppsSection.revokeTheLink`,`Revoke the "{{name}}" link?`,{name:n.name}),message:e(`access.linkedAppsSection.losesAccessForOnIts`,`{{name}} loses access for {{ownerName}} on its next call. Linking it again needs the account-link flow from the start.`,{name:n.name,ownerName:n.ownerName}),confirmLabel:e(`access.linkedAppsSection.revoke`,`Revoke`),variant:`danger`})&&(s(null),u.mutate({id:n.id}))},g=u.isPending?u.variables?.id??null:null;return d(X,{notice:Z(o,f.outcome),onDismissNotice:()=>{s(null),f.dismiss()},id:`linked-apps`,title:e(`access.linkedAppsSection.linkedApps`,`Linked apps`),icon:w,description:e(`access.linkedAppsSection.externalIntegrationsAlexaLinkedTo`,`External integrations (Alexa, …) linked to this hub through OAuth. Revoking one stops that integration on its next call. Already-revoked rows can be selected and removed from the list.`),children:d(Vt,{rows:p,label:e(`access.linkedAppsSection.linkedApps2`,`linked apps`),isLoading:a.isLoading,loadError:a.isError?a.error?.message??`Request failed`:null,emptyText:`No linked apps — an integration appears here once it completes the account-link flow.`,expiresNone:`—`,action:{label:e(`access.linkedAppsSection.revoke`,`Revoke`),icon:h,isAvailable:e=>e.status===`active`||e.status===`revoked`,onRun:e=>void m(e),busyId:g,disabled:u.isPending||f.busy},bulk:{revoke:f,noun:ln,isSelectable:e=>e.status===`active`||e.status===`revoked`,quickSelect:[{label:e(`access.linkedAppsSection.selectRevoked`,`Select revoked`),match:e=>e.status===`revoked`}]}})})}e();var fn={key:`access.nouns.session`};function pn(){let{t:e}=Y(),t=G(),i=q.useUtils(),a=Dt(),o=q.auth.listSessions.useQuery(),[s,c]=r(null),l=()=>void i.auth.listSessions.invalidate(),u=q.auth.revokeSessions.useMutation({onSuccess:l,onError:e=>c(`Sign out failed: ${e.message}`)}),f=Ct(`login-session`,fn,l),p=n(()=>(o.data??[]).map(e=>Tt(e,a,{client:e=>Xt(e).label,method:$t})),[o.data,a]),m=async n=>{await t({title:e(`access.loginSessionsSection.signOutThisSession`,`Sign out this session`),message:e(`access.loginSessionsSection.onWillHaveToSign`,`{{ownerName}} on {{name}} will have to sign in again.`,{ownerName:n.ownerName,name:n.name}),confirmLabel:e(`access.loginSessionsSection.signOut`,`Sign out`),variant:`danger`})&&(c(null),u.mutate({id:n.id}))};return d(X,{notice:Z(s,f.outcome),onDismissNotice:()=>{c(null),f.dismiss()},id:`login-sessions`,title:e(`access.loginSessionsSection.loginSessions`,`Login sessions`),icon:ne,description:e(`access.loginSessionsSection.everyBrowserAndAppSigned`,`Every browser and app signed in to this hub, for every user. Signing one out ends it at once; it has to sign in again. Your own current session is marked and never included in a bulk sign-out.`),children:d(Vt,{rows:p,label:e(`common.sessionsLabel`),isLoading:o.isLoading,loadError:o.isError?o.error?.message??`Request failed`:null,emptyText:`No active sessions.`,action:{label:e(`access.loginSessionsSection.signOut`,`Sign out`),icon:B,isAvailable:e=>e.status===`active`,onRun:e=>void m(e),busyId:u.isPending&&u.variables!==void 0&&`id`in u.variables?u.variables.id:null,disabled:u.isPending||f.busy},bulk:{revoke:f,noun:fn,isSelectable:e=>e.status===`active`}})})}function mn({token:e,label:t,onClose:n}){let{t:r}=Y();return d(ze,{open:!0,onOpenChange:e=>!e&&n(),children:a(ge,{width:`md`,scroll:`body`,children:[d(fe,{children:d($e,{children:r(`auth.tokenModals.token`,`Token: {{label}}`,{label:t})})}),a(ve,{className:`space-y-3`,children:[d(`div`,{className:`rounded-md border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning`,children:r(`auth.tokenModals.copyThisTokenNowOnce`,`Copy this token now. Once you close this dialog the secret cannot be displayed again.`)}),d(`div`,{className:`select-all break-all rounded-md border border-border bg-background p-2 font-mono text-[11px] text-foreground`,children:e})]}),a(nt,{children:[d(xe,{value:e,label:r(`common.copy`,`Copy`),srLabel:`token`}),d(U,{type:`button`,variant:`primary`,size:`sm`,onClick:n,children:r(`auth.tokenModals.done`,`Done`)})]})]})})}var hn={token:`newToken`,scoped:`newScoped`,admin:`newAdmin`};e();var gn=7,_n=90,vn=80;function yn(e){let t=Number(e);return Number.isInteger(t)&&t>=1&&t<=_n?t:null}function bn({open:e,users:n,onClose:i,onSubmitScoped:o,onSubmitAdmin:c,submitting:l,formError:u,awaitingProof:f}){let{t:p}=Y(),m=O(),{user:h}=bt(),g=h?.isAdmin===!0,_=g?null:h?.scopes??[],[v,y]=r(!1),[b,x]=r(n[0]?.id??``),[C,w]=r(``),[T,E]=r([{type:`capability`,target:``,access:[`view`,`create`]}]),[D,k]=r(``),[j,M]=r(String(gn));t(()=>{e||(y(!1),x(n[0]?.id??``),w(``),E([{type:`capability`,target:``,access:[`view`,`create`]}]),k(``),M(String(gn)))},[e,n]);let P=C.trim(),F=Ne(T,m),I=yn(j),L=!v&&b!==``&&P.length>0&&T.length>0&&F===null&&!l,R=v&&g&&P.length>0&&P.length<=vn&&I!==null&&!l&&!f,ee=()=>{if(v){if(!R||I===null)return;c({name:P,expiresInDays:I});return}if(!L)return;let e=parseInt(D,10),t=Number.isFinite(e)&&e>0?Date.now()+e*864e5:void 0;o({userId:b,name:P,scopes:T,...t===void 0?{}:{expiresAt:t}})},z=v,B=v?N:A;return d(st,{open:e,onClose:i,title:v?p(`access.createTokenModal.createAdminToken`,`Create admin token`):p(`access.createTokenModal.createToken`,`Create token`),icon:v?N:te,error:u,width:`md`,testId:`create-token-dialog`,footer:a(U,{type:`button`,variant:z?`danger`:`primary`,size:`sm`,onClick:ee,disabled:v?!R:!L,children:[l||f?d(S,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}):d(B,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),v?p(`access.createTokenModal.createAdminToken`,`Create admin token`):p(`access.createTokenModal.issueToken`,`Issue token`)]}),children:a(`div`,{className:`space-y-3`,children:[g?a(`label`,{className:`flex items-start gap-2 text-sm text-foreground`,children:[d(`input`,{type:`checkbox`,className:`mt-0.5`,checked:v,onChange:e=>y(e.target.checked),"data-testid":`token-as-admin`}),a(`span`,{children:[d(`span`,{className:`font-medium`,children:p(`access.createTokenModal.administrator`,`Administrator`)}),d(`span`,{className:`block text-[11px] text-foreground-subtle`,children:p(`access.createTokenModal.offScopedToASurface`,`Off = scoped to a surface. On = full admin for scripts (audited, max 90 days).`)})]})]}):null,v?d(`div`,{className:`space-y-1 rounded-md border border-danger/30 bg-danger/5 px-3 py-2 text-[11px] leading-relaxed text-foreground`,"data-testid":`admin-token-warning`,children:d(`p`,{children:d(pt,{i18nKey:`auth.adminTokenNoticeShort`,components:{strong:d(`strong`,{})}})})}):null,v?null:a(`div`,{className:`space-y-1`,children:[d(it,{htmlFor:`token-user`,children:p(`access.createTokenModal.onBehalfOfUser`,`On behalf of user`)}),d(at,{id:`token-user`,value:b,onChange:e=>x(e.target.value),options:n.map(e=>({value:e.id,label:e.username}))})]}),d(Se,{label:p(`access.createTokenModal.name`,`Name`),required:!0,children:d(Fe,{id:`token-name`,value:C,maxLength:vn,onChange:e=>w(e.target.value),placeholder:v?`nightly-backup`:`cloudflare-tunnel-route`,autoFocus:!0})}),v?a(`div`,{className:`space-y-1`,children:[d(it,{htmlFor:`token-admin-days`,children:p(`access.createTokenModal.expiresInDays`,`Expires in (days)`)}),d(Fe,{id:`token-admin-days`,type:`number`,min:1,max:_n,value:j,onChange:e=>M(e.target.value),state:I===null?`error`:`default`}),I===null?d(`p`,{className:`text-[11px] text-danger`,children:p(`auth.expiryInvalid`,{max:_n})}):d(`p`,{className:`text-[11px] text-foreground-subtle`,children:p(`auth.expiryHint`,{max:_n})})]}):a(s,{children:[a(`div`,{className:`space-y-1`,children:[d(it,{children:p(`access.createTokenModal.scopes`,`Scopes`)}),d(Ae,{value:T,onChange:E,clampToParent:_}),F&&d(`p`,{className:`text-[10px] text-danger`,children:F}),d(`p`,{className:`text-[10px] text-foreground-subtle`,children:p(`access.createTokenModal.eachScopePicksACap`,`Each scope picks a (cap or addon) target + one or more access flavours. The token can access ONLY what's listed.`)})]}),a(`div`,{className:`space-y-1`,children:[d(it,{htmlFor:`token-scoped-days`,children:p(`access.createTokenModal.expiresInDays`,`Expires in (days)`)}),d(Fe,{id:`token-scoped-days`,type:`number`,min:1,value:D,onChange:e=>k(e.target.value),placeholder:`30`}),d(`p`,{className:`text-[10px] text-foreground-subtle`,children:p(`access.createTokenModal.leaveBlankForNonExpiring`,`Leave blank for non-expiring.`)})]})]})]})})}e();var xn={key:`access.nouns.token`};function Sn(e,t){return e.type===`device`?`device:[${Ke(e.selector,t)}]`:`${e.type}:${e.target??``}`}function Cn({createRequested:e=!1,onCreateConsumed:i}){let{t:o}=Y(),s=O(),{user:l}=bt(),u=G(),f=c(),p=q.useUtils(),m=Dt(),{data:g,isLoading:_}=be(),v=n(()=>g??[],[g]),y=q.useQueries(e=>v.map(t=>e.userManagement.listScopedTokens({userId:t.id}))),b=q.auth.listAdminTokens.useQuery(void 0,{enabled:l?.isAdmin===!0}),{requestProof:x,dialog:S}=Mt(`Creating an admin token`),{state:C,openNew:w,close:T}=Ee({newKey:hn.token}),[E,D]=r(null),[k,A]=r(null),[j,M]=r(!1),[N,P]=r(null),[F,I]=r(null);t(()=>{e&&(w(),i?.())},[e,w,i]);let L=()=>{f.invalidateQueries({queryKey:[[`userManagement`,`listScopedTokens`]]}),p.auth.listAdminTokens.invalidate(),p.auth.listAuthAudit.invalidate()},R=he({onSuccess:({token:e,record:t})=>{L(),T(),A(null),P({token:e,label:t.name})},onError:e=>{D(`Create failed: ${e.message}`),A(`Create failed: ${e.message}`)}}),ee=q.auth.createAdminToken.useMutation({onSuccess:({token:e,record:t})=>{L(),T(),A(null),M(!1),P({token:e,label:t.name})},onError:e=>{D(`Create failed: ${e.message}`),A(`Create failed: ${e.message}`),M(!1)}}),z=ct({onSuccess:()=>{I(null),L()},onError:e=>{I(null),D(`Revoke failed: ${e.message}`)}}),B=q.auth.revokeAdminToken.useMutation({onSuccess:()=>{I(null),L()},onError:e=>{I(null),D(`Revoke failed: ${e.message}`)}}),V=Ot(xn,L),H=Date.now(),ne=v.flatMap((e,t)=>(y[t]?.data??[]).map(t=>kt(t,e.id,m,t.scopes.map(e=>Sn(e,s)).join(`, `),H))),re=l?.isAdmin===!0?(b.data??[]).map(e=>At(e,m,H)):[],ie=[...ne,...re],ae=y.find(e=>e.isError)?.error?.message??(b.isError?b.error?.message??`Request failed`:null),oe=async e=>{let t=e.kind===Qt;await u({title:o(`access.tokensSection.revoke`,`Revoke "{{name}}"?`,{name:e.name}),message:t?o(`access.tokensSection.everyScriptUsingItLoses`,`Every script using it loses access immediately. This cannot be undone.`):o(`access.tokensSection.sScopedTokenStopsWorking`,`{{ownerName}}'s scoped token stops working on its next use. This cannot be undone.`,{ownerName:e.ownerName}),confirmLabel:o(`access.tokensSection.revoke2`,`Revoke`),variant:`danger`})&&(D(null),I(e.id),t?B.mutate({id:e.id}):z.mutate({id:e.id}))},se=R.isPending||ee.isPending;return a(`div`,{"data-testid":`tokens`,children:[S,d(X,{notice:Z(E,V.outcome),onDismissNotice:()=>{D(null),V.dismiss()},id:`tokens`,title:o(`access.tokensSection.tokens`,`Tokens`),icon:te,description:o(`access.tokensSection.scopedTokensForANarrow`,`Scoped tokens for a narrow surface, and admin tokens for full-administrator scripts. Revoking one stops it on its next use.`),children:d(Vt,{rows:ie,label:o(`common.tokensLabel`),isLoading:_||y.some(e=>e.isLoading)||l?.isAdmin===!0&&b.isLoading,loadError:ae,emptyText:`No tokens.`,action:{label:o(`access.tokensSection.revoke2`,`Revoke`),icon:h,isAvailable:e=>e.status===`active`,onRun:e=>void oe(e),busyId:F,disabled:V.busy||F!==null},bulk:{revoke:V,noun:xn,isSelectable:e=>e.status===`active`}})}),d(bn,{open:C.mode===`new`,users:v.map(e=>({id:e.id,username:e.username})),onClose:()=>{T(),A(null),M(!1)},submitting:se,formError:k,awaitingProof:j,onSubmitScoped:e=>R.mutate({userId:e.userId,name:e.name,scopes:e.scopes,expiresAt:e.expiresAt}),onSubmitAdmin:e=>{(async()=>{D(null),A(null),M(!0);let t=await x();M(!1),t!==null&&ee.mutate({...e,reauthToken:t})})()}}),N&&d(mn,{token:N.token,label:N.label,onClose:()=>P(null)})]})}var wn={"share-link":`helpers.authAuditWording.bulkNoun.shareLink`,"admin-token":`helpers.authAuditWording.bulkNoun.adminToken`,"login-session":`helpers.authAuditWording.bulkNoun.loginSession`};function Q(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:null}function Tn(e,t){let n=Q(e,`tokenId`);return Q(e,`name`)??(n===null?void 0:t.get(n))??n??`?`}function En(e){return e.filter(e=>e!==null)}function Dn(e){let t=Q(e,`prefix`);return t===null?null:J.t(`helpers.authAuditWording.prefix`,{prefix:t})}function On(e,t){let n=e.detail??{};switch(e.action){case`admin-token-created`:{let e=n.expiresAt;return{title:J.t(`helpers.authAuditWording.tokenCreated`,{name:Tn(n,t)}),details:En([Dn(n),typeof e==`number`?J.t(`helpers.authAuditWording.expires`,{at:Pt(e)}):null])}}case`admin-token-used`:{let e=Q(n,`path`);return{title:J.t(`helpers.authAuditWording.tokenUsed`,{name:Tn(n,t)}),details:En([Dn(n),e===null?null:J.t(`helpers.authAuditWording.call`,{path:e})])}}case`admin-token-revoked`:return{title:J.t(`helpers.authAuditWording.tokenRevoked`,{name:Tn(n,t)}),details:En([Dn(n)])};case`credentials-revoked`:{let e=Q(n,`kind`)??`credential`,t=n.revoked,r=n.skipped,i=wn[e],a=i===void 0?`${e}s`:J.t(i);return{title:J.t(`helpers.authAuditWording.bulkRevoked`,{n:typeof t==`number`?String(t):`?`,noun:a}),details:En([typeof r==`number`&&r>0?J.t(`helpers.authAuditWording.skipped`,{count:r}):null,Q(n,`ids`)===null?null:J.t(`helpers.authAuditWording.ids`,{ids:Q(n,`ids`)??``})])}}case`second-factor-skipped`:{let e=Q(n,`method`),t=Q(n,`factors`);return{title:J.t(`helpers.authAuditWording.secondFactorSkipped`),details:En([e===null?null:J.t(`helpers.authAuditWording.signedInWith`,{method:$t(e)}),t===null?null:J.t(`helpers.authAuditWording.skippedFactors`,{factors:t.split(`,`).join(`, `)})])}}default:return{title:e.action,details:Object.entries(n).map(([e,t])=>`${e}: ${String(t)}`)}}}e();var kn=100;function An(){let{user:e}=bt();return e?.isAdmin?d(Mn,{}):null}function jn(){let{data:e}=be(),{data:t}=q.auth.listAdminTokens.useQuery();return n(()=>{let n=new Map;for(let t of e??[])n.set(t.id,t.username);let r=new Map;for(let e of t??[])r.set(e.id,e.name);return{userNameById:n,tokenNameById:r}},[e,t])}function Mn(){let{t:e}=Y(),t=q.auth.listAuthAudit.useQuery({limit:kn}),{userNameById:n,tokenNameById:r}=jn(),i=t.data??[];return a(`div`,{"data-testid":`auth-audit`,className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[a(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[d(D,{className:`h-3.5 w-3.5 text-foreground-subtle`}),d(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`auth.authAuditSection.authenticationAudit`,`Authentication audit`)}),d(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:e(`auth.authAuditSection.latest`,{count:kn})})]}),d(`div`,{className:`p-4`,children:t.isLoading?a(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[d(S,{className:`h-3.5 w-3.5 animate-spin`}),e(`auth.authAuditSection.loadingAuditTrail`,`Loading audit trail…`)]}):t.isError?a(`div`,{className:`text-[11px] text-danger`,children:[e(`auth.authAuditSection.couldNotLoadTheAudit`,`Could not load the audit trail:`),` `,t.error?.message??e(`auth.authAuditSection.requestFailed`,`Request failed`)]}):i.length===0?a(`div`,{className:`rounded border border-dashed border-border px-3 py-4 text-xs text-foreground-subtle text-center space-y-1`,children:[d(`div`,{children:e(`auth.authAuditSection.noAuthenticationEventsRecordedYet`,`No authentication events recorded yet.`)}),d(`div`,{className:`text-[11px] text-foreground-subtle/90`,children:e(`auth.authAuditSection.thisTrailRecordsAdminToken`,`This trail records admin-token create/use/revoke, trusted-network 2FA skips, and credential revokes (including single share-link revoke). Browser password logins are not listed here.`)})]}):d(`ul`,{className:`divide-y divide-border rounded-md border border-border max-h-[420px] overflow-y-auto`,children:i.map(e=>d(Nn,{record:e,userName:e.userId===void 0?null:n.get(e.userId)??e.userId,tokenNameById:r},e.id))})})]})}function Nn({record:e,userName:t,tokenNameById:n}){let r=On(e,n);return a(`li`,{"data-testid":`auth-audit-row`,className:`px-3 py-2 text-xs space-y-0.5`,children:[a(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[d(`span`,{className:`font-medium text-foreground`,children:r.title}),d(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:Pt(e.at)})]}),a(`div`,{className:`flex flex-wrap gap-x-3 text-[11px] text-foreground-subtle`,children:[t!==null&&d(`span`,{className:`text-foreground`,children:t}),e.ip!==void 0&&d(`span`,{className:`font-mono`,children:e.ip}),r.details.map(e=>d(`span`,{className:`font-mono`,children:e},e))]})]})}e();var $={loginSessions:`login-sessions`,linkedApps:`linked-apps`,tokens:`tokens`,scopedTokens:`scoped-tokens`,adminTokens:`admin-tokens`,shareLinks:`share-links`,legacyApiKeys:`legacy-api-keys`,externalIdentities:`external-identities`,audit:`auth-audit`},Pn={[$.scopedTokens]:$.tokens,[$.adminTokens]:$.tokens};function Fn(e){return[{id:$.loginSessions,label:J.t(`system.access.loginSessions`,`Login sessions`),icon:ne,render:()=>d(pn,{})},{id:$.linkedApps,label:J.t(`system.access.linkedApps`,`Linked apps`),icon:w,render:()=>d(dn,{})},{id:$.tokens,label:J.t(`system.access.tokens`,`Tokens`),icon:te,render:({createRequested:e,onCreateConsumed:t})=>d(Cn,{headerOwnsCreate:!0,createRequested:e,onCreateConsumed:t})},{id:$.shareLinks,label:J.t(`system.access.shareLinks`,`Share links`),icon:C,render:()=>d(Rt,{})},...e?[{id:$.legacyApiKeys,label:J.t(`system.access.legacyApiKeys`,`Legacy API keys`),icon:H,render:()=>d(cn,{})}]:[],{id:$.externalIdentities,label:J.t(`system.access.signInLinks`,`Sign-in links`),icon:V,render:()=>d(sn,{})},{id:$.audit,label:J.t(`system.access.audit`,`Audit`),icon:D,render:()=>d(An,{})}]}function In({createRequested:e=!1,onCreateConsumed:t}){let{t:r}=Y(),i=ke(),o=(i.data??[]).length>0,s=n(()=>Fn(o),[o]),c=en({ids:n(()=>s.map(e=>e.id),[s]),answered:!i.isLoading}),l=dt(),[u]=gt(),f=u.get(`integration`),p=f===null?void 0:Pn[f];if(p!==void 0){let e=new URLSearchParams(u);return e.set(`integration`,p),d(mt,{to:`?${e.toString()}`,replace:!0})}let m=s.find(e=>e.id===c.selectedId)??s[0],h=m?.id??$.loginSessions;return i.isLoading?d(`div`,{className:`text-sm text-foreground-subtle`,"data-testid":`access-page`,children:r(`common.loading`,`Loading…`)}):a(`div`,{className:`flex flex-col gap-3`,"data-testid":`access-page`,children:[d(Ye,{appearance:`pills`,value:h,onValueChange:e=>{l(`?${vt(u,e,null,null).toString()}`)},children:d(rt,{"aria-label":r(`system.access.credentialKinds`,`Credential kinds`),children:s.map(e=>a(ot,{value:e.id,"data-testid":`access-kind-${e.id}`,children:[d(e.icon,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),e.label]},e.id))})}),m===void 0?null:d(`div`,{role:`region`,"aria-label":m.label,"data-testid":`access-kind-body`,children:m.render({createRequested:e&&m.id===$.tokens,onCreateConsumed:t??(()=>void 0)})},m.id)]})}function Ln(e,t){if(e===$.tokens)return a(U,{size:`sm`,type:`button`,"data-testid":`access-new-token`,onClick:t,children:[d(te,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),J.t(`system.access.newToken`,`New token`)]})}function Rn(){let[e,t]=r(!1);return{createRequested:e,requestCreate:()=>t(!0),clearCreate:()=>t(!1)}}e();var zn=[`oidcConnections`,`listConnections`],Bn=[`oidcConnections`,`connectionFormSchema`],Vn={displayName:`OpenID Connect`,icon:`shield-check`,issuerUrl:``,clientId:``,clientSecret:``,redirectUri:``,scopes:`openid profile email`,usernameClaim:`preferred_username`},Hn=/^[a-z0-9][a-z0-9-]{0,63}$/;function Un(e){return e instanceof Error?e.message:String(e)}function Wn(e,t){if(t)return typeof e==`string`&&e.length>0?e:void 0;if(ue(e))return oe;if(typeof e==`string`&&e.length>0)return e;ie(e)}function Gn(e){return typeof e!=`object`||!e?!1:Array.isArray(Reflect.get(e,`sections`))}function Kn({addonId:e}){let{t:f}=Y(),p=j(),m=c(),g=G(),v=Ee({editKey:`oidcEdit`,newKey:`oidcNew`}),[y,b]=r(!1),[x,S]=r(null),[C,w]=r(``),[T,E]=r({...Vn}),D=l(null),O=o({queryKey:[...zn,e],queryFn:async()=>p.trpcClient.oidcConnections.listConnections.query({})}),k=o({queryKey:Bn,queryFn:async()=>p.trpcClient.oidcConnections.connectionFormSchema.query({})}),M=O.data??[],N=Gn(k.data)?k.data:void 0,P=v.state,F=P.mode===`edit`?M.find(e=>e.id===P.id)??null:null;t(()=>{if(v.state.mode===`edit`&&F!==null){let e=`edit:${F.id}`;if(D.current===e)return;D.current=e,S(null),w(F.id),E(F.formValues===void 0?{...Vn}:{...F.formValues});return}if(v.state.mode===`new`){if(D.current===`new`)return;D.current=`new`,S(null),w(``),E({...Vn})}},[F,v.state]);let I=i(async()=>{await m.invalidateQueries({queryKey:zn})},[m]),L=u({mutationFn:async e=>p.trpcClient.oidcConnections.deleteConnection.mutate({id:e}),onSuccess:async()=>I()}),R=i(async e=>{await g({title:f(`system.oidcSettingsConnections.deleteOidcConnection`,`Delete OIDC connection?`),message:f(`system.oidcSettingsConnections.removeTheLoginButtonAnd`,`Remove “{{displayName}}” ({{id}}). The login button and IdP credentials for this id are dropped.`,{displayName:e.displayName,id:e.id}),confirmLabel:f(`common.delete`,`Delete`),cancelLabel:f(`common.cancel`,`Cancel`),variant:`danger`})&&(await L.mutateAsync(e.id),v.state.mode===`edit`&&v.state.id===e.id&&(v.close(),D.current=null))},[g,L,v,f]),ee=i(async()=>{let e=T.displayName,t=typeof e==`string`&&e.trim()!==``?e.trim():``;if(t===``){S(`Display name is required.`);return}let n=v.state.mode===`new`,r=n?C.trim():F?.id??``;if(n&&!Hn.test(r)){S(`Instance id must be a lowercase slug (e.g. authentik, google).`);return}if(r===``){S(`That connection is no longer available.`);return}let i=Wn(T.clientSecret,n),a=T.icon,o=T.issuerUrl,s=T.clientId,c=T.redirectUri,l=T.scopes,u=T.usernameClaim,d=u===`email`||u===`sub`?u:`preferred_username`;b(!0),S(null);try{n&&await p.trpcClient.oidcConnections.createConnection.mutate({id:r,displayName:t}),await p.trpcClient.oidcConnections.updateConnection.mutate({id:r,displayName:t,icon:typeof a==`string`?a:`shield-check`,issuerUrl:typeof o==`string`?o:``,clientId:typeof s==`string`?s:``,...i===void 0?{}:{clientSecret:i},redirectUri:typeof c==`string`?c:``,scopes:typeof l==`string`?l:`openid profile email`,usernameClaim:d}),await I(),v.close(),D.current=null}catch(e){S(Un(e))}finally{b(!1)}},[C,F?.id,v,T,I,p]),z=n(()=>[{key:`id`,header:f(`system.oidcSettingsConnections.id`,`Id`),sortValue:e=>e.id,render:e=>d(`span`,{className:`font-mono text-xs text-foreground`,children:e.id})},{key:`name`,header:f(`system.oidcSettingsConnections.name`,`Name`),sortValue:e=>e.displayName,render:e=>d(`span`,{className:`truncate font-medium text-foreground`,children:e.displayName})},{key:`issuer`,header:f(`system.oidcSettingsConnections.issuer`,`Issuer`),sortValue:e=>e.issuerUrl,render:e=>d(`span`,{className:`truncate text-xs text-foreground-muted`,children:e.issuerUrl===``?`—`:e.issuerUrl})},{key:`status`,header:f(`system.oidcSettingsConnections.status`,`Status`),notSortableReason:`Badge`,render:e=>d(K,{variant:e.configured?`success`:`warning`,children:e.configured?f(`system.oidcSettingsConnections.configured`,`Configured`):f(`system.oidcSettingsConnections.notConfigured`,`Not configured`)})},{key:`actions`,header:``,align:`right`,notSortableReason:`Row actions`,nowrap:!0,render:e=>a(`div`,{className:`flex justify-end gap-1`,children:[d(U,{type:`button`,size:`sm`,variant:`secondary`,onClick:t=>{t.stopPropagation(),v.openEdit(e.id)},children:f(`common.edit`,`Edit`)}),d(U,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":f(`system.oidcSettingsConnections.delete`,`Delete {{displayName}}`,{displayName:e.displayName}),title:f(`common.delete`,`Delete`),onClick:t=>{t.stopPropagation(),R(e)},children:d(h,{className:`h-3.5 w-3.5 text-danger`})})]})}],[v,R,f]),B=v.state.mode===`new`,V=B||F!==null,H=B?`new`:F===null?`closed`:`edit:${F.id}:${F.configured?`cfg`:`empty`}`;return a(`div`,{className:`flex min-h-0 flex-col gap-3`,"data-testid":`oidc-settings-connections`,children:[a(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[a(`p`,{className:`text-sm text-foreground-muted`,children:[f(`system.oidcSettingsConnections.eachRowIsOneIdp`,`Each row is one IdP. Redirect URI:`),` `,d(`span`,{className:`font-mono text-xs`,children:`/addon/${e}/<id>/callback`})]}),a(U,{type:`button`,size:`sm`,"data-testid":`oidc-connections-add`,onClick:()=>v.openNew(),children:[d(_,{className:`h-3.5 w-3.5`}),f(`system.oidcSettingsConnections.addConnection`,`Add connection`)]})]}),O.isError?d(`p`,{className:`text-sm text-danger`,children:f(`system.oidcSettingsConnections.couldNotLoadConnections`,`Could not load connections.`)}):null,O.isPending?d(lt,{className:`h-32 w-full`}):d(Be,{columns:z,rows:M,rowKey:e=>e.id,pageSize:25,emptyMessage:f(`system.oidcSettingsConnections.noOidcConnectionsYetAdd`,`No OIDC connections yet. Add one to register an IdP.`),onRowClick:e=>v.openEdit(e.id),defaultSort:{columnKey:`name`,dir:`asc`}}),d(st,{open:V,onClose:()=>{v.close(),S(null),D.current=null},title:B?f(`system.oidcSettingsConnections.addOidcConnection`,`Add OIDC connection`):f(`system.oidcSettingsConnections.edit`,`Edit {{value1}}`,{value1:F?.displayName??`connection`}),icon:A,width:`xl`,testId:`oidc-connection-editor`,error:x,footer:d(U,{type:`button`,size:`sm`,disabled:y||B&&C.trim()===``,onClick:()=>void ee(),children:y?f(`system.oidcSettingsConnections.saving`,`Saving…`):f(`common.save`,`Save`)}),children:V?a(s,{children:[B?a(`div`,{children:[d(it,{htmlFor:`oidc-connection-id`,children:f(`system.oidcSettingsConnections.instanceId`,`Instance id`)}),d(Fe,{id:`oidc-connection-id`,value:C,onChange:e=>w(e.target.value),placeholder:`authentik`,autoComplete:`off`}),d(`p`,{className:`mt-1 text-xs text-foreground-muted`,children:f(`system.oidcSettingsConnections.urlSlugAppearsInAddon`,`URL slug — appears in /addon/{{addonId}}/<id>/callback. Stable; renaming is not supported after save.`,{addonId:e})})]}):a(`p`,{className:`text-sm text-foreground-muted`,children:[f(`system.oidcSettingsConnections.instanceId2`,`Instance id:`),` `,d(`span`,{className:`font-mono`,children:F?.id})]}),N===void 0?d(`p`,{className:`text-sm text-foreground-muted`,children:f(`system.oidcSettingsConnections.loadingForm`,`Loading form…`)}):d(Je,{schema:N,values:T,onChange:E,bare:!0},H)]}):null})]})}e();var qn=3e4,Jn=[{capName:`auth-provider`,stageBadge:null},{capName:`user-passkeys`,stageBadge:`Second factor`}],Yn={titleKey:`system.authentication.sectionTitle`,subtitleKey:`system.authentication.sectionSubtitle`,emptyTitleKey:`system.authentication.sectionEmptyTitle`,emptyDescriptionKey:`system.authentication.sectionEmptyDescription`,installLabelKey:`system.authentication.sectionInstall`};function Xn(e){return e===`local-auth`?{headline:`Username + password (local).`,icon:L,bullets:[`Users live in the hub’s SQLite database — no IdP roundtrip.`,`TOTP / 2FA is self-enrolled: each user enables it from their own profile page (My access → Two-factor authentication).`,`Scoped tokens, admin tokens and sessions are managed from Identity → Tokens & sessions.`],setupSteps:[`A fresh hub has one account, admin / changeme — the first sign-in asks for a new password. Add users from Users → New user.`,`Hand out either passwords or scoped tokens — both validate through this provider.`]}:e.startsWith(`auth-oidc`)?{headline:`OpenID Connect (Google, Microsoft, Okta, Keycloak, …).`,icon:z,bullets:[`Three-leg redirect flow with PKCE S256 + nonce.`,`id_token is signature-verified against the IdP’s JWKS — no implicit trust.`,`Explicit linking only: an IdP account signs in only the CamStack user who linked it from their profile (My access → Linked sign-in accounts). No auto-created users, no email matching.`,`The linked user’s role, scopes and two-factor authentication apply.`],setupSteps:[`Register a web app at your IdP and copy the client_id + client_secret.`,"Choose a stable instance id (slug). Set the IdP redirect URI to `https://<this-hub>/addon/auth-oidc/<id>/callback`.",`In Settings below, Add connection — enter the id, issuer, and credentials; Save.`,`Each user then links their IdP account from My access → Linked sign-in accounts.`]}:e.startsWith(`auth-saml`)?{headline:`SAML 2.0 — enterprise SSO (Azure AD, Okta, OneLogin).`,icon:z,bullets:[`Heavier handshake than OIDC — exchange metadata XML with your IdP.`,`Group → role mapping via SAML assertions.`]}:e.startsWith(`auth-webauthn`)||e.startsWith(`auth-passkey`)?{headline:`Passkeys / WebAuthn — passwordless second factor.`,icon:y,bullets:[`Enroll a YubiKey, Touch ID, or platform passkey per user.`,`Resistant to phishing — the browser binds the credential to your hub origin.`]}:e.startsWith(`auth-totp`)?{headline:`TOTP — second factor.`,icon:y,bullets:[`Time-based codes from an authenticator app (RFC 6238).`,`Compatible with Google Authenticator, Aegis, 1Password, Bitwarden, etc.`]}:{headline:`Authentication provider.`,icon:A,bullets:[`Generic authentication provider. No additional hints registered.`]}}function Zn(){let{t:e}=Y(),t=_e({capName:Jn[0].capName},{refetchInterval:qn}),r=_e({capName:Jn[1].capName},{refetchInterval:qn}),i=ye(void 0,{refetchInterval:qn}),a=n(()=>on(i.data??[]),[i.data]),o=n(()=>{let e=[],n=[t.data??[],r.data??[]];for(let[t,r]of Jn.entries())for(let i of n[t]??[])e.push({addonId:i.addonId,displayName:a.get(i.addonId)??i.addonId,isActive:i.isActive,capName:r.capName,stageBadge:r.stageBadge});return e},[t.data,r.data,a]),s=[{id:`authentication`,label:e(`system.authentication.authenticationProviders`,`Authentication providers`),install:{capability:Jn[0].capName,label:e(Yn.installLabelKey)},entries:o.map(t=>({id:t.addonId,name:t.displayName,fallbackIcon:A,...an(t.isActive),render:()=>d(tn,{addonId:t.addonId,displayName:t.displayName,capName:t.capName,isActive:t.isActive,badges:t.stageBadge===null?null:d(K,{variant:`info`,className:nn,children:t.stageBadge}),settingsContent:t.addonId.startsWith(`auth-oidc`)?d(Kn,{addonId:t.addonId}):void 0,panels:[{id:`about`,title:e(`system.authentication.about`,`About`),icon:Xn(t.addonId).icon,content:d(Qn,{addonId:t.addonId})}]})}))}];return d(rn,{embedded:!0,icon:A,title:e(Yn.titleKey),subtitle:e(Yn.subtitleKey),groups:s,isLoading:t.isLoading||r.isLoading,emptyTitle:e(Yn.emptyTitleKey),emptyDescription:e(Yn.emptyDescriptionKey)})}function Qn({addonId:e}){let{t}=Y(),n=Xn(e),r=n.icon;return a(`div`,{className:`space-y-3 rounded-lg border border-border bg-surface p-2 sm:p-4`,children:[a(`div`,{className:`flex items-start gap-2.5`,children:[d(r,{className:`h-4 w-4 mt-0.5 text-primary shrink-0`}),d(`div`,{className:`text-xs text-foreground font-medium`,children:n.headline})]}),d(`ul`,{className:`text-xs text-foreground-subtle space-y-1.5 pl-6 list-disc`,children:n.bullets.map((e,t)=>d(`li`,{children:e},t))}),n.setupSteps&&n.setupSteps.length>0&&a(`div`,{className:`rounded-md border border-border bg-surface-hover/40 px-3 py-2.5 space-y-1.5`,children:[a(`div`,{className:`flex items-center gap-1.5 text-[10px] font-semibold text-foreground-subtle uppercase tracking-wide`,children:[d(R,{className:`h-3 w-3`}),t(`system.authentication.setupSteps`,`Setup steps`)]}),d(`ol`,{className:`text-xs text-foreground space-y-0.5 pl-4 list-decimal`,children:n.setupSteps.map((e,t)=>d(`li`,{children:e},t))})]}),e===`local-auth`&&a(`div`,{className:`rounded-md border border-info/30 bg-info/5 px-3 py-2 flex items-start gap-2 text-[11px] text-foreground`,children:[d(M,{className:`h-3.5 w-3.5 mt-0.5 text-info shrink-0`}),d(`span`,{children:d(pt,{i18nKey:`system.authentication.totpNote`,components:{access:d(ft,{to:`/system/my-access`,className:`underline text-primary`}),users:d(ft,{to:`/system/identity?tab=users`,className:`underline text-primary`})}})})]})]})}function $n({isPending:e,error:t,what:n,onRetry:r,children:i}){let{t:o}=Y();return e?a(`div`,{className:`flex items-center gap-2 py-3 text-xs text-foreground-subtle`,role:`status`,"data-testid":`query-pending`,children:[d(S,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),o(`certificates.queryBody.reading`,{what:n})]}):t===null?i:d(Oe,{title:o(`certificates.queryBody.couldNotRead`,`Could not read {{what}}`,{what:n}),message:t.message.length>0?t.message:o(`certificates.queryBody.requestFailed`,`Request failed`),onRetry:r})}function er(){let{t:e}=Y(),t=q.deviceCredentials.getDeviceCaStatus.useQuery({}),n=t.data;return d(X,{id:`device-ca`,title:e(`certificates.deviceCaCard.deviceCertificateAuthority`,`Device certificate authority`),icon:A,description:e(`certificates.deviceCaCard.signsTheCertificateEachPaired`,`Signs the certificate each paired device holds. It is created the first time a device is paired.`),children:d($n,{isPending:t.isPending,error:t.error,what:`the device CA`,onRetry:()=>void t.refetch(),children:n!==void 0&&a(`div`,{className:`space-y-1`,"data-testid":`device-ca-status`,children:[a(W,{label:e(`certificates.deviceCaCard.state`,`State`),children:[n.state===`ready`&&d(K,{variant:`success`,children:e(`certificates.deviceCaCard.ready`,`Ready`)}),n.state===`absent`&&d(K,{variant:`default`,children:e(`certificates.deviceCaCard.notCreatedYet`,`Not created yet`)}),n.state===`unavailable`&&d(K,{variant:`danger`,children:e(`certificates.deviceCaCard.unavailable`,`Unavailable`)})]}),n.state===`ready`&&a(s,{children:[d(W,{label:e(`certificates.deviceCaCard.subject`,`Subject`),valueClassName:`font-mono`,children:n.subject}),d(W,{label:e(`certificates.deviceCaCard.fingerprintSha256`,`Fingerprint (SHA-256)`),valueClassName:`font-mono`,children:n.fingerprintSha256}),d(W,{label:e(`certificates.deviceCaCard.validUntil`,`Valid until`),children:n.validTo})]}),n.state===`unavailable`&&d(W,{label:e(`certificates.deviceCaCard.reason`,`Reason`),children:d(`span`,{className:`text-danger`,children:n.reason})})]})})})}e();function tr(){let{t:e}=Y(),t=q.useUtils(),n=q.deviceCredentials.getDeviceCertificateSettings.useQuery({}),[i,o]=r(null),s=q.deviceCredentials.setDeviceCertificateSettings.useMutation({onSuccess:()=>{o(null),t.deviceCredentials.getDeviceCertificateSettings.invalidate()},onError:e=>o(`Could not save: ${e.message}`)});return d($n,{isPending:n.isPending,error:n.error,what:`the enrollment setting`,onRetry:()=>void n.refetch(),children:n.data!==void 0&&a(W,{label:e(`certificates.deviceSettingsRow.usersCanEnrollTheirOwn`,`Users can enroll their own devices`),actions:d(Ze,{checked:n.data.selfEnrollment===`allowed`,disabled:s.isPending,"aria-label":e(`certificates.deviceSettingsRow.usersCanEnrollTheirOwn`,`Users can enroll their own devices`),onCheckedChange:e=>s.mutate({selfEnrollment:e?`allowed`:`disabled`})}),children:[d(`span`,{className:`text-[11px] text-foreground-subtle`,children:n.data.selfEnrollment===`allowed`?e(`certificates.deviceSettingsRow.allowedAUserSignedIn`,`Allowed - a user signed in on a phone can keep it signed in. Pairing by QR works either way.`):e(`certificates.deviceSettingsRow.disabledOnlyAnAdminCan`,`Disabled - only an admin can pair a device, with a QR code.`)}),i!==null&&d(`span`,{className:`block text-[11px] text-danger`,children:i})]})})}e();function nr(e){let[n,i]=r(()=>Date.now());return t(()=>{let t=setInterval(()=>i(Date.now()),e);return()=>clearInterval(t)},[e]),n}e();var rr=80,ir=208;function ar({open:e,users:t,onClose:n,onPaired:i}){let{t:o}=Y(),s=q.deviceCredentials.startEnrollment.useMutation({onSuccess:i}),[c,l]=r(``),[u,f]=r(``),p=c===``?t[0]?.id??``:c,m=s.data,h=()=>{s.reset(),f(``),n()};return d(st,{open:e,onClose:h,title:o(`certificates.pairDeviceDialog.pairADevice`,`Pair a device`),icon:y,width:`md`,testId:`pair-device-dialog`,error:s.isError?s.error.message:null,footer:m===void 0?a(U,{type:`button`,onClick:()=>{let e=u.trim();p===``||e===``||s.mutate({userId:p,deviceName:e})},disabled:s.isPending||p===``||u.trim()===``,children:[s.isPending&&d(S,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),o(`certificates.pairDeviceDialog.createPairingCode`,`Create pairing code`)]}):d(U,{type:`button`,variant:`outline`,onClick:h,children:o(`certificates.pairDeviceDialog.done`,`Done`)}),children:m===void 0?a(`div`,{className:`space-y-3`,children:[d(`p`,{className:`text-[11px] text-foreground-subtle`,children:o(`certificates.pairDeviceDialog.createsAOneTimeCode`,`Creates a one-time code for a phone you hold. Scan it with the CamStack app on that phone; the phone then stays signed in as the chosen user until you revoke it.`)}),d(Se,{label:o(`certificates.pairDeviceDialog.user`,`User`),required:!0,children:d(at,{value:p,onChange:e=>l(e.target.value),options:t.map(e=>({value:e.id,label:e.username}))})}),d(Se,{label:o(`certificates.pairDeviceDialog.deviceName`,`Device name`),required:!0,description:o(`certificates.pairDeviceDialog.howThisPhoneIsListed`,`How this phone is listed, e.g. Anna's iPhone.`),children:d(Fe,{value:u,maxLength:rr,onChange:e=>f(e.target.value),placeholder:o(`certificates.pairDeviceDialog.annaSIphone`,`Anna's iPhone`),autoFocus:!0})})]}):d(or,{enrollUrl:m.enrollUrl,expiresAt:m.expiresAt,hubKnown:m.hubOrigin!==null,onRestart:()=>s.reset()})})}function or({enrollUrl:e,expiresAt:t,hubKnown:n,onRestart:r}){let{t:i}=Y(),o=Gt(t,nr(1e3));return d(`div`,{className:`space-y-3`,"data-testid":`pair-issued`,children:a(`div`,{className:`flex flex-col items-center gap-3 sm:flex-row sm:items-start`,children:[d(`div`,{className:o.expired?`opacity-30`:void 0,children:d(me,{value:e,size:ir,alt:i(`certificates.pairDeviceDialog.enrollmentQrCode`,`Enrollment QR code`)})}),a(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[d(`p`,{className:`text-[11px] text-foreground-subtle`,children:i(`certificates.pairDeviceDialog.openTheCamstackAppOn`,`Open the CamStack app on the phone and scan this code. It works once.`)}),d(`div`,{className:`text-sm font-semibold tabular-nums text-foreground`,role:`timer`,"data-testid":`pair-countdown`,children:o.expired?i(`certificates.pairDeviceDialog.expiredCreateANewCode`,`Expired - create a new code`):i(`certificates.pairDeviceDialog.expiresIn`,`Expires in {{label}}`,{label:o.label})}),a(`div`,{className:`flex items-center gap-1 rounded-md border border-border bg-background px-2 py-1`,children:[d(`code`,{className:`min-w-0 flex-1 select-all break-all font-mono text-[11px] text-foreground`,children:e}),d(xe,{value:e,srLabel:`Enrollment link`})]}),!n&&a(`div`,{className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-1.5 text-[11px] text-foreground`,children:[d(g,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`,"aria-hidden":!0}),d(`span`,{children:i(`certificates.pairDeviceDialog.theHubCouldNotName`,`The hub could not name an address for this link, so the app must already know it.`)})]}),o.expired&&d(U,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:i(`certificates.pairDeviceDialog.newCode`,`New code`)})]})]})})}e();var sr={key:`access.nouns.device`};function cr({pairOpen:e,onPairClose:t}){let{t:i}=Y(),o=G(),s=Ie(),c=q.useUtils(),l=q.deviceCredentials.listDeviceCredentials.useQuery({includeRevoked:!0}),u=be(),[p,m]=r(null),[g,_]=r(null),b=()=>void c.deviceCredentials.listDeviceCredentials.invalidate(),x=e=>t=>{_(null),m(`${e} failed: ${t.message}`)},S=()=>{_(null),b()},C=q.deviceCredentials.revokeDeviceCredential.useMutation({onSuccess:S,onError:x(`Revoke`)}),w=q.deviceCredentials.deleteDeviceCredential.useMutation({onSuccess:e=>{e.result!==`deleted`&&m(e.result===`live`?`Only a revoked device can be deleted: revoke it first.`:`That device no longer exists.`),S()},onError:x(`Delete`)}),T=q.deviceCredentials.renameDeviceCredential.useMutation({onSuccess:S,onError:x(`Rename`)}),E=Bt(sr,e=>C.mutateAsync({id:e}),b),D=E.busy||g!==null,O=n(()=>(l.data??[]).map(Wt),[l.data]),k=async e=>{await o({title:i(`certificates.devicesCard.revoke`,`Revoke "{{name}}"?`,{name:e.name}),message:i(`certificates.devicesCard.sDeviceStopsSigningIn`,`{{ownerName}}'s device stops signing in at once and its open sessions end. To use it again it has to be paired anew. This cannot be undone.`,{ownerName:e.ownerName}),confirmLabel:i(`certificates.devicesCard.revoke2`,`Revoke`),variant:`danger`})&&(m(null),_(e.id),C.mutate({id:e.id}))},A=async e=>{await o({title:i(`certificates.devicesCard.delete`,`Delete "{{name}}"?`,{name:e.name}),message:i(`certificates.devicesCard.isRemovedFromTheList`,`{{name}} is removed from the list. The audit trail keeps the revocation.`,{name:e.name}),confirmLabel:i(`common.delete`,`Delete`),variant:`danger`})&&(m(null),_(e.id),w.mutate({id:e.id}))},j=async e=>{let t=(await s({title:i(`certificates.devicesCard.renameDevice`,`Rename device`),label:i(`certificates.devicesCard.deviceName`,`Device name`),defaultValue:e.name,confirmLabel:i(`certificates.devicesCard.rename`,`Rename`)}))?.trim()??``;t===``||t===e.name||(m(null),_(e.id),T.mutate({id:e.id,deviceName:t}))},M={label:i(`certificates.devicesCard.revoke2`,`Revoke`),icon:f,isAvailable:Nt,onRun:e=>void k(e),busyId:C.isPending?g:null,disabled:D},N=[{label:i(`certificates.devicesCard.rename`,`Rename`),icon:v,tone:`neutral`,isAvailable:()=>!0,onRun:e=>void j(e),busyId:T.isPending?g:null,disabled:D},{label:i(`common.delete`,`Delete`),icon:h,isAvailable:zt,onRun:e=>void A(e),busyId:w.isPending?g:null,disabled:D}];return a(X,{id:`devices`,title:i(`certificates.devicesCard.devices`,`Devices`),icon:y,description:i(`certificates.devicesCard.phonesThatStaySignedIn`,`Phones that stay signed in with a certificate instead of a login. Revoking one signs it out at once; it has to be paired again.`),notice:Z(p,E.outcome),onDismissNotice:()=>{m(null),E.dismiss()},children:[d(tr,{}),d(Vt,{rows:O,label:i(`certificates.devicesCard.label`),isLoading:l.isPending,loadError:l.error===null?null:l.error.message||`Request failed`,emptyText:`No devices paired yet.`,expiresNone:`—`,action:M,extraActions:N,bulk:{revoke:E,noun:sr,isSelectable:Nt}}),d(ar,{open:e,users:u.data??[],onClose:t,onPaired:b})]})}var lr={ok:`text-foreground-subtle`,soon:`text-warning`,expired:`text-danger`,unknown:`text-foreground-subtle`};function ur(e){let t=e.find(e=>e.isHub);return t?.https.kind===`served`?t.https.status.caFingerprintSha256:null}function dr({https:e,mesh:t,now:n}){let{t:r}=Y(),i=et().data?.caCertPem??``,o=()=>{if(i===``)return;let e=URL.createObjectURL(new Blob([i],{type:`application/x-pem-file`})),t=document.createElement(`a`);t.href=e,t.download=`camstack-ca.crt`,t.click(),URL.revokeObjectURL(e)},s=t?.ca,c=s?.state===`ready`?Date.parse(s.validTo):null,l=t?.listener;return a(`div`,{className:`space-y-1`,"data-testid":`ca-strip`,children:[d(W,{label:r(`certificates.caStrip.localHttpsCaSha256`,`Local HTTPS CA (SHA-256)`),valueClassName:`font-mono`,children:a(`span`,{className:`flex flex-wrap items-center gap-2`,children:[ur(e)??`—`,i!==``&&a(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:o,children:[d(p,{className:`h-3 w-3`,"aria-hidden":!0}),r(`certificates.caStrip.downloadCa`,`Download CA`)]})]})}),d(W,{label:r(`certificates.caStrip.clusterCaSha256`,`Cluster CA (SHA-256)`),valueClassName:`font-mono`,children:s===void 0?`—`:s.state===`ready`?s.fingerprintSha256:d(`span`,{className:`text-danger`,children:r(`certificates.caStrip.unavailable`,{reason:s.reason})})}),s?.state===`ready`&&a(W,{label:r(`certificates.caStrip.clusterCaValidUntil`,`Cluster CA valid until`),children:[s.validTo,c!==null&&!Number.isNaN(c)&&a(`span`,{className:`ml-2 text-[10px] ${lr[Yt(c,n)]}`,children:[`(`,Ft(c,n),`)`]})]}),l!==void 0&&a(W,{label:r(`certificates.caStrip.nodeListener`,`Node listener`),children:[l.state===`open`&&d(K,{variant:`success`,children:r(`certificates.caStrip.open`,`Open`)}),l.state===`not-started`&&d(K,{variant:`default`,children:r(`certificates.caStrip.notStarted`,`Not started`)}),l.state===`closed`&&a(`span`,{className:`text-danger`,children:[r(`certificates.caStrip.closedSince`,{when:It(l.since)}),` `,l.reason]})]}),t!==void 0&&!t.registryAvailable&&a(`div`,{className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-1.5 text-[11px] text-foreground`,children:[d(g,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`,"aria-hidden":!0}),d(`span`,{children:r(`certificates.caStrip.theCertificateRegistryIsNot`,`The certificate registry is not up, so the node list below is incomplete.`)})]})]})}function fr(e,t){let n=new Set;for(let t of e)n.add(t.nodeId);for(let e of t?.nodes??[])n.add(e.nodeId);return[...n].map(n=>{let r=e.find(e=>e.nodeId===n)??null,i=t?.nodes.find(e=>e.nodeId===n)??null;return{nodeId:n,isHub:r?.isHub??n===`hub`,online:r?.online??i?.online??!1,https:r,mesh:i}}).toSorted((e,t)=>Number(t.isHub)-Number(e.isHub)||e.nodeId.localeCompare(t.nodeId))}function pr(e){return e.isHub?J.t(`helpers.nodesModel.hubReissued`):e.mesh===null?J.t(`helpers.nodesModel.noCertRecorded`):e.online?null:J.t(`helpers.certificateModel.nodeOffline`)}function mr(e){return e.isHub||e.mesh===null?pr(e):null}var hr={ok:`text-foreground-subtle`,soon:`text-warning`,expired:`text-danger`,unknown:`text-foreground-subtle`},gr={enroll:`Issued at enrollment`,renewal:`Issued by a renewal`,boot:`Issued at boot`,pairing:`Issued at pairing`,observed:`Observed on its connection`},_r={uploaded:`Uploaded`,generated:`Generated`,disabled:`Disabled`};function vr(e){let t=e.https?.https;return t?.kind===`served`?qt(t.status.validTo):null}function yr({ms:e,now:t}){return e===null?d(`span`,{className:`text-foreground-subtle`,children:`—`}):a(`div`,{children:[d(`div`,{children:It(e)}),d(`div`,{className:`text-[10px] ${hr[Yt(e,t)]}`,children:Ft(e,t)})]})}function br({row:e}){let{t}=Y(),n=e.https?.https;return n===void 0?d(`span`,{className:`text-foreground-subtle`,children:`—`}):n.kind===`served`?a(`div`,{title:n.status.leafFingerprintSha256??``,children:[d(K,{variant:`success`,className:`text-[10px]`,children:t(`certificates.nodesColumns.served`,`Served`)}),d(`span`,{className:`ml-1.5 text-[10px] text-foreground-subtle`,children:_r[n.status.mode]}),d(`div`,{className:`mt-1 font-mono text-[10px] text-foreground-subtle`,children:Kt(n.status.leafFingerprintSha256)}),n.status.sans.length>0&&d(`div`,{className:`mt-0.5 max-w-[14rem] truncate font-mono text-[10px] text-foreground-subtle`,title:n.status.sans.join(`, `),children:n.status.sans.join(`, `)})]}):a(`div`,{className:`max-w-[16rem]`,children:[d(K,{variant:n.kind===`unreadable`?`danger`:`warning`,className:`text-[10px]`,children:n.kind===`unreadable`?t(`certificates.nodesColumns.unreadable`,`Unreadable`):t(`certificates.nodesColumns.notServed`,`Not served`)}),d(`div`,{className:`mt-1 whitespace-normal text-[10px] text-foreground-subtle`,children:n.reason})]})}function xr({row:e}){let{t}=Y(),n=e.mesh?.current??null;if(n===null)return d(`span`,{className:`text-foreground-subtle`,children:t(`certificates.nodesColumns.noneRecorded`,`None recorded`)});let r=e.mesh?.history.length??0;return a(`div`,{children:[d(`div`,{className:`font-mono text-[11px]`,title:n.serial,children:Ut(n.serial)}),d(`div`,{className:`font-mono text-[10px] text-foreground-subtle`,title:n.fingerprintSha256,children:Kt(n.fingerprintSha256)}),a(`div`,{className:`text-[10px] text-foreground-subtle`,children:[gr[n.issuedVia],r>0?` · ${t(`certificates.nodesColumns.earlier`,{count:r})}`:``]})]})}function Sr({row:e}){let{t}=Y(),n=e.mesh?.presentingCurrent??null;return n===null?d(`span`,{className:`text-foreground-subtle`,children:e.online?`—`:t(`certificates.nodesColumns.offline`,`Offline`)}):n?d(K,{variant:`success`,className:`text-[10px]`,children:t(`common.yes`,`Yes`)}):d(K,{variant:`warning`,className:`text-[10px]`,children:t(`certificates.nodesColumns.noPresentsAnother`,`No - presents another`)})}function Cr(e){let t=e.icon;return a(U,{type:`button`,variant:`ghost`,size:`sm`,className:e.danger?`text-danger hover:bg-danger/10`:void 0,disabled:e.reason!==null||e.busy,title:e.reason??void 0,"aria-label":e.ariaLabel,onClick:e.onClick,children:[e.spinning?d(S,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):d(t,{className:`h-3 w-3`,"aria-hidden":!0}),e.label]})}function wr({reasons:e}){let{t}=Y();return a(Ge,{className:`inline-block`,children:[d(qe,{children:d(`span`,{className:`cursor-help text-[11px] text-foreground-subtle`,"data-testid":`hub-managed-note`,children:t(`certificates.nodesColumns.managedByTheHub`,`Managed by the hub`)})}),d(We,{children:d(`ul`,{className:`max-w-xs space-y-1 whitespace-normal text-left text-[11px]`,children:e.map(e=>d(`li`,{children:e},e))})})]})}function Tr({row:e,o:t}){let{t:n}=Y(),r=e.https===null?`No HTTPS inventory for this node.`:Lt(e.https).reason,i=pr(e),o=mr(e),s=n=>t.running?.nodeId===e.nodeId&&t.running.action===n,c=t=>!e.isHub||t===null,l=[r,i,o].filter((e,t,n)=>e!==null&&n.indexOf(e)===t);return a(`div`,{className:`flex w-44 flex-col items-end gap-1`,children:[a(`div`,{className:`flex flex-col items-end gap-0.5`,children:[c(r)&&d(Cr,{label:n(`certificates.nodesColumns.renewHttps`,`Renew HTTPS`),ariaLabel:n(`certificates.nodesColumns.renewTheCertificateOn`,`Renew the certificate on {{nodeId}}`,{nodeId:e.nodeId}),icon:I,reason:r,busy:t.busy,spinning:s(`renew-https`),danger:!1,onClick:()=>t.onRenewHttps(e)}),c(i)&&d(Cr,{label:s(`renew-identity`)?n(`certificates.nodesColumns.renewing`,`Renewing…`):n(`certificates.nodesColumns.renewIdentity`,`Renew identity`),ariaLabel:n(`certificates.nodesColumns.renewTheClusterCertificateOf`,`Renew the cluster certificate of {{nodeId}}`,{nodeId:e.nodeId}),icon:I,reason:i,busy:t.busy,spinning:s(`renew-identity`),danger:!1,onClick:()=>t.onRenewIdentity(e)}),c(o)&&d(Cr,{label:n(`certificates.nodesColumns.revokeIdentity`,`Revoke identity`),ariaLabel:n(`certificates.nodesColumns.revokeTheClusterCertificateOf`,`Revoke the cluster certificate of {{nodeId}}`,{nodeId:e.nodeId}),icon:f,reason:o,busy:t.busy,spinning:s(`revoke-identity`),danger:!0,onClick:()=>t.onRevokeIdentity(e)})]}),e.isHub&&l.length>0&&d(wr,{reasons:l}),!e.isHub&&r!==null&&e.https!==null&&d(`div`,{className:`w-full whitespace-normal text-right text-[10px] text-foreground-subtle`,"data-testid":`renew-reason-${e.nodeId}`,children:r}),!e.isHub&&i!==null&&d(`div`,{className:`w-full whitespace-normal text-right text-[10px] text-foreground-subtle`,"data-testid":`mesh-reason-${e.nodeId}`,children:i})]})}function Er(e){return[{key:`node`,header:J.t(`certificates.nodesColumns.node`,`Node`),sortValue:e=>e.isHub?``:e.nodeId.toLowerCase(),render:e=>a(`div`,{className:`flex items-center gap-1.5`,children:[d(`span`,{className:`font-medium text-foreground`,children:e.nodeId}),e.nodeId===`hub`&&d(K,{variant:`info`,className:`text-[10px]`,children:J.t(`common.hubWord`)}),!e.online&&d(K,{variant:`default`,className:`text-[10px]`,children:J.t(`common.offline`)})]})},{key:`https-state`,header:`HTTPS`,notSortableReason:`A state with a reason has no single order.`,render:e=>d(br,{row:e})},{key:`https-expires`,header:J.t(`certificates.nodesColumns.httpsExpires`,`HTTPS expires`),sortValue:e=>vr(e),render:t=>d(yr,{ms:vr(t),now:e.now})},{key:`identity`,header:J.t(`certificates.nodesColumns.identity`,`Identity`),sortValue:e=>e.mesh?.current?.serial??null,render:e=>d(xr,{row:e})},{key:`identity-expires`,header:J.t(`certificates.nodesColumns.identityExpires`,`Identity expires`),sortValue:e=>e.mesh?.current?.notAfter??null,render:t=>d(yr,{ms:t.mesh?.current?.notAfter??null,now:e.now})},{key:`presenting`,header:J.t(`certificates.nodesColumns.inUse`,`In use`),notSortableReason:`Offline nodes have no answer to order by.`,render:e=>d(Sr,{row:e})},{key:`actions`,header:J.t(`certificates.nodesColumns.actions`,`Actions`),align:`right`,notSortableReason:`Actions have no order.`,render:t=>d(Tr,{row:t,o:e})}]}e();function Dr(){let{t:e}=Y(),t=G(),i=q.useUtils(),o=nr(6e4),s=q.certificates.listHttpsCertificates.useQuery(),c=q.certificates.getMeshCertificates.useQuery(),[l,u]=r(null),[f,p]=r(null),[m,h]=r(null),g=()=>{h(null),i.certificates.listHttpsCertificates.invalidate(),i.certificates.getMeshCertificates.invalidate()},_=e=>(t,n)=>{h(null),u(`${n.nodeId}: ${e} - ${t.message}`)},v=q.certificates.renewHttpsOnNode.useMutation({onSuccess:(t,n)=>{p({tone:`success`,message:t.restartRequired?e(`certificates.nodesCard.newCertificateIssuedRestartThe`,`{{nodeId}}: new certificate issued. Restart the node to serve it.`,{nodeId:n.nodeId}):e(`certificates.nodesCard.newCertificateIssuedAndServed`,`{{nodeId}}: new certificate issued and served.`,{nodeId:n.nodeId})}),g()},onError:_(`renewal failed`)}),y=q.certificates.renewMeshOnNode.useMutation({onSuccess:e=>{p(Ht(e)),g()},onError:_(`renewal could not start`)}),b=q.certificates.revokeMeshOnNode.useMutation({onSuccess:e=>{p({tone:`success`,message:`${e.nodeId}: ${e.next}`}),g()},onError:_(`revoke failed`)}),x=v.isPending||y.isPending||b.isPending,S=(e,t)=>{u(null),p(null),h({nodeId:e,action:t})},C=async n=>{await t({title:e(`certificates.nodesCard.renewHttpsOn`,`Renew HTTPS on "{{nodeId}}"?`,{nodeId:n.nodeId}),message:n.isHub?e(`certificates.nodesCard.aNewCertificateIsIssued`,`A new certificate is issued from the local CA. Clients that trust the CA keep working.`):e(`certificates.nodesCard.theNodeMakesANew`,`The node makes a new key, the hub signs it and the node switches over without a restart. It keeps serving what it had if anything fails.`),confirmLabel:e(`certificates.nodesCard.renew`,`Renew`)})&&(S(n.nodeId,`renew-https`),v.mutate({nodeId:n.nodeId}))},w=e=>{S(e.nodeId,`renew-identity`),y.mutate({nodeId:e.nodeId})},T=async n=>{await t({title:e(`certificates.nodesCard.revokeTheIdentityOf`,`Revoke the identity of "{{nodeId}}"?`,{nodeId:n.nodeId}),message:e(`certificates.nodesCard.isDisconnectedAtOnceAnd`,`{{nodeId}} is disconnected at once and can no longer connect. To bring it back it must be paired again from System → Cluster → Agents. It stays in the node list until you forget it on the Cluster page. This cannot be undone.`,{nodeId:n.nodeId}),confirmLabel:e(`certificates.nodesCard.revokeAndDisconnect`,`Revoke and disconnect`),variant:`danger`})&&(S(n.nodeId,`revoke-identity`),b.mutate({nodeId:n.nodeId}))},E=Er({now:o,busy:x,running:m,onRenewHttps:e=>void C(e),onRenewIdentity:w,onRevokeIdentity:e=>void T(e)}),D=n(()=>fr(s.data??[],c.data),[s.data,c.data]),O=c.data?.registryAvailable??!0;return d(X,{id:`nodes`,title:e(`certificates.nodesCard.nodes`,`Nodes`),icon:P,description:e(`certificates.nodesCard.eachNodeHoldsTwoCertificates`,`Each node holds two certificates: one it serves over HTTPS, one that proves its identity to the hub. Renewing replaces a certificate without a gap; revoking an identity cuts the node off until it re-joins.`),notice:Z(l,f),onDismissNotice:()=>{u(null),p(null)},children:d($n,{isPending:s.isPending||c.isPending,error:s.error??c.error,what:`node certificates`,onRetry:()=>{s.refetch(),c.refetch()},children:a(`div`,{className:`space-y-3`,children:[d(dr,{https:s.data??[],mesh:c.data,now:o}),d(Be,{columns:E,rows:D,rowKey:e=>e.nodeId,minWidthPx:960,maxBodyHeight:He,defaultSort:{columnKey:`node`,dir:`asc`},emptyMessage:O?e(`certificates.nodesCard.noNodesReported`,`No nodes reported.`):e(`certificates.nodesCard.theCertificateRegistryIsNot`,`The certificate registry is not available yet, so nodes cannot be listed.`)})]})})})}function Or({pairOpen:e,onPairClose:t}){return a(`div`,{className:`space-y-4`,"data-testid":`certificates-page`,children:[d(cr,{pairOpen:e,onPairClose:t}),d(er,{}),d(Dr,{})]})}function kr({userId:e,username:t,onClose:n}){let{t:r}=Y(),i=G(),o=q.useUtils(),s=je({userId:e}),c=q.auth.listLoginMethods.useQuery(),l=Ve({onSuccess:()=>void o.userManagement.listExternalIdentities.invalidate()}),u=new Map((c.data??[]).flatMap(e=>e.kind===`redirect`?[[e.id,e.label]]:[])),f=s.data??[],p=async(n,a)=>{await i({title:r(`users.externalIdentitiesModal.removeSignInLink`,`Remove sign-in link`),message:r(`users.externalIdentitiesModal.willNoLongerBeAble`,`"{{username}}" will no longer be able to sign in with this {{label}} account.`,{username:t,label:a}),confirmLabel:r(`common.remove`,`Remove`),variant:`danger`})&&l.mutate({userId:e,provider:n.provider,subject:n.subject})};return d(ze,{open:!0,onOpenChange:e=>!e&&n(),children:a(ge,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,"data-testid":`external-identities-modal`,children:[d(fe,{children:a($e,{className:`flex items-center gap-2`,children:[d(w,{className:`h-4 w-4 text-primary`}),a(`span`,{children:[r(`users.externalIdentitiesModal.linkedSignInAccounts`,`Linked sign-in accounts`),a(`span`,{className:`mt-0.5 block text-[11px] font-normal text-foreground-subtle`,children:[r(`users.externalIdentitiesModal.user`,`User:`),` `,d(`span`,{className:`font-mono`,children:t})]})]})]})}),d(ve,{className:`space-y-3`,children:s.isLoading?a(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[d(S,{className:`h-3.5 w-3.5 animate-spin`}),r(`common.loading`,`Loading…`)]}):f.length===0?d(`p`,{className:`text-xs text-foreground-subtle`,children:r(`users.externalIdentitiesModal.noLinkedAccountsOnlyThe`,`No linked accounts. Only the user can link one, from their own profile page.`)}):d(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:f.map(e=>{let t=u.get(e.provider),n=t??e.provider;return a(`li`,{className:`flex items-center gap-3 px-3 py-2 text-xs`,children:[a(`div`,{className:`flex-1 min-w-0`,children:[a(`div`,{className:`font-medium text-foreground truncate`,children:[n,t===void 0&&d(`span`,{className:`ml-2 rounded bg-foreground-subtle/15 px-1.5 py-0.5 text-[10px] font-normal text-foreground-subtle`,children:r(`users.externalIdentitiesModal.providerUnavailable`,`provider unavailable`)})]}),a(`div`,{className:`text-[11px] text-foreground-subtle truncate`,children:[e.label??e.subject,` ·`,` `,new Date(e.linkedAt).toLocaleDateString()]})]}),a(`button`,{onClick:()=>void p(e,n),disabled:l.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] text-danger hover:bg-danger/10 disabled:opacity-50`,children:[d(re,{className:`h-3 w-3`}),r(`common.remove`,`Remove`)]})]},`${e.provider}|${e.subject}`)})})}),d(nt,{children:d(U,{onClick:n,variant:`secondary`,children:r(`common.close`,`Close`)})})]})})}function Ar({userId:e,username:t,onClose:n}){let{t:r}=Y(),i=c(),o=G(),l=Qe({userId:e}),u=l.data,f=()=>i.invalidateQueries({queryKey:[[`userManagement`,`getTotpStatus`]]}),p=de({onSuccess:()=>{f(),n()}}),m=l.isLoading?`loading`:u?.enabled?`enrolled`:`not_enrolled`;return d(ze,{open:!0,onOpenChange:e=>!e&&n(),children:a(ge,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[d(fe,{children:a($e,{className:`flex items-center gap-2`,children:[d(y,{className:`h-4 w-4 text-primary`}),a(`span`,{children:[r(`users.totpModal.twoFactorAuthentication`,`Two-factor authentication`),a(`span`,{className:`mt-0.5 block text-[11px] font-normal text-foreground-subtle`,children:[r(`users.totpModal.user`,`User:`),` `,d(`span`,{className:`font-mono`,children:t})]})]})]})}),a(ve,{className:`space-y-4`,children:[m===`loading`&&a(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[d(S,{className:`h-3.5 w-3.5 animate-spin`}),r(`users.totpModal.checkingStatus`,`Checking status…`)]}),m===`not_enrolled`&&a(`div`,{className:`rounded-md border border-border bg-surface-hover/30 px-3 py-2.5 flex items-start gap-2.5 text-xs text-foreground-subtle`,children:[d(M,{className:`h-4 w-4 mt-0.5 shrink-0`}),a(`div`,{children:[d(`div`,{className:`font-medium text-foreground`,children:r(`users.totpModal.2faNotEnrolled`,`2FA not enrolled`)}),d(`p`,{className:`mt-0.5`,children:r(`users.totpModal.onlyTheUserThemselvesCan`,`Only the user themselves can enable 2FA, from their own profile page.`)})]})]}),m===`enrolled`&&u&&a(s,{children:[a(`div`,{className:`rounded-md border border-emerald-500/30 bg-emerald-500/5 px-3 py-2.5 flex items-start gap-2.5`,children:[d(E,{className:`h-4 w-4 mt-0.5 text-emerald-500 shrink-0`}),a(`div`,{className:`text-xs text-foreground space-y-0.5`,children:[d(`div`,{className:`font-medium`,children:r(`users.totpModal.2faIsActive`,`2FA is active`)}),d(`div`,{className:`text-foreground-subtle`,children:r(`common.enrolledOn`,{when:u.confirmedAt?new Date(u.confirmedAt).toLocaleString():`—`})})]})]}),d(`div`,{className:`text-[11px] text-foreground-subtle`,children:r(`users.totpModal.removingHereClearsTheServer`,`Removing here clears the server-side secret. Use this only when the user has lost access — they'll have to re-enroll from their profile page afterwards.`)}),a(`div`,{className:`flex justify-end gap-2`,children:[d(U,{onClick:n,variant:`secondary`,children:r(`common.close`,`Close`)}),a(`button`,{onClick:async()=>{await o({title:r(`users.totpModal.remove2fa`,`Remove 2FA`),message:r(`users.totpModal.removeTwoFactorAuthenticationFor`,`Remove two-factor authentication for "{{username}}"? They'll be able to log in with just their password until they re-enroll from their own profile page.`,{username:t}),confirmLabel:r(`common.remove`,`Remove`),variant:`danger`})&&p.mutate({userId:e})},disabled:p.isPending,className:`rounded bg-danger px-3 py-1.5 text-xs font-medium text-white hover:bg-danger/90 disabled:opacity-50 inline-flex items-center gap-1`,children:[p.isPending?d(S,{className:`h-3 w-3 animate-spin`}):d(T,{className:`h-3 w-3`}),r(`users.totpModal.remove2fa`,`Remove 2FA`)]})]})]})]})]})})}e();function jr({userId:e,username:t,onClose:n}){let{t:i}=Y(),{user:o,logout:s}=bt(),c=o?.id===e,l=G(),u=q.useUtils(),f=q.auth.listSessions.useQuery({userId:e}),[p,m]=r(null),h=q.auth.revokeSessions.useMutation({onSuccess:(e,t)=>{if(c&&`userId`in t){s();return}u.auth.listSessions.invalidate()},onError:e=>m(`Sign out failed: ${e.message}`)}),g=async e=>{await l({title:i(`users.userSessionsModal.signOutThisSession`,`Sign out this session`),message:i(`users.userSessionsModal.onWillHaveToSign`,`"{{username}}" on {{label}} will have to sign in again.`,{username:t,label:Xt(e.client).label}),confirmLabel:i(`users.userSessionsModal.signOut`,`Sign out`),variant:`danger`})&&(m(null),h.mutate({id:e.id}))},_=async()=>{await l({title:i(`users.userSessionsModal.signOutEverywhere`,`Sign out everywhere`),message:c?i(`users.userSessionsModal.everySessionOfYourOwn`,`Every session of your own account ends, this browser included: you will be signed out here too.`):i(`users.userSessionsModal.everySessionOfEndsAt`,`Every session of "{{username}}" ends at once; each device has to sign in again.`,{username:t}),confirmLabel:i(`users.userSessionsModal.signOutEverywhere`,`Sign out everywhere`),variant:`danger`})&&(m(null),h.mutate({userId:e}))},v=h.isPending&&h.variables!==void 0&&`id`in h.variables?h.variables.id:null;return d(ze,{open:!0,onOpenChange:e=>!e&&n(),children:a(ge,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,"data-testid":`user-sessions-modal`,children:[d(fe,{children:a($e,{className:`flex items-center gap-2`,children:[d(ne,{className:`h-4 w-4 text-primary`}),a(`span`,{children:[i(`users.userSessionsModal.activeSessions`,`Active sessions`),a(`span`,{className:`mt-0.5 block text-[11px] font-normal text-foreground-subtle`,children:[i(`users.userSessionsModal.user`,`User:`),` `,d(`span`,{className:`font-mono`,children:t})]})]})]})}),a(ve,{className:`space-y-3`,children:[p!==null&&d(`div`,{className:`text-[11px] text-danger`,children:p}),d(Jt,{sessions:f.data??[],isLoading:f.isLoading,loadError:f.isError?f.error?.message??`Request failed`:null,emptyText:`No active sessions.`,onRevoke:e=>void g(e),revokingId:v})]}),a(nt,{className:`justify-between`,children:[a(`button`,{onClick:()=>void _(),disabled:h.isPending||(f.data??[]).length===0,className:`inline-flex items-center gap-1.5 rounded border border-danger/40 px-2.5 py-1 text-[11px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,children:[h.isPending&&v===null?d(S,{className:`h-3 w-3 animate-spin`}):d(B,{className:`h-3 w-3`}),i(`users.userSessionsModal.signOutEverywhere`,`Sign out everywhere`)]}),d(U,{onClick:n,variant:`secondary`,children:i(`common.close`,`Close`)})]})]})})}function Mr({icon:e,label:t,count:n,all:r,total:i}){let{t:o}=Y();return a(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[d(e,{className:`h-3 w-3 shrink-0 text-foreground-subtle`}),d(`span`,{className:`min-w-0 flex-1 text-foreground-subtle`,children:t}),d(`span`,{className:n===0?`text-foreground-subtle`:`font-medium text-foreground`,children:n===0?o(`common.none`):r?o(`users.scopePreview.all`,`all {{total}}`,{total:i}):o(`users.scopePreview.of`,`{{count}} of {{total}}`,{count:n,total:i})})]})}function Nr({scopes:e,isAdmin:t,invalidReason:n}){let{t:r}=Y(),i=j(),c=o({queryKey:[`auth`,`previewScope`,e,t],enabled:n===null,queryFn:()=>i.trpcClient.auth.previewScope.query({scopes:[...e],isAdmin:t})}),{data:l}=Xe({projection:`slim`}),u=l?.length??0;if(n!==null)return d(`div`,{className:`rounded-lg border border-border bg-surface p-3`,children:a(`p`,{className:`flex items-center gap-1.5 text-[11px] text-warning`,children:[d(N,{className:`h-3 w-3 shrink-0`}),n]})});if(c.isLoading)return a(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface p-3 text-[11px] text-foreground-subtle`,children:[d(S,{className:`h-3 w-3 animate-spin`}),r(`users.scopePreview.resolving`,`Resolving…`)]});if(c.isError||!c.data)return d(`div`,{className:`rounded-lg border border-border bg-surface p-3`,children:d(`p`,{className:`text-[11px] text-danger`,children:r(`users.scopePreview.couldNotResolveThisGrant`,`Could not resolve this grant set. Saving is still allowed — the server enforces the same rules either way.`)})});let f=c.data;return d(`div`,{className:`space-y-2 rounded-lg border border-border bg-surface p-3`,children:f.isAdmin?a(`p`,{className:`text-[11px] text-foreground`,children:[d(`span`,{className:`font-medium`,children:r(`users.scopePreview.administrator`,`Administrator`)}),` `,r(`users.scopePreview.unrestricted`)]}):a(s,{children:[d(Mr,{icon:m,label:r(`users.scopePreview.devicesTheyCanSee`,`Devices they can see`),count:f.device.view.deviceCount,all:f.device.view.all,total:u}),d(Mr,{icon:v,label:r(`users.scopePreview.devicesTheyCanOperate`,`Devices they can operate`),count:f.device.create.deviceCount,all:f.device.create.all,total:u}),d(Mr,{icon:h,label:r(`users.scopePreview.devicesTheyCanDelete`,`Devices they can delete`),count:f.device.delete.deviceCount,all:f.device.delete.all,total:u}),a(`div`,{className:`border-t border-border pt-2 text-[10px] text-foreground-subtle`,children:[r(`users.scopePreview.systemAccess`,`System access:`),` `,f.system.length===0?r(`common.none`):f.system.join(`, `),f.capabilities.length>0&&a(s,{children:[` `,r(`users.scopePreview.extraCapabilities`,`· Extra capabilities:`),` `,f.capabilities.map(e=>e.name).join(`, `)]}),f.addons.length>0&&a(s,{children:[` `,r(`users.scopePreview.addons`,`· Addons:`),` `,f.addons.map(e=>e.name).join(`, `)]})]}),f.device.view.deviceCount===0&&d(`p`,{className:`text-[10px] text-warning`,children:r(`users.scopePreview.thisUserWillNotBe`,`This user will not be able to see any device.`)})]})})}e();function Pr(e){let t=ce(e);return t===null?{mode:e.length===0?`role`:`advanced`,roleId:null,selector:{kind:`all`},includeLinked:!0,advancedScopes:e}:{mode:`role`,roleId:t.roleId,selector:t.selector,includeLinked:t.includeLinked,advancedScopes:e}}function Fr(e){return e.mode===`advanced`?e.advancedScopes:e.roleId===null?[]:ae({roleId:e.roleId,selector:e.selector,includeLinked:e.includeLinked})}function Ir({user:e,onClose:t,onSubmit:i,submitting:o,callerScopes:c}){let{t:l}=Y(),u=O(),f=n(()=>Pr(e.scopes??[]),[e.scopes]),[p,m]=r(f),[h,g]=r(f.mode===`advanced`),_=n(()=>Fr(p),[p]),v=!e.isAdmin&&p.mode===`role`&&p.roleId===null,y=n(()=>e.isAdmin?null:p.mode===`role`&&p.roleId===null?l(`users.userAccessModal.pickAccess`):Ne(_,u),[e.isAdmin,p.mode,p.roleId,_]),b=e=>m({...p,...e});return d(ze,{open:!0,onOpenChange:e=>!e&&t(),children:a(ge,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,className:`md:max-w-2xl`,children:[a(fe,{children:[d($e,{children:l(`users.userAccessModal.title`,{name:e.username})}),d(`p`,{className:`text-[10px] text-foreground-subtle`,children:e.isAdmin?l(`users.userAccessModal.thisUserIsAnAdministrator`,`This user is an administrator — they can do everything, and the settings below are ignored.`):l(`users.userAccessModal.chooseWhatTheyCanDo`,`Choose what they can do, then which devices it applies to.`)})]}),a(ve,{className:`space-y-4`,children:[v&&a(`div`,{className:`flex items-start gap-2 rounded-lg border border-warning/40 bg-warning/10 p-3`,children:[d(N,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`}),a(`p`,{className:`text-[11px] text-foreground`,children:[d(`span`,{className:`font-medium`,children:l(`users.userAccessModal.noAccess`,`No access.`)}),` `,d(`span`,{className:`text-foreground-subtle`,children:l(`users.userAccessModal.cannotSeeAnything`,{name:e.username})})]})]}),a(`section`,{className:`space-y-2`,children:[d(`h3`,{className:`text-[11px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:l(`users.userAccessModal.1WhatCanTheyDo`,`1 · What can they do`)}),d(`div`,{className:`space-y-1.5`,children:se.map(e=>{let t=p.mode===`role`&&p.roleId===e.id;return a(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-lg border p-2.5 transition-colors ${t?`border-primary bg-primary/5`:`border-border hover:bg-foreground-subtle/5`}`,children:[d(`input`,{type:`radio`,name:`access-role`,checked:t,onChange:()=>b({mode:`role`,roleId:e.id}),className:`mt-0.5 border-border focus:ring-primary`}),a(`span`,{className:`min-w-0`,children:[d(`span`,{className:`block text-[12px] font-medium text-foreground`,children:e.label}),d(`span`,{className:`mt-0.5 block text-[10px] text-foreground-subtle`,children:e.description})]})]},e.id)})}),a(`button`,{type:`button`,onClick:()=>{if(!h){m({...p,mode:`advanced`,advancedScopes:_}),g(!0);return}g(!1),m(Pr(p.advancedScopes))},className:`inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] text-foreground-subtle transition-colors hover:bg-foreground-subtle/10 hover:text-foreground`,children:[d(h?F:x,{className:`h-3 w-3`}),l(`users.userAccessModal.advancedEditRawGrants`,`Advanced — edit raw grants`)]}),h&&a(`div`,{className:`rounded-lg border border-border p-2`,children:[d(`p`,{className:`mb-2 text-[10px] text-foreground-subtle`,children:l(`users.userAccessModal.oneRowPerGrantAnything`,`One row per grant. Anything expressible here overrides the three roles above; close this section to go back to them.`)}),d(Ae,{value:p.advancedScopes,onChange:e=>b({mode:`advanced`,advancedScopes:e}),clampToParent:c,emptyHint:d(s,{children:d(pt,{i18nKey:`users.userAccessModal.noGrants`,values:{name:e.username},components:{b:d(`span`,{className:`font-medium text-foreground`})}})})})]})]}),p.mode===`role`&&a(`section`,{className:`space-y-2`,children:[d(`h3`,{className:`text-[11px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:l(`users.userAccessModal.2OnWhichDevices`,`2 · On which devices`)}),d(Ue,{value:p.selector,onChange:e=>b({selector:e}),includeLinked:p.includeLinked,onIncludeLinkedChange:e=>b({includeLinked:e}),clampToDeviceIds:null})]}),a(`section`,{className:`space-y-2`,children:[d(`h3`,{className:`text-[11px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:p.mode===`role`?l(`users.userAccessModal.3Result`,`3 · Result`):l(`users.userAccessModal.2Result`,`2 · Result`)}),d(Nr,{scopes:_,isAdmin:e.isAdmin,invalidReason:y})]})]}),a(nt,{children:[d(U,{variant:`outline`,size:`sm`,onClick:t,children:l(`common.cancel`,`Cancel`)}),d(U,{size:`sm`,onClick:()=>i([..._]),disabled:o||y!==null,children:o?d(S,{className:`h-3 w-3 animate-spin`}):l(`users.userAccessModal.saveAccess`,`Save access`)})]})]})})}e();var Lr=8;function Rr(){return{username:``,password:``,isAdmin:!1}}function zr(e){return{id:e.id,username:e.username,password:``,isAdmin:e.isAdmin}}function Br(e){return e instanceof Error?e.message:J.t(`admin.system.users.genericError`)}function Vr(){let{t:e}=Y(),n=c(),{user:i}=bt(),{state:o,openNew:l,openEdit:u,close:f}=Ee(),[p,m]=r(null),[g,x]=r(null),[C,T]=r(!1),{data:E,isLoading:D,isError:O,error:k,refetch:j}=be(),M=G(),N=Ie(),P=()=>n.invalidateQueries({queryKey:[[`userManagement`,`listUsers`]]}),F=Me(),I=tt({onSuccess:P}),L=Ce({onSuccess:P}),R=we({onSuccess:P}),z=pe({onSuccess:()=>{P(),V(null)}}),[B,V]=r(null),[H,te]=r(null),[re,ie]=r(null),[ae,oe]=r(null),se=E??[],ce=o.mode===`edit`?se.find(e=>e.id===o.id)??null:null,le=()=>{m(null),x(null),T(!1),F.reset(),L.reset(),f()};t(()=>{if(o.mode===`closed`){m(null),x(null),T(!1);return}if(o.mode===`new`){m(e=>e!==null&&e.id===void 0?e:Rr());return}if(ce===null){D||f();return}m(e=>e?.id===ce.id?e:zr(ce))},[o,ce,D,f]);let ue=o.mode===`new`&&p!==null&&p.id===void 0||o.mode===`edit`&&p!==null&&ce!==null;async function de(t){await M({title:e(`admin.system.users.deleteUser`,`Delete user`),message:e(`admin.system.users.permanentlyDeleteUserThisCannot`,`Permanently delete user "{{username}}"? This cannot be undone — any active sessions will be revoked on next request.`,{username:t.username}),confirmLabel:e(`common.delete`,`Delete`),variant:`danger`})&&(I.mutate({id:t.id}),o.mode===`edit`&&o.id===t.id&&le())}async function fe(t){let n=await N({title:e(`admin.system.users.resetPassword`,`Reset password`),message:e(`admin.system.users.setANewPasswordFor`,`Set a new password for "{{username}}".`,{username:t.username}),label:e(`admin.system.users.newPassword`,`New password`),inputType:`password`,placeholder:e(`admin.system.users.atLeast8Characters`,`At least 8 characters`),confirmLabel:e(`admin.system.users.continue`,`Continue`),validate:e=>e.length<Lr?J.t(`admin.system.users.passwordTooShort`,{min:Lr}):null});n===null||n.length===0||await M({title:e(`admin.system.users.resetPassword`,`Reset password`),message:e(`admin.system.users.resetThePasswordForThey`,`Reset the password for "{{username}}"? They will need to use the new password on their next login.`,{username:t.username}),confirmLabel:e(`common.reset`,`Reset`)})&&R.mutate({id:t.id,newPassword:n})}function me(e,t){t!==e.isAdmin&&L.mutate({id:e.id,isAdmin:t})}async function he(){if(p!==null){x(null);try{if(p.id===void 0){let e=p.username.trim();if(e===``||p.password.length<Lr)return;await F.mutateAsync({username:e,password:p.password,isAdmin:p.isAdmin})}else await L.mutateAsync({id:p.id,isAdmin:p.isAdmin});P(),le()}catch(e){x(Br(e))}}}function ge(e){return e?new Date(typeof e==`number`?e:String(e)).toLocaleDateString(`en-GB`,{day:`2-digit`,month:`short`,year:`numeric`}):`—`}let _e=F.isPending||L.isPending,ve=p!==null&&p.id===void 0&&p.username.trim()!==``&&p.password.length>=Lr,ye=p!==null&&p.id!==void 0,xe=_e||(p?.id===void 0?!ve:!ye),W=e=>I.isPending&&I.variables?.id===e.id||L.isPending&&L.variables?.id===e.id||R.isPending&&R.variables?.id===e.id,De=[{key:`username`,header:e(`admin.system.users.username`,`Username`),sortValue:e=>e.username,render:e=>d(`span`,{className:`font-medium text-foreground`,"data-testid":`user-open-${e.id}`,children:e.username})},{key:`isAdmin`,header:e(`admin.system.users.admin`,`Admin`),nowrap:!0,sortValue:e=>+!!e.isAdmin,render:t=>d(`span`,{onClick:e=>e.stopPropagation(),children:a(`label`,{className:`inline-flex items-center gap-1.5 text-xs cursor-pointer`,children:[d(`input`,{type:`checkbox`,checked:t.isAdmin,onChange:e=>me(t,e.target.checked),disabled:W(t),className:`rounded border-border focus:ring-primary disabled:opacity-50`}),d(`span`,{className:t.isAdmin?`text-primary font-medium`:`text-foreground-subtle`,children:t.isAdmin?e(`admin.system.users.admin`,`Admin`):e(`admin.system.users.regular`,`Regular`)})]})})},{key:`scopes`,header:e(`admin.system.users.access`,`Access`),render:t=>t.isAdmin?d(`span`,{className:`text-[10px] italic text-foreground-subtle`,children:e(`admin.system.users.everythingAdmin`,`everything (admin)`)}):d(`span`,{onClick:e=>e.stopPropagation(),children:a(U,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>V(t),title:e(`admin.system.users.configureAccess`,`Configure access`),children:[d(A,{className:`h-3 w-3 shrink-0 text-foreground-subtle`}),d(Hr,{scopes:t.scopes??[]})]})})},{key:`createdAt`,header:e(`admin.system.users.created`,`Created`),nowrap:!0,sortValue:e=>e.createdAt,render:e=>d(`span`,{className:`text-foreground-subtle`,children:ge(e.createdAt)})},{key:`actions`,header:e(`admin.system.users.actions`,`Actions`),align:`right`,nowrap:!0,notSortableReason:`Row actions`,render:t=>{let n=W(t),r=t.id!==i?.id&&t.totpEnabled;return a(`div`,{className:`flex items-center justify-end gap-1`,onClick:e=>e.stopPropagation(),children:[a(U,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>u(t.id),disabled:n,title:e(`admin.system.users.editUser`,`Edit user`),children:[d(v,{className:`h-3 w-3`}),e(`common.edit`,`Edit`)]}),r&&a(U,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>te(t),disabled:n,title:e(`admin.system.users.removeTwoFactorAuthentication`,`Remove two-factor authentication`),children:[d(y,{className:`h-3 w-3`}),e(`admin.system.users.remove2fa`,`Remove 2FA`)]}),a(U,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>ie(t),disabled:n,title:e(`admin.system.users.linkedSignInAccounts`,`Linked sign-in accounts`),children:[d(w,{className:`h-3 w-3`}),e(`admin.system.users.signInLinks`,`Sign-in links`)]}),a(U,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>oe(t),disabled:n,title:e(`admin.system.users.activeSessions`,`Active sessions`),children:[d(ne,{className:`h-3 w-3`}),e(`admin.system.users.sessions`,`Sessions`)]}),a(U,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>void fe(t),disabled:n,title:e(`admin.system.users.resetPassword`,`Reset password`),children:[d(ee,{className:`h-3 w-3`}),e(`admin.system.users.resetPassword`,`Reset password`)]}),a(U,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>void de(t),disabled:n,title:e(`admin.system.users.deleteUser`,`Delete user`),className:`text-danger hover:bg-danger/10`,children:[n?d(S,{className:`h-3 w-3 animate-spin`}):d(h,{className:`h-3 w-3`}),e(`common.delete`,`Delete`)]})]})}}];return a(St,{embedded:!0,icon:b,title:e(`admin.system.users.users`,`Users`),subtitle:e(`admin.system.users.hubAccountsAdminFlagAccess`,`Hub accounts, admin flag, access scopes, sessions and sign-in links.`),actions:a(U,{size:`sm`,type:`button`,onClick:()=>{x(null),l()},children:[d(_,{className:`h-3.5 w-3.5`}),e(`admin.system.users.createUser`,`Create User`)]}),children:[O&&d(Oe,{title:e(`admin.system.users.couldNotLoadUsers`,`Could not load users`),message:Br(k),onRetry:()=>void j()}),D&&a(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[d(S,{className:`h-3.5 w-3.5 animate-spin`}),e(`common.loading`,`Loading…`)]}),!D&&!O&&se.length===0&&d(Re,{icon:b,title:e(`admin.system.users.noUsersYet`,`No users yet`),description:e(`admin.system.users.createAUserToGrant`,`Create a user to grant hub access.`)}),!D&&!O&&se.length>0&&d(Be,{columns:De,rows:se,rowKey:e=>e.id,minWidthPx:560,maxBodyHeight:`max-h-[60vh]`,onRowClick:e=>u(e.id)}),d(st,{open:ue,onClose:le,title:p?.id===void 0?e(`admin.system.users.createUser`,`Create User`):e(`admin.system.users.edit`,`Edit {{value1}}`,{value1:p.username||`user`}),icon:b,error:g,testId:`user-form-dialog`,footer:d(U,{size:`sm`,type:`button`,disabled:xe,onClick:()=>void he(),children:_e?a(s,{children:[d(S,{className:`h-3.5 w-3.5 animate-spin`}),e(`admin.system.users.saving`,`Saving…`)]}):p?.id===void 0?e(`admin.system.users.create`,`Create`):e(`common.save`,`Save`)}),children:p!==null&&a(`div`,{className:`space-y-3`,children:[d(Se,{label:e(`admin.system.users.username`,`Username`),required:p.id===void 0,children:d(Fe,{value:p.username,onChange:e=>m({...p,username:e.target.value}),placeholder:`john`,autoFocus:p.id===void 0,disabled:p.id!==void 0,"data-testid":`user-form-username`})}),p.id===void 0&&d(Se,{label:e(`admin.system.users.password`,`Password`),required:!0,description:e(`admin.system.users.atLeastCharacters`,`At least {{value1}} characters.`,{value1:String(Lr)}),children:d(Te,{value:p.password,onValueChange:e=>m({...p,password:e}),shown:C,onToggleShown:()=>T(e=>!e),placeholder:`••••••••`,"data-testid":`user-form-password`})}),d(Se,{label:e(`admin.system.users.admin`,`Admin`),description:e(`admin.system.users.unrestrictedAccessToEveryCapability`,`Unrestricted access to every capability and device.`),children:a(`label`,{className:`inline-flex items-center gap-2 text-xs text-foreground cursor-pointer`,children:[d(`input`,{type:`checkbox`,checked:p.isAdmin,onChange:e=>m({...p,isAdmin:e.target.checked}),className:`rounded border-border focus:ring-primary`,"data-testid":`user-form-admin`}),d(`span`,{children:e(`admin.system.users.admin`,`Admin`)})]})}),p.id!==void 0&&d(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`admin.system.users.toChangeThePasswordUse`,`To change the password, use Reset password on the user's row. Access scopes are configured from the Access column.`)})]})}),H&&d(Ar,{userId:H.id,username:H.username,onClose:()=>te(null)}),re&&d(kr,{userId:re.id,username:re.username,onClose:()=>ie(null)}),ae&&d(jr,{userId:ae.id,username:ae.username,onClose:()=>oe(null)}),B&&d(Ur,{user:B,onClose:()=>V(null),onSubmit:e=>z.mutate({userId:B.id,scopes:e}),submitting:z.isPending})]})}function Hr({scopes:e}){let{t}=Y(),n=O();if(e.length===0)return d(`span`,{className:`font-medium text-warning`,children:t(`admin.system.users.noAccess`,`No access`)});let r=ce(e);return r===null?d(`span`,{className:`text-foreground-subtle`,children:t(`users.customGrants`,{count:e.length})}):a(`span`,{className:`text-foreground-subtle`,children:[d(`span`,{className:`font-medium text-foreground`,children:le(r.roleId).label}),` ·`,` `,Ke(r.selector,n)]})}function Ur(e){let{user:t}=bt(),n=t?.isAdmin===!0;return d(Ir,{...e,callerScopes:n?null:t?.scopes??[]})}e();var Wr={"api-keys":$.tokens,"linked-sessions":$.linkedApps},Gr=`certificates`;function Kr(e){return a(U,{size:`sm`,type:`button`,"data-testid":`certificates-pair-device`,onClick:e,children:[d(y,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),J.t(`systemPage.identity.pairADevice`,`Pair a device`)]})}function qr(){let{t:e}=Y(),[t]=gt(),n=Rn(),[i,a]=r(!1),o=Wr[t.get(`tab`)??``];if(o!==void 0)return d(mt,{to:_t(`access`,{integration:o}),replace:!0});let s=ut(`/system/identity`,{t:e,isAdmin:!0})??{icon:k,title:e(`system.identity`,`Identity & Access`)},c=t.get(`tab`)??`users`,l=t.get(`integration`),u=c===ht.access.tab?Ln(l,n.requestCreate):c===`certificates`?Kr(()=>a(!0)):void 0;return d(xt,{icon:s.icon,title:s.title,defaultSection:`users`,sectionsLabel:`${s.title} sections`,actions:u,sections:[{id:`users`,label:e(`systemPage.identity.users`,`Users`),content:d(Vr,{})},{id:ht.access.tab,label:e(`systemPage.identity.tokensSessions`,`Tokens & sessions`),content:d(In,{createRequested:n.createRequested,onCreateConsumed:n.clearCreate}),ownedParams:yt.concat([hn.token,hn.scoped,hn.admin])},{id:Gr,label:e(`systemPage.identity.certificates`,`Certificates`),content:d(Or,{pairOpen:i,onPairClose:()=>a(!1)})},{id:ht.authentication.tab,label:e(`systemPage.identity.authentication`,`Authentication`),content:d(Zn,{}),ownedParams:yt}]})}export{qr as IdentityPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,B as t,G as n,J as r,L as i,S as a,o,q as s,x as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{Ir as l,It as u,Lr as d,Nt as f,On as p,Sn as m,_i as h,_n as g,ai as _,ar as v,bi as y,di as b,dt as x,fn as S,ht as C,ia as w,ln as ee,ot as T,qi as E,yi as D,yn as O}from"./player-overlays-D0U2dNvn.js";import{t as k}from"./search-x-eqJd3G8u.js";import{Mr as A}from"./client-DYbvGOid.js";import{$i as j,An as M,Dn as N,En as te,It as P,Ji as ne,Kt as F,Mr as I,Sa as L,Tn as R,Tt as z,Va as B,Xi as V,Yi as H,Zi as U,ao as W,co as G,et as re,fo as ie,fu as ae,ha as oe,hr as K,in as q,jn as se,lo as ce,lu as le,mr as ue,na as de,oa as fe,oo as pe,qi as me,rt as he,sa as ge,so as _e,ta as J,tt as ve,ua as ye,uo as Y,wa as be,yn as xe}from"./src-CGxdJN_f.js";import{t as X}from"./useTranslation-D3Is_4B6.js";import{n as Se}from"./addon-icons-context--6Hi3qRW.js";import{$ as Ce,L as we,Q as Te,Y as Ee,et as De}from"./index-DvOECbab.js";import{t as Oe}from"./NodeAddonsSettingsPanel-BMat4ckt.js";import{t as ke}from"./device-integration-icon-D2lWVDM2.js";import{n as Ae,r as je,t as Me}from"./ScanNetworkModal-dHWFmbFe.js";e();function Z(e){let t=[];for(let n of e)n.type===`probe`&&t.push(n.key),n.type===`group`&&`fields`in n&&t.push(...Z(n.fields));return t}function Ne(e,t,a){let[o,s]=r(`idle`),[c,l]=r({}),u=n(()=>{let t=[];for(let n of e.sections)t.push(...Z(n.fields));return t},[e]),d=u.length>0&&a!==void 0,f=i(e=>{l(t=>{if(!t[e])return t;let n={...t};return delete n[e],n})},[]);return{testAllStatus:o,hasProbeFields:d,probeResults:c,handleTestAll:i(async()=>{if(!a)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 a(e,t[e])}}catch(t){return{key:e,result:{status:`error`,error:t instanceof Error?t.message:String(t)}}}})),i={};for(let e of r)if(e.status===`fulfilled`){let{key:t,result:n}=e.value;i[t]={status:n.status===`ok`?`ok`:`error`,result:n}}l(i),s(`idle`)},[a,u,t]),clearProbeResult:f}}e();function Pe(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(...Pe(n.fields));return t}function Fe(e){return e==null?!0:typeof e==`string`?e.trim()===``:!1}function Ie(e,t={}){for(let n of e){if(n.type===`group`&&`fields`in n){Ie(n.fields,t);continue}`key`in n&&n.key&&`default`in n&&n.default!==void 0&&(t[n.key]=n.default)}return t}function Le(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`probe-${crypto.randomUUID()}`:`probe-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function Re({open:e,integrationId:s,addonId:l,onClose:u}){let{t:d}=X(),p=o(),[m,h]=r({}),[g,_]=r(!1),[y,b]=r(null),[w,ee]=r(Le),T=L({addonId:l},{enabled:e}),E=T.data?.deviceType??null,O=ye({addonId:l,type:E??A.Camera},{enabled:e&&T.isSuccess&&E!==null}),k=O.data??null;t(()=>{e&&(h(k?Ie(k.sections.flatMap(e=>e.fields)):{}),ee(Le()),_(!1),b(null))},[e,s,k]);let j=n(()=>({...m,_probeRequestId:w}),[m,w]),M=J({onSuccess:()=>{p.invalidateQueries({queryKey:[[`deviceManager`]]})}}),N=B(),te=i(async(e,t)=>{_(!0);let n=await N.mutateAsync({addonId:l,type:E??A.Camera,key:e,value:t,formValues:j});return n.status===`ok`&&n.suggestedValues&&h(e=>{let t=!1,r={...e};for(let[i,a]of Object.entries(n.suggestedValues??{}))Fe(e[i])&&!Fe(a)&&(r[i]=a,t=!0);return t?r:e}),n},[N,l,j,E]),{testAllStatus:P,hasProbeFields:ne,probeResults:F,handleTestAll:I,clearProbeResult:R}=Ne(k??{sections:[]},m,te);async function V(e){b(null);try{await M.mutateAsync({addonId:l,type:E??A.Camera,config:m,integrationId:s}),e?h(k?Ie(k.sections.flatMap(e=>e.fields)):{}):u()}catch(e){b(e instanceof Error?e.message:String(e))}}if(!e)return null;let H=Pe((k?.sections??[]).flatMap(e=>e.fields)).filter(e=>Fe(m[e])),U=H.length===0,W=T.isLoading||E!==null&&O.isLoading,G=T.isError||T.isSuccess&&E===null||O.isError||O.isSuccess&&k===null;return a(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[c(`div`,{className:`absolute inset-0 bg-black/60`,onClick:u}),a(`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:[a(`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:d(`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(x,{className:`h-4 w-4`})})]}),c(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-3`,children:W?c(`div`,{className:`flex items-center justify-center py-8`,children:c(v,{className:`h-5 w-5 animate-spin text-primary`})}):G?a(`div`,{className:`flex items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3`,children:[c(f,{className:`h-4 w-4 text-destructive mt-0.5 shrink-0`}),a(`div`,{className:`space-y-1`,children:[c(`p`,{className:`text-xs font-medium text-destructive`,children:d(`integrations.addDeviceDialog.providerUnavailable`,`Provider unavailable`)}),c(`p`,{className:`text-xs text-foreground-subtle`,children:c(Ee,{i18nKey:`integrations.addDeviceDialog.notReady`,values:{addonId:l},components:{mono:c(`span`,{className:`font-mono`})}})})]})]}):c(we,{schema:k,values:m,onChange:h,onTestField:te,probeResults:F,onClearProbe:R})}),!G&&!W&&a(`div`,{className:`border-t border-border bg-surface/50 shrink-0`,children:[a(`button`,{type:`button`,onClick:()=>_(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:[a(`span`,{className:`flex items-center gap-2`,children:[c(S,{className:`h-3.5 w-3.5`}),d(`integrations.addDeviceDialog.testLogs`,`Test logs`),c(`span`,{className:`font-mono text-[9px] opacity-60`,children:w.slice(0,14)})]}),c(D,{className:`h-3.5 w-3.5 transition-transform ${g?`rotate-180`:``}`})]}),g&&c(`div`,{className:`border-t border-border max-h-64 overflow-hidden`,children:c(z,{addonId:l,requestId:w,limit:50,maxHeight:`max-h-64`,showFilters:!1,showScope:!1,className:`border-0 rounded-none`})})]}),!G&&!W&&(y||H.length>0)&&c(`div`,{className:`border-t border-destructive/30 bg-destructive/5 px-5 py-2 shrink-0`,children:a(`div`,{className:`flex items-start gap-2`,children:[c(f,{className:`h-3.5 w-3.5 text-destructive mt-0.5 shrink-0`}),c(`p`,{className:`text-[11px] text-destructive`,children:y||d(`integrations.addDeviceDialog.required`,`Required: {{value1}}`,{value1:H.join(`, `)})})]})}),a(`div`,{className:`flex items-center justify-between border-t border-border px-5 py-3 shrink-0`,children:[a(`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:d(`integrations.cancel`)}),!G&&ne&&a(`button`,{type:`button`,onClick:I,disabled:P===`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:[P===`testing`?c(v,{className:`h-3.5 w-3.5 animate-spin`}):c(C,{className:`h-3.5 w-3.5`}),d(`integrations.addDeviceDialog.testAll`,`Test All`)]})]}),a(`div`,{className:`flex items-center gap-2`,children:[c(`button`,{onClick:()=>V(!0),disabled:G||!U||M.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`)}),c(`button`,{onClick:()=>V(!1),disabled:G||!U||M.isPending,className:`rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50`,children:M.isPending?d(`integrations.saving`):d(`integrations.save`)})]})]})]})]})}var Q=1500;function ze({addonId:e,integrationId:t,jobId:n,onFinished:r}){let{t:i}=X(),o=me(),s=(V({addonId:e,integrationId:t},{refetchInterval:e=>(e.state.data??[]).some(e=>e.state===`running`)?Q:!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&&r();let p=[`${u}/${s.total} ${i(`integrations.adoptJobProcessed`,{defaultValue:`processed`})}`];s.adopted>0&&p.push(`${s.adopted} ${i(`integrations.adoptJobAdded`,{defaultValue:`added`})}`),s.alreadyAdopted>0&&p.push(`${s.alreadyAdopted} ${i(`integrations.adoptJobSkipped`,{defaultValue:`already there`})}`),s.failed>0&&p.push(`${s.failed} ${i(`integrations.adoptJobFailed`,{defaultValue:`failed`})}`);let m=p.join(` · `);return a(`div`,{className:`border-t border-border px-5 py-3 shrink-0 space-y-2`,children:[a(`div`,{className:`flex items-center gap-2`,children:[l?c(v,{className:`h-3.5 w-3.5 animate-spin text-primary shrink-0`}):s.failed>0?c(f,{className:`h-3.5 w-3.5 text-destructive shrink-0`}):s.state===`cancelled`?c(_,{className:`h-3.5 w-3.5 text-foreground-subtle shrink-0`}):c(b,{className:`h-3.5 w-3.5 text-primary shrink-0`}),c(`p`,{className:`text-[11px] text-foreground`,children:m}),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:i(`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=>a(`p`,{className:`text-[11px] text-destructive`,children:[e.childNativeId,`: `,e.error]},e.childNativeId))]})}function Be(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(` `)}e();var $=`devices`;function Ve(e){return{id:$,label:e(`integrations.adoptDevicesModal.defaultFilter`),isDefault:!0}}var He=2e4,Ue=100;function We({addonId:e,integrationId:n,onClose:l}){let u=w(),{t:d}=X(),p=o(),[m,h]=r(new Set),[_,b]=r(new Set),[S,C]=r(new Map),[ee,T]=r(null),{data:E}=_e(),D=(E??[]).find(t=>t.addonId===e)?.supportsLocationImport??!1,[O,k]=r(!0),A=ne({addonId:e,integrationId:n}).data?.filters,M=A&&A.length>0?A:[Ve(d)],[N,te]=r(M.find(e=>e.isDefault)?.id??(M.some(e=>e.id===$)?$:M[0].id)),P=N!==$,F=U(),I=H({addonId:e,integrationId:n,page:1,pageSize:He,filter:N}),L=I.refetch,R=F.mutate,z=i(()=>{R({addonId:e,integrationId:n},{onSettled:()=>{L()}})},[R,e,n,L]),B=s(null);t(()=>{let t=`${e}::${n}`;B.current===t||I.isLoading||(B.current=t,(I.data?.candidates.length??0)===0&&z())},[e,n,I.isLoading,I.data,z]);let V=F.isPending,W=F.isError?F.error instanceof Error?F.error.message:String(F.error):null,G=typeof F.data?.lastError==`string`&&F.data.lastError.length>0?F.data.lastError:null,ie=I.data?.candidates??[],oe=I.isError?I.error instanceof Error?I.error.message:String(I.error):null,K=j(),[q,se]=r(null),ce=i(e=>{e.alreadyAdopted||h(t=>{let n=new Set(t);return n.has(e.childNativeId)?n.delete(e.childNativeId):n.add(e.childNativeId),n})},[]),ue=i(e=>{b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),de=i((e,t)=>{C(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})},[]),fe=i(e=>{let t={};for(let n of e){let e=S.get(n);e&&e.hiddenChildIds.size>0&&(t[n]={hiddenChildIds:[...e.hiddenChildIds]})}return Object.keys(t).length>0?t:void 0},[S]),pe=i(async()=>{T(null);let t=[...m];if(t.length!==0)try{let r=fe(t),{jobId:i}=await K.mutateAsync({addonId:e,integrationId:n,filter:N,childNativeIds:t,...r?{perCandidate:r}:{},...D?{importLocations:O}:{}});se(i),h(new Set),C(new Map)}catch(e){T(e instanceof Error?e.message:String(e))}},[m,fe,K,e,n,N,D,O]),me=s(null),he=i(()=>{q===null||me.current===q||(me.current=q,L(),p.invalidateQueries({queryKey:[[`integrations`]]}),p.invalidateQueries({queryKey:[[`deviceManager`]]}))},[q,L,p]),ge=i(e=>{te(e),h(new Set),b(new Set),C(new Map),T(null)},[]),J=m.size,ve=q!==null&&J===0&&!K.isPending;return a(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[c(`div`,{className:`absolute inset-0 bg-black/60`,onClick:l}),a(`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:[a(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[a(`div`,{className:`min-w-0`,children:[c(`h2`,{className:`text-sm font-semibold text-foreground`,children:d(`integrations.adoptDevices`,{defaultValue:`Adopt devices`})}),c(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:d(`integrations.adoptDevicesHint`,{defaultValue:`Preview the candidate devices and add the ones you want.`})})]}),a(`div`,{className:`flex items-center gap-3 shrink-0`,children:[D&&a(`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:O,onChange:e=>k(e.target.checked),className:`accent-primary`}),d(`integrations.importLocations`,{defaultValue:`Import locations from the integration`})]}),c(`button`,{onClick:l,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,"aria-label":d(`common.close`,`Close`),children:c(x,{className:`h-4 w-4`})})]})]}),a(`div`,{className:`flex-1 min-h-0 px-5 py-3 flex flex-col gap-2 overflow-hidden`,children:[(W??oe??G)&&ie.length===0&&c(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 px-4 py-3 shrink-0`,children:a(`div`,{className:`flex items-start gap-2`,children:[c(f,{className:`h-3.5 w-3.5 text-destructive mt-0.5 shrink-0`}),a(`div`,{className:`min-w-0`,children:[c(`p`,{className:`text-xs font-medium text-destructive`,children:d(`integrations.adoptRefreshFailed`,{defaultValue:`Could not discover devices.`})}),c(`p`,{className:`text-[11px] text-destructive/90 mt-0.5`,children:W??oe??G})]})]})}),M.length>1&&c(Ge,{filters:M,activeFilter:N,onSelect:ge}),c(`div`,{className:`flex-1 min-h-0`,children:c(re,{mode:`generic`,items:ie,pageSize:Ue,getKey:e=>e.childNativeId,getSearchText:Be,getFilterType:e=>e.type,filterOptions:le(u),filterLabel:d(`integrations.adoptColType`,{defaultValue:`Type`}),isLoading:I.isLoading||V&&ie.length===0,searchPlaceholder:d(`integrations.adoptSearch`,{defaultValue:`Search candidates…`}),emptyLabel:(W??oe??G)&&ie.length===0?``:d(`integrations.adoptNoCandidates`,{defaultValue:`No candidate devices found.`}),toolbar:a(`button`,{type:`button`,onClick:z,disabled:V,title:d(`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 ${V?`animate-spin`:``}`}),d(`integrations.adoptRefresh`,{defaultValue:`Refresh`})]}),columns:[{key:`name`,header:d(`integrations.adoptColName`,{defaultValue:`Name`}),headerClassName:`w-[55%]`,cell:e=>c(Ke,{candidate:e,expandable:!P,expanded:_.has(e.childNativeId),onToggleExpand:()=>ue(e.childNativeId),adoptedLabel:d(`integrations.adoptAlready`,{defaultValue:`Adopted`})})},{key:`type`,header:d(`integrations.adoptColType`,{defaultValue:`Type`}),headerClassName:`w-[30%] hidden sm:table-cell`,cellClassName:`hidden sm:table-cell`,cell:e=>{let t=ae(e.type,u),n=t.icon;return a(`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:()=>ce(e),disabled:e.alreadyAdopted,"aria-label":m.has(e.childNativeId)?d(`integrations.adoptDevicesModal.deselect`,`Deselect`):d(`integrations.adoptDevicesModal.select`,`Select`),className:`inline-flex h-5 w-5 items-center justify-center rounded border ${m.has(e.childNativeId)?`border-primary bg-primary`:`border-border`} ${e.alreadyAdopted?`cursor-not-allowed opacity-50`:``}`,children:m.has(e.childNativeId)&&c(y,{className:`h-3 w-3 text-primary-foreground`})})})}],isExpanded:e=>!P&&_.has(e.childNativeId),renderExpanded:P?void 0:e=>c(qe,{candidate:e,hiddenChildIds:S.get(e.childNativeId)?.hiddenChildIds??new Set,onToggleChildHidden:t=>de(e.childNativeId,t)}),rowClassName:e=>e.alreadyAdopted?`opacity-60`:m.has(e.childNativeId)?`bg-primary/5`:``})})]}),ee&&c(`div`,{className:`border-t border-destructive/30 bg-destructive/5 px-5 py-2 shrink-0`,children:a(`div`,{className:`flex items-start gap-2`,children:[c(f,{className:`h-3.5 w-3.5 text-destructive mt-0.5 shrink-0`}),c(`p`,{className:`text-[11px] text-destructive`,children:ee})]})}),q!==null&&c(ze,{addonId:e,integrationId:n,jobId:q,onFinished:he}),a(`div`,{className:`flex items-center justify-between border-t border-border px-5 py-3 shrink-0`,children:[c(`div`,{}),a(`div`,{className:`flex items-center gap-2`,children:[c(`button`,{onClick:l,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`,{defaultValue:`Cancel`})}),a(`button`,{onClick:ve?l:pe,disabled:!ve&&(J===0||K.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:[K.isPending&&c(v,{className:`h-3.5 w-3.5 animate-spin`}),ve?d(`integrations.close`,{defaultValue:`Close`}):d(`integrations.addSelected`,{defaultValue:`Add selected`}),!ve&&J>0?` (${J})`:``]})]})]})]})]})}function Ge({filters:e,activeFilter:t,onSelect:n}){let{t:r}=X();return c(`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 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 Ke({candidate:e,expandable:t,expanded:n,onToggleExpand:r,adoptedLabel:i}){let{t:o}=X(),s=(e.children??[]).length;return a(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[t&&s>0?a(`button`,{type:`button`,onClick:r,"aria-label":n?o(`integrations.adoptDevicesModal.collapse`,`Collapse`):o(`integrations.adoptDevicesModal.expand`,`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?D:h,{className:`h-3.5 w-3.5`}),s]}):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:i})]})}function qe({candidate:e,hiddenChildIds:t,onToggleChildHidden:n}){let{t:r}=X(),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),o=e.capabilities??[];return a(`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}),o.length>0&&c(`span`,{className:`text-[9px] text-foreground-subtle truncate`,children:o.join(`, `)}),c(`button`,{onClick:()=>n(e.childNativeId),"aria-label":i?r(`integrations.adoptDevicesModal.showChild`,`Show child`):r(`integrations.adoptDevicesModal.hideChild`,`Hide child`),title:i?r(`integrations.adoptDevicesModal.showAfterAdopt`,`Show after adopt`):r(`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:c(i?d:l,{className:`h-3 w-3`})})]},e.childNativeId)})})}e();function Je(e){let t=[];for(let n of e){if(n.type===`group`){t.push(...Je(n.fields));continue}`key`in n&&typeof n.key==`string`&&t.push(n.key)}return t}function Ye(e,t){if(!e)return{};let n=new Set(e.sections.flatMap(e=>Je(e.fields))),r={};for(let e of n)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r}function Xe(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 Ze({integrationId:e,addonId:t,name:r,kind:i,mode:s,brokerKind:l,canTest:u=!1,trpc:d,onClose:f}){let{t:p}=X(),m=o(),{data:h,isLoading:g}=G({id:e},{enabled:s===`account`||s===`broker`}),_=n(()=>{let e=h?.brokerId;return typeof e==`string`?e:null},[h]),{data:y,isLoading:b}=ue({addonId:t,nodeId:`hub`},{enabled:s===`account`}),x=n(()=>y?Xe(y):null,[y]),S=Y(),C=(t,n)=>{S.mutate({id:e,settings:t,...n?{secretKeys:[...n]}:{}},{onSuccess:()=>{m.invalidateQueries(),f()}})};return c(R,{open:!0,onOpenChange:e=>!e&&f(),children:a(N,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,children:[c(M,{children:a(se,{children:[p(`integrations.editConfig`,{defaultValue:`Edit configuration`}),` — `,r]})}),c(te,{children:s===`broker`?l?a(`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.`})}),_&&a(`p`,{className:`text-[11px] text-foreground`,children:[p(`integrations.currentBroker`,{defaultValue:`Current broker`}),`:`,` `,c(`span`,{className:`font-mono text-foreground-subtle`,children:_})]}),S.isPending?a(`div`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[c(v,{className:`h-3 w-3 animate-spin`}),p(`integrations.saving`,{defaultValue:`Saving…`})]}):c(je,{kind:l,onResolved:e=>{C({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`?g||b?a(`div`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[c(v,{className:`h-3 w-3 animate-spin`}),p(`integrations.loading`,{defaultValue:`Loading…`})]}):c(Ae,{addonId:t,configSchema:x,canTest:u,initialName:r,initialConfig:Ye(x,h??{}),submitLabel:p(`integrations.save`,{defaultValue:`Save`}),hideName:!0,onSave:({config:e,secretKeys:t})=>C(e,t),onBack:f}):c(xe,{trpc:d,addonId:t,nodeId:`hub`,title:r})})]})})}function Qe(e){return e==null?!1:e.sections.some(e=>e.fields.length>0)}e();function $e(){let{t:e}=X(),{integrationId:s}=Ce(),l=o(),d=Te(),[f,h]=De(),g=T(),[_,y]=r(!1),[b,x]=r(!1),[C,w]=r(!1),[D,A]=r(!1),{data:j,isLoading:ne}=pe({id:s??``},{enabled:!!s}),{data:L}=ue({addonId:j?.addonId??``,nodeId:`hub`},{enabled:!!j?.addonId}),{data:B,isSuccess:V}=_e(),H=n(()=>{let e=j?.addonId;return!e||!V?null:(B??[]).find(t=>t.addonId===e)?.kind===`device-adoption`?`device-adoption`:`device-provider`},[B,j?.addonId,V]),{data:U}=fe({}),G=n(()=>(U?.providers??[]).some(e=>e.addonId===j?.addonId),[U,j?.addonId]),ae=H!==null,le=j?.info?.fixed===!0,me=ae?H===`device-adoption`?e(`integrations.adoptDevices`,{defaultValue:`Adopt devices`}):e(`integrations.addDevice`):e(`integrations.addDeviceLoading`,{defaultValue:`Loading…`}),J=n(()=>{let e=j?.addonId;return!e||!V?null:(B??[]).find(t=>t.addonId===e)?.brokerKind??null},[B,j?.addonId,V]),ye=n(()=>{let e=j?.addonId;return!e||!V?!1:(B??[]).find(t=>t.addonId===e)?.canTest===!0},[B,j?.addonId,V]),Y=n(()=>{let e=j?.addonId;return!e||!V?null:(B??[]).find(t=>t.addonId===e)?.mode??null},[B,j?.addonId,V]);t(()=>{f.get(`add`)===`1`&&ae&&(y(!0),h(e=>{let t=new URLSearchParams(e);return t.delete(`add`),t},{replace:!0}))},[f,ae,h]);let xe=L!=null&&Array.isArray(L.sections)&&L.sections.some(e=>e.fields.length>0),{data:Se}=K({addonId:j?.addonId??``,nodeId:`hub`},{enabled:!!j?.addonId&&Y!==`account`}),we=Y!==null&&Y!==`account`&&Qe(Se),Ee=n(()=>j?.addonId?[j.addonId]:[],[j?.addonId]),{data:Ae}=oe({projection:`slim`},{refetchInterval:3e4}),je=[[`integrations`,`get`],{input:{id:s??``},type:`query`}],Z=ie({onMutate:async e=>{await l.cancelQueries({queryKey:je});let t=l.getQueryData(je);return t!=null&&l.setQueryData(je,{...t,enabled:e.enabled}),{previous:t}},onError:(e,t,n)=>{let r=n;r?.previous!=null&&l.setQueryData(je,r.previous)},onSettled:()=>{l.invalidateQueries({queryKey:[[`integrations`]]}),l.invalidateQueries({queryKey:[[`deviceManager`]]})}}),Ne=W({onSuccess:()=>{l.invalidateQueries({queryKey:[[`integrations`]]}),l.invalidateQueries({queryKey:[[`deviceManager`]]}),d(`/integrations`)}}),Pe=I({onSuccess:()=>{l.invalidateQueries({queryKey:[[`integrations`]]}),l.invalidateQueries({queryKey:[[`deviceManager`]]})}}),Fe=be({onSuccess:()=>{l.invalidateQueries({queryKey:[[`deviceManager`]]})}}),Ie=de({onSuccess:()=>{l.invalidateQueries({queryKey:[[`deviceManager`]]})}}),Le=ge({onSuccess:()=>{l.invalidateQueries({queryKey:[[`deviceManager`]]})}}),Q=n(()=>Ae??[],[Ae]),ze=n(()=>{let e=new Map;for(let t of Q)e.set(t.id,{id:t.id,name:t.name??t.stableId??`#${String(t.id)}`});return e},[Q]),Be=i(e=>ze.get(e)??null,[ze]),{data:$}=ce(void 0),Ve=n(()=>ve($),[$]),He=i(e=>d(`/devices/${String(e)}`),[d]),Ue=n(()=>{let e=j?.id;return e?Q.filter(t=>{let n=Ve(t);return n.kind===`resolved`&&n.integration.id===e}):[]},[Q,j?.id,Ve]),Ge=n(()=>$===void 0?null:he(Ue).length,[$,Ue])??`…`;return ne?a(`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`})]}):j?a(`div`,{className:`p-4 space-y-4 overflow-x-hidden`,children:[c(F,{items:[{label:e(`integrationDetail.integrations`,`Integrations`),onClick:()=>d(`/integrations`)},{label:j.name}]}),a(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[a(`div`,{className:`flex items-center gap-3 min-w-0`,children:[c(et,{addonId:j.addonId}),a(`div`,{className:`min-w-0`,children:[c(`h1`,{className:`text-lg font-semibold text-foreground truncate`,children:j.name}),a(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5 truncate`,children:[j.addonId,` · `,Ge,` `,e(`integrations.devices`)]})]})]}),a(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[G&&a(`button`,{onClick:()=>x(!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:e(`integrationDetail.scanTheNetworkForDevices`,`Scan the network for devices (incl. a different subnet)`),children:[c(m,{className:`h-3.5 w-3.5`}),e(`integrationDetail.scanNetwork`,`Scan network`)]}),!le&&a(`button`,{onClick:()=>y(!0),disabled:!ae,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:me,children:[c(p,{className:`h-3.5 w-3.5`}),me]}),a(`div`,{className:`inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 transition-colors ${Z.isPending?`opacity-60`:``} ${j.enabled?`border-success/30 bg-success/5`:`border-border bg-surface`}`,title:e(`integrations.toggleHint`,{defaultValue:`Click to toggle`}),children:[c(q,{checked:j.enabled,onCheckedChange:e=>Z.mutate({id:s,enabled:e}),disabled:Z.isPending,"aria-label":j.enabled?e(`integrationDetail.disableIntegration`,`Disable integration`):e(`integrationDetail.enableIntegration`,`Enable integration`)}),c(`span`,{className:`text-[11px] font-medium ${j.enabled?`text-success`:`text-foreground-subtle`}`,children:j.enabled?e(`integrationDetail.enabled`,`Enabled`):e(`integrationDetail.disabled`,`Disabled`)}),Z.isPending&&c(v,{className:`h-3 w-3 animate-spin text-foreground-subtle`})]}),Y!==`standalone`&&(xe||H===`device-adoption`)&&a(`button`,{onClick:()=>w(!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(ee,{className:`h-3 w-3`}),e(`integrations.config`)]}),a(`button`,{onClick:()=>A(!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:e(`integrations.logs`,{defaultValue:`View logs`}),children:[c(S,{className:`h-3 w-3`}),e(`integrations.logs`,{defaultValue:`Logs`})]}),c(P,{label:e(`integrationDetail.restart`,`Restart`),icon:O,title:e(`integrationDetail.restart2`,`Restart "{{name}}"?`,{name:j.name}),description:e(`integrationDetail.restartingTheAddonWillBriefly`,`Restarting the addon will briefly disconnect every device backed by it ({{topLevelCountLabel}} active). Streams will reconnect automatically.`,{topLevelCountLabel:Ge}),confirmLabel:e(`integrationDetail.restart`,`Restart`),triggerVariant:`outline`,confirmVariant:`danger`,disabled:Pe.isPending,action:()=>Pe.mutateAsync({addonId:j.addonId})}),!le&&s&&c(P,{label:e(`integrations.delete`,{defaultValue:`Delete`}),icon:u,title:e(`integrations.deleteTitle`,{defaultValue:`Delete integration?`}),description:e(`integrations.deleteWarning`,{defaultValue:`This removes the integration "{{name}}" and its {{count}} device(s). The addon will restart. This cannot be undone.`,name:j.name,count:Ge}),confirmLabel:e(`integrations.confirmDelete`,{defaultValue:`Delete integration`}),triggerVariant:`outline`,confirmVariant:`danger`,className:`border-danger bg-danger/10 text-danger hover:bg-danger hover:text-background`,disabled:Ne.isPending,action:()=>Ne.mutateAsync({id:s})})]})]}),we&&c(Oe,{nodeId:null,addonIds:Ee,level:`global`,surface:`integration`,title:e(`integrations.settings`,{defaultValue:`Settings`})}),c(re,{context:`integration-detail`,devices:Q,trpc:g.trpcClient,integrationOf:Ve,forceIntegrationId:j.id,urlScope:`root`,lsKey:`integration-detail:${j.addonId}`,resolveIntegrationIcon:ke,resolveParent:Be,onNavigate:He,batchActions:{remove:Fe.mutate,disable:Ie.mutate,enable:Le.mutate},...le?{}:{onDeleteDevice:e=>Fe.mutate({deviceId:e.id})}}),_&&s&&H===`device-adoption`&&c(We,{addonId:j.addonId,integrationId:s,onClose:()=>y(!1)}),_&&s&&H===`device-provider`&&c(Re,{open:_,integrationId:s,addonId:j.addonId,onClose:()=>y(!1)}),b&&j&&c(Me,{open:b,scope:{addonId:j.addonId,label:j.name},onClose:()=>x(!1)}),C&&s&&H!==null&&Y!==null&&c(Ze,{integrationId:s,addonId:j.addonId,name:j.name,kind:H,mode:Y,brokerKind:J,canTest:ye,trpc:g.trpcClient,onClose:()=>w(!1)}),D&&c(R,{open:!0,onOpenChange:e=>!e&&A(!1),children:a(N,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,className:`md:max-w-5xl md:h-[80vh]`,children:[c(M,{className:`mb-0`,children:a(se,{className:`flex items-center gap-2 min-w-0`,children:[c(S,{className:`h-4 w-4 text-primary shrink-0`}),c(`span`,{className:`truncate`,children:j.name}),a(`span`,{className:`text-[10px] text-foreground-subtle font-mono truncate font-normal`,children:[j.addonId,s?` · ${s}`:``]})]})}),c(te,{className:`min-h-0 overflow-hidden p-0`,children:c(z,{addonId:j.addonId,limit:200,maxHeight:`max-h-full`,showScope:!1,className:`h-full border-0 rounded-none`})})]})})]}):a(`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(k,{className:`h-6 w-6 text-foreground-subtle`})}),a(`div`,{className:`space-y-1 max-w-sm`,children:[c(`h2`,{className:`text-sm font-semibold text-foreground`,children:e(`integrations.integrationNotFound`,{defaultValue:`Integration not found`})}),c(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`integrations.integrationNotFoundHint`,{defaultValue:`The integration "{{id}}" does not exist. It may have been deleted, or the URL may be wrong.`,id:s??``})})]}),a(`button`,{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:[c(E,{className:`h-3 w-3`}),e(`integrations.backToList`,{defaultValue:`Back to integrations`})]})]})}function et({addonId:e}){let t=Se(e),[n,i]=r(!1);return!t||n?null:c(`img`,{src:t,alt:``,className:`h-8 w-8 rounded-lg shrink-0`,onError:()=>i(!0)})}export{$e as IntegrationDetailPage};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{$ as e,B as t,G as n,J as r,S as i,b as a,o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{$t as c,Br as l,Fi as u,Fr as d,Hi as f,It as p,Mr as m,O as h,On as g,Pn as _,Qi as v,Qr as y,Rt as b,V as x,Vr as S,Vt as C,Xi as w,Zi as T,_i as E,cr as D,dt as O,er as k,fn as A,hr as j,ji as ee,k as M,ki as N,lr as P,nn as F,nr as I,pt as L,sn as R,ui as z,ut as B,wi as te,yi as ne,yn as V,z as H,zt as re}from"./player-overlays-D0U2dNvn.js";import{t as ie}from"./boxes-DikDfAoo.js";import{n as ae,r as oe,t as se}from"./speaker-CcCWWecW.js";import{t as ce}from"./user-round-CMg3Ndlt.js";import{Xt as le,er as U,nr as W}from"./client-DYbvGOid.js";import{$l as ue,An as de,Bn as G,Da as fe,Dn as K,Ea as pe,En as me,Gi as he,Hi as ge,Ma as _e,Na as ve,Nt as ye,Oa as be,Pa as xe,Pt as Se,Ql as q,Ta as Ce,Tn as we,Ui as Te,Ut as J,W as Ee,Wi as De,Zn as Oe,_a as ke,an as Ae,ar as je,ba as Me,d as Ne,eu as Pe,ha as Fe,ja as Ie,jn as Le,kn as Re,on as ze,ql as Be,tr as Ve,va as He,ya as Ue,za as We}from"./src-CGxdJN_f.js";import{t as Y}from"./i18n-Vb3uBp7P.js";import{t as X}from"./useTranslation-D3Is_4B6.js";import{Q as Ge,X as Z,et as Ke,x as qe}from"./index-DvOECbab.js";import{t as Je}from"./AdminSectionedPage-B-qoE6ra.js";import{a as Ye,n as Xe,r as Ze}from"./linked-devices-model-CB7qgVjI.js";e();var Qe={camera:te,hub:ae,container:ie,light:P,siren:F,switch:re,sensor:v,thermostat:C,climate:T,button:z,"event-emitter":B,update:oe,notifier:u,script:A,automation:L,lock:I,cover:ee,valve:S,humidifier:l,"water-heater":m,fan:d,"media-player":se,"alarm-panel":R,control:c,presence:ce,weather:y,vacuum:N,"lawn-mower":b,image:j,smoke:w};function Q({type:e,className:t}){return s(Qe[e]??z,{"aria-hidden":`true`,className:t??`h-3.5 w-3.5 shrink-0 text-foreground-subtle`})}function $e({online:e,deviceName:t}){return s(`span`,{className:e?`inline-block h-1.5 w-1.5 shrink-0 rounded-full bg-success`:`inline-block h-1.5 w-1.5 shrink-0 rounded-full border border-foreground-subtle`,role:`img`,"aria-label":Y.t(`locations.deviceGlyphs.aria`,{name:t,state:e?Y.t(`common.online`):Y.t(`common.offline`)}),title:e?Y.t(`common.online`):Y.t(`common.offline`)})}function et({open:e,title:n,items:a,listState:o,lockedIds:c,lockedNote:l,suggestions:u=null,busy:d=!1,onConfirm:f,onClose:p}){let{t:m}=X(),[h,g]=r([]);t(()=>{e||g([])},[e]);let _=new Map(a.map(e=>[e.id,e.name])),v=(u?.ids??[]).filter(e=>_.has(e)&&!c.includes(e)),y=e=>g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return s(we,{open:e,onOpenChange:e=>e?void 0:p(),children:i(K,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,"aria-label":n,children:[s(de,{children:s(Le,{children:n})}),i(me,{className:`flex flex-col gap-3 p-2 sm:p-4`,children:[e&&u!==null&&v.length>0&&i(`section`,{"aria-label":u.heading,className:`flex flex-col gap-1`,children:[s(`h3`,{className:`text-[10px] sm:text-[11px] font-semibold text-foreground uppercase tracking-wider`,children:u.heading}),s(`div`,{className:`flex flex-wrap gap-1`,children:v.map(e=>s(`button`,{type:`button`,"aria-pressed":h.includes(e),className:`inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium transition-colors ${h.includes(e)?`border-primary/50 bg-primary/15 text-primary`:`border-border bg-surface text-foreground-subtle hover:bg-surface-hover`}`,onClick:()=>y(e),children:_.get(e)},e))})]}),e&&s(Ne,{devices:a,listState:o,value:h,onChange:e=>g(e),noun:`device`,emptyLabel:m(`locations.addDialog.nonePicked`),showAll:!0,lockedIds:c,lockedNote:l,testId:`quick-add-picker`})]}),i(Re,{children:[s(G,{variant:`ghost`,onClick:p,children:m(`locations.addDialog.cancel`)}),s(G,{disabled:h.length===0||d,onClick:()=>f(h),children:m(`locations.addDialog.confirm`,{count:h.length})})]})]})})}e();function tt({room:e,cameras:t,fleet:r}){let{t:i}=X(),a=n(()=>new Map(r.map(e=>[e.id,e])),[r]);return e===null?s(`p`,{className:`text-xs text-foreground-subtle`,children:i(`locations.links.noRoom`)}):s(`div`,{className:`flex flex-col gap-3`,"data-testid":`camera-links-section`,children:t.length===0?s(`p`,{className:`text-xs text-foreground-subtle`,"data-testid":`camera-links-empty`,children:i(`locations.links.noCameras`,{room:e})}):t.map(e=>s(rt,{camera:e,byId:a},e.id))})}function nt(e){return{id:e.deviceId,name:e.parentName===null?e.name:`${e.parentName} · ${e.name}`,type:e.type,location:e.location}}function rt({camera:e,byId:t}){let{t:n}=X(),a=o(),c=Ge(),[l,u]=r(!1),[d,f]=r(null),p=Te({deviceId:e.id}),m=Ze({status:p.status,data:p.data,error:p.error===null||p.error===void 0?null:p.error}),g=De(),_=m.kind===`present`?m:null,v=ge({deviceId:e.id,slotRef:_?.slot.slotRef??``},{enabled:l&&_!==null}),y=_===null?[]:Xe(_.slot,_.value),b=y.map(e=>e.deviceId),x=(v.data?.candidates??[]).map(nt),S=new Set(x.map(e=>e.id)),C=b.filter(e=>!S.has(e)).map(e=>{let n=t.get(e);return{id:e,name:n?.name??`#${String(e)}`,...n===void 0?{}:{type:n.type,location:n.location}}}),w=[...x,...C],T=(v.data?.candidates??[]).filter(e=>e.suggested).map(e=>e.deviceId),E=async t=>{if(_!==null){f(null);try{await g.mutateAsync({deviceId:e.id,slotRef:_.slot.slotRef,value:Ye(_.value,t)}),await p.refetch(),await a.invalidateQueries({queryKey:[[`deviceManager`]]}),u(!1)}catch(e){f(e instanceof Error?e.message:String(e))}}},O=[{key:`device`,header:n(`locations.columns.device`),notSortableReason:n(`locations.columns.noSort`),render:e=>{let r=t.get(e.deviceId),a=e.name??r?.name??`#${String(e.deviceId)}`;return i(`span`,{className:`flex items-center gap-1.5`,children:[r!==void 0&&s(Q,{type:r.type}),s(Z,{to:`/devices/${String(e.deviceId)}`,className:`min-w-0 truncate text-xs text-foreground hover:underline`,children:a}),e.implied&&s(`span`,{className:`text-[10px] text-foreground-subtle`,children:n(`locations.links.implied`)})]})}},{key:`type`,header:n(`locations.columns.type`),notSortableReason:n(`locations.columns.noSort`),render:e=>s(`span`,{className:`text-xs text-foreground-muted`,children:t.get(e.deviceId)?.type??`—`})},{key:`status`,header:n(`locations.columns.status`),notSortableReason:n(`locations.columns.noSort`),render:e=>{let r=t.get(e.deviceId);return r===void 0?s(`span`,{className:`text-xs text-foreground-subtle`,children:`—`}):i(`span`,{className:`flex items-center gap-1.5`,children:[s($e,{online:r.online,deviceName:r.name}),s(`span`,{className:`text-xs text-foreground-muted`,children:r.online?n(`common.online`):n(`common.offline`)})]})}}];return i(`section`,{className:`min-w-0 ${h}`,"data-testid":`camera-links-${String(e.id)}`,children:[i(`header`,{className:`${M} flex min-h-9 items-center gap-1.5`,children:[s(Q,{type:e.type}),s(`h2`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-foreground`,children:e.name}),i(G,{variant:`ghost`,size:`sm`,onClick:()=>c(qe(e.id)),children:[s(D,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),n(`locations.links.edit`)]}),s(G,{variant:`outline`,size:`sm`,disabled:_===null,onClick:()=>u(!0),"aria-label":n(`locations.links.addNamed`,{camera:e.name}),children:n(`locations.room.add`)})]}),m.kind===`pending`&&s(`p`,{role:`status`,className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:n(`locations.links.loading`)}),m.kind===`unknown`&&s(`p`,{role:`alert`,className:`px-3 py-3 text-xs text-warning sm:px-4`,children:n(`locations.links.unreadable`,{reason:m.reason})}),m.kind===`absent`&&s(`p`,{className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:n(`locations.links.unsupported`)}),d!==null&&s(`p`,{role:`alert`,className:`px-3 pt-2 text-xs text-danger break-words sm:px-4`,children:d}),_!==null&&(y.length===0?s(`p`,{className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:n(`locations.links.none`)}):s(J,{columns:O,rows:y,rowKey:e=>String(e.deviceId),bordered:!1,minWidthPx:360})),s(et,{open:l,title:n(`locations.links.pickTitle`,{camera:e.name}),items:w,listState:v.status===`error`?`failed`:v.data===void 0?`pending`:`answered`,lockedIds:b,lockedNote:n(`locations.links.alreadyLinked`),suggestions:e.location===null?null:{heading:n(`locations.links.suggested`,{room:e.location}),ids:T},busy:g.isPending,onConfirm:e=>void E(e),onClose:()=>u(!1)})]})}e();function it({name:e,description:n,busy:a,onSave:o}){let{t:c}=X(),[l,u]=r(n??``);return t(()=>{u(n??``)},[n]),i(`div`,{className:`border-t border-border px-3 py-2 sm:px-4`,children:[s(ze,{htmlFor:`location-description-${e}`,className:`block`,children:c(`locations.locationDescriptionField.whatIsThere`,`What is there`)}),s(`textarea`,{id:`location-description-${e}`,value:l,onChange:e=>u(e.target.value),onBlur:()=>{let e=l.trim();e!==(n??``)&&o(e.length===0?null:e)},disabled:a,rows:2,maxLength:400,placeholder:c(`locations.locationDescriptionField.surfacesBoundariesWhatIsNormally`,`Surfaces, boundaries, what is normally parked or stored here.`),className:`mt-1 w-full resize-y rounded-md border border-border bg-surface px-2.5 py-1.5 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:ring-1 focus:ring-inset focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50`}),s(`p`,{className:`mt-1 ${H}`,children:c(`locations.locationDescriptionField.givenToTheAiWith`,`Given to the AI with the pictures, so it knows what it is looking at. Describe the PLACE, not what happens in it — events change, the ground does not.`)})]})}function at(e,t){let n=e?.find(e=>e.locationKey===t);return n===void 0||n.description.length===0?null:n.description}var ot=` none`;function st({name:e,zones:t,zoneKey:n,busy:r,onChange:a}){let{t:o}=X();if(t.length===0)return null;let c=[{value:ot,label:o(`locations.locationZoneField.none`,`— none —`)},...t.map(e=>({value:e.zoneKey,label:e.label}))];return i(`div`,{className:`flex items-center gap-2 border-t border-border px-3 py-1.5 sm:px-4 sm:py-2`,children:[s(ze,{htmlFor:`location-zone-${e}`,children:o(`locations.locationZoneField.zone`,`Zone`)}),s(Be,{id:`location-zone-${e}`,value:n??ot,disabled:r,onChange:e=>{let n=e.target.value;if(n===ot){a(null);return}let r=t.find(e=>e.zoneKey===n);r!==void 0&&a(r.label)},options:c})]})}function ct(e,t){return e.find(e=>e.locationKeys.includes(t))?.zoneKey??null}function lt({name:e,icon:t,busy:n,onPick:r}){return s(Pe,{value:t,onPick:r,fallbackGlyph:k,clearGlyph:f,labels:{trigger:`Change the icon of ${e}`,panel:`Icon for ${e}`,searchPlaceholder:`Search icons`,clear:`No icon`,noMatches:`No icon matches that`},disabled:n})}function ut(e,t){let n=e?.find(e=>e.locationKey===t);return n===void 0?null:W(n.icon)??`map-pin`}function $(e){if(e==null)return null;let t=e.trim();return t.length===0?null:t.toLowerCase()}function dt(e,t){let n=$(t);return n===null?[]:e.filter(e=>$(e.location)===n)}function ft(e,t){let n=dt(e,t),r=new Set(n.map(e=>e.id));return n.filter(e=>e.parentDeviceId===null||!r.has(e.parentDeviceId))}function pt(e,t){let n=$(e.location);return n===null||new Set(t.map(e=>$(e))).has(n)?null:e.location?.trim()??null}function mt(e,t){let n=$(e.location);return n!==null&&t.has(n)}function ht(e,t){let n=new Set(t.map(e=>$(e))),r=new Set(e.filter(e=>mt(e,n)).map(e=>e.id));return e.filter(e=>!(mt(e,n)||e.parentDeviceId!==null&&r.has(e.parentDeviceId)))}function gt(e,t){return ht(e,t).filter(e=>e.parentDeviceId===null)}function _t(e,t){let n=new Map;for(let t of e){if(t.parentDeviceId===null)continue;let e=n.get(t.parentDeviceId);e?e.push(t):n.set(t.parentDeviceId,[t])}let r=[],i=new Set([t]),a=[t];for(;a.length>0;){let e=[];for(let t of a)for(let a of n.get(t)??[])i.has(a.id)||(i.add(a.id),r.push(a),e.push(a.id));a=e}return r}function vt(e,t){return _t(e,t).length}function yt(e,t){return e.filter(e=>!e.isCamera&&e.parentDeviceId===t)}function bt(e,t){return t.map(t=>({name:t,members:ft(e,t)}))}function xt(e){return`${e.kind}:${String(e.device.id)}`}function St(e,t,n){return e.flatMap(e=>{let r=yt(t,e.id),i=n.has(e.id),a={kind:`member`,device:e,accessories:r,open:i};return!i||r.length===0?[a]:[a,...r.map(t=>({kind:`accessory`,device:t,parent:e}))]})}e();function Ct({name:e,members:t,devices:o,busy:c,icon:l,description:u,onRename:d,onDelete:f,onRebuildLinks:m,onAddDevices:g,onPickIcon:v,onSaveDescription:y,zones:b,zoneKey:x,onChangeZone:S}){let{t:C}=X(),[w,T]=r(!1),[E,D]=r(e),k=ye(t,n(()=>({searchText:e=>[e.name,...yt(o,e.id).map(e=>e.name)],facetValue:e=>e.type}),[o])),[A,j]=r(()=>new Set),ee=e=>j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),N=n(()=>St(k.rows,o,A),[k.rows,o,A]),P=[{key:`name`,header:C(`locations.columns.device`),notSortableReason:C(`locations.columns.noSort`),render:e=>e.kind===`member`?s(wt,{row:e,onToggle:()=>ee(e.device.id)}):s(Tt,{row:e})},{key:`type`,header:C(`locations.columns.type`),notSortableReason:C(`locations.columns.noSort`),render:e=>s(`span`,{className:`text-xs text-foreground-muted`,children:e.device.type})},{key:`status`,header:C(`locations.columns.status`),notSortableReason:C(`locations.columns.noSort`),render:e=>i(`span`,{className:`flex items-center gap-1.5`,children:[s($e,{online:e.device.online,deviceName:e.device.name}),s(`span`,{className:`text-xs text-foreground-muted`,children:e.device.online?C(`common.online`):C(`common.offline`)})]})}],F=()=>{D(e),T(!1)},I=async()=>{let t=E.trim();if(t.length===0||t===e){F();return}await d(t),T(!1)},L=[{id:`rename`,label:C(`locations.locationCard.rename`,`Rename`),icon:_,disabled:c,onClick:()=>{D(e),T(!0)}},{id:`rebuild-links`,label:C(`locations.locationCard.rebuildLinkedDevices`,`Rebuild linked devices`),icon:V,separatorBefore:!0,disabled:c,onClick:()=>void m()},{id:`delete`,label:C(`common.delete`,`Delete`),icon:p,danger:!0,separatorBefore:!0,disabled:c,onClick:()=>void f()}];return i(`section`,{className:`min-w-0 ${h}`,children:[i(`header`,{className:`${M} flex min-h-9 items-center gap-1.5`,children:[s(lt,{name:e,icon:l,busy:c,onPick:v}),w?i(a,{children:[s(q,{value:E,onChange:e=>D(e.target.value),onKeyDown:e=>{e.key===`Enter`&&I(),e.key===`Escape`&&F()},"aria-label":C(`locations.locationCard.rename2`,`Rename {{name}}`,{name:e}),className:`min-w-0 flex-1`,autoFocus:!0}),s(G,{type:`button`,size:`sm`,onClick:()=>void I(),children:C(`common.save`,`Save`)}),s(ue,{type:`button`,variant:`ghost`,icon:O,onClick:F,"aria-label":C(`locations.locationCard.cancelRename`,`Cancel rename`)})]}):i(a,{children:[s(`h2`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-foreground`,children:e}),s(G,{type:`button`,variant:`outline`,size:`sm`,disabled:c,onClick:g,"aria-label":C(`locations.room.addTo`,{room:e}),children:C(`locations.room.add`)}),s(Ee,{items:L,title:C(`locations.locationCard.actionsFor`,`Actions for {{name}}`,{name:e}),triggerClassName:`p-1`})]})]}),s(st,{name:e,zones:b,zoneKey:x,busy:c,onChange:S}),s(it,{name:e,description:u,busy:c,onSave:y}),t.length>0&&s(`div`,{className:`border-b border-border px-3 py-1.5 sm:px-4 sm:py-2`,children:s(Se,{state:k.state,facets:k.facets,labels:{searchPlaceholder:C(`locations.filter.searchPlaceholder`),searchLabel:C(`locations.room.searchLabel`,{room:e}),facetsLabel:C(`locations.filter.typesLabel`),clearLabel:C(`locations.filter.clear`)},onSearch:k.setSearch,onToggleFacet:k.toggleFacet,onClear:k.clear})}),t.length===0?s(`p`,{className:`px-3 py-3 text-xs text-foreground-subtle sm:px-4`,children:C(`locations.locationCard.nothingHereYetAssignA`,`Nothing here yet — assign a device from the table below.`)}):s(J,{columns:P,rows:N,rowKey:xt,bordered:!1,minWidthPx:360,emptyMessage:C(`locations.filter.noMatch`)})]})}function wt({row:e,onToggle:t}){let{t:n}=X(),{device:r,accessories:a,open:o}=e,c=o?ne:E;return i(`span`,{className:`flex items-center gap-1.5`,children:[a.length>0?i(G,{type:`button`,variant:`ghost`,onClick:t,"aria-expanded":o,"aria-label":n(o?`locations.locationCard.collapseAccessories`:`locations.locationCard.expandAccessories`,{count:a.length,name:r.name}),className:`h-auto shrink-0 gap-0.5 p-0.5 text-foreground-subtle hover:text-foreground`,children:[s(c,{className:`h-3 w-3`}),s(`span`,{className:`text-[10px] tabular-nums`,children:a.length})]}):s(`span`,{"aria-hidden":`true`,className:`w-[1.35rem] shrink-0`}),s(Q,{type:r.type}),s(Z,{to:`/devices/${String(r.id)}`,className:`min-w-0 truncate text-xs text-foreground hover:underline`,children:r.name})]})}function Tt({row:e}){let{device:t}=e;return i(`span`,{className:`flex items-center gap-1.5 pl-6`,children:[s(`span`,{"aria-hidden":`true`,className:`text-[10px] text-foreground-subtle`,children:`└`}),s(Q,{type:t.type,className:`h-3 w-3 shrink-0 text-foreground-subtle`}),s(Z,{to:`/devices/${String(t.id)}`,className:`min-w-0 truncate text-xs text-foreground-muted hover:underline`,children:t.name})]})}e();function Et({zones:e,busy:t,onRename:n,onDelete:i,onPickIcon:a}){let{t:o}=X(),[c,l]=r(null),[u,d]=r(``),f=async e=>{let t=u.trim();l(null),!(t.length===0||t===e)&&await n(e,t)};return s(J,{columns:[{key:`icon`,header:o(`locations.siteZonesPanel.icon`,`Icon`),width:`w-12`,notSortableReason:`An icon has no order`,render:e=>s(lt,{name:e.label,icon:e.icon,busy:t,onPick:t=>a(e.label,t)})},{key:`name`,header:o(`locations.siteZonesPanel.zone`,`Zone`),sortValue:e=>e.label.toLowerCase(),render:e=>c===e.label?s(q,{value:u,onChange:e=>d(e.target.value),onKeyDown:t=>{t.key===`Enter`&&f(e.label),t.key===`Escape`&&l(null)},onBlur:()=>void f(e.label),"aria-label":o(`locations.siteZonesPanel.rename`,`Rename {{label}}`,{label:e.label}),autoFocus:!0}):s(G,{type:`button`,variant:`ghost`,size:`sm`,className:`px-0`,onClick:()=>{d(e.label),l(e.label)},disabled:t,title:o(`locations.siteZonesPanel.renameTheZone`,`Rename the zone`),children:e.label})},{key:`rooms`,header:o(`locations.siteZonesPanel.rooms`,`Rooms`),align:`right`,sortValue:e=>e.locationKeys.length,render:e=>s(`span`,{className:`tabular-nums text-foreground-subtle`,children:e.locationKeys.length===0?o(`common.empty`):o(`common.rooms`,{count:e.locationKeys.length})})},{key:`actions`,header:o(`locations.siteZonesPanel.actions`,`Actions`),align:`right`,notSortableReason:`Actions have no order`,render:e=>s(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void i(e.label),disabled:t,"aria-label":o(`locations.siteZonesPanel.delete`,`Delete {{label}}`,{label:e.label}),title:o(`locations.siteZonesPanel.deleteTheZoneTheRooms`,`Delete the zone — the rooms in it are kept`),children:s(p,{className:`h-3.5 w-3.5`})})}],rows:e,rowKey:e=>e.zoneKey,emptyMessage:o(`locations.siteZonesPanel.noZonesYetAZone`,`No zones yet. A zone groups rooms — “Zona notte” for the bedrooms — and shows up before them in the app’s camera filter.`)})}e();function Dt({busy:e,onCreate:t}){let{t:n}=X(),[a,o]=r(!1),[c,l]=r(``),u=()=>{l(``),o(!1)},d=async()=>{let e=c.trim();e.length!==0&&(await t(e),u())};return a?i(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),d()},children:[s(q,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Escape`&&u()},placeholder:n(`locations.newLocationButton.ingressoSaloneCucina`,`Ingresso, Salone, Cucina…`),"aria-label":n(`locations.newLocationButton.newLocationName`,`New location name`),className:`min-w-[12rem] flex-1`,autoFocus:!0}),i(G,{size:`sm`,type:`submit`,disabled:c.trim().length===0||e,children:[s(g,{className:`h-3.5 w-3.5`}),n(`common.add`,`Add`)]}),s(G,{size:`sm`,variant:`ghost`,type:`button`,onClick:u,"aria-label":n(`locations.newLocationButton.cancelNewLocation`,`Cancel new location`),children:s(O,{className:`h-3.5 w-3.5`})})]}):i(G,{size:`sm`,type:`button`,onClick:()=>o(!0),"data-testid":`new-location-button`,children:[s(g,{className:`h-3.5 w-3.5`}),n(`locations.newLocationButton.newLocation`,`New location`)]})}e();function Ot({busy:e,onCreate:t}){let{t:n}=X(),[a,o]=r(!1),[c,l]=r(``),u=()=>{l(``),o(!1)},d=async()=>{let e=c.trim();e.length!==0&&(await t(e),u())};return a?i(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:e=>{e.preventDefault(),d()},children:[s(q,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Escape`&&u()},placeholder:n(`locations.newZoneButton.zonaGiornoZonaNotte`,`Zona giorno, Zona notte…`),"aria-label":n(`locations.newZoneButton.newZoneName`,`New zone name`),className:`min-w-[12rem] flex-1`,autoFocus:!0}),i(G,{size:`sm`,type:`submit`,disabled:c.trim().length===0||e,children:[s(g,{className:`h-3.5 w-3.5`}),n(`common.add`,`Add`)]}),s(G,{size:`sm`,variant:`ghost`,type:`button`,onClick:u,"aria-label":n(`locations.newZoneButton.cancelNewZone`,`Cancel new zone`),children:s(O,{className:`h-3.5 w-3.5`})})]}):i(G,{size:`sm`,type:`button`,onClick:()=>o(!0),"data-testid":`new-zone-button`,children:[s(g,{className:`h-3.5 w-3.5`}),n(`locations.newZoneButton.newZone`,`New zone`)]})}e();function kt(e,t,n,r){let i=e.map(e=>({value:e.name,label:`${e.name} · ${String(e.count)}`}));return t===void 0?i:[...i,{value:n,label:`${r} · ${String(t)}`}]}function At({rooms:e,unassignedCount:t,value:r,unassignedValue:i,onChange:a}){let{t:o}=X(),c=n(()=>kt(e,t,i,o(`locations.roomPicker.unassigned`)),[e,t,i,o]);return s(`div`,{className:`max-w-sm`,"data-testid":`room-select`,children:s(Ve,{mode:`single`,singleDisplay:`field`,label:o(`locations.roomPicker.label`),placeholder:o(`locations.roomPicker.placeholder`),options:c,value:r,onChange:a,searchable:!0,testId:`room-select-control`,optionTestIdPrefix:`room-option`})})}e();var jt={searchText:e=>[e.name],facetValue:e=>e.type};function Mt({rows:e,fleet:t,locations:a,busy:o,emptyMessage:c,onAssign:l}){let{t:u}=X(),[d,f]=r([]),[p,m]=r(``),h=ye(e,jt),g=h.rows,_=n(()=>g.map(e=>e.id),[g]),v=n(()=>d.filter(e=>_.includes(e)),[d,_]),y=g.length>0&&v.length===g.length,b=n(()=>{let n=new Map;for(let r of e)n.set(r.id,vt(t,r.id));return n},[e,t]),S=v.reduce((e,t)=>e+(b.get(t)??0),0),C=e=>f(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),w=()=>f(y?[]:_),T=()=>{p.length===0||v.length===0||(l(v,p),f([]),m(``))},E=a.map(e=>({value:e,label:e})),D=[{key:`select`,width:`w-8`,headerRender:()=>s(Ae,{checked:y,onChange:w,"aria-label":y?u(`locations.unassignedTable.clearSelection`,`Clear selection`):u(`locations.unassignedTable.selectAllUnassignedDevices`,`Select all unassigned devices`)}),render:e=>s(Ae,{checked:v.includes(e.id),onChange:()=>C(e.id),"aria-label":u(`locations.unassignedTable.select`,`Select {{name}}`,{name:e.name})})},{key:`name`,header:u(`locations.unassignedTable.device`,`Device`),sortValue:e=>e.name.toLowerCase(),render:e=>{let t=pt(e,a);return i(`span`,{className:`flex items-center gap-1.5`,children:[s(Q,{type:e.type}),s(Z,{to:`/devices/${String(e.id)}`,className:`truncate text-xs text-foreground hover:underline`,children:e.name}),t!==null&&s(je,{variant:`warning`,children:u(`locations.unassignedTable.unknownRoom`,{room:t})})]})}},{key:`type`,header:u(`locations.unassignedTable.type`,`Type`),sortValue:e=>e.type,render:e=>s(`span`,{className:`text-xs text-foreground-muted`,children:e.type})},{key:`status`,header:u(`locations.unassignedTable.status`,`Status`),sortValue:e=>+!!e.online,render:e=>i(`span`,{className:`flex items-center gap-1.5`,children:[s($e,{online:e.online,deviceName:e.name}),s(`span`,{className:`text-xs text-foreground-muted`,children:e.online?u(`common.online`):u(`common.offline`)})]})},{key:`followers`,header:u(`locations.unassignedTable.accessoriesInTowCount`,`Accessories in tow`),align:`right`,sortValue:e=>b.get(e.id)??0,render:e=>s(`span`,{className:`tabular-nums text-xs text-foreground-muted`,children:b.get(e.id)??0})},{key:`assign`,header:u(`locations.unassignedTable.assignTo`,`Assign to`),align:`right`,notSortableReason:`This column is a control, not a value.`,render:e=>s(Be,{"aria-label":u(`locations.unassignedTable.locationFor`,`Location for {{name}}`,{name:e.name}),value:``,disabled:o||a.length===0,onChange:t=>{let n=t.target.value;n.length!==0&&l([e.id],n)},className:`max-w-[11rem]`,options:[{value:``,label:`—`},...E]})}];return i(`section`,{className:`space-y-2`,children:[i(`header`,{className:`flex flex-wrap items-baseline gap-2`,children:[s(`h2`,{className:x,children:u(`locations.unassignedTable.notInARoom`,`Not in a room`)}),s(`p`,{className:H,children:u(`locations.unassignedTable.topLevelDevicesOnlyAccessories`,`Top-level devices only — accessories move with their parent.`)})]}),e.length>0&&s(Se,{state:h.state,facets:h.facets,labels:{searchPlaceholder:u(`locations.filter.searchPlaceholder`),searchLabel:u(`locations.unassigned.searchLabel`),facetsLabel:u(`locations.filter.typesLabel`),clearLabel:u(`locations.filter.clear`)},onSearch:h.setSearch,onToggleFacet:h.toggleFacet,onClear:h.clear}),v.length>0&&i(`div`,{role:`group`,"aria-label":u(`locations.unassignedTable.bulkAssignment`,`Bulk assignment`),className:`flex flex-wrap items-center gap-2 rounded border border-primary/40 bg-primary/5 px-2 py-1.5`,children:[i(`span`,{className:`text-xs text-foreground`,children:[u(`locations.unassignedTable.selected`,{count:v.length}),S>0&&` · ${u(`locations.unassignedTable.accessoriesInTowCount`,{count:S})}`]}),s(Be,{"aria-label":u(`locations.unassignedTable.assignSelectedDevicesTo`,`Assign selected devices to`),value:p,onChange:e=>m(e.target.value),className:`w-auto min-w-[10rem]`,options:[{value:``,label:u(`locations.unassignedTable.assignTo2`,`Assign to…`)},...E]}),s(G,{type:`button`,size:`sm`,onClick:T,disabled:o||p.length===0,children:u(`locations.unassignedTable.assign`,`Assign`)}),s(G,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>f([]),children:u(`locations.unassignedTable.clear`,`Clear`)})]}),s(J,{columns:D,rows:g,rowKey:e=>e.id,minWidthPx:720,emptyMessage:h.active?u(`locations.filter.noMatch`):c})]})}function Nt(e){return{id:e.id,parentDeviceId:e.parentDeviceId,location:e.location,type:e.type,stableId:e.stableId??``,...e.primaryChildEntityId===void 0?{}:{primaryChildEntityId:e.primaryChildEntityId},...e.role!==void 0&&e.role!==null?{role:e.role}:{},name:e.name}}function Pt(e,t){let n=t.map(Nt),r=[];for(let i of t)i.isCamera&&i.location===e&&r.push({deviceId:i.id,name:i.name,ids:le({selfId:i.id,selfLocation:i.location,candidates:n})});return{entries:r}}var Ft=`device-manager:linked-devices`;function It(e){return{deviceId:e.deviceId,slotRef:Ft,value:{slot:`linked-devices`,deviceIds:[...e.ids]}}}e();var Lt=`__unassigned__`;function Rt(){let{t:e}=X(),t=o(),a=Oe(),{data:c,isLoading:l}=Ue(),{data:u}=He(),{data:d}=ke(),{data:f}=Me(),{data:p,isLoading:m}=Fe({projection:`slim`}),h=()=>{t.invalidateQueries({queryKey:[[`deviceManager`,`listLocations`]]}),t.invalidateQueries({queryKey:[[`deviceManager`,`listAll`]]}),t.invalidateQueries({queryKey:[[`deviceManager`,`listLocationIcons`]]}),t.invalidateQueries({queryKey:[[`deviceManager`,`listLocationDescriptions`]]}),t.invalidateQueries({queryKey:[[`deviceManager`,`listSiteZones`]]})},g=he({onSuccess:h}),_=Ce({onSuccess:h}),v=Ie({onSuccess:h}),y=fe({onSuccess:h}),b=ve({onSuccess:h}),x=_e({onSuccess:h}),S=We({onSuccess:h}),C=pe({onSuccess:h}),w=be({onSuccess:h}),T=xe({onSuccess:h}),E=De(),D=n(()=>(p??[]).map(e=>({id:e.id,name:e.name,location:e.location??null,type:String(e.type),isCamera:e.isCamera,parentDeviceId:e.parentDeviceId,online:e.online,role:e.role??null,stableId:e.stableId,primaryChildEntityId:e.primaryChildEntityId??null})),[p]),O=c??[],A=n(()=>bt(D,O),[D,O]),[j,ee]=Ke(),M=j.get(`tab`),N=M===`zones`||M===`camera-links`?M:`locations`,P=j.get(`room`),F=n(()=>gt(D,O),[D,O]),I=P===Lt,L=I?null:P!==null&&A.some(e=>e.name===P)?P:A[0]?.name??null,R=L===null?null:A.find(e=>e.name===L)??null,z=I?Lt:L??`__unassigned__`,B=L??A[0]?.name??null,te=n(()=>A.map(e=>({name:e.name,count:e.members.length})),[A]),ne=e=>{ee(t=>{let n=new URLSearchParams(t);return n.set(`room`,e),n},{replace:!0})},V=l||m,H=v.isPending||_.isPending||g.isPending||b.isPending,re=async e=>{await g.mutateAsync({name:e})},ie=async(e,t)=>{let n=t.trim();n.length===0||n===e||await y.mutateAsync({from:e,to:n})},ae=async t=>{let n=Pt(t,D);if(n.entries.length===0){await a({title:e(`locations.rebuildLinkedDevices`,`Rebuild linked devices`),message:e(`locations.noCameraIsAssignedTo`,`No camera is assigned to “{{room}}”.`,{room:t}),confirmLabel:`OK`});return}let r=n.entries.map(t=>e(`locations.rebuildEntry`,{name:t.name,count:t.ids.length})).join(`
|
|
2
|
-
`);if(!await a({title:e(`locations.rebuildLinkedDevices`,`Rebuild linked devices`),message:e(`locations.replaceTheLinkedDeviceList`,`Replace the linked-device list of every camera in “{{room}}” with what the room contains? {{lines}} Anything linked by hand that is not in this room is lost.`,{room:t,lines:r}),confirmLabel:e(`locations.rebuild`,`Rebuild`),variant:`danger`}))return;let i=[];for(let e of n.entries)try{await E.mutateAsync(It(e))}catch(t){i.push(`• ${e.name}: ${t instanceof Error?t.message:String(t)}`)}h(),i.length>0&&await a({title:e(`locations.rebuildLinkedDevices`,`Rebuild linked devices`),message:e(`locations.notRebuilt`,`Not rebuilt: {{value1}}`,{value1:i.join(`
|
|
3
|
-
`)}),confirmLabel:`OK`})},oe=async(t,n)=>{let r=n>0?` ${String(n)} device(s) will become unassigned.`:``;await a({title:e(`locations.deleteLocation`,`Delete location`),message:e(`locations.deleteTheLocation`,`Delete the location “{{name}}”?{{extra}}`,{name:t,extra:r}),confirmLabel:e(`common.delete`,`Delete`),variant:`danger`})&&await _.mutateAsync({name:t,cascade:!0})},se=async t=>{await a({title:e(`locations.deleteZone`,`Delete zone`),message:e(`locations.deleteTheZoneTheRooms`,`Delete the zone “{{name}}”? The rooms in it are kept.`,{name:t}),confirmLabel:e(`common.delete`,`Delete`),variant:`danger`})&&await C.mutateAsync({name:t})},ce=async(e,t)=>{await b.mutateAsync({location:e,icon:t})},le=async(e,t)=>{await x.mutateAsync({location:e,description:t})},W=f??[],ue=async(e,t)=>{await T.mutateAsync({location:e,zone:t})},de=(e,t)=>{for(let n of e)v.mutate({deviceId:n,location:t})},[G,K]=r(null),me=n(()=>D.filter(e=>e.parentDeviceId===null).map(e=>({id:e.id,name:e.name,type:e.type,location:e.location})),[D]),ge=s(At,{rooms:te,...N===`locations`?{unassignedCount:F.length}:{},value:N===`locations`?z:B??``,unassignedValue:Lt,onChange:ne}),ye=i(`div`,{className:`flex flex-col gap-3`,"data-testid":`locations-section`,children:[V&&s(`p`,{className:`text-xs text-foreground-subtle`,children:e(`locations.loadingLocationsAndDevices`,`Loading locations and devices…`)}),ge,I||R===null?s(Mt,{rows:F,fleet:D,locations:O,busy:H,emptyMessage:V?e(`common.loading`,`Loading…`):e(`locations.everyTopLevelDeviceHas`,`Every top-level device has a room.`),onAssign:de}):s(Ct,{name:R.name,members:R.members,devices:D,busy:H,icon:ut(u,U(R.name)),onPickIcon:e=>ce(R.name,e),description:at(d,U(R.name)),onSaveDescription:e=>le(R.name,e),zones:W,zoneKey:ct(W,U(R.name)),onChangeZone:e=>ue(R.name,e),onRename:e=>ie(R.name,e),onDelete:()=>oe(R.name,dt(D,R.name).length),onRebuildLinks:()=>ae(R.name),onAddDevices:()=>K(R.name)},R.name),O.length===0&&!V&&s(`p`,{className:`text-xs text-foreground-subtle`,children:e(`locations.noLocationsYetAddIngresso`,`No locations yet. Add Ingresso, Salone, Cucina…`)}),s(et,{open:G!==null,title:e(`locations.room.addDialogTitle`,{room:G??``}),items:me,listState:m?`pending`:`answered`,lockedIds:G===null?[]:(A.find(e=>e.name===G)?.members??[]).map(e=>e.id),lockedNote:e(`locations.room.alreadyHere`),suggestions:{heading:e(`locations.room.suggestedUnassigned`),ids:F.map(e=>e.id)},busy:v.isPending,onConfirm:e=>{G!==null&&de(e,G),K(null)},onClose:()=>K(null)})]}),Se=i(`div`,{className:`flex flex-col gap-3`,"data-testid":`camera-links-tab`,children:[ge,s(tt,{room:B,cameras:B===null?[]:dt(D,B).filter(e=>e.isCamera),fleet:D})]});return s(Je,{icon:k,title:e(`locations.locations`,`Locations`),subtitle:e(`locations.roomsAndAreasOfThe`,`Rooms and areas of the site. Assign any device here — storage disks are under Data → Storage.`),defaultSection:`locations`,sectionsLabel:`Locations sections`,actions:N===`zones`?s(Ot,{busy:S.isPending,onCreate:e=>S.mutateAsync({name:e})}):s(Dt,{busy:g.isPending,onCreate:re}),sections:[{id:`locations`,label:e(`locations.locations`,`Locations`),content:ye},{id:`camera-links`,label:e(`locations.cameraLinks`,`Camera links`),content:Se},{id:`zones`,label:e(`locations.zones`,`Zones`),content:s(Et,{zones:W,busy:H,onRename:(e,t)=>w.mutateAsync({from:e,to:t}),onDelete:se,onPickIcon:(e,t)=>S.mutateAsync({name:e,icon:t})})}]})}export{Rt as LocationsPage};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./browser-BHo8W_uH.js","./rolldown-runtime-Cyuzqnbw.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{t}from"./vite-preload-helper-kNaey6uv.js";import{$ as n,B as r,G as i,J as a,S as o,a as s,b as c,q as l,t as u,x as d}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{Hi as f,Ir as p,It as m,Nt as h,Pn as g,Q as _,Qt as v,Yr as y,ar as b,cr as x,fi as S,ia as C,nr as w,ot as T,pi as E,pr as D}from"./player-overlays-D0U2dNvn.js";import{o as O}from"./video-BBtESt54.js";import{t as k}from"./key-round-yCDTbIQb.js";import{t as A}from"./monitor-smartphone-9Ife1Trw.js";import{t as j}from"./unlink-DzoLNfsq.js";import{Jn as M,Yn as ee}from"./client-DYbvGOid.js";import{Ao as te,Bn as ne,Cn as re,Ft as ie,Oo as N,Wn as P,Z as ae,Zn as F,ql as oe,vu as I,wn as se}from"./src-CGxdJN_f.js";import{t as ce}from"./i18n-Vb3uBp7P.js";import{t as L}from"./useTranslation-D3Is_4B6.js";import"./mount-C4w1vbly.js";import{Y as R,i as z,n as B,r as V,t as H,z as U}from"./index-DvOECbab.js";import{t as W}from"./AdminPage-DAO24U0w.js";import{N as G,P as le,_ as K,a as ue,g as de,k as fe,r as pe,t as me,v as he}from"./SessionsList-BRTwG3uv.js";n();function ge({value:n,size:i=192}){let{t:s}=L(),[c,l]=a(null),[u,f]=a(null);if(r(()=>{let r=!1;return t(()=>import(`./browser-BHo8W_uH.js`).then(t=>e(t.default,1)).then(async e=>{if(r)return;let t=e.create;if(typeof t!=`function`){f(`qrcode.create() unavailable in installed version`);return}try{let e=t(n,{errorCorrectionLevel:`M`});r||l(e)}catch(e){r||f(e instanceof Error?e.message:`QR generation failed`)}}),__vite__mapDeps([0,1]),import.meta.url).catch(()=>{r||f(`qrcode library not installed`)}),()=>{r=!0}},[n]),u)return d(`div`,{className:`flex items-center justify-center text-[10px] text-foreground-subtle text-center p-4`,style:{width:i,height:i},children:s(`users.totpQrCode.qrRenderingUnavailableUseThe`,`QR rendering unavailable — use the secret below.`)});if(!c)return d(`div`,{className:`flex items-center justify-center text-[10px] text-foreground-subtle animate-pulse`,style:{width:i,height:i},children:s(`users.totpQrCode.generating`,`Generating…`)});let p=c.modules.size,m=i/p,h=[];for(let e=0;e<p;e++)for(let t=0;t<p;t++)c.modules.data[e*p+t]&&h.push(d(`rect`,{x:t*m,y:e*m,width:m,height:m,fill:`currentColor`},`${t}-${e}`));return o(`svg`,{width:i,height:i,viewBox:`0 0 ${i} ${i}`,className:`text-black`,children:[d(`rect`,{x:0,y:0,width:i,height:i,fill:`white`}),h]})}var _e=`${M}/connect`,q={public:0,mesh:1,lan:2,"lan-ipv6":3};function ve(e){switch(e.kind){case`public`:return e.interfaceKind===`vpn`?`mesh`:`public`;case`lan-ipv4`:return`lan`;case`lan-ipv6`:return`lan-ipv6`;case`custom`:return`public`;case`loopback`:case`app-link`:return null}}function J(e){return ee(e)}function ye(e){return e.startsWith(`https://`)}function be(e){let t=e.flatMap(e=>{let t=ve(e),n=J(e.baseUrl);return t===null||n===null?[]:[{endpoint:e,tier:t,origin:n}]}).toSorted((e,t)=>q[e.tier]-q[t.tier]||Number(t.endpoint.plausible)-Number(e.endpoint.plausible)||e.endpoint.priority-t.endpoint.priority),n=new Set;return t.flatMap(({endpoint:e,tier:t,origin:r})=>n.has(r)?[]:(n.add(r),[{origin:r,label:e.label,tier:t,secure:ye(r),plausible:e.plausible}]))}function xe(e,t,n=null){for(let r of[t,n]){if(r===null)continue;let t=J(r),n=e.find(e=>e.origin===t);if(n!==void 0)return n}return e[0]??null}function Se(e){let t=new URL(_e);return t.searchParams.set(`hub`,e),t.toString()}n();var Ce=176,Y={scheme:`https`};function we(){let{t:e}=L(),t=te(Y),n=N(Y).data?.roles.publicEndpoint.resolved??null;return o(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[o(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[d(v,{className:`h-3.5 w-3.5 text-foreground-subtle`}),d(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`connectPhone.title`)})]}),o(`div`,{className:`p-4 space-y-3`,children:[d(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`connectPhone.description`)}),t.isPending?o(`div`,{className:`flex items-center gap-2 text-[11px] text-foreground-subtle`,children:[d(b,{className:`h-3.5 w-3.5 animate-spin`}),e(`connectPhone.loading`)]}):t.isError?o(`div`,{className:`flex items-start gap-2 text-[11px] text-danger`,children:[d(h,{className:`h-3.5 w-3.5 mt-0.5 shrink-0`}),o(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[d(`div`,{className:`break-words`,children:e(`connectPhone.error`,{message:t.error.message})}),d(ne,{size:`sm`,variant:`ghost`,onClick:()=>void t.refetch(),children:e(`connectPhone.retry`)})]})]}):d(Te,{candidates:be(t.data.endpoints),preferredOrigin:n})]})]})}function Te({candidates:e,preferredOrigin:t}){let{t:n}=L(),[r,s]=a(null),c=xe(e,r,t),l=i(()=>c?Se(c.origin):null,[c]);if(c===null||l===null)return d(`p`,{className:`text-[11px] text-foreground-subtle`,children:n(`connectPhone.empty`)});let u=e=>n(`connectPhone.tier.${e}`),f=e.map(e=>({value:e.origin,label:`${u(e.tier)} — ${e.origin}`}));return o(`div`,{className:`flex flex-col sm:flex-row gap-4`,children:[d(re,{value:l,size:Ce,alt:n(`connectPhone.qrAlt`),className:`self-start`}),o(`div`,{className:`flex-1 min-w-0 space-y-3`,children:[o(`label`,{className:`block space-y-1`,children:[d(`span`,{className:`text-[11px] font-medium text-foreground`,children:n(`connectPhone.addressLabel`)}),d(oe,{value:c.origin,options:f,onChange:e=>s(e.target.value)}),o(`span`,{className:`block text-[10px] text-foreground-subtle`,children:[u(c.tier),` · `,c.label]})]}),!c.secure&&d(X,{text:n(`connectPhone.insecure`)}),!c.plausible&&d(X,{text:n(`connectPhone.implausible`)}),o(`div`,{className:`space-y-1`,children:[d(`span`,{className:`text-[11px] font-medium text-foreground`,children:n(`connectPhone.linkLabel`)}),o(`div`,{className:`flex items-center gap-1 rounded-md border border-border bg-background px-2 py-1`,children:[d(`code`,{className:`flex-1 min-w-0 font-mono text-[11px] text-foreground break-all select-all`,children:l}),d(ie,{value:l,srLabel:n(`connectPhone.linkLabel`)})]})]}),d(`p`,{className:`text-[11px] text-foreground-subtle`,children:n(`connectPhone.signInHint`)})]})]})}function X({text:e}){return o(`div`,{className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-2.5 py-1.5 text-[11px] text-foreground`,children:[d(h,{className:`h-3.5 w-3.5 text-warning mt-0.5 shrink-0`}),d(`span`,{children:e})]})}n();function Ee(e){return new Date(e).toLocaleDateString()}function De(){let{t:e}=L(),t=F(),n=I.useUtils(),i=I.auth.listLinkableProviders.useQuery(),s=I.auth.listOwnExternalIdentities.useQuery(),[c,u]=a(null),[f,p]=a(()=>z(window.location.search)),m=l(null),h=K(`Linking a sign-in account`),g=l(null);r(()=>()=>g.current?.(),[]);let[v,y]=a(null);r(()=>{if(f===null)return;let e=new URL(window.location.href);e.searchParams.delete(`linked`),e.searchParams.delete(`linkError`),window.history.replaceState({},``,e.pathname+e.search+e.hash)},[f]);let C=I.auth.beginExternalLink.useMutation({onSuccess:({url:e})=>{let t=m.current;if(m.current=null,t===null||t.closed){window.location.assign(e);return}let r=e=>{y(null),p(z(`?${e}`)),n.auth.listOwnExternalIdentities.invalidate()};g.current?.(),g.current=B(t,{onReturn:e=>{e.target===`profile`&&r(e.query)},onDone:e=>{e.target===`profile`&&r(e.query)},onClosed:()=>{g.current?.(),g.current=null,n.auth.listOwnExternalIdentities.invalidate()}}),t.location.href=_(V(e))},onError:e=>{m.current?.close(),m.current=null,y(null),u(e.message)}}),w=I.auth.unlinkOwnExternalIdentity.useMutation({onSuccess:()=>void n.auth.listOwnExternalIdentities.invalidate(),onError:e=>u(e.message)}),T=i.data??[],D=s.data??[],O=v!==null&&D.some(e=>e.provider===v);if(r(()=>{!O||v===null||(y(null),p({kind:`linked`,provider:v}))},[O,v]),T.length===0&&D.length===0)return null;let k=new Set(D.map(e=>e.provider)),A=e=>T.find(t=>t.provider===e)?.label??e,M=async(n,r)=>{await t({title:e(`users.linkedSignInsSection.unlinkSignInAccount`,`Unlink sign-in account`),message:e(`users.linkedSignInsSection.stopSigningInWithThis`,`Stop signing in with this {{label}} account?`,{label:r}),confirmLabel:e(`users.linkedSignInsSection.unlink`,`Unlink`),variant:`danger`})&&(u(null),w.mutate({provider:n.provider,subject:n.subject}))};return o(`div`,{"data-testid":`linked-sign-ins`,className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[h.dialog,o(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[d(x,{className:`h-3.5 w-3.5 text-foreground-subtle`}),d(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`users.linkedSignInsSection.linkedSignInAccounts`,`Linked sign-in accounts`)})]}),o(`div`,{className:`p-4 space-y-3`,children:[d(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`users.linkedSignInsSection.signInWithAnExternal`,`Sign in with an external account instead of your password. Only accounts you link here can sign you in; your two-factor authentication still applies.`)}),f?.kind===`linked`&&o(`div`,{className:`flex items-center gap-2 rounded-md border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 text-xs text-foreground`,children:[d(S,{className:`h-3.5 w-3.5 text-emerald-500 shrink-0`}),e(`users.linkedSignIns.linkedNotice`,{provider:A(f.provider)})]}),(f?.kind===`error`||c)&&o(`div`,{className:`flex items-center gap-2 rounded-md border border-danger/20 bg-danger/10 px-3 py-2 text-xs text-danger`,children:[d(E,{className:`h-3.5 w-3.5 shrink-0`}),c??(f?.kind===`error`?f.message:``)]}),D.length>0&&d(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:D.map(t=>{let n=t.providerLabel??t.provider;return o(`li`,{className:`flex items-center gap-3 px-3 py-2 text-xs`,children:[o(`div`,{className:`flex-1 min-w-0`,children:[o(`div`,{className:`font-medium text-foreground truncate`,children:[n,!t.available&&d(`span`,{className:`ml-2 rounded bg-foreground-subtle/15 px-1.5 py-0.5 text-[10px] font-normal text-foreground-subtle`,children:e(`users.linkedSignInsSection.providerUnavailable`,`provider unavailable`)})]}),d(`div`,{className:`text-[11px] text-foreground-subtle truncate`,children:e(`users.linkedSignIns.linkedOn`,{label:t.label??t.subject,date:Ee(t.linkedAt)})})]}),o(`button`,{onClick:()=>void M(t,n),disabled:w.isPending,className:`inline-flex items-center gap-1 rounded px-2 py-1 text-[10px] text-danger hover:bg-danger/10 disabled:opacity-50`,children:[d(j,{className:`h-3 w-3`}),e(`users.linkedSignInsSection.unlink`,`Unlink`)]})]},`${t.provider}|${t.subject}`)})}),d(`div`,{className:`flex flex-wrap gap-2`,children:T.filter(e=>!k.has(e.provider)).map(t=>o(`button`,{onClick:()=>{u(null),p(null),h.requestProof().then(e=>{e!==null&&(m.current=H(null),y(m.current===null?null:t.provider),C.mutate({provider:t.provider,reauthToken:e}))})},disabled:C.isPending,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1 text-[11px] font-medium text-foreground hover:bg-surface-hover disabled:opacity-50`,children:[C.isPending&&C.variables?.provider===t.provider?d(b,{className:`h-3 w-3 animate-spin`}):d(x,{className:`h-3 w-3`}),e(`users.linkedSignIns.link`,{provider:t.label})]},t.provider))})]})]})}n();function Z(e){return e.message.length>0?e.message:ce.t(`auth.authAuditSection.requestFailed`)}function Oe(){let{t:e}=L(),{logout:t}=U(),n=F(),r=I.useUtils(),i=I.auth.listOwnSessions.useQuery(),[s,c]=a(null),l=I.auth.revokeOwnSession.useMutation({onSuccess:()=>void r.auth.listOwnSessions.invalidate(),onError:e=>c(`Sign out failed: ${Z(e)}`)}),u=I.auth.logout.useMutation({onSuccess:()=>t(),onError:e=>c(`Sign out failed: ${Z(e)}`)}),f=async t=>{await n({title:e(`auth.mySessionsSection.signOutThisSession`,`Sign out this session`),message:e(`auth.mySessionsSection.willHaveToSignIn`,`{{label}} will have to sign in again.`,{label:he(t.client).label}),confirmLabel:e(`auth.mySessionsSection.signOut`,`Sign out`),variant:`danger`})&&(c(null),l.mutate({id:t.id}))},p=async()=>{await n({title:e(`auth.mySessionsSection.signOutEverywhere`,`Sign out everywhere`),message:e(`auth.mySessionsSection.everySessionOfYourAccount`,`Every session of your account ends, this browser included: you will be signed out here too and every device has to sign in again.`),confirmLabel:e(`auth.mySessionsSection.signOutEverywhere`,`Sign out everywhere`),variant:`danger`})&&(c(null),u.mutate({everywhere:!0}))};return o(`div`,{"data-testid":`my-sessions`,className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[o(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[d(A,{className:`h-3.5 w-3.5 text-foreground-subtle`}),d(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`auth.mySessionsSection.activeSessions`,`Active sessions`)})]}),o(`div`,{className:`p-4 space-y-3`,children:[d(`p`,{className:`text-[11px] text-foreground-subtle`,children:e(`auth.mySessionsSection.theBrowsersAndAppsSigned`,`The browsers and apps signed in to your account. Signing one out ends it at once.`)}),s!==null&&d(`div`,{className:`text-[11px] text-danger`,children:s}),d(me,{sessions:i.data??[],isLoading:i.isLoading,loadError:i.isError?i.error?.message??e(`auth.authAuditSection.requestFailed`):null,emptyText:`No active sessions.`,onRevoke:e=>void f(e),revokingId:l.isPending?l.variables?.id??null:null}),d(`div`,{className:`flex justify-end`,children:o(`button`,{onClick:()=>void p(),disabled:u.isPending,className:`inline-flex items-center gap-1.5 rounded border border-danger/40 px-2.5 py-1 text-[11px] font-medium text-danger hover:bg-danger/10 disabled:opacity-50`,children:[u.isPending?d(b,{className:`h-3 w-3 animate-spin`}):d(O,{className:`h-3 w-3`}),e(`auth.mySessionsSection.signOutEverywhere`,`Sign out everywhere`)]})})]})]})}n();var Q=`You`;function ke(){let{t:e}=L(),t=F(),n=I.useUtils(),r=I.auth.listOwnDeviceCredentials.useQuery(),[o,s]=a(null),c=I.auth.revokeOwnDeviceCredential.useMutation({onSuccess:e=>{e.revoked||s(`That device could not be revoked - it may already be gone.`),n.auth.listOwnDeviceCredentials.invalidate()},onError:e=>s(`Revoke failed: ${e.message}`)}),l=i(()=>(r.data??[]).map(e=>pe(e,Q)),[r.data]),u=async n=>{await t({title:e(`certificates.myDevicesSection.revoke`,`Revoke "{{name}}"?`,{name:n.name}),message:e(`certificates.myDevicesSection.theDeviceStopsSigningIn`,`The device stops signing in at once and its open sessions end. To use it again you have to pair it anew. This cannot be undone.`),confirmLabel:e(`certificates.myDevicesSection.revoke2`,`Revoke`),variant:`danger`})&&(s(null),c.mutate({id:n.id}))},p={label:e(`certificates.myDevicesSection.revoke2`,`Revoke`),icon:f,isAvailable:ue,onRun:e=>void u(e),busyId:c.isPending?c.variables?.id??null:null,disabled:c.isPending};return d(G,{id:`my-devices`,title:e(`certificates.myDevicesSection.myDevices`,`My devices`),icon:v,description:e(`certificates.myDevicesSection.phonesThatStaySignedIn`,`Phones that stay signed in to your account with a certificate. If one is lost, revoke it here and it is signed out at once.`),notice:le(o),onDismissNotice:()=>s(null),children:d(fe,{rows:l,label:e(`certificates.devicesCard.label`),isLoading:r.isPending,loadError:r.error===null?null:r.error.message||`Request failed`,emptyText:`No devices are signed in with a certificate.`,hideOwner:!0,expiresNone:`—`,action:p})})}n();var Ae={view:{icon:p,cls:`bg-foreground-subtle/15 text-foreground-subtle`},create:{icon:g,cls:`bg-primary/15 text-primary`},delete:{icon:m,cls:`bg-danger/15 text-danger`}};function je(){let{t:e}=L(),t=C(),{user:n,logout:r}=U();if(!n)return d(W,{children:d(`div`,{className:`text-xs text-foreground-subtle`,children:e(`systemPage.myAccess.notSignedIn`,`Not signed in.`)})});let i=n.isAdmin,a=n.scopes??[];return o(W,{children:[o(`div`,{className:`rounded-lg border border-border bg-surface px-4 py-3 flex items-center gap-3`,children:[d(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-full bg-primary/10 text-primary font-semibold text-base`,children:n.username.slice(0,1).toUpperCase()}),o(`div`,{className:`flex-1 min-w-0`,children:[d(`div`,{className:`text-sm font-semibold text-foreground truncate`,children:n.username}),o(`div`,{className:`text-[11px] text-foreground-subtle`,children:[i?e(`systemPage.myAccess.administrator`,`Administrator`):e(`systemPage.myAccess.user`,`User`),` `,d(R,{i18nKey:`systemPage.myAccess.sessionId`,values:{id:n.id.slice(0,8)},components:{mono:d(`span`,{className:`font-mono`})}})]})]})]}),i&&o(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 px-4 py-3 text-xs text-foreground flex items-start gap-2.5`,children:[d(D,{className:`h-4 w-4 text-primary mt-0.5 shrink-0`}),o(`div`,{children:[d(`div`,{className:`font-semibold text-foreground`,children:e(`systemPage.myAccess.unrestrictedAccess`,`Unrestricted access`)}),d(`p`,{className:`text-foreground-subtle mt-0.5`,children:e(`systemPage.myAccess.adminSessionsBypassThePer`,`Admin sessions bypass the per-call scope check. Every protected endpoint is reachable regardless of the list below.`)})]})]}),d(Me,{}),d(Ne,{username:n.username}),d(Pe,{}),d(De,{}),d(de,{}),d(Oe,{}),d(ke,{}),d(we,{}),a.length>0&&o(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[o(`div`,{className:`px-4 py-2 border-b border-border`,children:[d(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`systemPage.myAccess.grantedScopes`,`Granted scopes`)}),d(`div`,{className:`text-[10px] text-foreground-subtle`,children:e(`systemPage.myAccess.bakedIntoYourSessionToken`,`Baked into your session token at login; sign out + back in to refresh after changes.`)})]}),o(`div`,{className:`grid grid-cols-[100px_1fr_240px] gap-3 px-4 py-2 text-[10px] uppercase tracking-wide text-foreground-subtle border-b border-border`,children:[d(`div`,{children:e(`systemPage.myAccess.type`,`Type`)}),d(`div`,{children:e(`systemPage.myAccess.target`,`Target`)}),d(`div`,{children:e(`systemPage.myAccess.access`,`Access`)})]}),d(`ul`,{className:`divide-y divide-border`,children:a.map((n,r)=>o(`li`,{className:`grid grid-cols-[100px_1fr_240px] gap-3 px-4 py-2.5 items-center text-xs`,children:[d(`span`,{className:`font-mono text-foreground-subtle`,children:n.type}),d(`span`,{className:`font-mono text-foreground`,children:n.type===`device`?ae(n.selector,t):n.target}),d(`div`,{className:`flex items-center gap-1`,children:[`view`,`create`,`delete`].map(t=>{let r=n.access.includes(t),{icon:i,cls:a}=Ae[t];return o(`span`,{className:`inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium ${r?a:`bg-transparent text-foreground-subtle/40 line-through`}`,title:r?e(`systemPage.myAccess.can`,`Can {{a}}`,{a:t}):e(`systemPage.myAccess.cannot`,`Cannot {{a}}`,{a:t}),children:[d(i,{className:`h-3 w-3`}),t]},t)})})]},r))})]}),d(`div`,{className:`flex justify-end`,children:o(`button`,{onClick:r,className:`inline-flex items-center gap-1.5 rounded border border-border px-2.5 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-foreground-subtle/10 hover:text-foreground transition-colors`,children:[d(O,{className:`h-3 w-3`}),e(`systemPage.myAccess.signOut`,`Sign out`)]})})]})}function Me(){let{t:e}=L(),t=T(),[n,r]=a(``),[i,s]=a(``),[c,l]=a(``),[f,p]=a(null),m=u({mutationFn:e=>t.changeOwnPassword(e),onSuccess:()=>{p({kind:`success`,msg:`Password updated.`}),r(``),s(``),l(``)},onError:e=>{p({kind:`error`,msg:e instanceof Error?e.message:`Update failed`})}}),h=i.length>0&&c.length>0&&i!==c,g=i.length>0&&i.length<8,_=n.length>=1&&i.length>=8&&i===c;return o(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[o(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[d(k,{className:`h-3.5 w-3.5 text-foreground-subtle`}),d(`div`,{className:`text-xs font-semibold text-foreground`,children:e(`systemPage.myAccess.changePassword`,`Change password`)})]}),o(`div`,{className:`p-4 space-y-3`,children:[d($,{label:e(`systemPage.myAccess.currentPassword`,`Current password`),value:n,onChange:r,autoComplete:`current-password`}),d($,{label:e(`systemPage.myAccess.newPassword`,`New password`),value:i,onChange:s,autoComplete:`new-password`,hint:e(`systemPage.myAccess.atLeast8Characters`,`At least 8 characters.`)}),d($,{label:e(`systemPage.myAccess.confirmNewPassword`,`Confirm new password`),value:c,onChange:l,autoComplete:`new-password`}),(h||g)&&d(`div`,{className:`text-[11px] text-danger`,children:h?e(`systemPage.myAccess.passwordsDoNotMatch`,`Passwords do not match.`):e(`systemPage.myAccess.newPasswordMustBeAt`,`New password must be at least 8 characters.`)}),f&&o(`div`,{className:`text-[11px] flex items-center gap-1 ${f.kind===`success`?`text-emerald-500`:`text-danger`}`,children:[f.kind===`success`?d(S,{className:`h-3 w-3`}):d(E,{className:`h-3 w-3`}),f.msg]}),d(`div`,{className:`flex justify-end`,children:o(`button`,{onClick:()=>{p(null),m.mutate({currentPassword:n,newPassword:i})},disabled:!_||m.isPending,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[m.isPending?d(b,{className:`h-3 w-3 animate-spin`}):d(w,{className:`h-3 w-3`}),e(`systemPage.myAccess.updatePassword`,`Update password`)]})})]})]})}function $({label:e,value:t,onChange:n,autoComplete:r,hint:i}){return o(`div`,{className:`space-y-1`,children:[d(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:e}),d(`input`,{type:`password`,value:t,onChange:e=>n(e.target.value),autoComplete:r,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`}),i&&d(`div`,{className:`text-[10px] text-foreground-subtle`,children:i})]})}function Ne({username:e}){let{t}=L(),n=T(),l=s({queryKey:[`auth`,`getOwnTotpStatus`],queryFn:()=>n.getOwnTotpStatus()}),f=l.data,[p,m]=a(null),[h,g]=a(``),[_,x]=a(null),[C,w]=a(!1),D=u({mutationFn:()=>n.setupOwnTotp(),onSuccess:e=>{m({secret:e.secret,otpauthUrl:e.otpauthUrl}),g(``),x(null)},onError:e=>x(e instanceof Error?e.message:`Setup failed`)}),O=u({mutationFn:e=>n.confirmOwnTotp(e),onSuccess:()=>{m(null),g(``),x(null),l.refetch()},onError:e=>x(e instanceof Error?e.message:`Confirmation failed — code did not match`)}),k=K(`Turning off two-factor authentication`),A=u({mutationFn:async()=>{let e=await k.requestProof();return e===null?null:n.disableOwnTotp({reauthToken:e})},onSuccess:()=>{x(null),l.refetch()},onError:e=>x(e instanceof Error?e.message:`Disable failed`)});r(()=>{if(!C)return;let e=setTimeout(()=>w(!1),1500);return()=>clearTimeout(e)},[C]);let j=i(()=>l.isLoading?`loading`:p?`setup_in_progress`:f?.enabled?`enrolled`:`not_enrolled`,[l.isLoading,f?.enabled,p]);return o(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[k.dialog,o(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[d(v,{className:`h-3.5 w-3.5 text-foreground-subtle`}),d(`div`,{className:`text-xs font-semibold text-foreground`,children:t(`systemPage.myAccess.twoFactorAuthentication`,`Two-factor authentication`)})]}),o(`div`,{className:`p-4 space-y-3`,children:[j===`loading`&&o(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[d(b,{className:`h-3.5 w-3.5 animate-spin`}),t(`systemPage.myAccess.checkingStatus`,`Checking status…`)]}),j===`not_enrolled`&&o(c,{children:[d(`div`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.myAccess.2faIsnTActiveOn`,`2FA isn't active on your account. Enable it to require a 6-digit code from your authenticator app at every login.`)}),d(`div`,{className:`flex justify-end`,children:o(`button`,{onClick:()=>{x(null),D.mutate()},disabled:D.isPending,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[D.isPending?d(b,{className:`h-3 w-3 animate-spin`}):d(v,{className:`h-3 w-3`}),t(`systemPage.myAccess.enable2fa`,`Enable 2FA`)]})})]}),j===`setup_in_progress`&&p&&o(c,{children:[d(`div`,{className:`text-[11px] text-foreground-subtle`,children:d(R,{i18nKey:`systemPage.myAccess.scanQr`,values:{username:e},components:{mono:d(`span`,{className:`font-mono`})}})}),o(`div`,{className:`flex flex-col items-center gap-3`,children:[d(`div`,{className:`rounded-lg border border-border bg-white p-3`,children:d(ge,{value:p.otpauthUrl,size:180})}),o(`div`,{className:`w-full`,children:[d(`div`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle mb-1`,children:t(`systemPage.myAccess.secretManualEntry`,`Secret (manual entry)`)}),o(`div`,{className:`flex items-center gap-2 rounded border border-border bg-surface-hover/30 px-2 py-1.5`,children:[d(`code`,{className:`text-[11px] font-mono text-foreground break-all flex-1`,children:p.secret}),o(`button`,{onClick:()=>{p&&navigator.clipboard.writeText(p.secret).then(()=>w(!0))},className:`inline-flex items-center gap-1 text-[10px] text-foreground-subtle hover:text-foreground`,children:[C?d(S,{className:`h-3 w-3 text-emerald-500`}):d(y,{className:`h-3 w-3`}),C?t(`systemPage.myAccess.copied`,`Copied`):t(`common.copy`,`Copy`)]})]})]})]}),o(`div`,{className:`space-y-1`,children:[d(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`6-digit code`}),d(`input`,{type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,placeholder:`123456`,value:h,onChange:e=>g(e.target.value.replace(/\D/g,``).slice(0,6)),className:`w-full rounded-md border border-border bg-surface px-3 py-2 text-center text-lg font-mono tracking-widest text-foreground focus:outline-none focus:ring-2 focus:ring-primary`})]}),_&&o(`div`,{className:`text-[11px] text-danger flex items-center gap-1`,children:[d(E,{className:`h-3 w-3`}),_]}),o(`div`,{className:`flex justify-end gap-2`,children:[d(`button`,{onClick:()=>{m(null),x(null),g(``)},className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:t(`common.cancel`,`Cancel`)}),o(`button`,{onClick:()=>{x(null),O.mutate({code:h})},disabled:O.isPending||h.length!==6,className:`inline-flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:[O.isPending?d(b,{className:`h-3 w-3 animate-spin`}):d(S,{className:`h-3 w-3`}),t(`common.confirm`,`Confirm`)]})]})]}),j===`enrolled`&&f&&o(c,{children:[o(`div`,{className:`rounded-md border border-emerald-500/30 bg-emerald-500/5 px-3 py-2.5 flex items-start gap-2.5`,children:[d(S,{className:`h-4 w-4 mt-0.5 text-emerald-500 shrink-0`}),o(`div`,{className:`text-xs text-foreground space-y-0.5`,children:[d(`div`,{className:`font-medium`,children:t(`systemPage.myAccess.2faIsActive`,`2FA is active`)}),d(`div`,{className:`text-foreground-subtle`,children:t(`common.enrolledOn`,{when:f.confirmedAt?new Date(f.confirmedAt).toLocaleString():`—`})})]})]}),_&&o(`div`,{className:`text-[11px] text-danger flex items-center gap-1`,children:[d(E,{className:`h-3 w-3`}),_]}),d(`div`,{className:`flex justify-end`,children:o(`button`,{onClick:()=>{x(null),A.mutate()},disabled:A.isPending,className:`rounded bg-danger px-3 py-1.5 text-xs font-medium text-white hover:bg-danger/90 disabled:opacity-50 inline-flex items-center gap-1`,children:[A.isPending?d(b,{className:`h-3 w-3 animate-spin`}):d(v,{className:`h-3 w-3`}),t(`systemPage.myAccess.disable2fa`,`Disable 2FA`)]})})]})]})]})}function Pe(){return P(`auth-webauthn/passkey-enrollment`)?d(se,{widgetId:`auth-webauthn/passkey-enrollment`,host:`dashboard`}):null}export{je as MyAccessPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,B as t,G as n,J as r,L as i,S as a,b as o,o as s,q as c,x as l}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEHpkaJP.js";import{D as u,It as d,Jt as f,L as p,Nt as m,On as h,Rn as g,Rr as _,Xt as v,Yr as y,Z as b,an as x,ar as S,bi as C,dt as w,ht as T,in as E,kn as D,mn as ee,nr as te,ot as ne,un as O,vn as re,yn as ie}from"./player-overlays-D0U2dNvn.js";import{t as k}from"./boxes-DikDfAoo.js";import{c as A,o as ae}from"./video-BBtESt54.js";import{t as oe}from"./file-up-WS3s_T9x.js";import{t as se}from"./log-in-DFfxcqYz.js";import{Kn as ce,Un as le,_n as ue,qn as de}from"./client-DYbvGOid.js";import{Bn as j,Bo as fe,Bt as pe,Do as me,Dr as M,El as he,Er as N,Fo as ge,Ho as _e,Io as ve,It as ye,Jo as be,Ln as P,Lo as xe,Mo as Se,No as Ce,Oo as we,Pn as Te,Po as Ee,Ql as De,Ro as Oe,Rt as ke,Uo as Ae,Ut as je,Vo as Me,Vt as F,Wo as Ne,Yo as Pe,an as Fe,ar as I,ha as Ie,jo as Le,ko as Re,ql as ze,qo as Be,zo as Ve}from"./src-CGxdJN_f.js";import{t as L}from"./i18n-Vb3uBp7P.js";import{t as R}from"./useTranslation-D3Is_4B6.js";import"./mount-C4w1vbly.js";import{C as He,c as z,s as B}from"./index-DvOECbab.js";import{t as Ue}from"./AdminSectionedPage-B-qoE6ra.js";import{t as V}from"./AdminPage-DAO24U0w.js";import{t as We}from"./NodeAddonsSettingsPanel-BMat4ckt.js";import{n as H,r as Ge,t as U}from"./IntegrationHub-DdjWEObX.js";import{n as W,t as G}from"./addon-display-names-BkwMrExv.js";e();var K=5e3,q=`network-access`,Ke={connected:!1,endpoint:null};function qe(){let{t:e}=R(),t=s(),i=M({capName:`network-access`},{refetchInterval:K}),a=N(void 0,{refetchInterval:K}),o=n(()=>G(a.data??[]),[a.data]),c=n(()=>(i.data??[]).map(e=>({addonId:e.addonId,displayName:o.get(e.addonId)??e.addonId,isActive:e.isActive})),[i.data,o]),[u,d]=r(null),[f,p]=r({}),m=(e,n)=>{let r=n?.addonId;t.invalidateQueries({queryKey:[[`networkAccess`,`getStatus`],{input:{addonId:r},type:`query`}]}),d(null),p(e=>{if(r===void 0||!(r in e))return e;let t={...e};return delete t[r],t})},h=(e,t)=>{d(null);let n=t?.addonId;if(n===void 0)return;let r=e instanceof Error?e.message:String(e);p(e=>({...e,[n]:r}))},g=be({onSuccess:m,onError:h}),_=Pe({onSuccess:m,onError:h}),v=[{id:q,label:e(`system.remoteAccess.remoteAccess`,`Remote access`),install:{capability:q,label:e(`system.remoteAccess.addTunnel`,`Add tunnel`)},entries:c.map(e=>({id:e.addonId,name:e.displayName,fallbackIcon:A,...W(e.isActive),render:()=>l(H,{addonId:e.addonId,displayName:e.displayName,capName:q,isActive:e.isActive,badges:l(Ye,{addonId:e.addonId}),error:f[e.addonId]??null,primaryAction:l(Xe,{addonId:e.addonId,busyId:u,onStart:e=>{d(e),g.mutate({addonId:e})},onStop:e=>{d(e),_.mutate({addonId:e})}})})}))}];return l(U,{embedded:!0,icon:A,title:e(`system.remoteAccess.remoteAccess2`,`Remote Access`),subtitle:e(`system.remoteAccess.publicFacingTunnelsThatExpose`,`Public-facing tunnels that expose this hub to the internet (Cloudflare Tunnel, ngrok, …).`),groups:v,isLoading:i.isLoading,emptyTitle:e(`system.remoteAccess.noRemoteAccessProvidersInstalled`,`No remote-access providers installed`),emptyDescription:e(`system.remoteAccess.installATunnelAddonE`,`Install a tunnel addon (e.g. @camstack/addon-cloudflare) to expose this hub publicly.`)})}function Je(e){let{data:t}=Be({addonId:e},{refetchInterval:K,retry:!1}),n=t?le.safeParse(t):null;return n?.success?n.data:Ke}function Ye({addonId:e}){let{t}=R(),n=Je(e);return a(o,{children:[l(I,{variant:n.connected?`success`:`default`,className:Ge,children:n.connected?t(`system.remoteAccess.connected`,`Connected`):t(`system.remoteAccess.disconnected`,`Disconnected`)}),n.endpoint&&a(`a`,{href:n.endpoint.url,target:`_blank`,rel:`noopener noreferrer`,className:`flex min-w-0 items-center gap-1 break-all text-[11px] text-success hover:underline`,children:[l(_,{className:`h-3 w-3`}),n.endpoint.url]})]})}function Xe({addonId:e,busyId:t,onStart:n,onStop:r}){let{t:i}=R(),o=Je(e),s=t===e;return o.connected?a(j,{size:`sm`,variant:`secondary`,disabled:s,onClick:()=>r(e),children:[s?l(S,{className:`h-3 w-3 animate-spin`}):l(f,{className:`h-3 w-3`}),i(`system.remoteAccess.stop`,`Stop`)]}):a(j,{size:`sm`,variant:`primary`,disabled:s,onClick:()=>n(e),children:[s?l(S,{className:`h-3 w-3 animate-spin`}):l(D,{className:`h-3 w-3`}),i(`system.remoteAccess.start`,`Start`)]})}e();var Ze=3e4,J=`turn-provider`;function Qe(e){let t=[];for(let n of e)typeof n.urls==`string`?t.push(n.urls):t.push(...n.urls);return t}function $e(){let{t:e}=R(),t=M({capName:`turn-provider`},{refetchInterval:Ze}),r=N(void 0,{refetchInterval:Ze}),i=he(),o=i.data??[],s=n(()=>G(r.data??[]),[r.data]),c=n(()=>(t.data??[]).map(e=>({addonId:e.addonId,displayName:s.get(e.addonId)??e.addonId,isActive:e.isActive})),[t.data,s]),d=[{id:J,label:e(`system.turnServers.turnProviders`,`TURN providers`),install:{capability:J,label:e(`system.turnServers.addProvider`,`Add provider`)},entries:c.map(t=>({id:t.addonId,name:t.displayName,fallbackIcon:g,...W(t.isActive),render:()=>l(H,{addonId:t.addonId,displayName:t.displayName,capName:J,isActive:t.isActive,panels:[{id:`ice-servers`,title:e(`system.turnServers.discoveredIceServers`,`Discovered ICE servers`),icon:g,content:l(et,{addonId:t.addonId,enabled:t.isActive})}]})}))}];return l(U,{embedded:!0,icon:g,title:e(`system.turnServers.turnServers`,`TURN Servers`),subtitle:e(`system.turnServers.iceServersUsedForWebrtc`,`ICE servers used for WebRTC NAT traversal. Multiple providers can coexist — the WebRTC layer concatenates servers from all enabled providers per session.`),groups:d,isLoading:t.isLoading,emptyTitle:e(`system.turnServers.noTurnProvidersInstalled`,`No TURN providers installed`),emptyDescription:e(`system.turnServers.installATurnAddonE`,`Install a TURN addon (e.g. @camstack/addon-cloudflare) to enable WebRTC behind restrictive NATs.`),trailing:l(F,{headingId:`turn-combined-ice`,title:e(`system.turnServers.combinedIceServerListAll`,`Combined ICE server list — all enabled providers`),icon:g,actions:l(j,{size:`sm`,variant:`secondary`,onClick:()=>i.refetch(),disabled:i.isFetching,children:e(`common.refresh`,`Refresh`)}),children:l(`div`,{className:u,children:o.length===0?l(`div`,{className:`text-xs text-foreground-subtle`,children:e(`system.turnServers.noServersFromEnabledProviders`,`No servers from enabled providers.`)}):l(`div`,{className:`flex flex-col gap-3`,children:o.map((e,t)=>{let n=Array.isArray(e.urls)?e.urls:[e.urls];return a(`div`,{className:`rounded border border-border bg-surface`,children:[(e.username||e.credential)&&a(`div`,{className:`px-3 py-1.5 border-b border-border text-[10px] font-mono text-foreground-subtle flex items-center gap-3`,children:[e.username&&a(`span`,{children:[l(`span`,{className:`text-foreground-subtle`,children:`user:`}),` `,l(`span`,{className:`text-foreground`,children:e.username})]}),e.credential&&a(`span`,{children:[l(`span`,{className:`text-foreground-subtle`,children:`credential:`}),` `,l(`span`,{className:`text-foreground`,children:`••••••••`})]})]}),l(`ul`,{className:`divide-y divide-border`,children:n.map(e=>l(`li`,{className:`px-3 py-1.5 font-mono text-xs text-foreground break-all`,children:e},e))})]},t)})})})})})}function et({addonId:e,enabled:t}){let r=he({addonId:e},{enabled:t,retry:!1}),i=n(()=>Qe(r.data??[]),[r.data]),a=t?r.isLoading?`Loading…`:i.length===0?`This provider returned no servers.`:null:`Disabled — enable the provider to fetch its servers.`;return l(`div`,{className:`rounded-lg border border-border bg-surface p-2 sm:p-3`,children:a===null?l(`div`,{className:`flex flex-wrap gap-1`,children:i.map(e=>l(`span`,{className:`inline-block break-all rounded bg-foreground-subtle/10 px-1.5 py-0.5 font-mono text-[10px] text-foreground`,children:e},e))}):l(`div`,{className:`text-xs text-foreground-subtle`,children:a})})}e();var tt={lan:g,wifi:T,docker:k,vpn:te,loopback:O,other:O},nt={lan:`LAN`,wifi:`Wi-Fi`,docker:`Docker`,vpn:`VPN`,loopback:`Loopback`,other:`Other`},rt=[`lan`,`wifi`,`vpn`,`docker`,`other`,`loopback`];function it(e){let{t}=R(),{interfaces:r,disabled:i,hideLoopback:o,ipv4Only:s,emptyMessage:c}=e,u=n(()=>r.filter(e=>!(o&&e.kind===`loopback`||s&&e.family!==`IPv4`)),[r,o,s]),d=n(()=>{let e=new Map;for(let t of u){let n=e.get(t.kind)??[];n.push(t),e.set(t.kind,n)}return rt.filter(t=>e.has(t)).map(t=>({kind:t,items:e.get(t)}))},[u]),f=t=>e.mode===`single`?e.value===t:e.value.includes(t),p=t=>{if(i||t.kind===`loopback`)return;if(e.mode===`single`){e.onChange(e.value===t.address?null:t.address);return}let n=new Set(e.value);n.has(t.address)?n.delete(t.address):n.add(t.address),e.onChange([...n])};return u.length===0?l(`div`,{className:`text-xs text-foreground-subtle italic`,children:c??t(`shared.addressSelector.noAddressesAvailable`,`No addresses available.`)}):l(`div`,{className:`flex flex-col gap-3`,children:d.map(({kind:n,items:r})=>a(`div`,{className:`rounded-md border border-border overflow-hidden`,children:[a(`div`,{className:`flex items-center gap-2 px-3 py-1.5 bg-surface-hover/30 border-b border-border`,children:[l(tt[n]??O,{className:`h-3.5 w-3.5 text-foreground-subtle`}),l(`span`,{className:`text-[11px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:nt[n]??n}),a(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`· `,r.length]})]}),l(`ul`,{className:`divide-y divide-border`,children:r.map(n=>{let r=f(n.address),o=n.kind===`loopback`,s=!n.plausible&&!o;return a(`li`,{className:`flex items-center gap-3 px-3 py-2 ${o?`opacity-60 cursor-not-allowed`:i?`opacity-60`:s?`cursor-pointer hover:bg-surface-hover/30 bg-amber-500/[0.04]`:`cursor-pointer hover:bg-surface-hover/30`}`,onClick:()=>p(n),children:[l(`span`,{className:`flex items-center justify-center h-4 w-4 rounded ${e.mode===`single`?`rounded-full`:`rounded`} border ${r?`border-primary bg-primary text-primary-foreground`:`border-border bg-surface`}`,children:r&&l(C,{className:`h-3 w-3`})}),a(`div`,{className:`flex-1 min-w-0 ${s?`text-foreground-subtle`:``}`,children:[a(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[l(`span`,{className:`font-mono text-xs font-semibold ${s?`text-foreground-subtle`:`text-foreground`}`,children:n.name}),l(`span`,{className:`text-[10px] rounded px-1.5 py-0.5 bg-foreground-subtle/10 text-foreground-subtle font-mono`,children:n.family}),n.preferred&&l(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium bg-primary/15 text-primary`,children:t(`shared.addressSelector.autoPreferred`,`Auto-preferred`)}),o&&l(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium bg-foreground-subtle/15 text-foreground-subtle`,children:t(`shared.addressSelector.alwaysIncluded`,`Always included`)}),s&&a(`span`,{className:`inline-flex items-center gap-1 text-[10px] rounded-full px-2 py-0.5 font-medium bg-amber-500/15 text-amber-700 dark:text-amber-300`,title:n.plausibleReason||void 0,children:[l(m,{className:`h-2.5 w-2.5`}),t(`shared.addressSelector.unlikelyUsable`,`Unlikely usable`)]})]}),a(`div`,{className:`text-xs text-foreground-subtle mt-0.5 font-mono break-all`,children:[n.address,n.cidr&&n.cidr!==n.address?` (${n.cidr})`:``]})]})]},`${n.name}-${n.family}-${n.address}`)})})]},n))})}var Y=[{role:`appConnections`,get title(){return L.t(`helpers.addressTableModel.appConnectionsTitle`)},single:!1,get help(){return L.t(`helpers.addressTableModel.appConnectionsHelp`)}},{role:`notificationTaps`,get title(){return L.t(`helpers.addressTableModel.notificationTapsTitle`)},single:!0,get help(){return L.t(`helpers.addressTableModel.notificationTapsHelp`)}},{role:`publicEndpoint`,get title(){return L.t(`helpers.addressTableModel.publicEndpointTitle`)},single:!0,get help(){return L.t(`helpers.addressTableModel.publicEndpointHelp`)}},{role:`internal`,get title(){return L.t(`helpers.addressTableModel.internalTitle`)},single:!0,get help(){return L.t(`helpers.addressTableModel.internalHelp`)}}],at=`A role with nothing ticked is automatic. Add a custom address when the hub is reached at an address it cannot see itself (NAT, reverse proxy, VPN, Docker bridge).`;function X(e,t){return e.inUse.includes(t)}function ot(e,t){if(!e.eligible.includes(t))return{kind:`none`};if(e.kind===`app-link`)return X(e,t)?{kind:`none`}:{kind:`set`,input:{role:t,baseUrl:null,enabled:!0}};if(e.flags.includes(t)||t===`appConnections`&&X(e,t))return{kind:`set`,input:{role:t,baseUrl:e.baseUrl,enabled:!1}};let n={role:t,baseUrl:e.baseUrl,enabled:!0};return t===`publicEndpoint`&&e.baseUrl.startsWith(`http:`)?{kind:`confirm-http`,input:n,reason:ce}:{kind:`set`,input:n}}function st(e){return Y.map(({role:t,title:n})=>{if(t===`appConnections`){let r=e.roles.appConnections;return{role:t,title:n,inUse:r.resolved.length===0?`nothing reachable`:r.resolved.join(`, `),automatic:r.source!==`flagged`}}let r=e.roles[t];return{role:t,title:n,inUse:r.resolved===null?`nothing reachable`:t===`notificationTaps`&&r.source===`auto`?`CamStack app link`:r.resolved,automatic:r.source!==`flagged`}})}e();var ct={"lan-ipv4":{labelKey:`system.addressesCard.kindIpv4`,className:`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`},"lan-ipv6":{labelKey:`system.addressesCard.kindIpv6`,className:`bg-violet-500/15 text-violet-700 dark:text-violet-300`},public:{labelKey:`system.addressesCard.kindPublic`,className:`bg-blue-500/15 text-blue-700 dark:text-blue-300`},"app-link":{labelKey:`system.addressesCard.kindAppLink`,className:`bg-amber-500/15 text-amber-700 dark:text-amber-300`},custom:{labelKey:`system.addressesCard.kindCustom`,className:`bg-sky-500/15 text-sky-700 dark:text-sky-300`},loopback:{labelKey:`system.addressesCard.kindLoopback`,className:`bg-foreground-subtle/15 text-foreground-subtle`}};function lt({book:e,loading:t,saving:n,error:i,onSetRole:o,onAdd:s,onRemove:c}){let{t:u}=R(),[f,p]=r(``),[g,_]=r(``),[v,y]=r(null),[b,x]=r(null),S=()=>{let e=de(f);if(!e.ok){y(e.reason);return}y(null),p(``),_(``),s(e.baseUrl,g.trim())},C=(e,t)=>{let n=ot(e,t.role);if(n.kind!==`none`){if(n.kind===`confirm-http`){x({input:n.input,reason:n.reason});return}x(null),o(n.input)}},w=[{key:`url`,header:u(`system.addressesCard.address`,`Address`),render:t=>a(`div`,{className:`min-w-0 py-0.5`,children:[l(`div`,{className:`font-mono text-[12px] break-all ${t.plausible?`text-foreground`:`text-foreground-subtle`}`,children:t.baseUrl}),a(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5 text-[11px] text-foreground-subtle`,children:[l(`span`,{children:t.label}),t.kind===`app-link`&&a(`span`,{className:`font-mono`,children:[`hub=`,` `,e?.appLinkHub??u(`system.addressesCard.noneNoTunnelOrTailscale`,`none (no tunnel or Tailscale)`)]}),t.custom&&t.detected&&l(`span`,{children:u(`system.addressesCard.alsoAddedAsACustom`,`also added as a custom address`)}),t.kind!==`custom`&&t.interfaceKind!==`lan`&&t.interfaceKind!==`public`&&t.interfaceKind!==`other`&&l(`span`,{className:`uppercase tracking-wide`,children:t.interfaceKind}),!t.plausible&&t.interfaceKind!==`loopback`&&a(`span`,{className:`inline-flex items-center gap-1 text-amber-700 dark:text-amber-300`,title:t.plausibleReason||void 0,children:[l(m,{className:`h-2.5 w-2.5`}),u(`system.addressesCard.unlikelyUsable`,`Unlikely usable`)]})]})]})},{key:`kind`,header:u(`system.addressesCard.kind`,`Kind`),nowrap:!0,render:e=>{let t=ct[e.kind]??ct.loopback;return l(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${t.className}`,children:u(t.labelKey)})}},...Y.map(e=>({key:e.role,headerRender:()=>l(`span`,{title:e.help,children:e.title}),align:`center`,nowrap:!0,width:`w-24`,render:t=>{let r=t.eligible.includes(e.role),i=t.flags.includes(e.role),o=X(t,e.role);return a(`label`,{className:`inline-flex items-center justify-center gap-1 ${r?`cursor-pointer`:`cursor-not-allowed opacity-40`}`,title:r?o&&!i?u(`system.addressesCard.inUseAutomatically`,`{{title}}: in use automatically. {{help}}`,{title:e.title,help:e.help}):e.help:u(`system.addressesCard.thisAddressCannotBeUsed`,`This address cannot be used for this.`),children:[l(Fe,{checked:r&&o,disabled:!r||n,onChange:()=>C(t,e),"aria-label":`${e.title}: ${t.baseUrl}`}),o&&!i&&r&&l(`span`,{className:`text-[9px] text-foreground-subtle`,children:u(`common.auto`)})]})}})),{key:`actions`,header:``,align:`right`,nowrap:!0,render:e=>e.custom?l(j,{size:`sm`,variant:`ghost`,disabled:n,onClick:()=>c(e.baseUrl),"aria-label":u(`system.addressesCard.remove`,`Remove {{baseUrl}}`,{baseUrl:e.baseUrl}),title:u(`system.addressesCard.removeThisCustomAddressIts`,`Remove this custom address (its roles turn automatic)`),children:l(d,{className:`h-3 w-3`})}):null}],T=e===void 0?[]:st(e);return a(Te,{children:[a(`div`,{className:`px-4 py-3 border-b border-border flex flex-col gap-2`,children:[a(`div`,{children:[l(`div`,{className:`text-sm font-semibold`,children:u(`system.addressesCard.addresses`,`Addresses`)}),l(`div`,{className:`text-xs text-foreground-subtle max-w-3xl`,children:u(`system.addressesCard.everyAddressThisHubIs`,`Every address this hub is reached at, detected or added by you. Tick what each one is used for.`)}),a(`details`,{className:`mt-1.5 text-xs max-w-3xl`,"data-testid":`address-roles-help`,children:[l(`summary`,{className:`cursor-pointer select-none text-foreground-subtle hover:text-foreground`,children:u(`system.addressesCard.whatAreRoles`,`What are roles?`)}),l(`dl`,{className:`mt-1.5 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:Y.map(e=>a(`div`,{className:`contents`,children:[l(`dt`,{className:`font-medium`,children:e.title}),l(`dd`,{className:`text-foreground-subtle`,children:e.help})]},e.role))}),l(`p`,{className:`mt-1.5 text-foreground-subtle`,children:at})]})]}),T.length>0&&l(`div`,{className:`grid grid-cols-[auto_1fr_auto] gap-x-3 gap-y-1 items-baseline text-xs`,"data-testid":`address-roles-summary`,children:T.map(e=>a(`div`,{className:`contents`,children:[l(`span`,{className:`text-foreground-subtle`,children:e.title}),a(`span`,{className:`font-mono break-all`,"data-testid":`address-role-${e.role}`,children:[e.inUse,l(`span`,{className:`ml-1.5 font-sans text-foreground-subtle`,children:e.automatic?u(`system.addressesCard.automatic`,`(automatic)`):u(`system.addressesCard.setByYou`,`(set by you)`)})]}),e.automatic?l(`span`,{}):l(j,{size:`sm`,variant:`secondary`,disabled:n,onClick:()=>o({role:e.role,baseUrl:null,enabled:!1}),children:u(`system.addressesCard.useAutomatic`,`Use automatic`)})]},e.role))}),b!==null&&a(`div`,{className:`rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs flex flex-wrap items-center gap-2`,children:[l(m,{className:`h-3.5 w-3.5 text-amber-600`}),l(`span`,{className:`flex-1 min-w-[220px]`,children:b.reason}),l(j,{size:`sm`,variant:`secondary`,onClick:()=>{o({...b.input,acceptInsecureHttp:!0}),x(null)},children:u(`system.addressesCard.useHttpAnyway`,`Use http anyway`)}),l(j,{size:`sm`,variant:`ghost`,onClick:()=>x(null),children:u(`common.cancel`,`Cancel`)})]}),i!==null&&l(`div`,{className:`text-[11px] text-red-600 dark:text-red-400`,role:`alert`,children:i})]}),l(je,{columns:w,rows:e?.rows??[],rowKey:e=>`${e.kind}-${e.baseUrl}`,minWidthPx:760,bordered:!1,emptyMessage:t?u(`common.loading`,`Loading…`):u(`system.addressesCard.noAddressesAvailable`,`No addresses available.`),rowClassName:e=>e.plausible?void 0:`opacity-80`}),a(`div`,{className:`px-4 py-3 border-t border-border flex flex-wrap items-start gap-2`,children:[a(`div`,{className:`flex-1 min-w-[220px]`,children:[l(De,{value:f,onChange:e=>{p(e.target.value),y(null)},placeholder:`https://cams.example.com or https://192.168.1.50:4443`,"aria-label":u(`system.addressesCard.customAddress`,`Custom address`),disabled:n}),v!==null&&l(`div`,{className:`mt-1 text-[11px] text-red-600 dark:text-red-400`,children:v})]}),l(`div`,{className:`w-48`,children:l(De,{value:g,onChange:e=>_(e.target.value),placeholder:u(`system.addressesCard.labelOptional`,`Label (optional)`),"aria-label":u(`system.addressesCard.customAddressLabel`,`Custom address label`),maxLength:80,disabled:n})}),a(j,{size:`sm`,variant:`secondary`,disabled:n||f.trim()===``,onClick:S,children:[l(h,{className:`h-3 w-3`}),u(`system.addressesCard.addCustomAddress`,`Add custom address`)]})]})]})}e();function ut(){let{t:e}=R(),i=s(),o=()=>{i.invalidateQueries({queryKey:[[`localNetwork`]]})},c=Se(void 0,{refetchInterval:3e4}),d=Re(void 0),f=Oe({onSuccess:o}),p=ge({onSuccess:e=>{C(e.addresses),o()}}),m=n(()=>c.data?.interfaces??[],[c.data]),h=we({scheme:typeof window<`u`&&window.location.protocol===`https:`?`https`:`http`},{refetchInterval:3e4}),g=xe({onSuccess:o}),_=me({onSuccess:o}),y=Ee({onSuccess:o}),b=g.error?.message??_.error?.message??y.error?.message??null,x=g.isPending||_.isPending||y.isPending,[S,C]=r([]),[w,T]=r(!1);t(()=>{!w&&d.data&&(C(d.data.addresses),T(!0))},[d.data,w]);let E=d.data?.addresses??[],D=n(()=>{if(S.length!==E.length)return!0;let e=[...S].toSorted(),t=[...E].toSorted();return e.some((e,n)=>e!==t[n])},[S,E]);return a(V,{embedded:!0,children:[a(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[l(`p`,{className:`text-xs text-foreground-subtle max-w-2xl`,children:e(`system.networkAddresses.pinWhichHostInterfacesExist`,`Pin which host interfaces exist, then tick what each address is used for. Add a custom address when this hub is reached at one it cannot detect.`)}),l(`div`,{className:`flex items-center gap-2 shrink-0`,children:a(j,{size:`sm`,variant:`secondary`,onClick:()=>{c.refetch(),d.refetch(),h.refetch()},disabled:c.isLoading,children:[l(ie,{className:`h-3 w-3 ${c.isLoading?`animate-spin`:``}`}),e(`common.refresh`,`Refresh`)]})})]}),l(F,{headingId:`network-allowed-addresses`,title:e(`system.networkAddresses.allowedAddresses`,`Allowed addresses`),actions:a(`div`,{className:`flex flex-wrap items-center gap-1`,children:[a(j,{size:`sm`,variant:`secondary`,onClick:()=>p.mutate(void 0),disabled:p.isPending||f.isPending,title:e(`system.networkAddresses.reRunTheAutoDetection`,`Re-run the auto-detection heuristic + overwrite the current allowlist with the best matches.`),children:[l(v,{className:`h-3 w-3`}),p.isPending?e(`system.networkAddresses.detecting`,`Detecting…`):e(`system.networkAddresses.bestMatch`,`Best match`)]}),a(j,{size:`sm`,variant:`secondary`,onClick:()=>{C([])},disabled:S.length===0||f.isPending,children:[l(re,{className:`h-3 w-3`}),e(`system.networkAddresses.clear`,`Clear`)]}),D&&l(j,{size:`sm`,variant:`secondary`,onClick:()=>{C(E)},disabled:f.isPending,children:e(`system.networkAddresses.discard`,`Discard`)}),a(j,{size:`sm`,variant:`primary`,onClick:()=>{f.mutate({addresses:[...S]})},disabled:!D||f.isPending,children:[l(ee,{className:`h-3 w-3`}),f.isPending?e(`system.networkAddresses.saving`,`Saving…`):e(`common.save`,`Save`)]})]}),children:a(`div`,{className:u,children:[l(`p`,{className:`mb-3 text-xs text-foreground-subtle`,children:S.length===0?e(`system.networkAddresses.autoEveryNonLoopbackNon`,`Auto — every non-loopback / non-link-local interface participates.`):e(`system.networkAddresses.pinned`,`{{value1}} pinned`,{value1:String(S.length)})}),l(it,{mode:`multiple`,interfaces:m,value:S,onChange:C,disabled:f.isPending,emptyMessage:c.isLoading?e(`system.networkAddresses.loadingInterfaces`,`Loading interfaces…`):e(`system.networkAddresses.noInterfacesDetected`,`No interfaces detected.`)})]})}),l(lt,{book:h.data,loading:h.isLoading,saving:x,error:b,onSetRole:e=>g.mutate({...e}),onAdd:(e,t)=>_.mutate({baseUrl:e,label:t}),onRemove:e=>y.mutate({baseUrl:e})})]})}e();var dt={mesh:`bg-violet-500/15 text-violet-700 dark:text-violet-300`,public:`bg-blue-500/15 text-blue-700 dark:text-blue-300`},Z=5e3,ft=`mesh-network`,pt=3e4,mt={joined:!1,meshIp:``,magicDnsHostname:``,peerCount:0,endpoints:[],tenantName:``,magicDnsSuffix:``,userLogin:null,controlPlaneUrl:``,keyExpiry:null};function ht(){let{t:e}=R(),t=M({capName:`mesh-network`},{refetchInterval:Z}),r=N(void 0,{refetchInterval:Z}),i=n(()=>G(r.data??[]),[r.data]),a=n(()=>(t.data??[]).map(e=>({addonId:e.addonId,displayName:i.get(e.addonId)??e.addonId,isActive:e.isActive})),[t.data,i]),o=[{id:ft,label:e(`system.meshNetworks.meshNetworks`,`Mesh networks`),install:{capability:ft,label:e(`system.meshNetworks.addMesh`,`Add mesh`)},entries:a.map(t=>({id:t.addonId,name:t.displayName,fallbackIcon:g,...W(t.isActive),render:()=>l(H,{addonId:t.addonId,displayName:t.displayName,capName:ft,isActive:t.isActive,badges:l(_t,{addonId:t.addonId}),primaryAction:l(vt,{addonId:t.addonId}),panels:[{id:`status`,title:e(`system.meshNetworks.status`,`Status`),icon:k,content:l(yt,{addonId:t.addonId})}]})}))}];return l(U,{embedded:!0,icon:k,title:e(`system.meshNetworks.meshNetworks2`,`Mesh Networks`),subtitle:e(`system.meshNetworks.privateVpnMeshesThatConnect`,`Private VPN meshes that connect CamStack to your other devices (Tailscale, Headscale, …). Each provider can also expose this hub publicly via its ingress (Tailscale Funnel).`),groups:o,isLoading:t.isLoading,emptyTitle:e(`system.meshNetworks.noMeshNetworkProvidersInstalled`,`No mesh-network providers installed`),emptyDescription:e(`system.meshNetworks.installAMeshAddonE`,`Install a mesh addon (e.g. @camstack/addon-tailscale) to join this hub into a private VPN mesh.`)})}function gt(e){let{data:t,isLoading:n}=fe({addonId:e},{refetchInterval:Z,retry:!1}),r=t?ue.safeParse(t):null;return{status:r?.success?r.data:mt,isLoading:n}}function _t({addonId:e}){let{t}=R(),{status:n}=gt(e);return a(o,{children:[l(I,{variant:n.joined?`success`:`default`,className:Ge,children:n.joined?t(`system.meshNetworks.joined`,`Joined`):t(`system.meshNetworks.notJoined`,`Not joined`)}),n.joined&&l(I,{className:`text-[10px]`,children:t(`common.peers`,{count:n.peerCount})})]})}function vt({addonId:e}){let{t}=R(),n=s(),[c,u]=r(!1),[d,f]=r(null),p=ne(),{status:m}=gt(e),h=i(()=>{n.invalidateQueries({queryKey:[[`meshNetwork`]]})},[n]),g=Ne(),_=Me({onSuccess:h}),v=Ae({onSuccess:h}),y=i(async()=>{u(!0);let t={cancelled:!1};f(t);try{let n=await g.mutateAsync({addonId:e});if(t.cancelled)return;n.loginUrl&&window.open(n.loginUrl,`_blank`,`noopener,noreferrer`);let r=Date.now();for(;!t.cancelled&&(await Et(2e3),!t.cancelled);){let t=await p.trpcClient.meshNetwork.getStatus.query({addonId:e}).catch(()=>null),n=t?ue.safeParse(t):null;if(n?.success&&n.data.joined){h();break}if(Date.now()-r>6e5)break}}finally{u(!1),f(null)}},[e,h,g,p]),b=i(()=>{d&&(d.cancelled=!0),u(!1),f(null)},[d]);return l(o,{children:m.joined?a(o,{children:[a(j,{size:`sm`,variant:`secondary`,disabled:_.isPending,onClick:()=>_.mutate({addonId:e}),children:[_.isPending?l(S,{className:`h-3 w-3 animate-spin`}):l(ae,{className:`h-3 w-3`}),t(`system.meshNetworks.disconnect`,`Disconnect`)]}),a(j,{size:`sm`,variant:`ghost`,disabled:v.isPending,onClick:()=>v.mutate({addonId:e}),children:[v.isPending?l(S,{className:`h-3 w-3 animate-spin`}):l(x,{className:`h-3 w-3`}),t(`system.meshNetworks.logOut`,`Log out`)]})]}):c?a(j,{size:`sm`,variant:`ghost`,onClick:b,children:[l(w,{className:`h-3 w-3 mr-1`}),` `,t(`common.cancel`)]}):a(o,{children:[a(j,{size:`sm`,variant:`primary`,onClick:()=>void y(),children:[l(se,{className:`h-3 w-3`}),t(`system.meshNetworks.connect`,`Connect`)]}),a(j,{size:`sm`,variant:`ghost`,disabled:v.isPending,onClick:()=>v.mutate({addonId:e}),children:[v.isPending?l(S,{className:`h-3 w-3 animate-spin`}):l(x,{className:`h-3 w-3`}),t(`system.meshNetworks.logOut`,`Log out`)]})]})})}function yt({addonId:e}){let{t}=R(),{status:n}=gt(e),r=_e({addonId:e},{refetchInterval:pt,retry:!1});return a(`div`,{className:`rounded-lg border border-border bg-surface`,children:[a(`div`,{className:`space-y-4 p-2 sm:p-4`,children:[n.error&&l(P,{message:n.error}),l(bt,{status:n}),n.endpoints.length>0&&a(`div`,{className:`space-y-1.5`,children:[l(`div`,{className:`text-[11px] font-semibold text-foreground-subtle uppercase tracking-wide`,children:t(`system.meshNetworks.endpoints`,`Endpoints`)}),n.endpoints.map(e=>a(`div`,{className:`flex items-center gap-2 text-xs flex-wrap`,children:[a(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${dt[e.scope]??`bg-foreground-subtle/15 text-foreground-subtle`}`,children:[e.scope===`public`?l(A,{className:`inline h-2.5 w-2.5 mr-0.5`}):null,e.label]}),a(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-emerald-700 dark:text-emerald-300 hover:underline break-all flex items-center gap-1`,children:[l(_,{className:`h-3 w-3 shrink-0`}),e.url]})]},e.id))]})]}),l(`div`,{className:`border-t border-border`,children:l(St,{peers:r.data?.peers??[],loading:r.isLoading})})]})}function bt({status:e}){let{t}=R();return l(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-1.5`,children:[{label:t(`system.meshNetworks.tenant`,`Tenant`),value:e.tenantName||`—`},{label:t(`system.meshNetworks.user`,`User`),value:e.userLogin??`—`},{label:t(`system.meshNetworks.controlPlane`,`Control plane`),value:e.controlPlaneUrl||`—`},{label:t(`system.meshNetworks.meshIp`,`Mesh IP`),value:e.meshIp||`—`,mono:!0},{label:t(`system.meshNetworks.magicdns`,`MagicDNS`),value:e.magicDnsHostname||`—`,mono:!0},{label:t(`system.meshNetworks.dnsSuffix`,`DNS suffix`),value:e.magicDnsSuffix||`—`,mono:!0},{label:t(`system.meshNetworks.peers`,`Peers`),value:String(e.peerCount)},{label:t(`system.meshNetworks.keyExpiry`,`Key expiry`),value:e.keyExpiry?xt(e.keyExpiry):`—`}].map(e=>a(`div`,{className:`flex items-baseline justify-between gap-3 text-xs`,children:[l(`span`,{className:`text-foreground-subtle shrink-0`,children:e.label}),l(`span`,{className:`text-foreground truncate ${e.mono?`font-mono`:``}`,children:e.value})]},e.label))})}function xt(e){let t=e-Date.now();if(t<0)return L.t(`system.meshNetworks.expiredAgo`,{when:Tt(e)});let n=Math.floor(t/864e5);if(n>60)return new Date(e).toLocaleDateString();if(n>1)return L.t(`system.meshNetworks.expiryDays`,{count:n});let r=Math.floor(t/36e5);return r>1?L.t(`system.meshNetworks.expiryHours`,{count:r}):L.t(`system.meshNetworks.expiryMin`,{count:Math.max(1,Math.floor(t/6e4))})}function St({peers:e,loading:t}){let{t:r}=R(),o=n(()=>e.map(e=>({...e,_id:e.id})),[e]),s=i(e=>{e&&navigator.clipboard?.writeText(e)},[]),c=n(()=>[{key:`hostname`,header:r(`system.meshNetworks.hostname`,`Hostname`),render:e=>a(`div`,{className:`flex flex-col`,children:[a(`div`,{className:`flex items-center gap-1.5`,children:[l(`span`,{className:`font-medium text-foreground`,children:e.hostname||r(`system.meshNetworks.unknown`,`(unknown)`)}),e.isSelf&&l(I,{variant:`info`,children:r(`common.self`)}),e.exitNodeOption&&l(I,{variant:`warning`,children:`exit-node`})]}),e.userLogin&&l(`div`,{className:`text-[10px] text-foreground-subtle truncate`,children:e.userLogin})]})},{key:`magicDns`,header:r(`system.meshNetworks.magicdns`,`MagicDNS`),render:e=>e.magicDns?a(`div`,{className:`flex items-center gap-1`,children:[l(`span`,{className:`font-mono text-xs truncate`,children:e.magicDns}),l(`button`,{onClick:()=>s(e.magicDns),className:`p-0.5 hover:bg-foreground-subtle/10 rounded`,"aria-label":r(`system.meshNetworks.copyMagicdns`,`Copy MagicDNS`),children:l(y,{className:`h-3 w-3 text-foreground-subtle`})})]}):l(`span`,{className:`text-foreground-subtle`,children:`—`})},{key:`addresses`,header:`IP`,render:e=>{let t=e.addresses[0]??``;return t?a(`div`,{className:`flex items-center gap-1`,children:[l(`span`,{className:`font-mono text-xs`,children:t}),l(`button`,{onClick:()=>s(t),className:`p-0.5 hover:bg-foreground-subtle/10 rounded`,"aria-label":r(`system.meshNetworks.copyIp`,`Copy IP`),children:l(y,{className:`h-3 w-3 text-foreground-subtle`})})]}):l(`span`,{className:`text-foreground-subtle`,children:`—`})}},{key:`connection`,header:r(`system.meshNetworks.connection`,`Connection`),render:e=>a(`div`,{className:`flex items-center gap-1.5`,children:[l(I,{variant:Ct(e.connection),children:e.connection}),e.relay&&l(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:e.relay})]})},{key:`routes`,header:r(`system.meshNetworks.routes`,`Routes`),render:e=>e.advertisedRoutes.length>0?l(`span`,{className:`text-[10px] font-mono text-foreground-subtle truncate`,children:e.advertisedRoutes.join(`, `)}):l(`span`,{className:`text-foreground-subtle`,children:`—`})},{key:`tx`,header:r(`system.meshNetworks.txRx`,`TX / RX`),render:e=>a(`span`,{className:`text-[10px] text-foreground-subtle font-mono`,children:[`↑ `,wt(e.txBytes),` · ↓ `,wt(e.rxBytes)]})},{key:`lastSeen`,header:r(`system.meshNetworks.lastSeen`,`Last seen`),render:e=>l(`span`,{className:`text-[10px] text-foreground-subtle`,children:e.lastSeenMs>0?Tt(e.lastSeenMs):`—`})}],[s,r]);return t&&e.length===0?a(`div`,{className:`p-4 text-xs text-foreground-subtle`,children:[l(S,{className:`h-3 w-3 animate-spin inline mr-1`}),` `,r(`systemPage.meshNetworks.loadingPeers`)]}):e.length===0?l(`div`,{className:`p-4 text-xs text-foreground-subtle`,children:r(`system.meshNetworks.noPeersVisibleYourTailnet`,`No peers visible — your tailnet may be empty or the host is not joined.`)}):l(`div`,{className:`p-4`,children:l(je,{columns:c,rows:o,rowKey:e=>e._id,minWidthPx:820})})}function Ct(e){return e===`direct`?`success`:e===`relay`?`warning`:`info`}function wt(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)}MB`:`${(e/1024/1024/1024).toFixed(2)}GB`}function Tt(e){let t=Date.now()-e;return t<6e4?L.t(`system.meshNetworks.justNow`):t<36e5?L.t(`system.meshNetworks.agoMin`,{count:Math.round(t/6e4)}):t<864e5?L.t(`system.meshNetworks.agoHour`,{count:Math.round(t/36e5)}):L.t(`system.meshNetworks.agoDay`,{count:Math.round(t/864e5)})}function Et(e){return new Promise(t=>setTimeout(t,e))}var Dt=/-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----/,Ot=/-----BEGIN ((?:RSA |EC |ENCRYPTED )?PRIVATE KEY)-----[\s\S]+?-----END \1-----/,kt={certificate:`.pem,.crt,.cer`,privateKey:`.pem,.key`,ca:`.pem,.crt,.cer`};function Q(e,t){if(t.trim()===``)return null;if(e===`privateKey`){let e=Ot.exec(t);return e===null?Dt.test(t)?L.t(`helpers.pemFile.isCert`):L.t(`helpers.pemFile.notKey`):e[1]===`ENCRYPTED PRIVATE KEY`?L.t(`helpers.pemFile.encrypted`):null}return Dt.test(t)?e===`certificate`&&Ot.test(t)?L.t(`helpers.pemFile.certHasKey`):null:Ot.test(t)?L.t(`helpers.pemFile.isKey`):L.t(`helpers.pemFile.notCert`)}function At(e){return e.text()}e();function $({kind:e,label:t,value:n,onChange:i,rows:o=6}){let{t:s}=R(),u=c(null),[d,f]=r(null),[p,m]=r(null),h=p??Q(e,n),g=`pem-${e}`,_=async e=>{let t=e.target.files?.[0];if(e.target.value=``,t!==void 0){f(t.name);try{let e=await At(t);m(null),i(e)}catch(e){m(`Could not read ${t.name}: ${e instanceof Error?e.message:String(e)}`)}}};return a(`div`,{className:`space-y-1`,children:[a(`div`,{className:`flex items-center justify-between gap-2`,children:[l(`label`,{htmlFor:g,className:`text-[11px] text-foreground-subtle`,children:t}),a(`div`,{className:`flex min-w-0 items-center gap-2`,children:[d!==null&&l(`span`,{className:`truncate font-mono text-[10px] text-foreground-subtle`,"data-testid":`${g}-file-name`,children:d}),l(`input`,{ref:u,type:`file`,accept:kt[e],onChange:e=>void _(e),className:`hidden`,"data-testid":`${g}-file`}),a(j,{size:`sm`,variant:`outline`,type:`button`,onClick:()=>u.current?.click(),children:[l(oe,{className:`mr-1 h-3 w-3`}),s(`system.pemField.chooseFile`,`Choose file`)]})]})]}),l(`textarea`,{id:g,value:n,onChange:e=>{f(null),m(null),i(e.target.value)},rows:o,"aria-invalid":h!==null,className:`w-full rounded border border-border bg-surface px-2 py-1 font-mono text-[11px]`}),h!==null&&l(`p`,{className:`text-[11px] text-danger`,role:`alert`,children:h})]})}e();function jt(e){if(e===null||e===``)return`—`;let t=e.replace(/:/g,``);return t.length<=16?e:`${t.slice(0,8)}…${t.slice(-8)}`}function Mt(){let{t:e}=R(),t=s(),n=Le(void 0,{refetchInterval:15e3}),i=Ce({onSuccess:()=>void t.invalidateQueries({queryKey:[[`localNetwork`]]})}),o=ve({onSuccess:()=>void t.invalidateQueries({queryKey:[[`localNetwork`]]})}),c=Ve({onSuccess:()=>{m(!1),g(``),v(``),b(``),t.invalidateQueries({queryKey:[[`localNetwork`]]})}}),d=n.data,[f,m]=r(!1),[h,g]=r(``),[_,v]=r(``),[y,b]=r(``),x=()=>{if(!d?.caCertPem)return;let e=new Blob([d.caCertPem],{type:`application/x-pem-file`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`camstack-ca.crt`,n.click(),URL.revokeObjectURL(t)},S=d?.mode===`uploaded`?`Uploaded`:d?.mode===`generated`?`Generated local CA`:`TLS disabled`;return l(V,{embedded:!0,children:a(`div`,{className:p,children:[l(We,{nodeId:`hub`,addonIds:[`local-network`],level:`global`,title:e(`system.localAccess.lanHttp`,`LAN HTTP`),description:e(`system.localAccess.nativeAppsOnThisWi`,`Native apps on this Wi-Fi use http:// and skip the private certificate. The tunnel and this admin UI stay on HTTPS.`)}),l(F,{headingId:`local-access-certificate`,title:e(`system.localAccess.certificate`,`Certificate`),icon:E,children:a(`div`,{className:`${u} space-y-3`,children:[n.isError&&l(`p`,{className:`text-xs text-danger`,children:e(`system.localAccess.couldNotReadTlsStatus`,`Could not read TLS status.`)}),d?.reissueError&&l(P,{variant:`warning`,title:e(`system.localAccess.certificateReissue`,`Certificate reissue`),message:d.reissueError}),d?.restartRequired&&l(P,{variant:`warning`,title:e(`system.localAccess.restartRequired`,`Restart required`),message:e(`system.localAccess.theHttpsListenerStillServes`,`The HTTPS listener still serves the previous certificate. Restart the hub to apply it.`)}),a(`dl`,{className:`grid grid-cols-1 gap-2 text-xs sm:grid-cols-2`,children:[a(`div`,{children:[l(`dt`,{className:`text-foreground-subtle`,children:e(`system.localAccess.mode`,`Mode`)}),l(`dd`,{className:`font-medium`,children:S})]}),a(`div`,{children:[l(`dt`,{className:`text-foreground-subtle`,children:e(`system.localAccess.validTo`,`Valid to`)}),l(`dd`,{className:`font-mono`,children:d?.validTo?new Date(d.validTo).toLocaleString():`—`})]}),a(`div`,{children:[l(`dt`,{className:`text-foreground-subtle`,children:e(`system.localAccess.leafSha256`,`Leaf SHA-256`)}),l(`dd`,{className:`font-mono`,title:d?.leafFingerprintSha256??void 0,children:jt(d?.leafFingerprintSha256??null)})]}),a(`div`,{children:[l(`dt`,{className:`text-foreground-subtle`,children:e(`system.localAccess.caSha256`,`CA SHA-256`)}),l(`dd`,{className:`font-mono`,title:d?.caFingerprintSha256??void 0,children:d?.mode===`uploaded`&&d.caFingerprintSha256===null?l(`span`,{className:`font-sans text-foreground-subtle`,children:e(`system.localAccess.issuerNotIncludedInThe`,`Issuer not included in the upload (not the local CA)`)}):jt(d?.caFingerprintSha256??null)})]})]}),d&&d.sans.length>0&&l(`div`,{className:`flex flex-wrap gap-1`,children:d.sans.map(e=>l(`span`,{className:`rounded border border-border bg-surface px-1.5 py-0.5 font-mono text-[10px] text-foreground-subtle`,children:e},e))}),a(`div`,{className:`flex flex-wrap gap-2`,children:[l(ye,{label:e(`system.localAccess.regenerate`,`Regenerate`),title:e(`system.localAccess.issueANewLeaf`,`Issue a new leaf?`),description:e(`system.localAccess.issuesANewLeafUnder`,`Issues a new leaf under the current local CA. Clients that trust the CA keep working. The HTTPS listener reloads.`),confirmLabel:e(`system.localAccess.regenerate`,`Regenerate`),disabled:d?.mode===`uploaded`||i.isPending,action:()=>i.mutateAsync({})}),l(j,{size:`sm`,variant:`outline`,onClick:()=>m(e=>!e),children:e(`system.localAccess.upload`,`Upload`)}),d?.caCertPem&&l(j,{size:`sm`,variant:`outline`,onClick:x,children:e(`system.localAccess.downloadCa`,`Download CA`)}),d?.mode===`uploaded`&&l(ye,{label:e(`system.localAccess.revertToGenerated`,`Revert to generated`),title:e(`system.localAccess.dropTheUploadedCertificate`,`Drop the uploaded certificate?`),description:e(`system.localAccess.deletesTheUploadedPairAnd`,`Deletes the uploaded pair and returns to the generated local CA.`),confirmLabel:e(`system.localAccess.revert`,`Revert`),confirmVariant:`danger`,disabled:o.isPending,action:()=>o.mutateAsync({})})]}),f&&a(`div`,{className:`space-y-2 border-t border-border pt-3`,children:[l($,{kind:`certificate`,label:e(`system.localAccess.certificateOrFullChainPem`,`Certificate or full chain (PEM)`),value:h,onChange:g}),l($,{kind:`privateKey`,label:e(`system.localAccess.privateKeyPem`,`Private key (PEM)`),value:_,onChange:v}),l($,{kind:`ca`,label:e(`system.localAccess.caPemOptional`,`CA (PEM, optional)`),value:y,onChange:b,rows:4}),l(j,{size:`sm`,disabled:!h.trim()||!_.trim()||Q(`certificate`,h)!==null||Q(`privateKey`,_)!==null||Q(`ca`,y)!==null||c.isPending,onClick:()=>c.mutate({certPem:h,keyPem:_,...y.trim()?{caPem:y}:{}}),children:e(`system.localAccess.saveCertificate`,`Save certificate`)}),c.isError&&l(`p`,{className:`text-xs text-danger`,children:c.error instanceof Error?c.error.message:e(`system.localAccess.uploadFailed`,`Upload failed`)})]})]})})]})})}e();function Nt({value:e,onChange:t}){let{t:r}=R(),{data:i}=Ie({isCamera:!0,projection:`slim`}),o=n(()=>i===void 0?[{value:``,label:r(`system.networkDiagnostics.loadingCameras`,`Loading cameras…`)}]:i.length===0?[{value:``,label:r(`system.networkDiagnostics.noCameras`,`No cameras`)}]:[{value:``,label:r(`system.networkDiagnostics.pickACamera`,`Pick a camera`)},...i.toSorted((e,t)=>e.name.localeCompare(t.name)).map(e=>({value:String(e.id),label:`${e.name} (#${String(e.id)})`}))],[i,r]);return a(`label`,{className:`flex min-w-0 flex-col gap-1`,children:[l(`span`,{className:`text-[11px] text-foreground-subtle`,children:r(`system.networkDiagnostics.camera`,`Camera`)}),l(ze,{value:e===null?``:String(e),disabled:i===void 0||i.length===0,onChange:e=>t(e.target.value===``?null:Number(e.target.value)),options:o})]})}function Pt(){let e=ne(),[t,n]=r(null);return l(V,{embedded:!0,children:a(`div`,{className:p,"data-testid":`network-diagnostics`,children:[l(pe,{loadServers:i(async()=>e.trpcClient.turnProvider.getTurnServers.query(),[e])}),l(ke,{trpc:e.trpcClient,serverUrl:b(),deviceId:t,cameraField:l(Nt,{value:t,onChange:n})})]})})}function Ft(){let{t:e}=R(),t=He(`/system/network`,{t:e,isAdmin:!0})??{icon:A,title:e(`system.network`,`Network`)};return l(Ue,{icon:t.icon,title:t.title,defaultSection:`addresses`,sectionsLabel:`${t.title} sections`,sections:[{id:`local-access`,label:e(`systemPage.network.localAccess`,`Local access`),content:l(Mt,{})},{id:`addresses`,label:e(`systemPage.network.networkAddresses`,`Network Addresses`),content:l(ut,{})},{id:z.remoteAccess.tab,label:e(`systemPage.network.remoteAccess`,`Remote Access`),content:l(qe,{}),ownedParams:B},{id:z.mesh.tab,label:e(`systemPage.network.meshNetworks`,`Mesh Networks`),content:l(ht,{}),ownedParams:B},{id:z.turn.tab,label:e(`systemPage.network.turnServers`,`TURN Servers`),content:l($e,{}),ownedParams:B},{id:`diagnostics`,label:e(`systemPage.network.diagnostics`,`Diagnostics`),content:l(Pt,{})}]})}export{Ft as NetworkPage};
|