@camstack/addon-admin-ui 1.2.637 → 1.2.638
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/CHANGELOG.md +6 -0
- package/dist/assets/{Addons-BlKy1u2u.js → Addons-BzsBtyAW.js} +1 -1
- package/dist/assets/{AdminSectionedPage-Xr_hesYw.js → AdminSectionedPage-Dj-OV5CA.js} +1 -1
- package/dist/assets/{AiProfiles-YERCq98T.js → AiProfiles-DyZj94wt.js} +1 -1
- package/dist/assets/BootstrapSettingsForm-BXzPZqWx.js +1 -0
- package/dist/assets/{Build-BmlbmwZw.js → Build-BhmtFpYr.js} +1 -1
- package/dist/assets/{Calendars-Bg6sl6iG.js → Calendars-7GvrQigo.js} +1 -1
- package/dist/assets/{CameraGrids-BWF-BVdJ.js → CameraGrids-Bb9wTIKp.js} +1 -1
- package/dist/assets/{Cluster-BsLfi42d.js → Cluster-C-zIpXGP.js} +1 -1
- package/dist/assets/{CompositionBlockEditor-C0mH1XDD.js → CompositionBlockEditor-N5UMRfDt.js} +1 -1
- package/dist/assets/{CompositionEditorPage-5iKEcr6R.js → CompositionEditorPage-CHhoRf0w.js} +1 -1
- package/dist/assets/{Data-DSMQmnZv.js → Data-DNK8sdoy.js} +1 -1
- package/dist/assets/{DeviceDetail-kBF3z5wo.js → DeviceDetail-Cuc91kn4.js} +1 -1
- package/dist/assets/{Devices-DQ8VksMo.js → Devices-Btn-7OLF.js} +1 -1
- package/dist/assets/{EmbedDevicePage-DOj0N5Mn.js → EmbedDevicePage-Bx1loP2O.js} +1 -1
- package/dist/assets/{History-BFkKRlW8.js → History-BQ4O-B-t.js} +1 -1
- package/dist/assets/Identity-BoO8xvI-.js +1 -0
- package/dist/assets/{InstancesTable-BagVOERb.js → InstancesTable-VqqK1wvv.js} +1 -1
- package/dist/assets/{IntegrationDetail-ByG-grc8.js → IntegrationDetail-Bs7hOHDO.js} +1 -1
- package/dist/assets/{Integrations-BReJ0gq9.js → Integrations-CqV8OqAX.js} +1 -1
- package/dist/assets/{Integrations-DK9ZlSbS.js → Integrations-D7TYxG9-.js} +1 -1
- package/dist/assets/{Library-CVdwKZBw.js → Library-DsZ1hTgf.js} +1 -1
- package/dist/assets/{Locations-CDUPDAGA.js → Locations-DjKqQHFe.js} +1 -1
- package/dist/assets/{Logs-qlrqjJUI.js → Logs-DXXtgKOb.js} +1 -1
- package/dist/assets/{MyAccess-sO6455Tp.js → MyAccess-D8NtdZSw.js} +1 -1
- package/dist/assets/{Network-B-NGzfdC.js → Network-DhA7thGL.js} +1 -1
- package/dist/assets/NodeAddonsSettingsPanel-o9q4_Y7B.js +2 -0
- package/dist/assets/{Notifications-BhHrfZKJ.js → Notifications-BmZy88k1.js} +1 -1
- package/dist/assets/{Pipeline-C9_jNGPl.js → Pipeline-CazRA6DH.js} +1 -1
- package/dist/assets/{Recordings-DTwvvqkz.js → Recordings-Ci3f9TFU.js} +1 -1
- package/dist/assets/{SessionsList-WhsG7RxJ.js → SessionsList-Cep2xLCv.js} +1 -1
- package/dist/assets/{Showroom-DGD_uw5N.js → Showroom-BjwUl_qA.js} +1 -1
- package/dist/assets/{StorageLocationsTable-CV0MMZ6R.js → StorageLocationsTable-DQVW1xnr.js} +1 -1
- package/dist/assets/System-KS6XUNN7.js +1 -0
- package/dist/assets/{Templates-B1e69LSo.js → Templates-BmQmXptV.js} +1 -1
- package/dist/assets/{Terminal-BzbVWqvg.js → Terminal-Rm3EaYyP.js} +1 -1
- package/dist/assets/{TrainingProviders-CF4NFH__.js → TrainingProviders-DHoX9yR2.js} +1 -1
- package/dist/assets/{ai-page.helpers-B1a9LT5I.js → ai-page.helpers-CaFgUuvz.js} +1 -1
- package/dist/assets/{assignment-candidates-DtwDORE1.js → assignment-candidates-DbC-TLvF.js} +1 -1
- package/dist/assets/{board-model-DB92Pi_O.js → board-model-BvS324KY.js} +1 -1
- package/dist/assets/{create-composition-xpQJ_im0.js → create-composition-B8s7rb7B.js} +1 -1
- package/dist/assets/{device-detail-rao8xQIi.js → device-detail-sXpv_vUg.js} +1 -1
- package/dist/assets/{device-integration-icon-DSKbNj0K.js → device-integration-icon-D4lkKdpB.js} +1 -1
- package/dist/assets/{format-B0YD4Zes.js → format-DIfkCsNl.js} +1 -1
- package/dist/assets/i18n-DmOCWVEq.js +1 -0
- package/dist/assets/{index-D5GcZJtC.js → index-D7Qm6t2n.js} +3 -3
- package/dist/assets/{linked-devices-model-DMdglvhv.js → linked-devices-model-CCjfyGL1.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-aa99f5e1.js → mf-entry-bootstrap-0-ff862d80.js} +1 -1
- package/dist/assets/{notification-rule-status-DfiT5MFH.js → notification-rule-status-D1G2O8do.js} +1 -1
- package/dist/assets/{sso-popup-CcJP5NlL.js → sso-popup-CBrgyqXr.js} +1 -1
- package/dist/assets/{step-inspector-model-DrTK6qqE.js → step-inspector-model-rtgdeDgk.js} +1 -1
- package/dist/assets/{useAdminDeviceRemoval-Ds-ZvGNc.js → useAdminDeviceRemoval-B-qCzajf.js} +1 -1
- package/dist/assets/{useNodeUrlSelection-DAoFJ0Oq.js → useNodeUrlSelection-BSPl0vnb.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/server/addon.js +1 -1
- package/package.json +2 -2
- package/dist/assets/Authentication-CWHj8Czl.js +0 -1
- package/dist/assets/Identity-5sx8SWa4.js +0 -1
- package/dist/assets/NodeAddonsSettingsPanel-BtSyXQ4v.js +0 -1
- package/dist/assets/System-CUM8c-ad.js +0 -1
- package/dist/assets/i18n-ByFr51sS.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Li as e,Zo as t}from"./client-mnldOm50.js";import{t as n}from"./i18n-
|
|
1
|
+
import{Li as e,Zo as t}from"./client-mnldOm50.js";import{t as n}from"./i18n-DmOCWVEq.js";import{t as r}from"./assignment-candidates-DbC-TLvF.js";function i(n,r){let i=e[n];return i.hostDeviceTypes.some(e=>e===r)?`host`:i.descriptor.sourceCaps===`any`&&r!==t.Container?`guest`:null}function a(e){return e.slot===`linked-devices`}function o(e){if(e.status===`error`)return{kind:`unknown`,reason:e.error?.message??n.t(`helpers.customize.requestFailed`)};if(e.status===`pending`||e.data===void 0)return{kind:`pending`};for(let t of e.data)if(t.state===`ok`&&t.slot===`linked-devices`&&a(t.value))return{kind:`present`,slot:t,value:t.value};let t=e.data.find(e=>e.state===`unreachable`);return t!==void 0&&t.state===`unreachable`?{kind:`unknown`,reason:t.reason}:{kind:`absent`}}function s(e,t){let n=t.trackedDeviceIds??[],r=e=>t=>({deviceId:t.deviceId,name:t.name,health:t.health,implied:e,tracked:n.includes(t.deviceId)});return[...e.sources.map(r(!1)),...(e.impliedSources??[]).map(r(!0))]}function c(e,t){let n=new Set([...e.sources,...e.impliedSources??[]].map(e=>e.deviceId));return(t.trackedDeviceIds??[]).filter(e=>!n.has(e))}function l(e,t){return{...e,deviceIds:[...e.deviceIds,...t.filter(t=>!e.deviceIds.includes(t))]}}function u(e,t){return{...e,deviceIds:e.deviceIds.filter(e=>e!==t),...e.trackedDeviceIds===void 0?{}:{trackedDeviceIds:e.trackedDeviceIds.filter(e=>e!==t)}}}function d(e,t,n){let r=e.trackedDeviceIds??[],i=n?[...r.filter(e=>e!==t),t]:r.filter(e=>e!==t);return{...e,trackedDeviceIds:i}}function f(e,t,n){return e.flatMap(e=>{let i=t.get(e.deviceId);return n.has(e.deviceId)||i===void 0?[]:[{deviceId:e.deviceId,ref:{addonId:i.addonId,stableId:i.stableId},name:e.parentName===null?e.name:`${e.parentName} · ${e.name}`,detail:r(i.integration,e.location),meta:e.type,caps:[],value:null}]})}function p(e,t,n){return n?l(e,[t]):u(e,t)}function m(e,t,n){if(t.deviceIds.includes(n))return{linked:!0,implied:!1};let r=(e.impliedSources??[]).some(e=>e.deviceId===n);return{linked:r,implied:r}}export{c as a,l as c,m as i,d as l,s as n,i as o,o as r,p as s,f as t,u};
|
package/dist/assets/{notification-rule-status-DfiT5MFH.js → notification-rule-status-D1G2O8do.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./i18n-
|
|
1
|
+
import{t as e}from"./i18n-DmOCWVEq.js";var t=`pipeline-analytics`,n=`nc.getRuleStatus`,r=`nc.testRule`;function i(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function a(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function o(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function s(e){if(!i(e))return;let t=o(e,`id`),n=o(e,`downloadPath`),r=a(e,`capturedAt`);if(!(t===void 0||n===void 0||r===void 0))return{id:t,mediaType:o(e,`mediaType`)??`video`,sizeBytes:a(e,`sizeBytes`)??0,capturedAt:r,downloadPath:n}}function c(e){if(!i(e))return;let t=a(e,`startMs`),n=a(e,`endMs`);if(!(t===void 0||n===void 0))return{startMs:t,endMs:n}}function l(e){if(!i(e))return null;let t=a(e,`deviceId`);if(t===void 0)return null;let n=a(e,`lastGeneratedAt`),r=s(e.lastArtifact),o=e.rendering,c=i(o)?{startedAt:a(o,`startedAt`)??0,windowStartMs:a(o,`windowStartMs`)??0,windowEndMs:a(o,`windowEndMs`)??0}:void 0;return{deviceId:t,...n===void 0?{}:{lastGeneratedAt:n},...r===void 0?{}:{lastArtifact:r},...c===void 0?{}:{rendering:c}}}function u(e){if(!i(e))return null;let t=a(e,`deviceId`),n=o(e,`windowKey`),r=a(e,`openedAt`),s=a(e,`closesAt`),c=a(e,`members`),l=a(e,`pending`);return t===void 0||n===void 0||r===void 0||s===void 0||c===void 0||l===void 0?null:{deviceId:t,windowKey:n,openedAt:r,closesAt:s,members:c,pending:l}}function d(e){if(!i(e))return null;let t=o(e,`kind`);if(t===`none`)return{kind:`none`,reason:o(e,`reason`)??``};if(t===`occupancy`){let t=a(e,`deviceId`),n=a(e,`threshold`),r=a(e,`sustainSeconds`);if(t===void 0||n===void 0||r===void 0)return null;let i=o(e,`unavailable`),s=i===`no-snapshot`||i===`zone-absent`?i:void 0,c=a(e,`count`),l=a(e,`observedAt`),u=a(e,`since`),d=o(e,`scope`),f=o(e,`className`),p=o(e,`warning`);return{kind:`occupancy`,deviceId:t,threshold:n,sustainSeconds:r,...d===void 0?{}:{scope:d},...f===void 0?{}:{className:f},...c===void 0?{}:{count:c},...typeof e.occupied==`boolean`?{occupied:e.occupied}:{},...l===void 0?{}:{observedAt:l},...u===void 0?{}:{since:u},...s===void 0?{}:{unavailable:s},...p===void 0?{}:{warning:p}}}if(t===`grouped`){let t=a(e,`groupingSec`);if(t===void 0)return null;if(e.openWindows===null){let n=o(e,`reason`);return{kind:`grouped`,groupingSec:t,openWindows:null,...n===void 0?{}:{reason:n}}}if(!Array.isArray(e.openWindows))return null;let n=[];for(let t of e.openWindows){let e=u(t);if(e===null)return null;n.push(e)}return{kind:`grouped`,groupingSec:t,openWindows:n}}if(t===`timelapse`){let t=Array.isArray(e.devices)?e.devices:[],n=[];for(let e of t){let t=l(e);t!==null&&n.push(t)}let r=c(e.lastWindow),o=e.nextWindow,s=i(o)?{startMs:a(o,`startMs`)??0,endMs:a(o,`endMs`)??null}:void 0;return{kind:`timelapse`,devices:n,...r===void 0?{}:{lastWindow:r},...s===void 0?{}:{nextWindow:s},settleMs:a(e,`settleMs`)??0}}return null}function f(t){let n=Math.max(0,Math.floor(t/6e4));if(n<1)return e.t(`helpers.notificationRuleStatus.lessThanMinute`);if(n<60)return e.t(`helpers.notificationRuleStatus.durMin`,{count:n});let r=Math.floor(n/60),i=n%60;if(r<24)return i===0?e.t(`helpers.notificationRuleStatus.durH`,{count:r}):e.t(`helpers.notificationRuleStatus.durHMin`,{hours:r,minutes:i});let a=Math.floor(r/24),o=r%24;return o===0?e.t(`helpers.notificationRuleStatus.durD`,{count:a}):e.t(`helpers.notificationRuleStatus.durDH`,{days:a,hours:o})}function p(t){if(t<1024)return`${String(t)} B`;let n=t/1024;if(n<1024)return e.t(`helpers.notificationRuleStatus.sizeKb`,{value:n.toFixed(0)});let r=n/1024;return r<1024?e.t(`helpers.notificationRuleStatus.sizeMb`,{value:r.toFixed(1)}):e.t(`helpers.notificationRuleStatus.sizeGb`,{value:(r/1024).toFixed(2)})}function m(e,t){let n=e.scope??`the whole frame`,r=e.className??`objects`;if(e.unavailable!==void 0){let t=e.unavailable===`no-snapshot`?`no live count for this camera yet — the condition fails closed until one arrives`:`“${n}” is not in this camera’s current snapshot — the condition fails closed (deleted zone?)`;return e.warning===void 0?t:`${e.warning} · ${t}`}let i=[`Now: ${String(e.count??0)}/${String(e.threshold)} ${r} in ${n}`,e.occupied===!0?`condition TRUE`:`condition false`];e.since!==void 0&&i.push(`for ${f(Math.max(0,t-e.since))}`),i.push(`holds ${String(e.sustainSeconds)} s before firing`);let a=i.join(` · `);return e.warning===void 0?a:`${e.warning} · ${a}`}function h(t,n,r){if(t.rendering!==void 0)return e.t(`helpers.notificationRuleStatus.tlRendering`,{camera:n,duration:f(Math.max(0,r-t.rendering.startedAt)),from:new Date(t.rendering.windowStartMs).toLocaleString(),to:new Date(t.rendering.windowEndMs).toLocaleString()});if(t.lastGeneratedAt===void 0)return e.t(`helpers.notificationRuleStatus.tlNever`,{camera:n});let i=new Date(t.lastGeneratedAt).toLocaleString(),a=t.lastArtifact;return a===void 0?e.t(`helpers.notificationRuleStatus.tlGone`,{camera:n,when:i}):e.t(`helpers.notificationRuleStatus.tlLast`,{camera:n,when:i,size:p(a.sizeBytes)})}function g(e){return{windows:e.length,waiting:e.reduce((e,t)=>e+t.pending,0)}}export{f as a,h as c,g as i,n,m as o,r,d as s,t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./i18n-
|
|
1
|
+
import{t as e}from"./i18n-DmOCWVEq.js";function t(e){return e===`totp`||e===`passkey`}function n(e){if(!e.startsWith(`#`))return null;let n=new URLSearchParams(e.slice(1)),r=n.get(`challenge`);if(r!==null){if(r.length===0)return null;let e=(n.get(`factors`)??``).split(`,`).filter(t);return e.length===0?null:{kind:`challenge`,challengeToken:r,factors:e}}let i=n.get(`error`);return i===`sso-not-linked`||i===`sso-state`?{kind:`error`,code:i,provider:n.get(`provider`)}:null}function r(t,n){switch(t){case`sso-not-linked`:return e.t(`helpers.ssoReturn.notLinked`,{provider:n??e.t(`helpers.ssoReturn.signInFallback`)});case`sso-state`:return e.t(`helpers.ssoReturn.state`)}}var i={expired:`helpers.ssoReturn.link.expired`,provider:`helpers.ssoReturn.link.provider`,session:`helpers.ssoReturn.link.session`,conflict:`helpers.ssoReturn.link.conflict`,state:`helpers.ssoReturn.link.state`};function a(t){let n=new URLSearchParams(t),r=n.get(`linked`);if(r!==null&&r.length>0)return{kind:`linked`,provider:r};let a=n.get(`linkError`);return a===null?null:{kind:`error`,message:e.t(i[a]??`helpers.ssoReturn.link.failed`)}}var o=`camstack:sso-return`,s=`camstack:sso-ack`,c=`/sso-complete`,l=1500,u=520,d=680;function f(e){if(!e.startsWith(`#`))return null;let t=new URLSearchParams(e.slice(1)),n=t.get(`return`);t.delete(`return`);let r=t.toString();return n===`login`?r.length>0?{target:n,fragment:r}:null:n===`profile`&&r.length>0?{target:n,query:r}:null}function p(e){return e.target===`login`?`/login#${e.fragment}`:`/system/my-access?${e.query}`}function m(e){let t=new URL(e,`http://placeholder.invalid`);return t.searchParams.set(`popup`,`1`),/^[a-z][a-z0-9+.-]*:/i.test(e)?t.toString():`${t.pathname}${t.search}${t.hash}`}function h(e=window){let t=Math.max(0,Math.round(e.screenX+(e.outerWidth-u)/2)),n=Math.max(0,Math.round(e.screenY+(e.outerHeight-d)/2));return[`popup=yes`,`width=${u}`,`height=${d}`,`left=${t}`,`top=${n}`,`toolbar=no`,`menubar=no`,`location=no`,`status=no`,`resizable=yes`,`scrollbars=yes`].join(`,`)}function g(e){try{return window.open(e??`about:blank`,`camstack-sso`,h())??null}catch{return null}}function _(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.target===`login`?typeof t.fragment==`string`:t.target===`profile`?typeof t.query==`string`:!1}function v(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`camstack:sso-return`&&_(t.completion)}function y(e,t,n){return t===null||e.source!==t||e.origin!==n?null:v(e.data)?e.data.completion:null}var b=`camstack-sso`,x=`camstack:sso-done`;function S(e,t){return e.target===`profile`?{target:`profile`,query:e.query}:t?{target:`login`}:null}function C(e){if(typeof e!=`object`||!e)return null;let t=e;if(t.type!==`camstack:sso-done`)return null;let n=Object.keys(t).sort().join(`,`);return t.target===`login`&&n===`target,type`?{target:`login`}:t.target===`profile`&&typeof t.query==`string`&&n===`query,target,type`?{target:`profile`,query:t.query}:null}function w(e){return typeof e==`object`&&!!e&&e.type===`camstack:sso-done-ack`}function T(e){try{let t=e.location.origin;return typeof t==`string`?t:null}catch{return null}}function E(){if(typeof BroadcastChannel>`u`)return null;try{let e=new BroadcastChannel(b);return{post:t=>e.postMessage(t),subscribe:t=>{let n=e=>t(e.data);return e.addEventListener(`message`,n),()=>e.removeEventListener(`message`,n)},close:()=>e.close()}}catch{return null}}var D=500;function O(e,t,n=window,r={}){let i=n.location.origin,a=r.channel===void 0?E():null,o=r.channel===void 0?a:r.channel,c=r.setInterval??((e,t)=>window.setInterval(e,t)),l=r.clearInterval??(e=>window.clearInterval(e)),u=!1,d=!1,f=r=>{let a=y(r,e,i);a===null||u||(u=!0,n.removeEventListener(`message`,f),e.postMessage({type:s},i),t.onReturn(a))};n.addEventListener(`message`,f);let p=o?.subscribe(e=>{let n=C(e);n===null||u||(u=!0,o.post({type:`camstack:sso-done-ack`}),t.onDone?.(n))})??null,m=c(()=>{d||!e.closed||(d=!0,l(m),t.onClosed?.())},D);return()=>{n.removeEventListener(`message`,f),p?.(),a?.close(),l(m)}}function k(e,t,n){if(t===null||e.source!==t||e.origin!==n)return!1;let r=e.data;return typeof r==`object`&&!!r&&r.type===`camstack:sso-ack`}function A(e,t){return new Promise(n=>{let r=!1,i=t(()=>{r||(r=!0,i(),n(!0))});e.setTimeout(()=>{r||(r=!0,i(),n(!1))},l)})}function j(e,t,n){let r=A(n,e=>{let r=r=>{k(r,t,n.origin)&&e()};return n.addEventListener(`message`,r),()=>n.removeEventListener(`message`,r)});try{let r={type:o,completion:e};t.postMessage(r,n.origin)}catch{}return r}function M(e,t,n){let r=A(n,e=>t.subscribe(t=>{w(t)&&e()}));return t.post({type:x,...e}),r}async function N(e,t){let n=t.opener!==null&&!t.opener.closed?t.opener:null;if(n!==null&&T(n)===t.origin&&await j(e,n,t)){t.close();return}let r=e.target===`login`?new URLSearchParams(e.fragment).get(`token`):null,i=r!==null&&r.length>0,o=S(e,i);if(o!==null&&t.channel!==null&&(r!==null&&i&&await t.persistSession(r),await M(o,t.channel,t))){t.close();return}if(n!==null&&e.target===`profile`){let n=a(`?${e.query}`);if(n?.kind===`error`){t.showResult({kind:`link-error`,message:n.message});return}t.close();return}t.continueAt(p(e))}function P(e,t){return(t.length>0&&e.startsWith(t)?e.slice(t.length):e).replace(/\/+$/,``)===c}export{f as a,m as c,r as d,g as i,a as l,P as n,T as o,E as r,O as s,N as t,n as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{K as e,R as t,et as n}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Rs as r,ci as i,fi as a,ns as o,rs as s}from"./client-mnldOm50.js";import{Er as c,Sr as l,Tr as u,vr as d,xr as f,yr as p}from"./src-DKRp5NPI.js";import{t as m}from"./i18n-
|
|
1
|
+
import{K as e,R as t,et as n}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Rs as r,ci as i,fi as a,ns as o,rs as s}from"./client-mnldOm50.js";import{Er as c,Sr as l,Tr as u,vr as d,xr as f,yr as p}from"./src-DKRp5NPI.js";import{t as m}from"./i18n-DmOCWVEq.js";import{Kr as h}from"./index-D7Qm6t2n.js";n();var g=`step`,_=[g,`acc`];function v(e,t){return`${e}/${t}`}function y(e,t,n){let r=n.step!==null&&e.includes(n.step),i=n.acc!==null&&t.includes(n.acc);return{stepId:r?n.step:null,acceleratorId:i?n.acc:null,staleStepId:n.step!==null&&n.step!==``&&!r&&e.length>0?n.step:null}}var b=`armed:`;function x(e){return e.assignment.reasons.detection?.startsWith(b)===!0}function S(e){let{assignment:t,detection:n}=e;return n!==null&&n.provisioning.state===`failed`||t.detectionNodeId===null&&n===null&&!x(e)?`error`:n!==null&&n.phase===`active`?`healthy`:`idle`}function C(e){let t=[],n=[],{assignment:r,detection:i,broker:a}=e;i!==null&&i.provisioning.state===`failed`&&t.push({code:`provisioning-failed`,severity:`error`,message:i.provisioning.error!==void 0&&i.provisioning.error.length>0?m.t(`helpers.cameraCardModel.provisioningFailedWith`,{error:i.provisioning.error}):m.t(`helpers.cameraCardModel.provisioningFailed`)}),i!==null&&i.phase===`active`&&i.actualFps===0&&t.push({code:`detection-black-hole`,severity:`error`,message:m.t(`helpers.cameraCardModel.blackHole`)}),r.detectionNodeId===null&&i===null&&!x(e)&&n.push({code:`unassigned`,severity:`warning`,message:m.t(`helpers.cameraCardModel.unassigned`)});let o=e.degraded??[];if(o.length>0){let e=[...new Set(o.map(e=>e.stage))].join(`, `);n.push({code:`status-unreadable`,severity:`warning`,message:m.t(`helpers.cameraCardModel.statusUnreadable`,{stages:e})})}n.push(...ne(e.cameraSensors));for(let e of a?.profiles??[])e.status===`streaming`&&e.inFps===0&&n.push({code:`broker-stalled`,severity:`warning`,message:m.t(`helpers.cameraCardModel.brokerStalled`,{profile:e.profile})});return[...t,...n]}function ee(e){return e.state===`unreadable`&&a.state===`unreadable`&&e.reason===a.reason}function te(e){switch(e.state){case`ready`:return null;case`missing`:return{code:`camera-sensor-missing`,severity:`warning`,message:m.t(`helpers.cameraCardModel.sensorMissing`,{addonId:e.addonId,stableId:e.stableId})};case`offline`:return{code:`camera-sensor-offline`,severity:`warning`,message:m.t(`helpers.cameraCardModel.sensorOffline`,{name:e.name,deviceId:e.deviceId,reason:e.reason})};case`unsupported`:return{code:`camera-sensor-unsupported`,severity:`warning`,message:m.t(`helpers.cameraCardModel.sensorUnsupported`,{name:e.name,deviceId:e.deviceId,reason:e.reason})};case`unreadable`:return{code:`camera-sensor-unreadable`,severity:`warning`,message:m.t(`helpers.cameraCardModel.sensorUnreadable`,{addonId:e.addonId,stableId:e.stableId,reason:e.reason})}}}function ne(e){if(e===void 0||e.state===`not-configured`)return[];if(e.state===`unreadable`)return ee(e)?[]:[{code:`camera-sensors-unreadable`,severity:`warning`,message:m.t(`helpers.cameraCardModel.sensorsUnreadable`,{reason:e.reason})}];let t=e.sensors.flatMap(e=>{let t=te(e);return t===null?[]:[t]}),n=e.notForwarded===void 0?t:[w(e.notForwarded),...t];return e.notEnforced===void 0?n:[{code:`camera-sensors-not-enforced`,severity:`warning`,message:m.t(`helpers.cameraCardModel.notEnforced`)},...n]}function w(e){return{code:`camera-sensors-not-forwarded`,severity:`warning`,message:e===`onboard-not-listed`?m.t(`helpers.cameraCardModel.notForwardedOnboard`):m.t(`helpers.cameraCardModel.notForwardedNoDetection`)}}function T(e){return e===void 0?m.t(`helpers.cameraCardModel.summaryUnavailable`):e.state===`not-configured`?m.t(`helpers.cameraCardModel.summaryNone`):e.state===`unreadable`?m.t(`helpers.cameraCardModel.summaryUnknown`,{reason:e.reason}):e.sensors.map(D).join(`, `)}function E(e){return e.mode===`in-addition`?``:` · ${e.mode}`}function D(e){return`${O(e)}${E(e)}`}function O(e){switch(e.state){case`ready`:return`${e.name} (#${e.deviceId})`;case`offline`:return`${e.name} (#${e.deviceId}) — ${e.reason}`;case`unsupported`:return m.t(`helpers.cameraCardModel.summaryUnsupported`,{name:e.name,deviceId:e.deviceId});case`missing`:case`unreadable`:return`${e.addonId}/${e.stableId} — ${e.state}`}}function k(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function A(e){return typeof e==`string`&&e.length>0?e:null}function j(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function M(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function N(e,t){return e==null?!1:JSON.stringify(e)!==JSON.stringify(t??null)}var P={detectionMode:null,detectionStreamProfile:null,detectionFps:null,motionSources:[],motionFps:null,motionCooldownMs:null,motionStreamProfile:null,audioMode:null,pipelineNodeId:null,decoderNodeId:null,audioNodeId:null,overriddenKeys:new Set};function F(e){if(!k(e)||!Array.isArray(e.sections))return P;let t=r(e),n=e=>{let n=t.get(e);if(n!==void 0)return n.value??n.default},i=new Set;for(let[e,n]of t)N(n.value,n.default)&&i.add(e);return{detectionMode:A(n(`detectionMode`)),detectionStreamProfile:A(n(`detectionStreamProfile`)),detectionFps:j(n(`detectionFps`)),motionSources:M(n(`motionSources`)),motionFps:j(n(`motionFps`)),motionCooldownMs:j(n(`motionCooldownMs`)),motionStreamProfile:A(n(`motionStreamProfile`)),audioMode:A(n(`audioMode`)),pipelineNodeId:A(n(`pipelineNodeId`)),decoderNodeId:A(n(`decoderNodeId`)),audioNodeId:A(n(`audioNodeId`)),overriddenKeys:i}}function I(e,t=0){let n=[];for(let r of e)n.push({addonId:r.addonId,modelId:r.modelId??null,enabled:r.enabled,depth:t}),r.children!==void 0&&r.children.length>0&&n.push(...I(r.children,t+1));return n}function L(n,r){let[i,a]=h(),o=i.get(g),s=i.get(`acc`),c=e(()=>y(n,r,{step:o,acc:s}),[n,r,o,s]),l=t(e=>{a(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},[a]);return{selection:c,open:t(e=>l(t=>{t.set(g,e.stepId),e.acceleratorId===void 0?t.delete(`acc`):t.set(`acc`,e.acceleratorId)}),[l]),close:t(()=>l(e=>{e.delete(g),e.delete(`acc`)}),[l])}}function R(e,t){for(let n of e?.slots??[])for(let e of n.addons)if(e.id===t)return e;return null}function z(e){return e.split(`.`)[0]??e}function B(e,t,n){return{id:v(e,n.key),nodeId:e,deviceKey:n.key,device:n,label:`${z(t)} · ${u(n)}`,shortLabel:`${z(t)} · ${c(n)}`,nodeLabel:z(t),disabled:!n.enabled}}function V(e,t,n,r=!1){return n.filter(e=>r||e.enabled).map(n=>B(e,t,n))}function H(e,t,n){return{modelId:f({catalog:e,device:t.device,base:n.nodePin}),source:n.nodePin===void 0?`default`:`node`}}function U(e,t){let n=R(e,`object-detection`);if(n===null)return;let r=f({catalog:n,device:t.device,base:t.device.steps?.[`object-detection`]?.modelId});if(r===void 0)return;let i=n.models.find(e=>e.id===r);return{modelId:r,name:i?.name??r,supplies:i?.suppliesSteps??[]}}function W(e,t,n){return!o(e)||n===void 0?!1:s(e,t,n.supplies).effective}function G(e,t){return e!==null&&l(e.models,t.device.format)}function K(e){return G(e.addon,e.acc)?e.clusterModelId===void 0?{kind:`enabled`,modelId:e.model.modelId??`Auto`,...e.rootName===void 0?{}:{suppliedByRoot:e.rootName},...e.jumpTo===void 0?{}:{jumpTo:e.jumpTo}}:{kind:`enabled`,modelId:e.clusterModelId,clusterWide:!0}:e.gatedOn?e.jumpTo===void 0?{kind:`skip`}:{kind:`skip`,jumpTo:e.jumpTo}:{kind:`na`}}function q(e){if(e===null)return[];let t=(e.configSchema??[]).flatMap(e=>`label`in e&&typeof e.label==`string`?[e.label]:[]),n=i(e.id).map(e=>e.label);return[...new Set([...t,...n])]}function J(e){return e.flatMap(e=>[{node:e,depth:0},...J(e.children).map(e=>({node:e.node,depth:e.depth+1}))])}function Y(e){return p(e)}function X(e){return{nodeFields:Y(e),acceleratorFields:Z(e)}}function Z(e){return e.flatMap(e=>{if(e.type===`group`){let t=Z(e.fields);return t.length>0?[{...e,fields:[...t]}]:[]}return d(e)?[e]:[]})}function Q(e){return e.some(e=>e.type===`group`?Q(e.fields):d(e))}function $(e,t){return e.flatMap(e=>{let n=$(e.children,t);return t.has(e.addonId)||n.length>0?[{...e,children:n}]:[]})}export{F as _,J as a,_ as b,U as c,q as d,H as f,C as g,T as h,R as i,G as l,L as m,K as n,Q as o,W as p,$ as r,V as s,Y as t,X as u,I as v,S as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as e,et as t,o as n}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{c as r,is as i}from"./src-DKRp5NPI.js";import{t as a}from"./useTranslation-BJr-n0es.js";import{ot as o}from"./index-
|
|
1
|
+
import{R as e,et as t,o as n}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{c as r,is as i}from"./src-DKRp5NPI.js";import{t as a}from"./useTranslation-BJr-n0es.js";import{ot as o}from"./index-D7Qm6t2n.js";t();function s(){let{t}=a(),s=n(),{mutateAsync:c}=i();return r({remove:e(e=>c({deviceId:e.deviceId}),[c]),refresh:e(()=>s.invalidateQueries({queryKey:[[`deviceManager`]]}),[s]),onError:e((e,n)=>{o({severity:`critical`,title:t(`devices.removeFailed.title`,`Could not remove the device`),message:n,duration:8e3})},[t])})}export{s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,K as t,R as n,S as r,V as i,Y as a,et as o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Kt as c,Sa as l,gt as u}from"./player-overlays-BZByYYB8.js";import{Br as d,Hr as f,Ir as p,Lr as m,Rr as h,Vr as g,bt as _,ji as v}from"./src-DKRp5NPI.js";import{t as y}from"./useTranslation-BJr-n0es.js";import{Br as b,Kr as x}from"./index-
|
|
1
|
+
import{C as e,K as t,R as n,S as r,V as i,Y as a,et as o,x as s}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Kt as c,Sa as l,gt as u}from"./player-overlays-BZByYYB8.js";import{Br as d,Hr as f,Ir as p,Lr as m,Rr as h,Vr as g,bt as _,ji as v}from"./src-DKRp5NPI.js";import{t as y}from"./useTranslation-BJr-n0es.js";import{Br as b,Kr as x}from"./index-D7Qm6t2n.js";o();var S=3e3;function C(e){return{backup:!e.skipBackup,addons:!e.skipAddons}}function w(e,t,n){return e.ok?e.job===null?t?{kind:`restarting`,last:n}:{kind:`idle`}:{kind:`job`,job:e.job}:t?{kind:`restarting`,last:n}:{kind:`error`,message:e.message}}function T(e,t){return t.kind===`restarting`?e:t.kind===`job`?t.job.state===`running`:!1}function E(e,t){return t!==null||e.kind===`restarting`||e.kind===`job`&&e.job.state===`running`?`progress`:`preview`}function D(e){return e.kind===`restarting`?e.last:e.kind===`job`&&e.job.state===`running`?e.job:null}var O={pending:`idle`,running:`running`,ok:`online`,failed:`error`,skipped:`disabled`};function k(e){return O[e]}function A({steps:t,restarting:n,targetVersion:i,skippedOffline:a}){let{t:o}=y();return e(`div`,{className:`flex flex-col gap-2`,children:[i!==null&&i!==``&&r(`p`,{className:`text-xs text-foreground-muted`,children:o(`clusterUpdate.target`,{defaultValue:`Target {{version}}`,version:i})}),n&&r(`p`,{role:`status`,className:`text-xs text-warning`,children:o(`clusterUpdate.restarting`,`The hub is restarting. Progress resumes when it answers.`)}),r(`ul`,{"aria-label":o(`clusterUpdate.stepsLabel`,`Cluster update steps`),className:`flex flex-col gap-1`,children:t.map((e,t)=>r(M,{step:e},j(e,t)))}),a.length>0&&r(`p`,{className:`text-xs text-foreground-subtle`,children:o(`clusterUpdate.offline`,{defaultValue:`Offline, not updated: {{nodes}}`,nodes:a.join(`, `)})})]})}function j(e,t){return`${t}:${e.kind}:${e.nodeId??``}`}function M({step:t}){let{t:n}=y();return e(`li`,{"data-status":t.status,"data-kind":t.kind,...t.reason===void 0?{}:{"data-reason":t.reason},className:`flex flex-wrap items-baseline gap-x-2 gap-y-0.5 rounded border border-border bg-surface px-2 py-1 text-xs`,children:[r(_,{status:k(t.status),label:P(t.status,n)}),r(`span`,{className:`font-medium text-foreground`,children:N(t,n)}),r(`span`,{className:`text-foreground-muted`,children:t.detail}),t.reason!==void 0&&r(`span`,{className:`text-danger`,children:n(`clusterUpdate.reason.${t.reason}`)})]})}function N(e,t){let n=String(t(`clusterUpdate.step.${e.kind}`,{defaultValue:e.kind}));return e.nodeId===void 0?n:`${n} · ${e.nodeId}`}function P(e,t){return String(t(`clusterUpdate.status.${e}`,{defaultValue:e}))}var F={later:(e,t)=>{let n=setTimeout(t,e);return()=>clearTimeout(n)}};function I(){let{trpcClient:e}=u();return t(()=>({preview:t=>e.clusterUpdate.previewClusterUpdate.query(t),start:t=>e.clusterUpdate.startClusterUpdate.mutate(t),readJob:t=>e.clusterUpdate.getClusterUpdateJob.query(t===void 0?{}:{jobId:t})}),[e])}o();function L(e){let t=I();return r(R,{...e,client:t,clock:F})}function R({open:i,onOpenChange:o,client:c,clock:l}){let{t:u}=y(),[_,b]=a(!1),[x,S]=a(!1),[w,T]=a(null),[O,k]=a(!1),[j,M]=a(null),[N,P]=a({kind:`idle`}),[F,I]=a({kind:`idle`}),L=t(()=>C({skipBackup:_,skipAddons:x}),[_,x]),R=E(N,w),V=z(N),G=D(N);B(c,l,w,P),H(c,i,R,L,I);let K=n(async()=>{k(!0),M(null);try{let e=await c.start(L);if(!e.accepted||e.jobId===null){M(e.message);return}T(e.jobId)}catch(e){M(e instanceof Error?e.message:String(e))}finally{k(!1)}},[c,L]),q=n(()=>{(N.kind!==`job`||N.job.state!==`running`)&&T(null),o(!1)},[o,N]);return e(s,{children:[!i&&G!==null&&r(A,{steps:G.steps,restarting:N.kind===`restarting`,targetVersion:G.targetVersion,skippedOffline:G.skippedOffline}),r(p,{open:i,onOpenChange:o,children:e(h,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,"aria-label":u(`clusterUpdate.title`,`Update the cluster`),children:[r(g,{children:r(f,{children:u(`clusterUpdate.title`,`Update the cluster`)})}),r(m,{children:R===`progress`?r(U,{view:N,shown:V}):r(W,{planState:F,skipBackup:_,skipAddons:x,startMessage:j,onSkipBackup:b,onSkipAddons:S})}),r(d,{children:R===`preview`?e(s,{children:[r(v,{type:`button`,variant:`ghost`,onClick:q,children:u(`clusterUpdate.cancel`,`Cancel`)}),r(v,{type:`button`,disabled:O||F.kind!==`ready`||F.plan.blocker!==null,onClick:()=>void K(),children:u(`clusterUpdate.start`,`Start update`)})]}):r(v,{type:`button`,variant:`ghost`,onClick:q,children:u(`clusterUpdate.close`,`Close`)})})]})})]})}function z(e){return e.kind===`job`?e.job:e.kind===`restarting`?e.last:null}function B(e,t,n,r){i(()=>{let i=!1,a,o=n!==null,s=null,c=async()=>{let l=await V(e,n??void 0);if(i)return;let u=w(l,o||s?.state===`running`,s);u.kind===`job`&&(s=u.job),o=T(o||s?.state===`running`,u),r(u),!(!o||i)&&(a=t.later(S,()=>void c()))};return c(),()=>{i=!0,a?.()}},[e,t,n,r])}async function V(e,t){try{return{ok:!0,job:await e.readJob(t)}}catch(e){return{ok:!1,message:e instanceof Error?e.message:String(e)}}}function H(e,t,n,r,a){i(()=>{if(!t||n!==`preview`)return;let i=!1;return a({kind:`loading`}),e.preview(r).then(e=>{i||a({kind:`ready`,plan:e})},e=>{i||a({kind:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{i=!0}},[e,t,n,r,a])}function U({view:t,shown:n}){let{t:i}=y();return n===null?r(`p`,{role:`status`,className:`text-xs text-warning`,children:i(`clusterUpdate.restarting`,`The hub is restarting. Progress resumes when it answers.`)}):e(`div`,{className:`flex flex-col gap-2`,children:[n.state===`succeeded`&&r(`p`,{role:`status`,className:`text-xs text-success`,children:i(`clusterUpdate.succeeded`,`Cluster update finished.`)}),n.state===`failed`&&r(`p`,{role:`alert`,className:`text-xs text-danger`,children:i(`clusterUpdate.failed`,{defaultValue:`Stopped at {{where}}.`,where:n.stoppedAt??n.reason??``})}),r(A,{steps:n.steps,restarting:t.kind===`restarting`,targetVersion:n.targetVersion,skippedOffline:n.skippedOffline})]})}function W({planState:t,skipBackup:n,skipAddons:i,startMessage:a,onSkipBackup:o,onSkipAddons:s}){let{t:c}=y();return e(`div`,{className:`flex flex-col gap-3`,children:[r(`p`,{className:`text-xs text-foreground-muted`,children:c(`clusterUpdate.previewBody`,`Backup, then the hub, then each online agent, then the addons. This page keeps the progress while the hub restarts.`)}),t.kind===`loading`&&r(`p`,{role:`status`,className:`text-xs text-foreground-subtle`,children:c(`clusterUpdate.loadingPlan`,`Reading what this update would do…`)}),t.kind===`error`&&r(`p`,{role:`alert`,className:`text-xs text-danger`,children:c(`clusterUpdate.planFailed`,{defaultValue:`Could not read the plan: {{message}}`,message:t.message})}),t.kind===`ready`&&r(G,{plan:t.plan,skipBackup:n,skipAddons:i,onSkipBackup:o,onSkipAddons:s}),a!==null&&r(`p`,{role:`alert`,className:`text-xs text-danger`,children:a})]})}function G({plan:t,skipBackup:n,skipAddons:i,onSkipBackup:a,onSkipAddons:o}){let{t:s}=y();return e(`div`,{className:`flex flex-col gap-3`,children:[t.blocker!==null&&e(`p`,{role:`alert`,"data-blocker":t.blocker,className:`text-xs text-warning`,children:[s(`clusterUpdate.blocker.${t.blocker}`),t.blockerDetail!==null&&t.blockerDetail!==``?` ${t.blockerDetail}`:``]}),r(A,{steps:t.steps,restarting:!1,targetVersion:t.targetVersion,skippedOffline:t.skippedOffline}),e(`label`,{className:`flex items-center gap-2 text-xs text-foreground`,children:[r(l,{checked:n,onChange:e=>a(e.target.checked)}),s(`clusterUpdate.skipBackup`,`Skip the backup`)]}),e(`label`,{className:`flex items-center gap-2 text-xs text-foreground`,children:[r(l,{checked:i,onChange:e=>o(e.target.checked)}),s(`clusterUpdate.skipAddons`,`Skip addon updates`)]})]})}function K({staleNodeId:t,shownNodeName:n}){return t===null?null:e(`div`,{role:`status`,className:`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/5 px-3 py-2 text-[11px] text-foreground-subtle`,children:[r(c,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`}),r(`span`,{children:r(b,{i18nKey:`shared.staleNodeNotice.notice`,values:{id:t,name:n},components:{b:r(`span`,{className:`font-medium text-foreground`})}})})]})}var q=`node`;function J(e){return[...e].toSorted((e,t)=>e.isHub===t.isHub?e.isOnline===t.isOnline?e.name.localeCompare(t.name):e.isOnline?-1:1:e.isHub?-1:1)}function Y(e,t){let n=J(e),r=n[0]??null;if(r===null)return{node:null,outcome:`empty`,staleNodeId:null};if(t===null||t.length===0)return{node:r,outcome:`default`,staleNodeId:null};let i=n.find(e=>e.id===t);return i===void 0?{node:r,outcome:`stale`,staleNodeId:t}:{node:i,outcome:`requested`,staleNodeId:null}}o();function X(e){let[r,i]=x(),a=r.get(q);return{selection:t(()=>Y(e,a),[e,a]),selectNode:n(e=>{let t=new URLSearchParams(r);t.set(q,e),i(t,{replace:!0})},[r,i]),requestedNodeId:a}}export{K as n,L as r,X as t};
|
package/dist/index.html
CHANGED
|
@@ -150,20 +150,20 @@
|
|
|
150
150
|
})
|
|
151
151
|
})()
|
|
152
152
|
</script>
|
|
153
|
-
<script type="module" crossorigin src="./assets/mf-entry-bootstrap-0-
|
|
153
|
+
<script type="module" crossorigin src="./assets/mf-entry-bootstrap-0-ff862d80.js"></script>
|
|
154
154
|
<link rel="modulepreload" crossorigin href="./assets/chevron-down-CBb-F8DT.js">
|
|
155
155
|
<link rel="modulepreload" crossorigin href="./assets/__vite-browser-external-BCAtXlNQ.js">
|
|
156
156
|
<link rel="modulepreload" crossorigin href="./assets/client-mnldOm50.js">
|
|
157
157
|
<link rel="modulepreload" crossorigin href="./assets/player-overlays-BZByYYB8.js">
|
|
158
158
|
<link rel="modulepreload" crossorigin href="./assets/src-DKRp5NPI.js">
|
|
159
159
|
<link rel="modulepreload" crossorigin href="./assets/useTranslation-BJr-n0es.js">
|
|
160
|
-
<link rel="modulepreload" crossorigin href="./assets/i18n-
|
|
160
|
+
<link rel="modulepreload" crossorigin href="./assets/i18n-DmOCWVEq.js">
|
|
161
161
|
<link rel="modulepreload" crossorigin href="./assets/video-BV-3O_ZC.js">
|
|
162
162
|
<link rel="modulepreload" crossorigin href="./assets/mount-CLxwtH6P.js">
|
|
163
163
|
<link rel="modulepreload" crossorigin href="./assets/addon-icons-context-Bb2eBZv3.js">
|
|
164
|
-
<link rel="modulepreload" crossorigin href="./assets/sso-popup-
|
|
164
|
+
<link rel="modulepreload" crossorigin href="./assets/sso-popup-CBrgyqXr.js">
|
|
165
165
|
<link rel="stylesheet" crossorigin href="./assets/index-CcY1r6e1.css">
|
|
166
|
-
<link rel="modulepreload" crossorigin href="./assets/hostInit-Cc2xXBkZ.js"><link rel="modulepreload" crossorigin href="./assets/index-
|
|
166
|
+
<link rel="modulepreload" crossorigin href="./assets/hostInit-Cc2xXBkZ.js"><link rel="modulepreload" crossorigin href="./assets/index-D7Qm6t2n.js"><link rel="modulepreload" crossorigin href="./assets/remoteEntry-BFXSwA_z.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BezlQnHO.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-8kv6pj9W.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-DzoL8nR8.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom__loadShare__.js-BPba2g2p.js"><link rel="modulepreload" crossorigin href="./assets/_virtual_mf___mfe_internal__admin_ui_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-ZBKFTPET.js"></head>
|
|
167
167
|
<body>
|
|
168
168
|
<div id="root"></div>
|
|
169
169
|
<!-- Lock the app shell at 1x zoom. iOS Safari ignores `user-scalable=no`
|
package/dist/server/addon.js
CHANGED
|
@@ -95216,7 +95216,7 @@ var AdminUIAddon = class extends BaseAddon {
|
|
|
95216
95216
|
capability: adminUiCapability,
|
|
95217
95217
|
provider: {
|
|
95218
95218
|
getStaticDir: async () => ({ staticDir: resolveAdminUiDistDir() }),
|
|
95219
|
-
getVersion: async () => ({ version: "1.2.
|
|
95219
|
+
getVersion: async () => ({ version: "1.2.638" })
|
|
95220
95220
|
}
|
|
95221
95221
|
}];
|
|
95222
95222
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-admin-ui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.638",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Admin UI — Vite frontend build and server-side addon",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
}
|
|
51
51
|
],
|
|
52
52
|
"requires": {
|
|
53
|
-
"server": ">=1.2.
|
|
53
|
+
"server": ">=1.2.832"
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,K as t,R as n,S as r,Y as i,et as a}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Cn as o,D as s}from"./player-overlays-BZByYYB8.js";import{p as c}from"./video-BV-3O_ZC.js";import{Vn as l}from"./src-DKRp5NPI.js";import{t as u}from"./useTranslation-BJr-n0es.js";import{Br as d,F as f,P as p,Vr as m,Z as h,_ as g,g as _,lt as v}from"./index-D5GcZJtC.js";import{n as y}from"./NodeAddonsSettingsPanel-BtSyXQ4v.js";import{t as b}from"./InstancesTable-BagVOERb.js";a();function x(e,t){if(e.type===`group`){for(let n of e.fields)x(n,t);return}if(e.type===`sub-tabs`){for(let n of e.tabs)for(let e of n.fields)x(e,t);return}`value`in e&&(t[e.key]=e.value)}function S(e){let t={};for(let n of e.sections)for(let e of n.fields)x(e,t);return t}function C({sectionIds:e,omitSectionIds:n,hideSectionChrome:i,emptyMessage:a}){let o=_(),s=t(()=>{if(o.data===void 0)return null;let t=o.data.sections.filter(t=>(e===void 0||e.includes(t.id))&&!(n?.includes(t.id)??!1));return{...o.data,sections:y(t,{...i===!0?{hideSectionChrome:i}:{}})}},[o.data,e,n,i]);return o.isPending?null:s===null||o.isError?r(`p`,{className:`text-sm text-foreground-muted`,children:a}):s.sections.length===0?null:r(w,{schema:s})}function w({schema:a}){let{t:o}=u(),s=g(),[c,l]=i(null),d=t(()=>S(a),[a]),m=n(async e=>{l(null);try{await s.mutateAsync({patch:e})}catch(e){throw l(e instanceof Error&&e.message.length>0?e.message:o(`system.bootstrapForm.saveFailed`,`Could not save`)),e}},[s,o]),h=f({schema:a,serverValues:d,onImmediateSave:e=>void m(e).catch(()=>void 0),onDeferredSave:m});return e(`div`,{className:`flex flex-col gap-3`,children:[c!==null&&r(`div`,{role:`alert`,className:`rounded-md border border-danger/40 bg-danger/10 px-3 py-2 text-xs text-danger`,children:c}),r(v,{schema:a,values:h.values,onChange:h.handleChange,disabled:s.isPending}),r(p,{pendingCount:h.pendingKeys.length,onSave:()=>h.handleSave(h.pendingKeys),onDiscard:()=>h.handleDiscard(h.pendingKeys),saving:s.isPending})]})}function T(){let{t}=u();return e(`div`,{className:`space-y-3 sm:space-y-4`,children:[r(b,{functionCap:`login-method`,icon:c,title:t(`system.authentication.connectionsTitle`,`Sign-in connections`),subtitle:t(`system.authentication.connectionsSubtitle`,`Identity providers that sign users in. Each connection has its own id, which cannot be changed later.`),emptyTitle:t(`system.authentication.connectionsEmptyTitle`,`No sign-in connections`),emptyDescription:t(`system.authentication.connectionsEmptyDescription`,`Add a connection to let users sign in through an identity provider.`),addLabel:t(`system.authentication.addConnection`,`Add connection`),install:{capability:`login-method`,label:t(`system.authentication.sectionInstall`,`Add provider`)},typedId:()=>({pattern:h})}),r(D,{})]})}var E=`system-config-auth`;function D(){let{t}=u();return r(l,{headingId:`authentication-policy`,title:t(`system.authentication.policyTitle`,`Sign-in policy`),icon:o,children:e(`div`,{className:s,children:[r(`p`,{className:`text-xs text-foreground-subtle`,children:t(`system.authentication.localAlwaysOn`,`Username and password sign-in is always on and cannot be turned off. It is not a connection, so it has no row above.`)}),r(`p`,{className:`text-xs text-foreground-subtle`,children:r(d,{i18nKey:`system.authentication.totpNote`,components:{access:r(m,{to:`/system/my-access?tab=sign-in`,className:`underline text-primary`}),users:r(m,{to:`/system/identity?tab=users`,className:`underline text-primary`})}})}),r(C,{sectionIds:[E],hideSectionChrome:!0,emptyMessage:t(`system.authentication.policyUnavailable`,`Not available — the addon that owns these settings did not answer.`)})]})})}var O=`webauthn`;export{C as i,T as n,O as r,E as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,J as t,K as n,S as r,V as i,Y as a,a as o,et as s,o as c,x as l}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{Cn as u,D as d,Dn as f,Jn as p,Kt as m,Lt as h,Nr as g,Or as _,Pi as v,Sa as y,Sr as b,St as x,Tr as S,Yt as C,ct as w,da as ee,er as te,gt as T,kn as E,li as D,lt as ne,pn as O,ri as k,ut as re,wn as ie,xn as ae,zn as oe}from"./player-overlays-BZByYYB8.js";import{$o as A,Qo as se,l as ce}from"./client-mnldOm50.js";import{c as j,f as M,h as le,r as N}from"./video-BV-3O_ZC.js";import{t as ue}from"./file-up-2YD_M6f_.js";import{t as de}from"./key-CH4aXNMz.js";import{t as fe}from"./monitor-smartphone-DPI9EQus.js";import{t as pe}from"./unlink-D3-IGpS8.js";import{$ as me,Ac as he,Bd as ge,Br as P,Cc as _e,Ci as F,Dt as ve,Ec as ye,Fn as be,Gd as xe,Hd as Se,Hn as I,Hr as L,In as R,Ir as z,Jd as Ce,Kd as we,Ko as Te,Ld as Ee,Lr as B,Lt as V,Nf as H,Pr as De,Rd as Oe,Rr as U,Ti as W,Ud as ke,Un as Ae,Vd as je,Vn as Me,Vr as G,Wd as Ne,Wn as Pe,Xr as Fe,af as Ie,ar as Le,cr as Re,dr as ze,if as Be,jc as Ve,ji as K,kt as He,lr as Ue,nf as We,qd as Ge,rf as Ke,sr as qe,tf as Je,ur as Ye,vt as Xe,wi as Ze,xc as Qe,zd as $e}from"./src-DKRp5NPI.js";import{t as q}from"./i18n-ByFr51sS.js";import{t as J}from"./useTranslation-BJr-n0es.js";import{Hr as et,I as tt,Kr as nt,Wr as rt,a as it,c as at,i as ot,l as st,o as ct,s as lt,t as ut,u as dt,x as ft}from"./index-D5GcZJtC.js";import{t as pt}from"./AdminSectionedPage-Xr_hesYw.js";import{t as mt}from"./AdminPage-_ITsYONa.js";import{C as ht,D as Y,E as gt,O as X,S as _t,T as vt,_ as yt,a as bt,b as xt,c as St,d as Ct,f as wt,g as Tt,h as Et,i as Dt,k as Ot,l as kt,m as At,n as jt,o as Mt,p as Nt,s as Pt,t as Ft,u as It,v as Lt,w as Rt,x as zt,y as Bt}from"./SessionsList-WhsG7RxJ.js";import{n as Vt}from"./Authentication-CWHj8Czl.js";s();function Ht(){let{t:e}=J(),t=w(),i=H.useUtils(),o=Ot(),{data:s,isLoading:c}=ke(),l=n(()=>s??[],[s]),u=H.useQueries(e=>l.map(t=>e.userManagement.listExternalIdentities({userId:t.id}))),d=H.auth.listLoginMethods.useQuery(),[f,p]=a(null),m=Ge({onSuccess:()=>void i.userManagement.listExternalIdentities.invalidate(),onError:e=>p(`Remove failed: ${e.message}`)}),h=n(()=>new Map((d.data??[]).flatMap(e=>e.kind===`redirect`?[[e.id,e.label]]:[])),[d.data]),g=l.flatMap((e,t)=>u[t]?.data??[]),_=g.map(e=>({...zt(e,o),kind:h.get(e.provider)??e.provider})),v=async n=>{let r=g.find(e=>xt(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 r(Y,{notice:X(f),onDismissNotice:()=>{p(null)},id:`external-identities`,title:e(`access.externalIdentitiesSection.signInLinks`,`Sign-in links`),icon:le,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:r(Rt,{rows:_,label:`sign-in links`,isLoading:c||u.some(e=>e.isLoading),loadError:u.find(e=>e.isError)?.error?.message??null,emptyText:`No user has linked a sign-in account.`,expiresNone:`—`,action:{label:e(`common.remove`,`Remove`),icon:pe,isAvailable:()=>!0,onRun:e=>void v(e),busyId:null,disabled:m.isPending}})})}s();var Ut={key:`access.nouns.linkedApp`};function Wt(e){if(e.type===`category`){let t=e.target??``;return t===`device`?q.t(`access.linkedAppsSection.allDevices`):q.t(`access.linkedAppsSection.allTarget`,{target:t})}if(e.type===`device`)return`device:[${(e.targets??[]).join(`,`)}]`;let t=e;return`${t.type}:${t.target??``}`}function Gt(){let{t:e}=J(),t=w(),i=c(),o=Se(),[s,l]=a(null),u=()=>void i.invalidateQueries({queryKey:[[`userManagement`,`listOauthSessions`]]}),d=xe({onSuccess:u,onError:e=>l(`Revoke failed: ${e.message}`)}),f=vt(Ut,u),p=n(()=>(o.data??[]).map(e=>_t(e,e.scopes.map(Wt).join(`, `))),[o.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`})&&(l(null),d.mutate({id:n.id}))},h=d.isPending?d.variables?.id??null:null;return r(Y,{notice:X(s,f.outcome),onDismissNotice:()=>{l(null),f.dismiss()},id:`linked-apps`,title:e(`access.linkedAppsSection.linkedApps`,`Linked apps`),icon:_,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:r(Rt,{rows:p,label:e(`access.linkedAppsSection.linkedApps2`,`linked apps`),isLoading:o.isLoading,loadError:o.isError?o.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:C,isAvailable:e=>e.status===`active`||e.status===`revoked`,onRun:e=>void m(e),busyId:h,disabled:d.isPending||f.busy},bulk:{revoke:f,noun:Ut,isSelectable:e=>e.status===`active`||e.status===`revoked`,quickSelect:[{label:e(`access.linkedAppsSection.selectRevoked`,`Select revoked`),match:e=>e.status===`revoked`}]}})})}var Kt=5e3;function qt(){let{t}=J(),n=H.useUtils(),i=H.auth.cliLoginPending.useQuery(void 0,{refetchInterval:Kt}),a=H.auth.cliLoginDeny.useMutation({onSuccess:()=>void n.auth.cliLoginPending.invalidate()}),o=i.data??[];if(o.length===0)return null;let s=Date.now();return e(`div`,{className:`space-y-2 rounded-md border border-border bg-background-elevated p-3`,"data-testid":`pending-terminal-signins`,children:[e(`div`,{className:`flex items-center gap-2 text-xs font-medium text-foreground`,children:[r(N,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),t(`cliLogin.pendingTitle`,`Pending terminal sign-ins`)]}),r(`ul`,{className:`space-y-1`,children:o.map(n=>{let i=ut(n.createdAt,s);return e(`li`,{className:`flex items-center justify-between gap-3 text-xs`,children:[e(`span`,{className:`min-w-0 truncate text-foreground-muted`,children:[n.userAgent??t(`cliLogin.unknownValue`,`Unknown`),` · `,n.ip??t(`cliLogin.unknownValue`,`Unknown`),` · `,i.key===`justNow`?t(`cliLogin.ageNow`,`just now`):i.key===`seconds`?t(`cliLogin.ageSeconds`,`{{count}} s ago`,{count:i.value}):t(`cliLogin.ageMinutes`,`{{count}} min ago`,{count:i.value})]}),r(K,{type:`button`,size:`sm`,variant:`ghost`,disabled:a.isPending,onClick:()=>a.mutate({requestId:n.requestId}),children:t(`cliLogin.notMe`,`Not me`)})]},n.requestId)})}),r(`p`,{className:`text-[11px] text-foreground-subtle`,children:t(`cliLogin.pendingHint`,`To approve one, open the approval page and type the code the terminal shows.`)})]})}s();var Jt={key:`access.nouns.session`};function Yt(){let{t}=J(),i=w(),o=H.useUtils(),s=Ot(),c=H.auth.listSessions.useQuery(),[l,u]=a(null),d=()=>void o.auth.listSessions.invalidate(),f=H.auth.revokeSessions.useMutation({onSuccess:d,onError:e=>u(`Sign out failed: ${e.message}`)}),p=vt(Jt,d),m=n(()=>(c.data??[]).map(e=>ht(e,s,{client:e=>yt(e).label,method:Lt})),[c.data,s]),h=async e=>{await i({title:t(`access.loginSessionsSection.signOutThisSession`,`Sign out this session`),message:t(`access.loginSessionsSection.onWillHaveToSign`,`{{ownerName}} on {{name}} will have to sign in again.`,{ownerName:e.ownerName,name:e.name}),confirmLabel:t(`access.loginSessionsSection.signOut`,`Sign out`),variant:`danger`})&&(u(null),f.mutate({id:e.id}))};return e(Y,{notice:X(l,p.outcome),onDismissNotice:()=>{u(null),p.dismiss()},id:`login-sessions`,title:t(`access.loginSessionsSection.loginSessions`,`Login sessions`),icon:fe,description:t(`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:[r(qt,{}),r(Rt,{rows:m,label:t(`common.sessionsLabel`),isLoading:c.isLoading,loadError:c.isError?c.error?.message??`Request failed`:null,emptyText:`No active sessions.`,action:{label:t(`access.loginSessionsSection.signOut`,`Sign out`),icon:j,isAvailable:e=>e.status===`active`,onRun:e=>void h(e),busyId:f.isPending&&f.variables!==void 0&&`id`in f.variables?f.variables.id:null,disabled:f.isPending||p.busy},bulk:{revoke:p,noun:Jt,isSelectable:e=>e.status===`active`}})]})}var Xt={"by-id":`helpers.authAuditWording.bulkNoun.credential`,"share-link":`helpers.authAuditWording.bulkNoun.shareLink`,"admin-token":`helpers.authAuditWording.bulkNoun.adminToken`,"login-session":`helpers.authAuditWording.bulkNoun.loginSession`};function Z(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:null}function Zt(e,t){let n=Z(e,`tokenId`);return Z(e,`name`)??(n===null?void 0:t.get(n))??n??`?`}function Q(e){return e.filter(e=>e!==null)}function Qt(e){let t=Z(e,`prefix`);return t===null?null:q.t(`helpers.authAuditWording.prefix`,{prefix:t})}function $t(e,t){let n=e.detail??{};switch(e.action){case`admin-token-created`:{let e=n.expiresAt;return{title:q.t(`helpers.authAuditWording.tokenCreated`,{name:Zt(n,t)}),details:Q([Qt(n),typeof e==`number`?q.t(`helpers.authAuditWording.expires`,{at:Bt(e)}):null])}}case`admin-token-used`:{let e=Z(n,`path`);return{title:q.t(`helpers.authAuditWording.tokenUsed`,{name:Zt(n,t)}),details:Q([Qt(n),e===null?null:q.t(`helpers.authAuditWording.call`,{path:e})])}}case`token-minted`:{let e=n.expiresAt;return{title:q.t(`helpers.authAuditWording.tokenMinted`,{name:Zt(n,t)}),details:Q([typeof e==`number`?q.t(`helpers.authAuditWording.expires`,{at:Bt(e)}):null])}}case`token-revoked`:return{title:q.t(`helpers.authAuditWording.anyTokenRevoked`,{name:Zt(n,t)}),details:[]};case`admin-token-revoked`:return{title:q.t(`helpers.authAuditWording.tokenRevoked`,{name:Zt(n,t)}),details:Q([Qt(n)])};case`credentials-revoked`:{let e=Z(n,`kind`)??`credential`,t=n.revoked,r=n.skipped,i=Xt[e],a=i===void 0?`${e}s`:q.t(i);return{title:q.t(`helpers.authAuditWording.bulkRevoked`,{n:typeof t==`number`?String(t):`?`,noun:a}),details:Q([typeof r==`number`&&r>0?q.t(`helpers.authAuditWording.skipped`,{count:r}):null,Z(n,`ids`)===null?null:q.t(`helpers.authAuditWording.ids`,{ids:Z(n,`ids`)??``})])}}case`second-factor-skipped`:{let e=Z(n,`method`),t=Z(n,`factors`);return{title:q.t(`helpers.authAuditWording.secondFactorSkipped`),details:Q([e===null?null:q.t(`helpers.authAuditWording.signedInWith`,{method:Lt(e)}),t===null?null:q.t(`helpers.authAuditWording.skippedFactors`,{factors:t.split(`,`).join(`, `)})])}}default:return{title:e.action,details:Object.entries(n).map(([e,t])=>`${e}: ${String(t)}`)}}}s();var en=100;function tn(){let{user:e}=tt();return e?.isAdmin?r(rn,{}):null}function nn(){let{data:e}=ke(),{data:t}=H.auth.listTokens.useQuery(void 0);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.label);return{userNameById:n,tokenNameById:r}},[e,t])}function rn(){let{t}=J(),n=H.auth.listAuthAudit.useQuery({limit:en}),{userNameById:i,tokenNameById:a}=nn(),o=n.data??[];return e(`div`,{"data-testid":`auth-audit`,className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[e(`div`,{className:`px-4 py-2.5 border-b border-border flex items-center gap-2`,children:[r(E,{className:`h-3.5 w-3.5 text-foreground-subtle`}),r(`div`,{className:`text-xs font-semibold text-foreground`,children:t(`auth.authAuditSection.authenticationAudit`,`Authentication audit`)}),r(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:t(`auth.authAuditSection.latest`,{count:en})})]}),r(`div`,{className:`p-4`,children:n.isLoading?e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(S,{className:`h-3.5 w-3.5 animate-spin`}),t(`auth.authAuditSection.loadingAuditTrail`,`Loading audit trail…`)]}):n.isError?e(`div`,{className:`text-[11px] text-danger`,children:[t(`auth.authAuditSection.couldNotLoadTheAudit`,`Could not load the audit trail:`),` `,n.error?.message??t(`auth.authAuditSection.requestFailed`,`Request failed`)]}):o.length===0?e(`div`,{className:`rounded border border-dashed border-border px-3 py-4 text-xs text-foreground-subtle text-center space-y-1`,children:[r(`div`,{children:t(`auth.authAuditSection.noAuthenticationEventsRecordedYet`,`No authentication events recorded yet.`)}),r(`div`,{className:`text-[11px] text-foreground-subtle/90`,children:t(`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.`)})]}):r(`ul`,{className:`divide-y divide-border rounded-md border border-border max-h-[420px] overflow-y-auto`,children:o.map(e=>r(an,{record:e,userName:e.userId===void 0?null:i.get(e.userId)??e.userId,tokenNameById:a},e.id))})})]})}function an({record:t,userName:n,tokenNameById:i}){let a=$t(t,i);return e(`li`,{"data-testid":`auth-audit-row`,className:`px-3 py-2 text-xs space-y-0.5`,children:[e(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[r(`span`,{className:`font-medium text-foreground`,children:a.title}),r(`span`,{className:`ml-auto text-[10px] text-foreground-subtle`,children:Bt(t.at)})]}),e(`div`,{className:`flex flex-wrap gap-x-3 text-[11px] text-foreground-subtle`,children:[n!==null&&r(`span`,{className:`text-foreground`,children:n}),t.ip!==void 0&&r(`span`,{className:`font-mono`,children:t.ip}),a.details.map(e=>r(`span`,{className:`font-mono`,children:e},e))]})]})}s();function on(e){let{ids:t,answered:r,legacyGroupParam:i=null,groupFirst:a}=e,[o]=nt(),s=o.get(ct),c=i===null?null:o.get(i),l=o.get(lt),u=n(()=>st({ids:t,requested:s,answered:r,legacyGroup:c,...a===void 0?{}:{groupFirst:a}}),[t,s,r,c,a]),d=n(()=>(e,t)=>`?${dt(o,e,i,t??null).toString()}`,[o,i]);return{...u,requestedSection:l,hrefFor:d}}s();var $={loginSessions:`login-sessions`,linkedApps:`linked-apps`,tokens:`tokens`,scopedTokens:`scoped-tokens`,adminTokens:`admin-tokens`,shareLinks:`share-links`,externalIdentities:`external-identities`,audit:`auth-audit`},sn={[$.scopedTokens]:$.tokens,[$.adminTokens]:$.tokens,[$.shareLinks]:$.tokens};function cn(){return[{id:$.loginSessions,label:q.t(`system.access.loginSessions`,`Login sessions`),icon:fe,render:()=>r(Yt,{})},{id:$.linkedApps,label:q.t(`system.access.linkedApps`,`Linked apps`),icon:_,render:()=>r(Gt,{})},{id:$.tokens,label:q.t(`system.access.tokens`,`Tokens`),icon:M,render:({createRequested:e,onCreateConsumed:t})=>r(Et,{headerOwnsCreate:!0,createRequested:e,onCreateConsumed:t})},{id:$.externalIdentities,label:q.t(`system.access.signInLinks`,`Sign-in links`),icon:le,render:()=>r(Ht,{})},{id:$.audit,label:q.t(`system.access.audit`,`Audit`),icon:E,render:()=>r(tn,{})}]}function ln({createRequested:t=!1,onCreateConsumed:i}){let{t:a}=J(),o=n(()=>cn(),[]),s=on({ids:n(()=>o.map(e=>e.id),[o]),answered:!0}),c=rt(),[l]=nt(),u=l.get(`integration`),d=u===null?void 0:sn[u];if(d!==void 0){let e=new URLSearchParams(l);return e.set(`integration`,d),r(et,{to:`?${e.toString()}`,replace:!0})}let f=o.find(e=>e.id===s.selectedId)??o[0];return e(`div`,{className:`flex flex-col gap-3`,"data-testid":`access-page`,children:[r(Le,{appearance:`pills`,value:f?.id??$.loginSessions,onValueChange:e=>{c(`?${dt(l,e,null,null).toString()}`)},children:r(qe,{"aria-label":a(`system.access.credentialKinds`,`Credential kinds`),children:o.map(t=>e(Re,{value:t.id,"data-testid":`access-kind-${t.id}`,children:[r(t.icon,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0}),t.label]},t.id))})}),f===void 0?null:r(`div`,{role:`region`,"aria-label":f.label,"data-testid":`access-kind-body`,children:f.render({createRequested:t&&f.id===$.tokens,onCreateConsumed:i??(()=>void 0)})},f.id)]})}function un(t,n){if(t===$.tokens)return e(K,{size:`sm`,type:`button`,"data-testid":`access-new-token`,onClick:n,children:[r(M,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),q.t(`system.access.newToken`,`New token`)]})}function dn(){let[e,t]=a(!1);return{createRequested:e,requestCreate:()=>t(!0),clearCreate:()=>t(!1)}}function fn({isPending:t,error:n,what:i,onRetry:a,children:o}){let{t:s}=J();return t?e(`div`,{className:`flex items-center gap-2 py-3 text-xs text-foreground-subtle`,role:`status`,"data-testid":`query-pending`,children:[r(S,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),s(`certificates.queryBody.reading`,{what:i})]}):n===null?o:r(F,{title:s(`certificates.queryBody.couldNotRead`,`Could not read {{what}}`,{what:i}),message:n.message.length>0?n.message:s(`certificates.queryBody.requestFailed`,`Request failed`),onRetry:a})}function pn(){let{t}=J(),n=H.deviceCredentials.getDeviceCaStatus.useQuery({}),i=n.data;return r(Y,{id:`device-ca`,title:t(`certificates.deviceCaCard.deviceCertificateAuthority`,`Device certificate authority`),icon:u,description:t(`certificates.deviceCaCard.signsTheCertificateEachPaired`,`Signs the certificate each paired device holds. It is created the first time a device is paired.`),children:r(fn,{isPending:n.isPending,error:n.error,what:`the device CA`,onRetry:()=>void n.refetch(),children:i!==void 0&&e(`div`,{className:`space-y-1`,"data-testid":`device-ca-status`,children:[e(I,{label:t(`certificates.deviceCaCard.state`,`State`),children:[i.state===`ready`&&r(W,{variant:`success`,children:t(`certificates.deviceCaCard.ready`,`Ready`)}),i.state===`absent`&&r(W,{variant:`default`,children:t(`certificates.deviceCaCard.notCreatedYet`,`Not created yet`)}),i.state===`unavailable`&&r(W,{variant:`danger`,children:t(`certificates.deviceCaCard.unavailable`,`Unavailable`)})]}),i.state===`ready`&&e(l,{children:[r(I,{label:t(`certificates.deviceCaCard.subject`,`Subject`),valueClassName:`font-mono`,children:i.subject}),r(I,{label:t(`certificates.deviceCaCard.fingerprintSha256`,`Fingerprint (SHA-256)`),valueClassName:`font-mono`,children:i.fingerprintSha256}),r(I,{label:t(`certificates.deviceCaCard.validUntil`,`Valid until`),children:i.validTo})]}),i.state===`unavailable`&&r(I,{label:t(`certificates.deviceCaCard.reason`,`Reason`),children:r(`span`,{className:`text-danger`,children:i.reason})})]})})})}s();function mn(){let{t}=J(),n=H.useUtils(),i=H.deviceCredentials.getDeviceCertificateSettings.useQuery({}),[o,s]=a(null),c=H.deviceCredentials.setDeviceCertificateSettings.useMutation({onSuccess:()=>{s(null),n.deviceCredentials.getDeviceCertificateSettings.invalidate()},onError:e=>s(`Could not save: ${e.message}`)});return r(fn,{isPending:i.isPending,error:i.error,what:`the enrollment setting`,onRetry:()=>void i.refetch(),children:i.data!==void 0&&e(I,{label:t(`certificates.deviceSettingsRow.usersCanEnrollTheirOwn`,`Users can enroll their own devices`),actions:r(Ue,{checked:i.data.selfEnrollment===`allowed`,disabled:c.isPending,"aria-label":t(`certificates.deviceSettingsRow.usersCanEnrollTheirOwn`,`Users can enroll their own devices`),onCheckedChange:e=>c.mutate({selfEnrollment:e?`allowed`:`disabled`})}),children:[r(`span`,{className:`text-[11px] text-foreground-subtle`,children:i.data.selfEnrollment===`allowed`?t(`certificates.deviceSettingsRow.allowedAUserSignedIn`,`Allowed - a user signed in on a phone can keep it signed in. Pairing by QR works either way.`):t(`certificates.deviceSettingsRow.disabledOnlyAnAdminCan`,`Disabled - only an admin can pair a device, with a QR code.`)}),o!==null&&r(`span`,{className:`block text-[11px] text-danger`,children:o})]})})}s();function hn(e){let[t,n]=a(()=>Date.now());return i(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}s();var gn=80,_n=208;function vn({open:t,users:n,onClose:i,onPaired:o}){let{t:s}=J(),c=H.deviceCredentials.startEnrollment.useMutation({onSuccess:o}),[l,u]=a(``),[d,f]=a(``),p=l===``?n[0]?.id??``:l,m=c.data,h=()=>{c.reset(),f(``),i()};return r(He,{open:t,onClose:h,title:s(`certificates.pairDeviceDialog.pairADevice`,`Pair a device`),icon:O,width:`md`,testId:`pair-device-dialog`,error:c.isError?c.error.message:null,footer:m===void 0?e(K,{type:`button`,onClick:()=>{let e=d.trim();p===``||e===``||c.mutate({userId:p,deviceName:e})},disabled:c.isPending||p===``||d.trim()===``,children:[c.isPending&&r(S,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),s(`certificates.pairDeviceDialog.createPairingCode`,`Create pairing code`)]}):r(K,{type:`button`,variant:`outline`,onClick:h,children:s(`certificates.pairDeviceDialog.done`,`Done`)}),children:m===void 0?e(`div`,{className:`space-y-3`,children:[r(`p`,{className:`text-[11px] text-foreground-subtle`,children:s(`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.`)}),r(V,{label:s(`certificates.pairDeviceDialog.user`,`User`),required:!0,children:r(re,{value:p,onChange:e=>u(e.target.value),options:n.map(e=>({value:e.id,label:e.username}))})}),r(V,{label:s(`certificates.pairDeviceDialog.deviceName`,`Device name`),required:!0,description:s(`certificates.pairDeviceDialog.howThisPhoneIsListed`,`How this phone is listed, e.g. Anna's iPhone.`),children:r(Ie,{value:d,maxLength:gn,onChange:e=>f(e.target.value),placeholder:s(`certificates.pairDeviceDialog.annaSIphone`,`Anna's iPhone`),autoFocus:!0})})]}):r(yn,{enrollUrl:m.enrollUrl,expiresAt:m.expiresAt,hubKnown:m.hubOrigin!==null,onRestart:()=>c.reset()})})}function yn({enrollUrl:t,expiresAt:n,hubKnown:i,onRestart:a}){let{t:o}=J(),s=Mt(n,hn(1e3));return r(`div`,{className:`space-y-3`,"data-testid":`pair-issued`,children:e(`div`,{className:`flex flex-col items-center gap-3 sm:flex-row sm:items-start`,children:[r(`div`,{className:s.expired?`opacity-30`:void 0,children:r(De,{value:t,size:_n,alt:o(`certificates.pairDeviceDialog.enrollmentQrCode`,`Enrollment QR code`)})}),e(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[r(`p`,{className:`text-[11px] text-foreground-subtle`,children:o(`certificates.pairDeviceDialog.openTheCamstackAppOn`,`Open the CamStack app on the phone and scan this code. It works once.`)}),r(`div`,{className:`text-sm font-semibold tabular-nums text-foreground`,role:`timer`,"data-testid":`pair-countdown`,children:s.expired?o(`certificates.pairDeviceDialog.expiredCreateANewCode`,`Expired - create a new code`):o(`certificates.pairDeviceDialog.expiresIn`,`Expires in {{label}}`,{label:s.label})}),e(`div`,{className:`flex items-center gap-1 rounded-md border border-border bg-background px-2 py-1`,children:[r(`code`,{className:`min-w-0 flex-1 select-all break-all font-mono text-[11px] text-foreground`,children:t}),r(be,{value:t,srLabel:`Enrollment link`})]}),!i&&e(`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:[r(m,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`,"aria-hidden":!0}),r(`span`,{children:o(`certificates.pairDeviceDialog.theHubCouldNotName`,`The hub could not name an address for this link, so the app must already know it.`)})]}),s.expired&&r(K,{type:`button`,variant:`outline`,size:`sm`,onClick:a,children:o(`certificates.pairDeviceDialog.newCode`,`New code`)})]})]})})}s();var bn={key:`access.nouns.device`};function xn({pairOpen:t,onPairClose:i}){let{t:o}=J(),s=w(),c=ne(),l=H.useUtils(),u=H.deviceCredentials.listDeviceCredentials.useQuery({includeRevoked:!0}),d=ke(),[f,p]=a(null),[m,h]=a(null),g=()=>void l.deviceCredentials.listDeviceCredentials.invalidate(),_=e=>t=>{h(null),p(`${e} failed: ${t.message}`)},v=()=>{h(null),g()},y=H.deviceCredentials.revokeDeviceCredential.useMutation({onSuccess:v,onError:_(`Revoke`)}),b=H.deviceCredentials.deleteDeviceCredential.useMutation({onSuccess:e=>{e.result!==`deleted`&&p(e.result===`live`?`Only a revoked device can be deleted: revoke it first.`:`That device no longer exists.`),v()},onError:_(`Delete`)}),x=H.deviceCredentials.renameDeviceCredential.useMutation({onSuccess:v,onError:_(`Rename`)}),S=gt(bn,e=>y.mutateAsync({id:e}),g),T=S.busy||m!==null,E=n(()=>(u.data??[]).map(jt),[u.data]),D=async e=>{await s({title:o(`certificates.devicesCard.revoke`,`Revoke "{{name}}"?`,{name:e.name}),message:o(`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:o(`certificates.devicesCard.revoke2`,`Revoke`),variant:`danger`})&&(p(null),h(e.id),y.mutate({id:e.id}))},k=async e=>{await s({title:o(`certificates.devicesCard.delete`,`Delete "{{name}}"?`,{name:e.name}),message:o(`certificates.devicesCard.isRemovedFromTheList`,`{{name}} is removed from the list. The audit trail keeps the revocation.`,{name:e.name}),confirmLabel:o(`common.delete`,`Delete`),variant:`danger`})&&(p(null),h(e.id),b.mutate({id:e.id}))},re=async e=>{let t=(await c({title:o(`certificates.devicesCard.renameDevice`,`Rename device`),label:o(`certificates.devicesCard.deviceName`,`Device name`),defaultValue:e.name,confirmLabel:o(`certificates.devicesCard.rename`,`Rename`)}))?.trim()??``;t===``||t===e.name||(p(null),h(e.id),x.mutate({id:e.id,deviceName:t}))},ie={label:o(`certificates.devicesCard.revoke2`,`Revoke`),icon:ee,isAvailable:bt,onRun:e=>void D(e),busyId:y.isPending?m:null,disabled:T},ae=[{label:o(`certificates.devicesCard.rename`,`Rename`),icon:te,tone:`neutral`,isAvailable:()=>!0,onRun:e=>void re(e),busyId:x.isPending?m:null,disabled:T},{label:o(`common.delete`,`Delete`),icon:C,isAvailable:Dt,onRun:e=>void k(e),busyId:b.isPending?m:null,disabled:T}];return e(Y,{id:`devices`,title:o(`certificates.devicesCard.devices`,`Devices`),icon:O,description:o(`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:X(f,S.outcome),onDismissNotice:()=>{p(null),S.dismiss()},children:[r(mn,{}),r(Rt,{rows:E,label:o(`certificates.devicesCard.label`),isLoading:u.isPending,loadError:u.error===null?null:u.error.message||`Request failed`,emptyText:`No devices paired yet.`,expiresNone:`—`,action:ie,extraActions:ae,bulk:{revoke:S,noun:bn,isSelectable:bt}}),r(vn,{open:t,users:d.data??[],onClose:i,onPaired:g})]})}var Sn=/-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----/,Cn=/-----BEGIN ((?:RSA |EC |ENCRYPTED )?PRIVATE KEY)-----[\s\S]+?-----END \1-----/,wn={certificate:`.pem,.crt,.cer`,privateKey:`.pem,.key`,ca:`.pem,.crt,.cer`};function Tn(e,t){if(t.trim()===``)return null;if(e===`privateKey`){let e=Cn.exec(t);return e===null?Sn.test(t)?q.t(`helpers.pemFile.isCert`):q.t(`helpers.pemFile.notKey`):e[1]===`ENCRYPTED PRIVATE KEY`?q.t(`helpers.pemFile.encrypted`):null}return Sn.test(t)?e===`certificate`&&Cn.test(t)?q.t(`helpers.pemFile.certHasKey`):null:Cn.test(t)?q.t(`helpers.pemFile.isKey`):q.t(`helpers.pemFile.notCert`)}function En(e){return e.text()}s();function Dn({kind:n,label:i,value:o,onChange:s,rows:c=6}){let{t:l}=J(),u=t(null),[d,f]=a(null),[p,m]=a(null),h=p??Tn(n,o),g=`pem-${n}`,_=async e=>{let t=e.target.files?.[0];if(e.target.value=``,t!==void 0){f(t.name);try{let e=await En(t);m(null),s(e)}catch(e){m(`Could not read ${t.name}: ${e instanceof Error?e.message:String(e)}`)}}};return e(`div`,{className:`space-y-1`,children:[e(`div`,{className:`flex items-center justify-between gap-2`,children:[r(`label`,{htmlFor:g,className:`text-[11px] text-foreground-subtle`,children:i}),e(`div`,{className:`flex min-w-0 items-center gap-2`,children:[d!==null&&r(`span`,{className:`truncate font-mono text-[10px] text-foreground-subtle`,"data-testid":`${g}-file-name`,children:d}),r(Ye,{ref:u,accept:wn[n],onChange:e=>void _(e),className:`hidden`,"data-testid":`${g}-file`}),e(K,{size:`sm`,variant:`outline`,type:`button`,onClick:()=>u.current?.click(),children:[r(ue,{className:`mr-1 h-3 w-3`}),l(`system.pemField.chooseFile`,`Choose file`)]})]})]}),r(ze,{id:g,value:o,onChange:e=>{f(null),m(null),s(e.target.value)},rows:c,"aria-invalid":h!==null,className:`w-full rounded border border-border bg-surface px-2 py-1 font-mono text-[11px]`}),h!==null&&r(`p`,{className:`text-[11px] text-danger`,role:`alert`,children:h})]})}s();var On=30;function kn(e){let t=Date.parse(e);return!Number.isNaN(t)&&Date.now()-t<On*864e5}function An(e){if(e===null||e===``)return`—`;let t=e.replace(/:/g,``);return t.length<=16?e:`${t.slice(0,8)}…${t.slice(-8)}`}function jn(){let{t}=J(),n=c(),i=Qe(void 0,{refetchInterval:15e3}),o=_e({onSuccess:()=>void n.invalidateQueries({queryKey:[[`localNetwork`]]})}),s=ye({onSuccess:()=>void n.invalidateQueries({queryKey:[[`localNetwork`]]})}),l=Ve({onSuccess:()=>void n.invalidateQueries({queryKey:[[`localNetwork`]]})}),u=he({onSuccess:()=>{m(!1),g(``),v(``),b(``),n.invalidateQueries({queryKey:[[`localNetwork`]]})}}),f=i.data,[p,m]=a(!1),[h,g]=a(``),[_,v]=a(``),[y,b]=a(``),x=()=>{if(!f?.caCertPem)return;let e=new Blob([f.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=f?.mode===`uploaded`?`Uploaded`:f?.mode===`generated`?`Generated local CA`:`TLS disabled`;return r(Me,{headingId:`local-access-certificate`,title:t(`system.localAccess.certificate`,`Certificate`),icon:ae,children:e(`div`,{className:`${d} space-y-3`,children:[i.isError&&r(`p`,{className:`text-xs text-danger`,children:t(`system.localAccess.couldNotReadTlsStatus`,`Could not read TLS status.`)}),f?.reissueError&&r(F,{variant:`warning`,title:t(`system.localAccess.certificateReissue`,`Certificate reissue`),message:f.reissueError}),f?.restartRequired&&r(F,{variant:`warning`,title:t(`system.localAccess.restartRequired`,`Restart required`),message:t(`system.localAccess.theHttpsListenerStillServes`,`The HTTPS listener still serves the previous certificate. Restart the hub to apply it.`)}),f?.caMissing===!0&&r(F,{variant:`warning`,title:t(`system.localAccess.caMissingTitle`,`CA missing - devices cannot trust this hub`),message:t(`system.localAccess.caMissingBody`,"The uploaded certificate was not issued by a public CA and no CA was stored with it, so Download CA has nothing to hand out. Upload the certificate again together with its CA (for mkcert, the rootCA.pem in the folder `mkcert -CAROOT` prints).")}),f?.caReplacedAt!=null&&kn(f.caReplacedAt)&&r(F,{variant:`warning`,title:t(`system.localAccess.caReplacedTitle`,`The local CA was replaced - re-install it on your devices`),message:t(`system.localAccess.caReplacedBody`,`The previous local CA had no name constraints: if its key ever leaked it could vouch for any website. The hub now uses a CA limited to private addresses and local names. Download it again and trust it on every phone and computer that used the old one (replaced {{when}}).`,{when:new Date(f.caReplacedAt).toLocaleString()})}),e(`dl`,{className:`grid grid-cols-1 gap-2 text-xs sm:grid-cols-2`,children:[e(`div`,{children:[r(`dt`,{className:`text-foreground-subtle`,children:t(`system.localAccess.mode`,`Mode`)}),r(`dd`,{className:`font-medium`,children:S})]}),e(`div`,{children:[r(`dt`,{className:`text-foreground-subtle`,children:t(`system.localAccess.validTo`,`Valid to`)}),r(`dd`,{className:`font-mono`,children:f?.validTo?new Date(f.validTo).toLocaleString():`—`})]}),e(`div`,{children:[r(`dt`,{className:`text-foreground-subtle`,children:t(`system.localAccess.leafSha256`,`Leaf SHA-256`)}),r(`dd`,{className:`font-mono`,title:f?.leafFingerprintSha256??void 0,children:An(f?.leafFingerprintSha256??null)})]}),f?.storedUpload!=null&&e(`div`,{children:[r(`dt`,{className:`text-foreground-subtle`,children:t(`system.localAccess.storedUpload`,`Stored upload`)}),r(`dd`,{className:`font-medium`,children:t(`system.localAccess.storedUploadValue`,`valid to {{validTo}}, {{ca}}`,{validTo:new Date(f.storedUpload.validTo).toLocaleDateString(),ca:f.storedUpload.hasCa?t(`system.localAccess.storedUploadWithCa`,`with its CA`):t(`system.localAccess.storedUploadNoCa`,`no CA`)})})]}),e(`div`,{children:[r(`dt`,{className:`text-foreground-subtle`,children:t(`system.localAccess.caSha256`,`CA SHA-256`)}),r(`dd`,{className:`font-mono`,title:f?.caFingerprintSha256??void 0,children:f?.mode===`uploaded`&&f.caFingerprintSha256===null?r(`span`,{className:`font-sans text-foreground-subtle`,children:t(`system.localAccess.issuerNotIncludedInThe`,`Issuer not included in the upload (not the local CA)`)}):An(f?.caFingerprintSha256??null)})]})]}),f&&f.sans.length>0&&r(`div`,{className:`flex flex-wrap gap-1`,children:f.sans.map(e=>r(`span`,{className:`rounded border border-border bg-surface px-1.5 py-0.5 font-mono text-[10px] text-foreground-subtle`,children:e},e))}),e(`div`,{className:`flex flex-wrap gap-2`,children:[r(R,{label:t(`system.localAccess.regenerate`,`Regenerate`),title:t(`system.localAccess.issueANewLeaf`,`Issue a new leaf?`),description:t(`system.localAccess.issuesANewLeafUnder`,`Issues a new leaf under the current local CA. Clients that trust the CA keep working. The HTTPS listener reloads.`),confirmLabel:t(`system.localAccess.regenerate`,`Regenerate`),disabled:f?.mode===`uploaded`||o.isPending,action:()=>o.mutateAsync({})}),r(K,{size:`sm`,variant:`outline`,onClick:()=>m(e=>!e),children:t(`system.localAccess.upload`,`Upload`)}),f?.caCertPem&&r(K,{size:`sm`,variant:`outline`,onClick:x,children:t(`system.localAccess.downloadCa`,`Download CA`)}),f?.mode===`uploaded`&&r(R,{label:t(`system.localAccess.revertToGenerated`,`Revert to generated`),title:t(`system.localAccess.revertTitle`,`Switch back to the generated certificate?`),description:t(`system.localAccess.keepsTheUploadedPair`,`Returns to the generated local CA. The uploaded certificate and its CA stay stored here; you can select them again.`),confirmLabel:t(`system.localAccess.revert`,`Revert`),disabled:s.isPending,action:()=>s.mutateAsync({})}),f?.mode===`generated`&&f.storedUpload!=null&&r(R,{label:t(`system.localAccess.useUploaded`,`Use uploaded certificate`),title:t(`system.localAccess.useUploadedTitle`,`Serve the stored upload again?`),description:t(`system.localAccess.useUploadedDescription`,`The stored uploaded certificate replaces the generated one on the HTTPS listener. The generated certificate stays stored.`),confirmLabel:t(`system.localAccess.useUploaded`,`Use uploaded certificate`),disabled:l.isPending,action:()=>l.mutateAsync(void 0)})]}),p&&e(`div`,{className:`space-y-2 border-t border-border pt-3`,children:[r(Dn,{kind:`certificate`,label:t(`system.localAccess.certificateOrFullChainPem`,`Certificate or full chain (PEM)`),value:h,onChange:g}),r(Dn,{kind:`privateKey`,label:t(`system.localAccess.privateKeyPem`,`Private key (PEM)`),value:_,onChange:v}),r(Dn,{kind:`ca`,label:t(`system.localAccess.caPemRequired`,`CA (PEM) - required unless the certificate comes from a public CA`),value:y,onChange:b,rows:4}),r(K,{size:`sm`,disabled:!h.trim()||!_.trim()||Tn(`certificate`,h)!==null||Tn(`privateKey`,_)!==null||Tn(`ca`,y)!==null||u.isPending,onClick:()=>u.mutate({certPem:h,keyPem:_,...y.trim()?{caPem:y}:{}}),children:t(`system.localAccess.saveCertificate`,`Save certificate`)}),u.isError&&r(`p`,{className:`text-xs text-danger`,children:u.error instanceof Error?u.error.message:t(`system.localAccess.uploadFailed`,`Upload failed`)})]})]})})}var Mn={ok:`text-foreground-subtle`,soon:`text-warning`,expired:`text-danger`,unknown:`text-foreground-subtle`};function Nn(e){let t=e.find(e=>e.isHub);return t?.https.kind===`served`?t.https.status.caFingerprintSha256:null}function Pn({https:t,mesh:n,now:i}){let{t:a}=J(),o=Qe().data?.caCertPem??``,s=()=>{if(o===``)return;let e=URL.createObjectURL(new Blob([o],{type:`application/x-pem-file`})),t=document.createElement(`a`);t.href=e,t.download=`camstack-ca.crt`,t.click(),URL.revokeObjectURL(e)},c=n?.ca,l=c?.state===`ready`?Date.parse(c.validTo):null,u=n?.listener;return e(`div`,{className:`space-y-1`,"data-testid":`ca-strip`,children:[r(I,{label:a(`certificates.caStrip.localHttpsCaSha256`,`Local HTTPS CA (SHA-256)`),valueClassName:`font-mono`,children:e(`span`,{className:`flex flex-wrap items-center gap-2`,children:[Nn(t)??`—`,o!==``&&e(K,{type:`button`,variant:`ghost`,size:`sm`,onClick:s,children:[r(D,{className:`h-3 w-3`,"aria-hidden":!0}),a(`certificates.caStrip.downloadCa`,`Download CA`)]})]})}),r(I,{label:a(`certificates.caStrip.clusterCaSha256`,`Cluster CA (SHA-256)`),valueClassName:`font-mono`,children:c===void 0?`—`:c.state===`ready`?c.fingerprintSha256:r(`span`,{className:`text-danger`,children:a(`certificates.caStrip.unavailable`,{reason:c.reason})})}),c?.state===`ready`&&e(I,{label:a(`certificates.caStrip.clusterCaValidUntil`,`Cluster CA valid until`),children:[c.validTo,l!==null&&!Number.isNaN(l)&&e(`span`,{className:`ml-2 text-[10px] ${Mn[It(l,i)]}`,children:[`(`,St(l,i),`)`]})]}),u!==void 0&&e(I,{label:a(`certificates.caStrip.nodeListener`,`Node listener`),children:[u.state===`open`&&r(W,{variant:`success`,children:a(`certificates.caStrip.open`,`Open`)}),u.state===`not-started`&&r(W,{variant:`default`,children:a(`certificates.caStrip.notStarted`,`Not started`)}),u.state===`closed`&&e(`span`,{className:`text-danger`,children:[a(`certificates.caStrip.closedSince`,{when:Ct(u.since)}),` `,u.reason]})]}),n!==void 0&&!n.registryAvailable&&e(`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:[r(m,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-warning`,"aria-hidden":!0}),r(`span`,{children:a(`certificates.caStrip.theCertificateRegistryIsNot`,`The certificate registry is not up, so the node list below is incomplete.`)})]})]})}function Fn(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 In(e){return e.isHub?q.t(`helpers.nodesModel.hubReissued`):e.mesh===null?q.t(`helpers.nodesModel.noCertRecorded`):e.online?null:q.t(`helpers.certificateModel.nodeOffline`)}function Ln(e){return e.isHub||e.mesh===null?In(e):null}var Rn={ok:`text-foreground-subtle`,soon:`text-warning`,expired:`text-danger`,unknown:`text-foreground-subtle`},zn={enroll:`Issued at enrollment`,renewal:`Issued by a renewal`,boot:`Issued at boot`,pairing:`Issued at pairing`,observed:`Observed on its connection`},Bn={uploaded:`Uploaded`,generated:`Generated`,disabled:`Disabled`};function Vn(e){let t=e.https?.https;return t?.kind===`served`?Pt(t.status.validTo):null}function Hn({ms:t,now:n}){return t===null?r(`span`,{className:`text-foreground-subtle`,children:`—`}):e(`div`,{children:[r(`div`,{children:Ct(t)}),r(`div`,{className:`text-[10px] ${Rn[It(t,n)]}`,children:St(t,n)})]})}function Un({row:t}){let{t:n}=J(),i=t.https?.https;return i===void 0?r(`span`,{className:`text-foreground-subtle`,children:`—`}):i.kind===`served`?e(`div`,{title:i.status.leafFingerprintSha256??``,children:[r(W,{variant:`success`,className:`text-[10px]`,children:n(`certificates.nodesColumns.served`,`Served`)}),r(`span`,{className:`ml-1.5 text-[10px] text-foreground-subtle`,children:Bn[i.status.mode]}),r(`div`,{className:`mt-1 font-mono text-[10px] text-foreground-subtle`,children:Nt(i.status.leafFingerprintSha256)}),i.status.sans.length>0&&r(`div`,{className:`mt-0.5 max-w-[14rem] truncate font-mono text-[10px] text-foreground-subtle`,title:i.status.sans.join(`, `),children:i.status.sans.join(`, `)})]}):e(`div`,{className:`max-w-[16rem]`,children:[r(W,{variant:i.kind===`unreadable`?`danger`:`warning`,className:`text-[10px]`,children:i.kind===`unreadable`?n(`certificates.nodesColumns.unreadable`,`Unreadable`):n(`certificates.nodesColumns.notServed`,`Not served`)}),r(`div`,{className:`mt-1 whitespace-normal text-[10px] text-foreground-subtle`,children:i.reason})]})}function Wn({row:t}){let{t:n}=J(),i=t.mesh?.current??null;if(i===null)return r(`span`,{className:`text-foreground-subtle`,children:n(`certificates.nodesColumns.noneRecorded`,`None recorded`)});let a=t.mesh?.history.length??0;return e(`div`,{children:[r(`div`,{className:`font-mono text-[11px]`,title:i.serial,children:At(i.serial)}),r(`div`,{className:`font-mono text-[10px] text-foreground-subtle`,title:i.fingerprintSha256,children:Nt(i.fingerprintSha256)}),e(`div`,{className:`text-[10px] text-foreground-subtle`,children:[zn[i.issuedVia],a>0?` · ${n(`certificates.nodesColumns.earlier`,{count:a})}`:``]})]})}function Gn({row:e}){let{t}=J(),n=e.mesh?.presentingCurrent??null;return n===null?r(`span`,{className:`text-foreground-subtle`,children:e.online?`—`:t(`certificates.nodesColumns.offline`,`Offline`)}):n?r(W,{variant:`success`,className:`text-[10px]`,children:t(`common.yes`,`Yes`)}):r(W,{variant:`warning`,className:`text-[10px]`,children:t(`certificates.nodesColumns.noPresentsAnother`,`No - presents another`)})}function Kn(t){let n=t.icon;return e(K,{type:`button`,variant:`ghost`,size:`sm`,className:t.danger?`text-danger hover:bg-danger/10`:void 0,disabled:t.reason!==null||t.busy,title:t.reason??void 0,"aria-label":t.ariaLabel,onClick:t.onClick,children:[t.spinning?r(S,{className:`h-3 w-3 animate-spin`,"aria-hidden":!0}):r(n,{className:`h-3 w-3`,"aria-hidden":!0}),t.label]})}function qn({reasons:t}){let{t:n}=J();return e(We,{className:`inline-block`,children:[r(Be,{children:r(`span`,{className:`cursor-help text-[11px] text-foreground-subtle`,"data-testid":`hub-managed-note`,children:n(`certificates.nodesColumns.managedByTheHub`,`Managed by the hub`)})}),r(Ke,{children:r(`ul`,{className:`max-w-xs space-y-1 whitespace-normal text-left text-[11px]`,children:t.map(e=>r(`li`,{children:e},e))})})]})}function Jn({row:t,o:n}){let{t:i}=J(),a=t.https===null?`No HTTPS inventory for this node.`:wt(t.https).reason,o=In(t),s=Ln(t),c=e=>n.running?.nodeId===t.nodeId&&n.running.action===e,l=e=>!t.isHub||e===null,u=[a,o,s].filter((e,t,n)=>e!==null&&n.indexOf(e)===t);return e(`div`,{className:`flex w-44 flex-col items-end gap-1`,children:[e(`div`,{className:`flex flex-col items-end gap-0.5`,children:[l(a)&&r(Kn,{label:i(`certificates.nodesColumns.renewHttps`,`Renew HTTPS`),ariaLabel:i(`certificates.nodesColumns.renewTheCertificateOn`,`Renew the certificate on {{nodeId}}`,{nodeId:t.nodeId}),icon:oe,reason:a,busy:n.busy,spinning:c(`renew-https`),danger:!1,onClick:()=>n.onRenewHttps(t)}),l(o)&&r(Kn,{label:c(`renew-identity`)?i(`certificates.nodesColumns.renewing`,`Renewing…`):i(`certificates.nodesColumns.renewIdentity`,`Renew identity`),ariaLabel:i(`certificates.nodesColumns.renewTheClusterCertificateOf`,`Renew the cluster certificate of {{nodeId}}`,{nodeId:t.nodeId}),icon:oe,reason:o,busy:n.busy,spinning:c(`renew-identity`),danger:!1,onClick:()=>n.onRenewIdentity(t)}),l(s)&&r(Kn,{label:i(`certificates.nodesColumns.revokeIdentity`,`Revoke identity`),ariaLabel:i(`certificates.nodesColumns.revokeTheClusterCertificateOf`,`Revoke the cluster certificate of {{nodeId}}`,{nodeId:t.nodeId}),icon:ee,reason:s,busy:n.busy,spinning:c(`revoke-identity`),danger:!0,onClick:()=>n.onRevokeIdentity(t)})]}),t.isHub&&u.length>0&&r(qn,{reasons:u}),!t.isHub&&a!==null&&t.https!==null&&r(`div`,{className:`w-full whitespace-normal text-right text-[10px] text-foreground-subtle`,"data-testid":`renew-reason-${t.nodeId}`,children:a}),!t.isHub&&o!==null&&r(`div`,{className:`w-full whitespace-normal text-right text-[10px] text-foreground-subtle`,"data-testid":`mesh-reason-${t.nodeId}`,children:o})]})}function Yn(t){return[{key:`node`,header:q.t(`certificates.nodesColumns.node`,`Node`),sortValue:e=>e.isHub?``:e.nodeId.toLowerCase(),render:t=>e(`div`,{className:`flex items-center gap-1.5`,children:[r(`span`,{className:`font-medium text-foreground`,children:t.nodeId}),t.nodeId===`hub`&&r(W,{variant:`info`,className:`text-[10px]`,children:q.t(`common.hubWord`)}),!t.online&&r(W,{variant:`default`,className:`text-[10px]`,children:q.t(`common.offline`)})]})},{key:`https-state`,header:`HTTPS`,notSortableReason:`A state with a reason has no single order.`,render:e=>r(Un,{row:e})},{key:`https-expires`,header:q.t(`certificates.nodesColumns.httpsExpires`,`HTTPS expires`),sortValue:e=>Vn(e),render:e=>r(Hn,{ms:Vn(e),now:t.now})},{key:`identity`,header:q.t(`certificates.nodesColumns.identity`,`Identity`),sortValue:e=>e.mesh?.current?.serial??null,render:e=>r(Wn,{row:e})},{key:`identity-expires`,header:q.t(`certificates.nodesColumns.identityExpires`,`Identity expires`),sortValue:e=>e.mesh?.current?.notAfter??null,render:e=>r(Hn,{ms:e.mesh?.current?.notAfter??null,now:t.now})},{key:`presenting`,header:q.t(`certificates.nodesColumns.inUse`,`In use`),notSortableReason:`Offline nodes have no answer to order by.`,render:e=>r(Gn,{row:e})},{key:`actions`,header:q.t(`certificates.nodesColumns.actions`,`Actions`),align:`right`,notSortableReason:`Actions have no order.`,render:e=>r(Jn,{row:e,o:t})}]}s();function Xn(){let{t}=J(),i=w(),o=H.useUtils(),s=hn(6e4),c=H.certificates.listHttpsCertificates.useQuery(),l=H.certificates.getMeshCertificates.useQuery(),[u,d]=a(null),[p,m]=a(null),[h,g]=a(null),_=()=>{g(null),o.certificates.listHttpsCertificates.invalidate(),o.certificates.getMeshCertificates.invalidate()},v=e=>(t,n)=>{g(null),d(`${n.nodeId}: ${e} - ${t.message}`)},y=H.certificates.renewHttpsOnNode.useMutation({onSuccess:(e,n)=>{m({tone:`success`,message:e.restartRequired?t(`certificates.nodesCard.newCertificateIssuedRestartThe`,`{{nodeId}}: new certificate issued. Restart the node to serve it.`,{nodeId:n.nodeId}):t(`certificates.nodesCard.newCertificateIssuedAndServed`,`{{nodeId}}: new certificate issued and served.`,{nodeId:n.nodeId})}),_()},onError:v(`renewal failed`)}),b=H.certificates.renewMeshOnNode.useMutation({onSuccess:e=>{m(kt(e)),_()},onError:v(`renewal could not start`)}),x=H.certificates.revokeMeshOnNode.useMutation({onSuccess:e=>{m({tone:`success`,message:`${e.nodeId}: ${e.next}`}),_()},onError:v(`revoke failed`)}),S=y.isPending||b.isPending||x.isPending,C=(e,t)=>{d(null),m(null),g({nodeId:e,action:t})},ee=async e=>{await i({title:t(`certificates.nodesCard.renewHttpsOn`,`Renew HTTPS on "{{nodeId}}"?`,{nodeId:e.nodeId}),message:e.isHub?t(`certificates.nodesCard.aNewCertificateIsIssued`,`A new certificate is issued from the local CA. Clients that trust the CA keep working.`):t(`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:t(`certificates.nodesCard.renew`,`Renew`)})&&(C(e.nodeId,`renew-https`),y.mutate({nodeId:e.nodeId}))},te=e=>{C(e.nodeId,`renew-identity`),b.mutate({nodeId:e.nodeId})},T=async e=>{await i({title:t(`certificates.nodesCard.revokeTheIdentityOf`,`Revoke the identity of "{{nodeId}}"?`,{nodeId:e.nodeId}),message:t(`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:e.nodeId}),confirmLabel:t(`certificates.nodesCard.revokeAndDisconnect`,`Revoke and disconnect`),variant:`danger`})&&(C(e.nodeId,`revoke-identity`),x.mutate({nodeId:e.nodeId}))},E=Yn({now:s,busy:S,running:h,onRenewHttps:e=>void ee(e),onRenewIdentity:te,onRevokeIdentity:e=>void T(e)}),D=n(()=>Fn(c.data??[],l.data),[c.data,l.data]),ne=l.data?.registryAvailable??!0;return r(Y,{id:`nodes`,title:t(`certificates.nodesCard.nodes`,`Nodes`),icon:f,description:t(`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:X(u,p),onDismissNotice:()=>{d(null),m(null)},children:r(fn,{isPending:c.isPending||l.isPending,error:c.error??l.error,what:`node certificates`,onRetry:()=>{c.refetch(),l.refetch()},children:e(`div`,{className:`space-y-3`,children:[r(Pn,{https:c.data??[],mesh:l.data,now:s}),r(Ae,{columns:E,rows:D,rowKey:e=>e.nodeId,minWidthPx:960,maxBodyHeight:Pe,defaultSort:{columnKey:`node`,dir:`asc`},emptyMessage:ne?t(`certificates.nodesCard.noNodesReported`,`No nodes reported.`):t(`certificates.nodesCard.theCertificateRegistryIsNot`,`The certificate registry is not available yet, so nodes cannot be listed.`)})]})})})}function Zn({pairOpen:t,onPairClose:n}){return e(`div`,{className:`space-y-4`,"data-testid":`certificates-page`,children:[r(xn,{pairOpen:t,onPairClose:n}),r(pn,{}),r(jn,{}),r(Xn,{})]})}function Qn({userId:t,username:n,onClose:i}){let{t:a}=J(),o=w(),s=H.useUtils(),c=je({userId:t}),l=H.auth.listLoginMethods.useQuery(),u=Ge({onSuccess:()=>void s.userManagement.listExternalIdentities.invalidate()}),d=new Map((l.data??[]).flatMap(e=>e.kind===`redirect`?[[e.id,e.label]]:[])),f=c.data??[],p=async(e,r)=>{await o({title:a(`users.externalIdentitiesModal.removeSignInLink`,`Remove sign-in link`),message:a(`users.externalIdentitiesModal.willNoLongerBeAble`,`"{{username}}" will no longer be able to sign in with this {{label}} account.`,{username:n,label:r}),confirmLabel:a(`common.remove`,`Remove`),variant:`danger`})&&u.mutate({userId:t,provider:e.provider,subject:e.subject})};return r(z,{open:!0,onOpenChange:e=>!e&&i(),children:e(U,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,"data-testid":`external-identities-modal`,children:[r(G,{children:e(L,{className:`flex items-center gap-2`,children:[r(_,{className:`h-4 w-4 text-primary`}),e(`span`,{children:[a(`users.externalIdentitiesModal.linkedSignInAccounts`,`Linked sign-in accounts`),e(`span`,{className:`mt-0.5 block text-[11px] font-normal text-foreground-subtle`,children:[a(`users.externalIdentitiesModal.user`,`User:`),` `,r(`span`,{className:`font-mono`,children:n})]})]})]})}),r(B,{className:`space-y-3`,children:c.isLoading?e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(S,{className:`h-3.5 w-3.5 animate-spin`}),a(`common.loading`,`Loading…`)]}):f.length===0?r(`p`,{className:`text-xs text-foreground-subtle`,children:a(`users.externalIdentitiesModal.noLinkedAccountsOnlyThe`,`No linked accounts. Only the user can link one, from their own profile page.`)}):r(`ul`,{className:`divide-y divide-border rounded-md border border-border`,children:f.map(t=>{let n=d.get(t.provider),i=n??t.provider;return e(`li`,{className:`flex items-center gap-3 px-3 py-2 text-xs`,children:[e(`div`,{className:`flex-1 min-w-0`,children:[e(`div`,{className:`font-medium text-foreground truncate`,children:[i,n===void 0&&r(`span`,{className:`ml-2 rounded bg-foreground-subtle/15 px-1.5 py-0.5 text-[10px] font-normal text-foreground-subtle`,children:a(`users.externalIdentitiesModal.providerUnavailable`,`provider unavailable`)})]}),e(`div`,{className:`text-[11px] text-foreground-subtle truncate`,children:[t.label??t.subject,` ·`,` `,new Date(t.linkedAt).toLocaleDateString()]})]}),e(K,{variant:`unstyled`,onClick:()=>void p(t,i),disabled:u.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:[r(pe,{className:`h-3 w-3`}),a(`common.remove`,`Remove`)]})]},`${t.provider}|${t.subject}`)})})}),r(P,{children:r(K,{onClick:i,variant:`secondary`,children:a(`common.close`,`Close`)})})]})})}function $n({userId:t,username:n,onClose:i}){let{t:a}=J(),o=c(),s=w(),u=ge({userId:t}),d=u.data,f=()=>o.invalidateQueries({queryKey:[[`userManagement`,`getTotpStatus`]]}),p=$e({onSuccess:()=>{f(),i()}}),m=u.isLoading?`loading`:d?.enabled?`enrolled`:`not_enrolled`;return r(z,{open:!0,onOpenChange:e=>!e&&i(),children:e(U,{width:`md`,placement:`sheet-on-mobile`,scroll:`body`,children:[r(G,{children:e(L,{className:`flex items-center gap-2`,children:[r(O,{className:`h-4 w-4 text-primary`}),e(`span`,{children:[a(`users.totpModal.twoFactorAuthentication`,`Two-factor authentication`),e(`span`,{className:`mt-0.5 block text-[11px] font-normal text-foreground-subtle`,children:[a(`users.totpModal.user`,`User:`),` `,r(`span`,{className:`font-mono`,children:n})]})]})]})}),e(B,{className:`space-y-4`,children:[m===`loading`&&e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(S,{className:`h-3.5 w-3.5 animate-spin`}),a(`users.totpModal.checkingStatus`,`Checking status…`)]}),m===`not_enrolled`&&e(`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:[r(g,{className:`h-4 w-4 mt-0.5 shrink-0`}),e(`div`,{children:[r(`div`,{className:`font-medium text-foreground`,children:a(`users.totpModal.2faNotEnrolled`,`2FA not enrolled`)}),r(`p`,{className:`mt-0.5`,children:a(`users.totpModal.onlyTheUserThemselvesCan`,`Only the user themselves can enable 2FA, from their own profile page.`)})]})]}),m===`enrolled`&&d&&e(l,{children:[e(`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:[r(v,{className:`h-4 w-4 mt-0.5 text-emerald-500 shrink-0`}),e(`div`,{className:`text-xs text-foreground space-y-0.5`,children:[r(`div`,{className:`font-medium`,children:a(`users.totpModal.2faIsActive`,`2FA is active`)}),r(`div`,{className:`text-foreground-subtle`,children:a(`common.enrolledOn`,{when:d.confirmedAt?new Date(d.confirmedAt).toLocaleString():`—`})})]})]}),r(`div`,{className:`text-[11px] text-foreground-subtle`,children:a(`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.`)}),e(`div`,{className:`flex justify-end gap-2`,children:[r(K,{onClick:i,variant:`secondary`,children:a(`common.close`,`Close`)}),e(K,{variant:`unstyled`,onClick:async()=>{await s({title:a(`users.totpModal.remove2fa`,`Remove 2FA`),message:a(`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:n}),confirmLabel:a(`common.remove`,`Remove`),variant:`danger`})&&p.mutate({userId:t})},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?r(S,{className:`h-3 w-3 animate-spin`}):r(x,{className:`h-3 w-3`}),a(`users.totpModal.remove2fa`,`Remove 2FA`)]})]})]})]})]})})}s();function er({userId:t,username:n,onClose:i}){let{t:o}=J(),{user:s,logout:c}=tt(),l=s?.id===t,u=w(),d=H.useUtils(),f=H.auth.listSessions.useQuery({userId:t}),[p,m]=a(null),h=H.auth.revokeSessions.useMutation({onSuccess:(e,t)=>{if(l&&`userId`in t){c();return}d.auth.listSessions.invalidate()},onError:e=>m(`Sign out failed: ${e.message}`)}),g=async e=>{await u({title:o(`users.userSessionsModal.signOutThisSession`,`Sign out this session`),message:o(`users.userSessionsModal.onWillHaveToSign`,`"{{username}}" on {{label}} will have to sign in again.`,{username:n,label:yt(e.client).label}),confirmLabel:o(`users.userSessionsModal.signOut`,`Sign out`),variant:`danger`})&&(m(null),h.mutate({id:e.id}))},_=async()=>{await u({title:o(`users.userSessionsModal.signOutEverywhere`,`Sign out everywhere`),message:l?o(`users.userSessionsModal.everySessionOfYourOwn`,`Every session of your own account ends, this browser included: you will be signed out here too.`):o(`users.userSessionsModal.everySessionOfEndsAt`,`Every session of "{{username}}" ends at once; each device has to sign in again.`,{username:n}),confirmLabel:o(`users.userSessionsModal.signOutEverywhere`,`Sign out everywhere`),variant:`danger`})&&(m(null),h.mutate({userId:t}))},v=h.isPending&&h.variables!==void 0&&`id`in h.variables?h.variables.id:null;return r(z,{open:!0,onOpenChange:e=>!e&&i(),children:e(U,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,"data-testid":`user-sessions-modal`,children:[r(G,{children:e(L,{className:`flex items-center gap-2`,children:[r(fe,{className:`h-4 w-4 text-primary`}),e(`span`,{children:[o(`users.userSessionsModal.activeSessions`,`Active sessions`),e(`span`,{className:`mt-0.5 block text-[11px] font-normal text-foreground-subtle`,children:[o(`users.userSessionsModal.user`,`User:`),` `,r(`span`,{className:`font-mono`,children:n})]})]})]})}),e(B,{className:`space-y-3`,children:[p!==null&&r(`div`,{className:`text-[11px] text-danger`,children:p}),r(Ft,{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})]}),e(P,{className:`justify-between`,children:[e(K,{variant:`unstyled`,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?r(S,{className:`h-3 w-3 animate-spin`}):r(j,{className:`h-3 w-3`}),o(`users.userSessionsModal.signOutEverywhere`,`Sign out everywhere`)]}),r(K,{onClick:i,variant:`secondary`,children:o(`common.close`,`Close`)})]})]})})}function tr({scopes:t,invalidReason:n}){let{t:i}=J(),a=T(),s=o({queryKey:[`auth`,`previewScope`,t,!1],enabled:n===null,queryFn:()=>a.trpcClient.auth.previewScope.query({scopes:[...t],isAdmin:!1})}),{data:c}=Te({projection:`slim`}),l=c?.length??null;if(n!==null)return e(`p`,{className:`flex items-center gap-1.5 text-[11px] text-warning`,"data-testid":`role-preview`,children:[r(ie,{className:`h-3 w-3 shrink-0`}),n]});if(s.isLoading)return e(`p`,{className:`flex items-center gap-1.5 text-[11px] text-foreground-subtle`,"data-testid":`role-preview`,children:[r(S,{className:`h-3 w-3 shrink-0 animate-spin`}),i(`users.rolePreview.resolving`)]});if(s.isError||!s.data)return r(`p`,{className:`text-[11px] text-danger`,"data-testid":`role-preview`,children:i(`users.rolePreview.couldNotResolve`)});let u=s.data.viewableDeviceCount,d=s.data.device.view.all?i(`users.rolePreview.everyDevice`,{count:u}):l===null?i(`users.rolePreview.devicesVisible`,{count:u}):i(`users.rolePreview.devicesVisibleOf`,{count:u,total:l});return e(`p`,{className:`flex items-center gap-1.5 text-[11px] ${u===0?`text-warning`:`text-foreground`}`,"data-testid":`role-preview`,children:[u===0?r(ie,{className:`h-3 w-3 shrink-0`}):r(k,{className:`h-3 w-3 shrink-0 text-foreground-subtle`}),u===0?i(`users.rolePreview.noDevice`):d]})}function nr(e){let t=ce(e.scopes??[]);if(t===null)return{role:e.isAdmin?`admin`:`viewer`,mode:`except`,pickedIds:[],viewer:se,unconfigured:!e.isAdmin};let n=lr(t);return{role:e.isAdmin?`admin`:`viewer`,mode:n.mode,pickedIds:n.pickedIds,viewer:ur(n.mode,n.pickedIds,t.features),unconfigured:!1}}function rr(e,t){return{...e,role:t}}function ir(e,t){return{...e,mode:t,viewer:ur(t,e.pickedIds,e.viewer.features)}}function ar(e,t){let n=dr(t);return{...e,pickedIds:n,viewer:ur(e.mode,n,e.viewer.features)}}function or(e,t,n){let r=e.viewer.features.filter(e=>e!==t),i=n?[...r,t]:r;return{...e,viewer:ur(e.mode,e.pickedIds,i)}}function sr(e){return e.role===`viewer`&&e.mode===`only`&&e.pickedIds.length===0?`no-allowed-device`:null}function cr(e){return sr(e)===null?e.role===`admin`?{isAdmin:!0,scopes:[]}:{isAdmin:!1,scopes:[e.viewer]}:null}function lr(e){if(e.allow===`*`)return{mode:`except`,pickedIds:e.block};let t=new Set(e.block);return{mode:`only`,pickedIds:e.allow.filter(e=>!t.has(e))}}function ur(e,t,n){let r=dr(t);return e===`except`?{type:`viewer`,allow:`*`,block:r,features:[...n]}:{type:`viewer`,allow:r,block:[],features:[...n]}}function dr(e){return[...new Set(e)]}s();var fr=`text-[11px] font-semibold uppercase tracking-wide text-foreground-subtle`;function pr(e,t){return e?`failed`:t===void 0?`pending`:`answered`}function mr(e){let t=[];for(let n of e)n.parentDeviceId===null&&t.push({id:n.id,name:n.name,type:String(n.type),...n.location===null?{}:{location:n.location}});return t}function hr({user:t,isSelf:i,onClose:o,onSubmit:s,submitting:c,error:u}){let{t:d}=J(),[f,p]=a(n(()=>nr(t),[t])),m=Te({projection:`slim`}),h=m.data,g=pr(m.isError,h),_=n(()=>mr(h??[]),[h]),v=n(()=>({state:g,devices:g===`answered`?(h??[]).map(e=>({id:e.id,name:e.name})):void 0}),[g,h]),b=sr(f),x=cr(f),C=b===`no-allowed-device`?d(`users.userAccessModal.pickAllowedDevice`):null,w=e=>{p(rr(f,e))},ee=[{value:`except`,label:d(`users.userAccessModal.modeExcept`)},{value:`only`,label:d(`users.userAccessModal.modeOnly`)}];return r(z,{open:!0,onOpenChange:e=>!e&&o(),children:e(U,{width:`lg`,placement:`sheet-on-mobile`,scroll:`body`,className:`md:max-w-2xl`,children:[r(G,{children:r(L,{children:d(`users.userAccessModal.title`,{name:t.username})})}),e(B,{className:`space-y-4`,children:[f.unconfigured&&f.role===`viewer`&&r(F,{variant:`warning`,title:d(`users.userAccessModal.noAccessYet`),message:d(`users.userAccessModal.noAccessYetDetail`,{name:t.username})}),e(`section`,{className:`space-y-2`,children:[r(`h3`,{className:fr,children:d(`users.userAccessModal.role`)}),e(`div`,{role:`radiogroup`,"aria-label":d(`users.userAccessModal.role`),className:`grid gap-1.5 sm:grid-cols-2`,children:[r(gr,{name:`admin`,checked:f.role===`admin`,label:d(`users.userAccessModal.admin`),description:d(`users.userAccessModal.adminDescription`),onPick:()=>w(`admin`)}),r(gr,{name:`viewer`,checked:f.role===`viewer`,disabled:i,label:d(`users.userAccessModal.viewer`),description:d(i?`users.userAccessModal.cannotDemoteSelf`:`users.userAccessModal.viewerDescription`),onPick:()=>w(`viewer`)})]})]}),f.role===`viewer`&&e(l,{children:[e(`section`,{className:`space-y-3`,children:[r(`h3`,{className:fr,children:d(`users.userAccessModal.devices`)}),r(Xe,{label:d(`users.userAccessModal.whichDevices`),value:f.mode,options:ee,onChange:e=>p(ir(f,e))}),r(me,{devices:_,listState:g,fleet:v,value:[...f.pickedIds],onChange:e=>p(ar(f,e)),emptyMeansAll:f.mode===`except`,noun:`device`,testId:`viewer-device-picker`}),r(tr,{scopes:x?.scopes??[],invalidReason:C})]}),e(`section`,{className:`space-y-2`,children:[r(`h3`,{className:fr,children:d(`users.userAccessModal.features`)}),r(`div`,{className:`space-y-1`,children:A.map(t=>e(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md p-1.5 hover:bg-surface-hover`,children:[r(y,{className:`mt-0.5`,checked:f.viewer.features.includes(t.id),onChange:e=>p(or(f,t.id,e.target.checked))}),e(`span`,{className:`min-w-0`,children:[r(`span`,{className:`block text-[12px] font-medium text-foreground`,children:d(`users.viewerFeatures.${t.id}.label`,t.label)}),r(`span`,{className:`block text-[10px] text-foreground-subtle`,children:d(`users.viewerFeatures.${t.id}.description`,t.description)})]})]},t.id))})]})]}),u!==null&&r(F,{message:u})]}),e(P,{children:[r(K,{variant:`outline`,size:`sm`,onClick:o,children:d(`common.cancel`,`Cancel`)}),r(K,{size:`sm`,onClick:()=>x!==null&&s(x),disabled:c||x===null,children:c?r(S,{className:`h-3 w-3 animate-spin`}):d(`users.userAccessModal.saveAccess`)})]})]})})}function gr({name:t,checked:n,disabled:i=!1,label:a,description:o,onPick:s}){return e(`label`,{className:`flex items-start gap-2 rounded-lg border p-2.5 transition-colors ${n?`border-primary bg-primary/5`:`border-border hover:bg-surface-hover`} ${i?`cursor-not-allowed opacity-60`:`cursor-pointer`}`,children:[r(Ze,{name:`user-role`,value:t,checked:n,disabled:i,onChange:s,className:`mt-0.5`}),e(`span`,{className:`min-w-0`,children:[r(`span`,{className:`block text-[12px] font-medium text-foreground`,children:a}),r(`span`,{className:`block text-[10px] text-foreground-subtle`,children:o})]})]})}s();var _r=8;function vr(){return{username:``,password:``,isAdmin:!1}}function yr(e){return{id:e.id,username:e.username,password:``,isAdmin:e.isAdmin}}function br(e){return e instanceof Error?e.message:q.t(`admin.system.users.genericError`)}function xr(){let{t}=J(),n=c(),{user:o}=tt(),{state:s,openNew:d,openEdit:f,close:m}=ve(),[g,v]=a(null),[b,x]=a(null),[ee,T]=a(!1),{data:E,isLoading:D,isError:k,error:re,refetch:ie}=ke(),ae=w(),oe=ne(),A=()=>n.invalidateQueries({queryKey:[[`userManagement`,`listUsers`]]}),se=Ee(),ce=Oe({onSuccess:A}),j=Ce({onSuccess:A}),M=Ne({onSuccess:A}),le=we(),[N,ue]=a(null),[pe,me]=a(!1),[he,ge]=a(null),[P,_e]=a(null),[ye,be]=a(null),[xe,Se]=a(null),I=E??[],L=s.mode===`edit`?I.find(e=>e.id===s.id)??null:null,R=()=>{v(null),x(null),T(!1),se.reset(),j.reset(),m()};i(()=>{if(s.mode===`closed`){v(null),x(null),T(!1);return}if(s.mode===`new`){v(e=>e!==null&&e.id===void 0?e:vr());return}if(L===null){D||m();return}v(e=>e?.id===L.id?e:yr(L))},[s,L,D,m]);let z=s.mode===`new`&&g!==null&&g.id===void 0||s.mode===`edit`&&g!==null&&L!==null;async function Te(e){await ae({title:t(`admin.system.users.deleteUser`,`Delete user`),message:t(`admin.system.users.permanentlyDeleteUserThisCannot`,`Permanently delete user "{{username}}"? This cannot be undone — any active sessions will be revoked on next request.`,{username:e.username}),confirmLabel:t(`common.delete`,`Delete`),variant:`danger`})&&(ce.mutate({id:e.id}),s.mode===`edit`&&s.id===e.id&&R())}async function B(e){let n=await oe({title:t(`admin.system.users.resetPassword`,`Reset password`),message:t(`admin.system.users.setANewPasswordFor`,`Set a new password for "{{username}}".`,{username:e.username}),label:t(`admin.system.users.newPassword`,`New password`),inputType:`password`,placeholder:t(`admin.system.users.atLeast8Characters`,`At least 8 characters`),confirmLabel:t(`admin.system.users.continue`,`Continue`),validate:e=>e.length<_r?q.t(`admin.system.users.passwordTooShort`,{min:_r}):null});n===null||n.length===0||await ae({title:t(`admin.system.users.resetPassword`,`Reset password`),message:t(`admin.system.users.resetThePasswordForThey`,`Reset the password for "{{username}}"? They will need to use the new password on their next login.`,{username:e.username}),confirmLabel:t(`common.reset`,`Reset`)})&&M.mutate({id:e.id,newPassword:n})}function H(e){ge(null),ue(e)}async function De(e,t){me(!0),ge(null);try{t.isAdmin!==e.isAdmin&&await j.mutateAsync({id:e.id,isAdmin:t.isAdmin}),await le.mutateAsync({userId:e.id,scopes:[...t.scopes]}),ue(null)}catch(e){ge(br(e))}finally{me(!1),A()}}async function U(){if(g!==null){x(null);try{if(g.id===void 0){let e=g.username.trim();if(e===``||g.password.length<_r)return;await se.mutateAsync({username:e,password:g.password,isAdmin:g.isAdmin})}else await j.mutateAsync({id:g.id,isAdmin:g.isAdmin});A(),R()}catch(e){x(br(e))}}}function W(e){return e?new Date(typeof e==`number`?e:String(e)).toLocaleDateString(`en-GB`,{day:`2-digit`,month:`short`,year:`numeric`}):`—`}let je=se.isPending||j.isPending,Me=g!==null&&g.id===void 0&&g.username.trim()!==``&&g.password.length>=_r,G=g!==null&&g.id!==void 0,Pe=je||(g?.id===void 0?!Me:!G),Le=e=>ce.isPending&&ce.variables?.id===e.id||j.isPending&&j.variables?.id===e.id||M.isPending&&M.variables?.id===e.id,Re=[{key:`username`,header:t(`admin.system.users.username`,`Username`),sortValue:e=>e.username,render:e=>r(`span`,{className:`font-medium text-foreground`,"data-testid":`user-open-${e.id}`,children:e.username})},{key:`scopes`,header:t(`admin.system.users.access`,`Access`),sortValue:e=>Sr(e),render:n=>r(`span`,{onClick:e=>e.stopPropagation(),children:e(K,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>H(n),disabled:Le(n),title:t(`admin.system.users.configureAccess`,`Configure access`),"data-testid":`user-access-${n.id}`,children:[r(u,{className:`h-3 w-3 shrink-0 text-foreground-subtle`}),r(Cr,{user:n})]})})},{key:`createdAt`,header:t(`admin.system.users.created`,`Created`),nowrap:!0,sortValue:e=>e.createdAt,render:e=>r(`span`,{className:`text-foreground-subtle`,children:W(e.createdAt)})},{key:`actions`,header:t(`admin.system.users.actions`,`Actions`),align:`right`,nowrap:!0,notSortableReason:`Row actions`,render:n=>{let i=Le(n),a=n.id!==o?.id&&n.totpEnabled;return e(`div`,{className:`flex items-center justify-end gap-1`,onClick:e=>e.stopPropagation(),children:[e(K,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>f(n.id),disabled:i,title:t(`admin.system.users.editUser`,`Edit user`),children:[r(te,{className:`h-3 w-3`}),t(`common.edit`,`Edit`)]}),a&&e(K,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>_e(n),disabled:i,title:t(`admin.system.users.removeTwoFactorAuthentication`,`Remove two-factor authentication`),children:[r(O,{className:`h-3 w-3`}),t(`admin.system.users.remove2fa`,`Remove 2FA`)]}),e(K,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>be(n),disabled:i,title:t(`admin.system.users.linkedSignInAccounts`,`Linked sign-in accounts`),children:[r(_,{className:`h-3 w-3`}),t(`admin.system.users.signInLinks`,`Sign-in links`)]}),e(K,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>Se(n),disabled:i,title:t(`admin.system.users.activeSessions`,`Active sessions`),children:[r(fe,{className:`h-3 w-3`}),t(`admin.system.users.sessions`,`Sessions`)]}),e(K,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>void B(n),disabled:i,title:t(`admin.system.users.resetPassword`,`Reset password`),children:[r(de,{className:`h-3 w-3`}),t(`admin.system.users.resetPassword`,`Reset password`)]}),e(K,{size:`sm`,variant:`ghost`,type:`button`,onClick:()=>void Te(n),disabled:i,title:t(`admin.system.users.deleteUser`,`Delete user`),className:`text-danger hover:bg-danger/10`,children:[i?r(S,{className:`h-3 w-3 animate-spin`}):r(C,{className:`h-3 w-3`}),t(`common.delete`,`Delete`)]})]})}}];return e(mt,{embedded:!0,icon:h,title:t(`admin.system.users.users`,`Users`),subtitle:t(`admin.system.users.hubAccountsAdminFlagAccess`,`Hub accounts, admin flag, access scopes, sessions and sign-in links.`),actions:e(K,{size:`sm`,type:`button`,onClick:()=>{x(null),d()},children:[r(p,{className:`h-3.5 w-3.5`}),t(`admin.system.users.createUser`,`Create User`)]}),children:[k&&r(F,{title:t(`admin.system.users.couldNotLoadUsers`,`Could not load users`),message:br(re),onRetry:()=>void ie()}),D&&e(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[r(S,{className:`h-3.5 w-3.5 animate-spin`}),t(`common.loading`,`Loading…`)]}),!D&&!k&&I.length===0&&r(Fe,{icon:h,title:t(`admin.system.users.noUsersYet`,`No users yet`),description:t(`admin.system.users.createAUserToGrant`,`Create a user to grant hub access.`)}),!D&&!k&&I.length>0&&r(Ae,{columns:Re,rows:I,rowKey:e=>e.id,minWidthPx:560,maxBodyHeight:`max-h-[60vh]`,onRowClick:e=>f(e.id)}),r(He,{open:z,onClose:R,title:g?.id===void 0?t(`admin.system.users.createUser`,`Create User`):t(`admin.system.users.edit`,`Edit {{value1}}`,{value1:g.username||`user`}),icon:h,error:b,testId:`user-form-dialog`,footer:r(K,{size:`sm`,type:`button`,disabled:Pe,onClick:()=>void U(),children:je?e(l,{children:[r(S,{className:`h-3.5 w-3.5 animate-spin`}),t(`admin.system.users.saving`,`Saving…`)]}):g?.id===void 0?t(`admin.system.users.create`,`Create`):t(`common.save`,`Save`)}),children:g!==null&&e(`div`,{className:`space-y-3`,children:[r(V,{label:t(`admin.system.users.username`,`Username`),required:g.id===void 0,children:r(Ie,{value:g.username,onChange:e=>v({...g,username:e.target.value}),placeholder:`john`,autoFocus:g.id===void 0,disabled:g.id!==void 0,"data-testid":`user-form-username`})}),g.id===void 0&&r(V,{label:t(`admin.system.users.password`,`Password`),required:!0,description:t(`admin.system.users.atLeastCharacters`,`At least {{value1}} characters.`,{value1:String(_r)}),children:r(Je,{value:g.password,onValueChange:e=>v({...g,password:e}),shown:ee,onToggleShown:()=>T(e=>!e),placeholder:`••••••••`,"data-testid":`user-form-password`})}),r(V,{label:t(`admin.system.users.admin`,`Admin`),description:t(`admin.system.users.unrestrictedAccessToEveryCapability`,`Unrestricted access to every capability and device.`),children:e(`label`,{className:`inline-flex items-center gap-2 text-xs text-foreground cursor-pointer`,children:[r(y,{checked:g.isAdmin,onChange:e=>v({...g,isAdmin:e.target.checked}),className:`rounded border-border focus:ring-primary`,"data-testid":`user-form-admin`}),r(`span`,{children:t(`admin.system.users.admin`,`Admin`)})]})}),g.id!==void 0&&r(`p`,{className:`text-[11px] text-foreground-subtle`,children:t(`admin.system.users.toChangeThePasswordUse`,`To change the password, use Reset password on the user's row. Access scopes are configured from the Access column.`)})]})}),P&&r($n,{userId:P.id,username:P.username,onClose:()=>_e(null)}),ye&&r(Qn,{userId:ye.id,username:ye.username,onClose:()=>be(null)}),xe&&r(er,{userId:xe.id,username:xe.username,onClose:()=>Se(null)}),N&&r(hr,{user:N,isSelf:N.id===o?.id,onClose:()=>ue(null),onSubmit:e=>void De(N,e),submitting:pe,error:he})]})}function Sr(e){let t=nr(e);return t.role===`admin`?0:t.unconfigured?2:1}function Cr({user:t}){let{t:n}=J(),i=nr(t);if(i.role===`admin`)return r(`span`,{className:`font-medium text-foreground`,children:n(`users.accessSummary.admin`)});if(i.unconfigured)return r(`span`,{className:`font-medium text-warning`,children:n(`admin.system.users.noAccess`,`No access`)});let{allow:a,block:o,features:s}=i.viewer,c=a===`*`?n(`users.accessSummary.allDevices`):n(`users.accessSummary.devices`,{count:a.length});return e(`span`,{className:`text-foreground-subtle`,children:[r(`span`,{className:`font-medium text-foreground`,children:n(`users.accessSummary.viewer`)}),` ·`,` `,c,o.length>0&&e(l,{children:[` · `,n(`users.accessSummary.blocked`,{count:o.length})]}),s.length>0&&e(l,{children:[` · `,n(`users.accessSummary.features`,{count:s.length})]})]})}s();var wr={"api-keys":$.tokens,"linked-sessions":$.linkedApps},Tr=`certificates`;function Er(t){return e(K,{size:`sm`,type:`button`,"data-testid":`certificates-pair-device`,onClick:t,children:[r(O,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),q.t(`systemPage.identity.pairADevice`,`Pair a device`)]})}function Dr(){let{t:e}=J(),[t]=nt(),n=dn(),[i,o]=a(!1),s=wr[t.get(`tab`)??``];if(s!==void 0)return r(et,{to:at(`access`,{integration:s}),replace:!0});let c=ft(`/system/identity`,{t:e,isAdmin:!0})??{icon:b,title:e(`system.identity`,`Identity & Access`)},l=t.get(`tab`)??`users`,u=t.get(`integration`),d=l===it.access.tab?un(u,n.requestCreate):l===`certificates`?Er(()=>o(!0)):void 0;return r(pt,{icon:c.icon,title:c.title,defaultSection:`users`,sectionsLabel:`${c.title} sections`,actions:d,sections:[{id:`users`,label:e(`systemPage.identity.users`,`Users`),content:r(xr,{})},{id:it.access.tab,label:e(`systemPage.identity.tokensSessions`,`Tokens & sessions`),ownedParams:ot.concat([Tt.token,Tt.scoped,Tt.admin]),content:r(ln,{createRequested:n.createRequested,onCreateConsumed:n.clearCreate})},{id:Tr,label:e(`systemPage.identity.certificates`,`Certificates`),content:r(Zn,{pairOpen:i,onPairClose:()=>o(!1)})},{id:it.authentication.tab,label:e(`systemPage.identity.authentication`,`Authentication`),content:r(Vt,{}),ownedParams:ot}]})}export{Dr as IdentityPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,J as t,K as n,R as r,S as i,V as a,W as o,Y as s,et as c,i as l,j as u,o as d,p as f,t as p}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{gt as m}from"./player-overlays-BZByYYB8.js";import{Ls as h,Rs as g}from"./client-mnldOm50.js";import{Oa as _,Xi as v,Zi as y,fo as ee,ji as b,jt as te,sa as ne}from"./src-DKRp5NPI.js";import{t as re}from"./useTranslation-BJr-n0es.js";import{F as x,N as ie,P as ae,lt as S}from"./index-D5GcZJtC.js";c();var C=u(function({addonId:e,schema:s,serverValues:c,onImmediateSave:l,onStateChange:u,onAction:d,disabled:f},p){let m=x({schema:s,serverValues:c,onImmediateSave:r(t=>l(e,t),[e,l]),onDeferredSave:r(()=>{},[])});o(p,()=>({flush:()=>{let e={};for(let t of m.pendingKeys)e[t]=m.values[t];return m.handleDiscard(m.pendingKeys),e},discard:()=>m.resetAll()}),[m]);let h=m.pendingKeys,g=h.join(`|`),_=n(()=>h.map(e=>`${e}=${JSON.stringify(m.values[e])}`).join(`,`),[h,m.values]),v=t(u);a(()=>{v.current=u},[u]),a(()=>{let t={};for(let e of h)t[e]=m.values[e];v.current({addonId:e,pendingKeys:h,pendingValues:t})},[e,g,_]);let y=n(()=>{if(d)return(t,n,r)=>d(e,t,n,r)},[e,d]);return i(S,{schema:s,values:m.values,onChange:m.handleChange,disabled:f,onAction:y})});function w(e){return`perNode`in e&&e.perNode===!0}function T(e,t){if(e.type===`group`){let n=E(e.fields,t);return n.length>0?{...e,fields:n}:null}if(e.type===`sub-tabs`){let n=e.tabs.map(e=>({...e,fields:E(e.fields,t)})).filter(e=>e.fields.length>0);return n.length>0?{...e,tabs:n}:null}return w(e)===(t===`perNode`)?e:null}function E(e,t){let n=[];for(let r of e){let e=T(r,t);e!==null&&n.push(e)}return n}function oe(e,t){let n=[];for(let r of e.sections){let e=E(r.fields,t);e.length!==0&&n.push({...r,fields:e})}return{...e,sections:n}}function D(e,t){return t===void 0?!0:t===`perNode`?e===`node`:e!==`node`}function se(e){let t=e.allowSectionIds?new Set(e.allowSectionIds):null,n=e.omitSectionIds?new Set(e.omitSectionIds):null,r=new Set,i=[];for(let a of e.declarations){if(!D(a.scope,e.fieldScope)||e.capability!==void 0&&a.cap!==e.capability)continue;let o=a.sectionIds.filter(e=>r.has(e)||(r.add(e),t!==null&&!t.has(e))?!1:n===null||!n.has(e));o.length>0&&i.push({cap:a.cap,scope:a.scope,sectionIds:o})}return i}function ce(e){let t=[],n=new Map,r={};for(let{declaration:i,form:a}of e){let e=new Set(i.sectionIds),o=a.sections.filter(t=>e.has(t.id));t.push(...o);for(let e of a.tabs??[])n.has(e.id)||n.set(e.id,e);for(let e of g({sections:o}).keys()){let t=r[e]??[];t.push({cap:i.cap,scope:i.scope}),r[e]=t}}return{form:{...n.size>0?{tabs:[...n.values()]}:{},sections:t},keyTargets:r}}function le(e,t){let n=new Map,r=[];for(let[i,a]of Object.entries(e)){let e=t[i];if(e===void 0||e.length===0){r.push(i);continue}for(let t of e){let e=`${t.cap}\u0000${t.scope}`,r=n.get(e)??{target:t,patch:{}};r.patch[i]=a,n.set(e,r)}}return{groups:[...n.values()].map(e=>({...e.target,patch:e.patch})),unowned:r}}function ue(e,t){let n=e??`general`;return t?.[n]??n}function O(e){return typeof e!=`object`||!e||!(`key`in e)?null:typeof e.key==`string`?e.key:null}function k(e,t){let n=t.fieldKeys===void 0?null:new Set(t.fieldKeys),r=[];for(let i of e){let e=n===null?i.fields:i.fields.filter(e=>{let t=O(e);return t!==null&&n.has(t)});e.length!==0&&r.push({...i,fields:e,...t.tabAliases===void 0?{}:{tab:ue(i.tab,t.tabAliases)},...t.hideSectionChrome===!0?{title:``,description:void 0}:{}})}return r}c();function A(e,t){if(e.type===`separator`||e.type===`info`||e.type===`button`)return e;if(e.type===`group`){let n=e.fields.map(e=>A(e,t));return{...e,fields:n}}let n=e;t[e.key]=n.value;let{value:r,...i}=n;return i}function j(e,t){return{...e,fields:e.fields.map(e=>A(e,t))}}function de(e){let t={};return{schema:{...e.tabs?{tabs:e.tabs}:{},sections:e.sections.map(e=>j(e,t))},values:t}}function M({nodeId:a,addonIds:o,level:c,deviceId:u,capability:g,sectionIds:b,omitSectionIds:x,fieldKeys:S,hideSectionChrome:C,tabAliases:w,tabLabelOverrides:T,sectionTab:E,fieldScope:D,emptyMessage:O,extraTabs:A,schemaTabExtras:j,title:M,description:N,selfTabbed:pe,activeTab:me,onActiveTabChange:he}){let{t:P}=re(),F=d(),I=m().trpcClient,ge=y(),_e=v(),ve=ee(),ye=_(),L=pe===!0||!!(A&&A.length>0),[be,xe]=s(null);if(c===`device`&&!u)throw Error(`NodeAddonsSettingsPanel: deviceId is required when level === "device"`);let R=a??`hub`,z=l({queries:o.map(e=>({queryKey:[[`addonSettings`,c===`global`?`listScopedSettings`:`getDeviceSettings`],{addonId:e,nodeId:R,deviceId:u??null,cap:g??null,scope:D??null,sections:[b??null,x??null]}],queryFn:async()=>{if(c===`global`){let t=await I.addonSettings.listScopedSettings.query({addonId:e,nodeId:R});if(t===null)return{addonId:e,result:null,keyTargets:{}};let n=se({declarations:t,...D===void 0?{}:{fieldScope:D},...g===void 0?{}:{capability:g},...b===void 0?{}:{allowSectionIds:b},...x===void 0?{}:{omitSectionIds:x}}),r=await Promise.all(n.map(async t=>{let n=await I.addonSettings.getScopedSettings.query({addonId:e,cap:t.cap,scope:t.scope,...t.scope===`node`?{nodeId:R}:{}});return n===null?null:{declaration:t,form:n}})),i=r.filter(e=>e!==null);if(i.length!==r.length)return{addonId:e,result:null,keyTargets:{}};let a=ce(i);return{addonId:e,result:a.form,keyTargets:a.keyTargets}}let t=await I.addonSettings.getDeviceSettings.query({addonId:e,deviceId:u,nodeId:R});return{addonId:e,result:t!==null&&D!==void 0?oe(t,D):t,keyTargets:{}}},placeholderData:f}))}),Se=z.some(e=>e.isLoading),B=z.map(e=>{if(!e.data)return`-`;if(e.data.result===null)return`${e.data.addonId}:n`;let t=[];for(let n of e.data.result.sections){t.push(`s:${n.id}:${n.tab??`general`}`);for(let e of n.fields){if(!(`key`in e))continue;let n=`options`in e&&Array.isArray(e.options)?e.options.map(e=>e.value).join(`,`):``,r=e.value,i=r===void 0?``:typeof r==`string`?r:JSON.stringify(r);t.push(`f:${e.key}:${n}:${i}`)}}return`${e.data.addonId}:${t.join(`|`)}`}).join(`||`),V=n(()=>{let e=new Set;for(let t of z){let n=t.data?.result?.sections;if(n)for(let t of n)e.add(ue(t.tab,w))}return[...e]},[w,B+`::`+z.map(e=>(e.data?.result?.sections??[]).map(e=>e.tab??`general`).join(`,`)).join(`::`)]),H=n(()=>new Map((A??[]).map(e=>[e.id,e])),[A]),U=n(()=>{if(!L)return[];let e=[...new Set([...V,...(A??[]).map(e=>e.id),...(j??[]).map(e=>e.tabId)])],t=e=>{let t=H.get(e);if(t?.order!==void 0)return t.order;let n=h[e];return n?n.order:50};return e.toSorted((e,n)=>{let r=t(e),i=t(n);return r===i?e.localeCompare(n):r-i})},[L,V,A,H,j]),Ce=n(()=>{let e=new Map,t=e=>h[e]?.label??e.charAt(0).toUpperCase()+e.slice(1);for(let n of V)e.set(n,t(n));for(let n of j??[])e.has(n.tabId)||e.set(n.tabId,t(n.tabId));for(let t of A??[])e.set(t.id,t.label);for(let[t,n]of Object.entries(T??{}))e.set(t,n);return e},[V,A,j,T]),W=me===void 0?be:me,G=L?W&&U.includes(W)?W:U[0]??null:null,we=e=>{xe(e),he?.(e)},Te=G!==null&&H.has(G),K=L?G&&!Te?G:void 0:E,{data:Ee}=ne(void 0),De=n(()=>{let e=new Map;for(let t of Ee??[]){let n=t.manifest?.id;if(!n)continue;let r=t.manifest?.name??t.manifest?.packageDisplayName??n;e.set(n,r)}return e},[Ee]),q=t(new Map),J=n(()=>{let e=b?new Set(b):null,t=x?new Set(x):null,n=n=>!(e!==null&&!e.has(n)||t!==null&&t.has(n)),r=[];for(let e of z){if(!e.data)continue;e.data.result!==null&&q.current.set(e.data.addonId,{result:e.data.result,keyTargets:e.data.keyTargets});let t=q.current.get(e.data.addonId)??null;if(t===null)continue;let{result:i,keyTargets:a}=t,{schema:o,values:s}=de(i),c={...S===void 0?{}:{fieldKeys:S},...C===void 0?{}:{hideSectionChrome:C},...w===void 0?{}:{tabAliases:w}},l=k(o.sections.filter(e=>n(e.id)),c);if(l.length===0)continue;let u={...i,sections:k(i.sections.filter(e=>n(e.id)),c)},d={...o,sections:l};r.push({addonId:e.data.addonId,schemaWithValues:u,schema:d,serverValues:s,keyTargets:a})}return r},[B,b,x,S,C,w]),Oe=n(()=>z.flatMap(e=>c===`global`&&e.data!==void 0&&e.data.result===null&&!q.current.has(e.data.addonId)?[e.data.addonId]:[]),[B,c]),[Y,ke]=s(new Map),Ae=r(e=>{ke(t=>{let n=new Map(t);return n.set(e.addonId,e),n})},[]),X=t(new Map),je=r(e=>t=>{t?X.current.set(e,t):X.current.delete(e)},[]),Z=r(async(e,t)=>{if(c!==`global`){await _e.mutateAsync({addonId:e,deviceId:u,nodeId:R,patch:t});return}let{groups:n,unowned:r}=le(t,J.find(t=>t.addonId===e)?.keyTargets??{});if(r.length>0)throw Error(`${e}: no scoped setting declares ${r.join(`, `)}`);let i=(await Promise.allSettled(n.map(t=>ge.mutateAsync({addonId:e,cap:t.cap,scope:t.scope,...t.scope===`node`?{nodeId:R}:{},patch:t.patch})))).flatMap((e,t)=>{let r=n[t];if(e.status!==`rejected`||r===void 0)return[];let i=e.reason instanceof Error?e.reason.message:String(e.reason);return[`${r.cap}/${r.scope}: ${i}`]});if(i.length>0)throw F.invalidateQueries({queryKey:[[`addonSettings`]]}),Error(`${e}: not saved to ${i.join(`; `)}`)},[c,J,ge,_e,F,R,u]),Me=r(async(e,t)=>{await Z(e,t),F.invalidateQueries({queryKey:[[`addonSettings`]]})},[Z,F]),Ne=r(async(e,t,n,r)=>{let i=R;try{switch(t){case`reprobe-hwaccel`:await ve.mutateAsync({nodeId:i}),F.invalidateQueries({queryKey:[[`addonSettings`]]});return;case`reprobe-audio-engine`:await ye.mutateAsync({nodeId:i}),F.invalidateQueries({queryKey:[[`addonSettings`]]});return;default:{let n=await I.addons.custom.mutate({addonId:e,action:t,input:r});return F.invalidateQueries({queryKey:[[`addonSettings`]]}),n}}}catch(n){throw console.error(`[NodeAddonsSettingsPanel] action failed`,{addonId:e,action:t,err:n}),n}},[ve,ye,R,F,I]),Pe=r((e,t)=>{Me(e,t)},[Me]),Q=p({mutationFn:async()=>{let e=[];for(let t of J){let n=Y.get(t.addonId);!n||n.pendingKeys.length===0||e.push({addonId:t.addonId,patch:n.pendingValues})}return e.length===0?{saved:[]}:{saved:await Promise.all(e.map(async({addonId:e,patch:t})=>(await Z(e,t),e)))}},onSuccess:({saved:e})=>{for(let t of e)X.current.get(t)?.discard();F.invalidateQueries({queryKey:[[`addonSettings`]]})}}),Fe=r(()=>{for(let e of X.current.values())e.discard()},[]),Ie=n(()=>{let e=0;for(let t of J){let n=Y.get(t.addonId);n&&(e+=n.pendingKeys.length)}return e},[J,Y]),Le=n(()=>{let e=new Map;for(let t of J){let n=Y.get(t.addonId);if(!n||n.pendingKeys.length===0)continue;let r=new Set(n.pendingKeys);for(let n of t.schema.sections){let t=n.tab??`general`;for(let i of n.fields)`key`in i&&r.has(i.key)&&e.set(t,(e.get(t)??0)+1)}}return e},[J,Y]);if(Se)return i(`div`,{className:`h-24 rounded-lg border border-border bg-surface animate-pulse`});let $=G&&Te?H.get(G):void 0,Re=Oe.length>0?i(`div`,{className:`space-y-1 text-[11px] text-foreground-subtle`,role:`status`,children:Oe.map(e=>i(`div`,{children:P(`settings.nodeAddonsSettingsPanel.addonUnavailable`,`{{name}} not available.`,{name:De.get(e)??e})},e))}):null;if(!L&&J.length===0)return Re===null?i(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:O??P(`settings.nodeAddonsSettingsPanel.noAddonsIn`,{scope:o.length>0?`[${o.join(`, `)}]`:P(`settings.nodeAddonsSettingsPanel.theCurrentSelection`,`the current selection`),level:c})}):Re;let ze=Q.isPending;return e(`div`,{className:`space-y-4`,children:[(M||N)&&e(`div`,{className:`border-b border-border pb-2`,children:[M&&i(`h2`,{className:`text-sm font-semibold text-foreground`,children:M}),N&&i(`p`,{className:`text-[11px] text-foreground-subtle mt-0.5`,children:N})]}),J.length>0||L?Re:null,L&&i(ie,{tabs:U.map(e=>({id:e,label:Ce.get(e)??e})),activeId:G,onChange:we,pendingByTab:Le}),Q.isError&&e(`div`,{className:`rounded-md border border-red-500/40 bg-red-500/10 px-3 py-2 text-[11px] text-red-400`,children:[P(`settings.nodeAddonsSettingsPanel.saveFailed`,`Save failed:`),` `,String(Q.error?.message??Q.error)]}),i(te,{tabKey:$?`extra:${G??``}`:`tab:${G??``}`,children:$?$.content:(()=>{let t=K?J.reduce((e,t)=>e+t.schemaWithValues.sections.filter(e=>(e.tab??`general`)===K).length,0):0,n=!!K&&t<=1,r=J.map(e=>({...e,renderedWithValues:{...e.schemaWithValues,sections:e.schemaWithValues.sections.filter(e=>K?(e.tab??`general`)===K:!0).map(e=>n?{...e,title:``,description:void 0}:e)}})).filter(e=>e.renderedWithValues.sections.length>0).toSorted((e,t)=>{let n=e=>{let t=1/0;for(let n of e)typeof n.order==`number`&&n.order<t&&(t=n.order);return t},r=n(e.renderedWithValues.sections),i=n(t.renderedWithValues.sections);return r===i?0:r-i}),a=(j??[]).filter(e=>e.tabId===K),o=a.filter(e=>(e.placement??`before`)===`before`),s=a.filter(e=>e.placement===`after`);return r.length===0&&a.length===0?i(`div`,{className:`text-[11px] text-foreground-subtle italic`,children:O??P(`settings.nodeAddonsSettingsPanel.nothingToConfigureHereFor`,`Nothing to configure here for this node.`)}):e(`div`,{className:`space-y-6`,children:[o.map((e,t)=>i(`div`,{children:e.content},`extra-before-${t}`)),r.length>0&&i(fe,{entries:r,paneStates:Y,displayNames:De,disabled:ze,setPaneRef:je,onPaneStateChange:Ae,onImmediateSave:Pe,onAction:Ne,inline:L||!!E}),s.map((e,t)=>i(`div`,{children:e.content},`extra-after-${t}`))]})})()}),!Se&&i(ae,{pendingCount:Ie,onSave:()=>Q.mutate(),onDiscard:Fe,saving:ze})]})}function fe({entries:t,paneStates:r,displayNames:o,disabled:c,setPaneRef:l,onPaneStateChange:u,onImmediateSave:d,onAction:f,inline:p}){let m=n(()=>[...t].toSorted((e,t)=>{let n=o.get(e.addonId)??e.addonId,r=o.get(t.addonId)??t.addonId;return n.localeCompare(r)}),[t,o]),[h,g]=s(m[0]?.addonId??``);a(()=>{m.length!==0&&(m.find(e=>e.addonId===h)||g(m[0].addonId))},[m,h]);let _=m.find(e=>e.addonId===h)??m[0];if(!_)return null;let v=n(()=>f?(e,t,n,r)=>f(e,t,n,r):void 0,[f]),y=e=>i(C,{ref:l(e.addonId),addonId:e.addonId,schema:e.renderedWithValues,serverValues:e.serverValues,onImmediateSave:d,onStateChange:u,onAction:v,disabled:c},e.addonId);return m.length===1||p?i(`div`,{className:`flex flex-col gap-4`,children:m.map(y)}):e(`div`,{className:`flex flex-col gap-3`,children:[i(`div`,{className:`flex flex-wrap items-center gap-1 border-b border-border shrink-0`,children:m.map(t=>{let n=o.get(t.addonId)??t.addonId,a=t.addonId===_.addonId,s=(r.get(t.addonId)?.pendingKeys.length??0)>0;return e(b,{variant:`unstyled`,type:`button`,onClick:()=>g(t.addonId),className:`relative px-3 py-1.5 text-xs font-medium rounded-t-md transition-colors -mb-px border-b-2 whitespace-nowrap ${a?`text-primary border-primary bg-primary/5`:`text-foreground-subtle border-transparent hover:text-foreground hover:bg-surface-hover`}`,children:[n,s&&i(`span`,{className:`ml-1.5 inline-flex h-1.5 w-1.5 rounded-full bg-amber-400`})]},t.addonId)})}),i(`div`,{className:`space-y-2`,children:m.map(e=>i(`div`,{style:e.addonId===_.addonId?void 0:{display:`none`},children:y(e)},e.addonId))})]})}export{k as n,M as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,K as t,S as n,V as r,Y as i,a,et as o,o as s,t as c,x as l}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CEyXHAdg.js";import{En as u,Fi as d,Pi as f,Sa as p,Tr as m,br as h,gt as g,mn as _,ut as v,zn as y}from"./player-overlays-BZByYYB8.js";import{As as b}from"./client-mnldOm50.js";import{n as x,t as S}from"./ruler-Buxogset.js";import{Ci as C,Gr as w,Hn as T,Of as E,Sd as ee,Ti as D,Vn as O,Xr as k,_f as A,af as j,gd as te,ji as M,m as ne,vf as N,vn as P,yd as F,yf as I}from"./src-DKRp5NPI.js";import{t as L}from"./i18n-ByFr51sS.js";import{t as R}from"./useTranslation-BJr-n0es.js";import{Hr as z,T as B,Ur as V,x as H}from"./index-D5GcZJtC.js";import{t as U}from"./AdminSectionedPage-Xr_hesYw.js";import{t as W}from"./AdminPage-_ITsYONa.js";import{t as G}from"./NodeAddonsSettingsPanel-BtSyXQ4v.js";import{i as K,r as q,t as J}from"./Authentication-CWHj8Czl.js";o();var re={detection:`border-green-500`,detector:`border-green-500`,streaming:`border-blue-500`,decode:`border-blue-500`,decoder:`border-blue-500`,recording:`border-orange-500`,recorder:`border-orange-500`,transcoding:`border-purple-500`,transcoder:`border-purple-500`,restream:`border-cyan-500`,restreamer:`border-cyan-500`,storage:`border-yellow-500`,notification:`border-pink-500`,notifier:`border-pink-500`,faces:`border-indigo-500`},Y={detection:`bg-green-500/5`,detector:`bg-green-500/5`,streaming:`bg-blue-500/5`,decode:`bg-blue-500/5`,decoder:`bg-blue-500/5`,recording:`bg-orange-500/5`,recorder:`bg-orange-500/5`,transcoding:`bg-purple-500/5`,transcoder:`bg-purple-500/5`,restream:`bg-cyan-500/5`,restreamer:`bg-cyan-500/5`,storage:`bg-yellow-500/5`,notification:`bg-pink-500/5`,notifier:`bg-pink-500/5`,faces:`bg-indigo-500/5`};function X({entry:t,actions:r}){let i=t.name.toLowerCase(),a=re[i]??`border-primary`,o=Y[i]??`bg-primary/5`,s=t.providers.find(e=>e.active),c=r?.pendingCapability===t.name;return e(`div`,{className:`rounded-lg border-t-2 border border-border ${a} ${o} p-3 space-y-2`,children:[e(`div`,{className:`flex items-center justify-between gap-2`,children:[e(`span`,{className:`text-xs font-semibold text-foreground capitalize flex items-center gap-1.5`,children:[t.name,c&&n(m,{className:`h-3 w-3 animate-spin text-primary`})]}),n(`span`,{className:`rounded-full px-2 py-0.5 text-[10px] font-medium ${t.mode===`singleton`?`bg-primary/10 text-primary`:`bg-info/10 text-info`}`,children:t.mode})]}),t.mode===`singleton`?n(ie,{entry:t,actions:r,activeProvider:s,isPending:c}):n(ae,{entry:t,actions:r,isPending:c})]})}function ie({entry:t,actions:r,activeProvider:i,isPending:a}){let{t:o}=R();if(!r)return n(`div`,{children:i?e(`div`,{className:`flex items-center gap-1.5 text-[10px] text-foreground`,children:[n(f,{className:`h-3 w-3 text-green-400 shrink-0`}),n(`span`,{className:`font-medium`,children:i.addonName}),n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto`,children:`ACTIVE`})]}):n(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noActiveProvider`,`No active provider`)})});if(t.providers.length===0)return n(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:o(`addons.capabilityMap.noProviders`,`No providers`)});let s=`__inherit__`;return e(`div`,{className:`space-y-2`,children:[n(`div`,{className:`space-y-1`,children:t.providers.map(i=>{let o=i.active;return e(M,{variant:`unstyled`,type:`button`,disabled:a||o,onClick:()=>r.onSelectSingleton(t.name,i.addonId),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${o?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[n(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${o?`border-green-400 bg-green-400`:`border-border`}`}),n(`span`,{className:`font-medium truncate`,children:i.addonName}),o&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},i.addonId)})}),t.perNode&&t.perNode.length>0&&n(`div`,{className:`space-y-2 pt-1 border-t border-border/40`,children:t.perNode.map(i=>{let c=i.hasOverride&&i.resolvedActive?i.resolvedActive:s,l=[{value:s,label:i.resolvedActive?o(`addons.capabilityMap.inheritGlobalWith`,{provider:i.resolvedActive}):o(`addons.capabilityMap.inheritGlobal`)},...i.providers.map(e=>({value:e,label:e}))],u=e=>{e===s?r.onClearNodeSingleton(t.name,i.nodeId):r.onSelectNodeSingleton(t.name,i.nodeId,e)},d=a;return e(`div`,{className:`space-y-0.5`,children:[e(`div`,{className:`text-[9px] font-semibold uppercase tracking-widest text-foreground-subtle/60 px-1.5`,children:[i.nodeId,i.hasOverride&&n(`span`,{className:`ml-1.5 rounded-full bg-primary/10 text-primary px-1 py-0.5 normal-case tracking-normal font-medium`,children:o(`common.override`)})]}),l.map(t=>{let r=c===t.value;return e(M,{variant:`unstyled`,type:`button`,disabled:d||r,onClick:()=>u(t.value),className:`flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-[10px] text-left transition-colors ${r?`bg-green-500/10 text-foreground cursor-default`:`text-foreground-subtle hover:bg-surface-hover hover:text-foreground disabled:opacity-50`}`,children:[n(`span`,{className:`h-2.5 w-2.5 rounded-full border shrink-0 ${r?`border-green-400 bg-green-400`:`border-border`}`}),n(`span`,{className:`font-medium truncate`,children:t.label}),r&&t.value!==s&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium ml-auto shrink-0`,children:`ACTIVE`})]},t.value)})]},i.nodeId)})})]})}function ae({entry:t,actions:r,isPending:i}){let{t:a}=R();if(t.providers.length===0)return n(`div`,{className:`text-[10px] text-foreground-subtle italic`,children:a(`addons.capabilityMap.noProviders`,`No providers`)});if(!r)return n(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[n(`span`,{className:`text-foreground-subtle`,children:t.addonName}),t.active&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium`,children:`ACTIVE`})]},t.addonId))});let o=t.providers.filter(e=>e.active).map(e=>e.addonId),s=(e,n)=>{let i=n?[...new Set([...o,e])]:o.filter(t=>t!==e);r.onToggleCollection(t.name,i)};return n(`div`,{className:`space-y-1`,children:t.providers.map(t=>e(`label`,{className:`flex items-center justify-between gap-2 text-[10px] rounded px-1.5 py-1 transition-colors ${i?`opacity-50`:`hover:bg-surface-hover cursor-pointer`}`,children:[e(`span`,{className:`flex items-center gap-1.5 min-w-0`,children:[n(p,{checked:t.active,disabled:i,onChange:e=>s(t.addonId,e.target.checked),className:`h-3 w-3 accent-green-500 shrink-0`}),n(`span`,{className:`text-foreground truncate`,children:t.addonName})]}),t.active&&n(`span`,{className:`rounded-full bg-green-500/10 text-green-400 px-1.5 py-0.5 font-medium shrink-0`,children:`ACTIVE`})]},t.addonId))})}function Z({capabilities:e,actions:t}){let{t:r}=R();return e.length===0?n(`div`,{className:`text-xs text-foreground-subtle text-center py-8`,children:r(`addons.capabilityMap.noCapabilitiesRegistered`,`No capabilities registered`)}):n(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3`,children:e.map(e=>n(X,{entry:e,actions:t},e.name))})}var oe=[`capabilities`,`listCapabilities`];function se(e){return e===`singleton`||e===`collection`}function ce(e){let t=e.indexOf(`@`);return t===-1?L.t(`system.capabilities.providerHub`,{addonId:e}):`${e.slice(0,t)} (${e.slice(t+1)})`}function le(e,t){return{name:e.name,mode:t,providers:e.providers.map(n=>({addonId:n,addonName:ce(n),active:t===`singleton`?e.activeProvider===n:!e.disabledProviders.includes(n)})),...t===`singleton`&&e.perNode?{perNode:e.perNode}:{}}}function ue(){let{t:r}=R(),o=g(),[s,l]=i(null),[u,p]=i(null),m=a({queryKey:oe,queryFn:()=>o.trpcClient.capabilities.listCapabilities.query()}),h=t(()=>{let e=(m.data??[]).flatMap(e=>se(e.mode)?[le(e,e.mode)]:[]),t=e.filter(e=>e.mode===`singleton`).toSorted((e,t)=>e.name.localeCompare(t.name)),n=e.filter(e=>e.mode===`collection`).toSorted((e,t)=>e.name.localeCompare(t.name));return[...t,...n]},[m.data]),v=t(()=>h.filter(e=>e.mode===`singleton`),[h]),y=t(()=>h.filter(e=>e.mode===`collection`),[h]),b=c({mutationFn:e=>o.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId}),onMutate:e=>{l(e.capName),p(null)},onSuccess:async(e,t)=>{p({kind:`success`,message:r(`system.capabilities.isNowActive`,`{{capName}} → {{addonId}} is now active.`,{capName:t.capName,addonId:t.addonId})}),await m.refetch()},onError:(e,t)=>{p({kind:`error`,message:r(`system.capabilities.failedToSet`,{cap:t.capName,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),x=c({mutationFn:e=>o.trpcClient.capabilities.setActiveSingleton.mutate({capability:e.capName,addonId:e.addonId,nodeId:e.nodeId}),onMutate:e=>{l(e.capName),p(null)},onSuccess:async(e,t)=>{p({kind:`success`,message:`${t.capName} @ ${t.nodeId} → ${t.addonId}.`}),await m.refetch()},onError:(e,t)=>{p({kind:`error`,message:r(`system.capabilities.failedToSetOnNode`,{cap:t.capName,node:t.nodeId,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),S=c({mutationFn:e=>o.trpcClient.capabilities.clearSingletonNodeOverride.mutate({capability:e.capName,nodeId:e.nodeId}),onMutate:e=>{l(e.capName),p(null)},onSuccess:async(e,t)=>{p({kind:`success`,message:r(`system.capabilities.nowInheritsTheGlobalDefault`,`{{capName}} @ {{nodeId}} now inherits the global default.`,{capName:t.capName,nodeId:t.nodeId})}),await m.refetch()},onError:(e,t)=>{p({kind:`error`,message:r(`system.capabilities.failedToClearOnNode`,{cap:t.capName,node:t.nodeId,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),w=c({mutationFn:e=>o.trpcClient.capabilities.setCollectionEnabledProviders.mutate({capability:e.capName,enabledAddonIds:[...e.enabledAddonIds]}),onMutate:e=>{l(e.capName),p(null)},onSuccess:async(e,t)=>{p({kind:`success`,message:r(`system.capabilities.providerSEnabled`,`{{capName}}: {{length}} provider(s) enabled.`,{capName:t.capName,length:t.enabledAddonIds.length})}),await m.refetch()},onError:(e,t)=>{p({kind:`error`,message:r(`system.capabilities.failedToUpdate`,{cap:t.capName,error:e instanceof Error?e.message:r(`common.unknownError`)})})},onSettled:()=>l(null)}),T={onSelectSingleton:(e,t)=>b.mutate({capName:e,addonId:t}),onSelectNodeSingleton:(e,t,n)=>x.mutate({capName:e,nodeId:t,addonId:n}),onClearNodeSingleton:(e,t)=>S.mutate({capName:e,nodeId:t}),onToggleCollection:(e,t)=>w.mutate({capName:e,enabledAddonIds:t}),pendingCapability:s};return e(W,{embedded:!0,icon:_,title:r(`system.capabilities.capabilities`,`Capabilities`),subtitle:r(`system.capabilities.chooseWhichProviderIsActive`,`Choose which provider is active for each system capability. Singleton caps pick exactly one provider; collection caps enable a set.`),children:[u&&e(`div`,{className:`flex items-center gap-2 rounded-md border px-3 py-2 text-xs ${u.kind===`success`?`border-success/30 bg-success/10 text-success`:`border-danger/40 bg-danger/10 text-danger`}`,children:[u.kind===`success`?n(f,{className:`h-3.5 w-3.5 shrink-0`}):n(d,{className:`h-3.5 w-3.5 shrink-0`}),n(`span`,{children:u.message})]}),m.isLoading&&n(`div`,{className:`flex items-center justify-center py-16`,children:n(`div`,{className:`animate-spin h-6 w-6 border-2 border-primary border-t-transparent rounded-full`})}),m.isError&&!m.isLoading&&n(C,{title:r(`system.capabilities.failedToLoadCapabilities`,`Failed to load capabilities`),message:m.error instanceof Error?m.error.message:r(`system.capabilities.unknownError`,`Unknown error`),onRetry:()=>void m.refetch()}),!m.isLoading&&!m.isError&&h.length===0&&n(`div`,{className:`text-xs text-foreground-subtle text-center py-16`,children:r(`system.capabilities.noCapabilitiesRegistered`,`No capabilities registered.`)}),!m.isLoading&&!m.isError&&h.length>0&&e(`div`,{className:`space-y-6`,children:[v.length>0&&e(`section`,{className:`space-y-2`,children:[n(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:r(`system.capabilities.singletonPickOneProvider`,`Singleton — pick one provider`)}),n(Z,{capabilities:v,actions:T})]}),y.length>0&&e(`section`,{className:`space-y-2`,children:[n(`h2`,{className:`text-[11px] font-semibold uppercase tracking-widest text-foreground-subtle/70`,children:r(`system.capabilities.collectionEnableASet`,`Collection — enable a set`)}),n(Z,{capabilities:y,actions:T})]})]})]})}var de={escape:`Esc`,enter:`Enter`};function fe(e,t){let n=I(e),r=de[n.key]??n.key.toUpperCase();return t===`mac`?`${n.alt?`⌥`:``}${n.shift?`⇧`:``}${n.mod?`⌘`:``}${r}`:[...n.mod?[`Ctrl`]:[],...n.alt?[`Alt`]:[],...n.shift?[`Shift`]:[],r].join(`+`)}function pe(){let{t}=R(),r=A(),i=N();return n(O,{headingId:`settings-hotkeys`,title:t(`systemPage.settings.hotkeys.title`,`Keyboard shortcuts`),icon:x,testId:`settings-hotkeys`,children:e(`div`,{className:`space-y-2 p-3`,children:[n(`p`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.settings.hotkeys.description`,`The shortcuts active on this page. They cannot be changed.`)}),r.length===0?n(k,{title:t(`systemPage.settings.hotkeys.empty`,`No shortcuts are active on this page.`)}):r.map(e=>n(T,{label:e.label??t(`systemPage.settings.hotkeys.unnamed`,`Shortcut`),children:n(`kbd`,{className:`rounded-md border border-border bg-surface px-1.5 py-0.5 font-mono text-xs text-foreground`,children:fe(e.combo,i)})},`${e.scope}|${e.combo}`))]})})}o();var me=[[`system`]];function Q(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function he(){let{t}=R(),a=s(),o=F(),c=ee(),l=te(),[u,d]=i(``),[f,p]=i(``),[m,g]=i(null),_=o.data?.location??null;r(()=>{d(_===null?``:Q(_.latitude)),p(_===null?``:Q(_.longitude))},[_]);let v=async()=>{await a.invalidateQueries({queryKey:me})},b=async e=>{e.preventDefault();let t=Number(u),n=Number(f);if(u.trim()===``||f.trim()===``){g(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){g(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){g(`Longitude must be between -180 and 180 decimal degrees.`);return}g(null),await c.mutateAsync({latitude:t,longitude:n}),await v()},x=async()=>{g(null),await c.mutateAsync(null),await v()},S=async()=>{g(null),await l.mutateAsync(),await v()},C=c.isPending||l.isPending||o.isLoading;return e(w,{className:`space-y-3`,children:[e(`div`,{className:`flex items-start justify-between gap-3`,children:[e(`div`,{className:`flex items-start gap-2`,children:[n(h,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),n(`div`,{children:n(`h3`,{className:`text-sm font-medium`,children:t(`settings.siteLocationCard.siteLocation`,`Site location`)})})]}),_===null?n(D,{variant:`warning`,children:t(`settings.siteLocationCard.notConfigured`,`Not configured`)}):n(D,{variant:_.source===`operator-set`?`success`:`info`,children:_.source===`operator-set`?t(`settings.siteLocationCard.setByYou`,`Set by you`):t(`settings.siteLocationCard.derivedFromIp`,`Derived from IP`)})]}),_?.label!==void 0&&_.label!==``?n(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.detectedNear`,{place:_.label})}):null,_===null&&o.data?.derivationAttemptedAt!==null?e(`p`,{className:`text-xs text-warning`,children:[t(`settings.siteLocationCard.automaticDetectionFromThePublic`,`Automatic detection from the public IP did not succeed`),o.data?.derivationError!==null&&o.data?.derivationError!==void 0?`: ${o.data.derivationError}`:`.`,` `,t(`settings.siteLocationCard.itIsNotRetriedOn`,`It is not retried on its own — enter the coordinates, or press Detect.`)]}):null,e(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:b,children:[e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[n(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.latitude`,`Latitude`)}),n(j,{className:`w-40`,value:u,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>d(e.target.value),"aria-label":t(`settings.siteLocationCard.latitude`,`Latitude`)})]}),e(`label`,{className:`flex flex-col gap-1 text-xs`,children:[n(`span`,{className:`text-muted-foreground`,children:t(`settings.siteLocationCard.longitude`,`Longitude`)}),n(j,{className:`w-40`,value:f,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>p(e.target.value),"aria-label":t(`settings.siteLocationCard.longitude`,`Longitude`)})]}),n(M,{type:`submit`,disabled:C,children:t(`common.save`,`Save`)}),e(M,{type:`button`,variant:`ghost`,disabled:C,onClick:S,children:[n(y,{className:`h-3.5 w-3.5 mr-1`}),t(`settings.siteLocationCard.detectFromIp`,`Detect from IP`)]}),_===null?null:n(M,{type:`button`,variant:`ghost`,disabled:C,onClick:x,children:t(`settings.siteLocationCard.clear`,`Clear`)})]}),m===null?null:n(`p`,{className:`text-xs text-danger`,children:m}),n(`p`,{className:`text-xs text-muted-foreground`,children:t(`settings.siteLocationCard.wgs84DecimalDegreesDetectAsks`,`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`)})]})}o();function ge(e){return b.some(t=>t===e)}function $(e){return P.some(t=>t===e)}function _e(){let{t}=R(),r=ne(),[a,o]=i(!1),[s,c]=i(null),l=e=>{o(!0),c(null),r.update(e).catch(e=>c(e instanceof Error?e.message:String(e))).finally(()=>o(!1))},u=r.status!==`ok`||!r.writable||a;return n(O,{headingId:`settings-units`,title:t(`systemPage.myAccess.units.title`,`Units`),icon:S,testId:`settings-units`,children:e(`div`,{className:`space-y-2 p-3`,children:[n(`p`,{className:`text-xs text-foreground-subtle`,children:t(`systemPage.myAccess.units.description`,`How readings are shown to you, on every device you sign in on. Stored values do not change.`)}),r.status===`error`&&n(C,{message:t(`systemPage.myAccess.units.loadError`,`Your unit preferences could not be read.`)}),r.status===`ok`&&!r.writable&&n(C,{message:t(`systemPage.myAccess.units.unreadable`,`The saved unit preferences are in a format this version cannot read, so they are left untouched.`)}),s!==null&&n(C,{message:s}),n(T,{label:t(`systemPage.myAccess.units.temperature`,`Temperature`),children:n(v,{"aria-label":t(`systemPage.myAccess.units.temperature`,`Temperature`),value:r.value.temperature,disabled:u,onChange:e=>{let t=e.target.value;$(t)&&l({temperature:t})},options:[{value:`celsius`,label:t(`systemPage.myAccess.units.celsius`,`Celsius (°C)`)},{value:`fahrenheit`,label:t(`systemPage.myAccess.units.fahrenheit`,`Fahrenheit (°F)`)}]})}),n(T,{label:t(`systemPage.myAccess.units.system`,`Other measurements`),children:n(v,{"aria-label":t(`systemPage.myAccess.units.system`,`Other measurements`),value:r.value.system,disabled:u,onChange:e=>{let t=e.target.value;ge(t)&&l({system:t})},options:[{value:`metric`,label:t(`systemPage.myAccess.units.metric`,`Metric (km/h, hPa, mm)`)},{value:`imperial`,label:t(`systemPage.myAccess.units.imperial`,`Imperial (mph, inHg, in)`)}]})})]})})}var ve=`system-config`;function ye(){let{t}=R(),{nodes:r,isLoading:i}=E(),a=r.find(e=>e.isHub&&e.isOnline),o=(a?.addons.map(e=>e.addonId)??[]).filter(e=>e!==ve);return e(W,{embedded:!0,children:[n(he,{}),i?n(`div`,{className:`text-foreground-subtle text-sm py-12 text-center`,children:t(`admin.system.settings.loadingHubTopology`,`Loading hub topology…`)}):a?e(l,{children:[n(K,{omitSectionIds:[J],emptyMessage:t(`admin.system.settings.bootstrapUnavailable`,`Not available — the addon that owns the server settings did not answer.`)}),o.length===0?n(`div`,{className:`text-foreground-subtle text-sm py-12 text-center`,children:t(`admin.system.settings.noAddonsInstalledOnThe`,`No addons installed on the hub yet.`)}):n(G,{nodeId:a.id,addonIds:o,level:`global`,omitSectionIds:[J,q]})]}):e(`div`,{className:`flex flex-col items-center justify-center text-foreground-subtle text-sm gap-2 py-12`,children:[n(u,{className:`h-8 w-8 opacity-30`}),n(`p`,{children:t(`admin.system.settings.noOnlineHubNodeFound`,`No online hub node found.`)}),n(`p`,{className:`text-xs`,children:t(`admin.system.settings.settingsWillAppearOnceThe`,`Settings will appear once the hub is reachable.`)})]}),e(`section`,{"aria-labelledby":`settings-per-user`,className:`mt-3 sm:mt-4 space-y-3 sm:space-y-4`,children:[n(`h2`,{id:`settings-per-user`,className:`text-xs font-semibold uppercase tracking-wide text-foreground-subtle`,children:t(`systemPage.settings.perUser`,`Your settings`)}),n(_e,{}),n(pe,{})]})]})}function be(){let{t:e}=R(),t=H(`/system/settings`,{t:e,isAdmin:!0})??{icon:u,title:e(`system.systemNav`,`System`)},{search:r,hash:i}=V();return new URLSearchParams(r).get(`tab`)===`secrets`?n(z,{replace:!0,to:`${B(r)}${i}`}):n(U,{icon:t.icon,title:t.title,defaultSection:`settings`,sectionsLabel:`${t.title} sections`,sections:[{id:`settings`,label:e(`system.system.settings`,`Settings`),content:n(ye,{})},{id:`capabilities`,label:e(`system.system.capabilities`,`Capabilities`),content:n(ue,{})}]})}export{be as SystemPage};
|