@lacneu/atrium 0.54.0 → 0.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccessTab-DY-_W44L.js → AccessTab-Bra1w9mI.js} +1 -1
- package/dist/assets/{AdvancedFilter-DyxLXUxk.js → AdvancedFilter-CXI70fDB.js} +1 -1
- package/dist/assets/{AgentFilesTab-BZ-sJ98U.js → AgentFilesTab--eTTThOy.js} +1 -1
- package/dist/assets/{AnomaliesTab-CJteiNE_.js → AnomaliesTab-lkmO_g5K.js} +1 -1
- package/dist/assets/{AuditTab-34knmXJb.js → AuditTab-BJSOjXf5.js} +1 -1
- package/dist/assets/{BridgeTab-DZW3Ex7N.js → BridgeTab-DSY7hdDk.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-CPinuj9W.js → ChatDefaultsTab-vjRy3Av7.js} +1 -1
- package/dist/assets/{DataTableShell-D64nWDBv.js → DataTableShell-DTw-rOw3.js} +1 -1
- package/dist/assets/{DetailChips-BkCxA-j5.js → DetailChips-BviEGC5c.js} +1 -1
- package/dist/assets/{FeedbacksTab-RJRY0B5q.js → FeedbacksTab-6qgIgk4h.js} +1 -1
- package/dist/assets/{FieldLabel-9EnuRpXB.js → FieldLabel-B-ZBXJZE.js} +1 -1
- package/dist/assets/{FilesTab-DNBtXjVq.js → FilesTab-DDPMBYeS.js} +1 -1
- package/dist/assets/{FilterBar-CwLzwvAh.js → FilterBar-CTBZM__z.js} +1 -1
- package/dist/assets/{GroupsTab-CV--ambi.js → GroupsTab-DMuGAp-1.js} +1 -1
- package/dist/assets/{InstancesTab-BoGr0E6E.js → InstancesTab-HXTzTikJ.js} +1 -1
- package/dist/assets/{IntegrationsTab-DAHHn1ZI.js → IntegrationsTab-C1dCcfJI.js} +1 -1
- package/dist/assets/{KpiTab-CzEvdGve.js → KpiTab-Gr9INsJ6.js} +1 -1
- package/dist/assets/{PreferencesTab-CiLl-rr8.js → PreferencesTab-BBWh7JJ_.js} +1 -1
- package/dist/assets/{PromptInjectionsTab-xyD6EfPx.js → PromptInjectionsTab-DPW4ZK_F.js} +1 -1
- package/dist/assets/{RolesTab-C6ONFLVw.js → RolesTab-C4CjCfXQ.js} +1 -1
- package/dist/assets/{ScheduledTab-Cu7N8tdX.js → ScheduledTab-iq39kp5Z.js} +1 -1
- package/dist/assets/{ServiceAccountsTab-Whz-rzfb.js → ServiceAccountsTab-Bg5IYwHt.js} +1 -1
- package/dist/assets/{SubAgentReportsTab-C-zd821N.js → SubAgentReportsTab-B8lPe9Yy.js} +1 -1
- package/dist/assets/{ThemeShowroom-H18edgy5.js → ThemeShowroom-CmvPT6pZ.js} +1 -1
- package/dist/assets/{TimeRangePicker-DVJCx8F-.js → TimeRangePicker-C3vWWVJs.js} +1 -1
- package/dist/assets/{TracesTab-Bh31C3II.js → TracesTab-BX1G_6or.js} +1 -1
- package/dist/assets/{UsersTab-CYrE-Dl0.js → UsersTab-B2gKsvUO.js} +1 -1
- package/dist/assets/{VoiceTab-BZ-l-_P4.js → VoiceTab-RHH5sbcg.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-CaUQ2KWd.js → highlighted-body-OFNGDK62-DoH8U-bo.js} +1 -1
- package/dist/assets/{index-Bk18lEVJ.js → index-BoGVkzmD.js} +7 -7
- package/dist/assets/mermaid-GHXKKRXX-Cox7MkSV.js +1 -0
- package/dist/assets/{pdf-D_MeH9g_.js → pdf-DgVAKiaL.js} +1 -1
- package/dist/assets/{tabs-eWt8KqrV.js → tabs-BQAkx85P.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/mermaid-GHXKKRXX-DnNEf9Hf.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$C as r,JC as i,KC as a,MM as o,QC as s,XC as c,YC as l,ZC as u,aw as d,c as f,co as p,do as m,ew as h,fo as g,iw as _,jM as v,kM as y,lo as b,mo as x,nw as S,oo as C,po as w,qC as T,rw as E,so as D,tw as O,uo as k}from"./dist-Bh78J5oj.js";import{t as A}from"./button-BWtKy7q6.js";import{ct as j,lt as M,p as N}from"./index-
|
|
1
|
+
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$C as r,JC as i,KC as a,MM as o,QC as s,XC as c,YC as l,ZC as u,aw as d,c as f,co as p,do as m,ew as h,fo as g,iw as _,jM as v,kM as y,lo as b,mo as x,nw as S,oo as C,po as w,qC as T,rw as E,so as D,tw as O,uo as k}from"./dist-Bh78J5oj.js";import{t as A}from"./button-BWtKy7q6.js";import{ct as j,lt as M,p as N}from"./index-BoGVkzmD.js";var P=e(t(),1),F=n();function I(){let e=o(f.integrations.status.status,{}),t=v(f.admin.setIntegrationConfig),[n,p]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&p(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:d()});let m=n,y=(e,t,n)=>p({...m,[e]:{...m[e],[t]:n}}),b=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,F.jsx)(`strong`,{children:E()}),` `,S()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:h()}):(0,F.jsx)(j,{variant:`outline`,children:r()}),note:s(),children:[(0,F.jsx)(R,{label:c(),children:(0,F.jsx)(M,{value:m.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>y(`langfuse`,`host`,e.target.value),onBlur:()=>b(`langfuse`,{host:m.langfuse.host??``})})}),(0,F.jsx)(z,{label:a(),checked:m.langfuse.enabled??!0,onChange:e=>{y(`langfuse`,`enabled`,e),b(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:h()}):(0,F.jsx)(j,{variant:`outline`,children:r()}),note:u(),children:[(0,F.jsx)(R,{label:l(),children:(0,F.jsx)(M,{value:m.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>y(`opik`,`baseUrl`,e.target.value),onBlur:()=>b(`opik`,{baseUrl:m.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:i(),children:(0,F.jsx)(M,{value:m.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||T(),onChange:e=>y(`opik`,`workspace`,e.target.value),onBlur:()=>b(`opik`,{workspace:m.opik.workspace??``})})}),(0,F.jsx)(z,{label:a(),checked:m.opik.enabled??!0,onChange:e=>{y(`opik`,`enabled`,e),b(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:h()}):(0,F.jsx)(j,{variant:`outline`,children:x()}),note:w(),children:[(0,F.jsx)(R,{label:g(),children:(0,F.jsx)(M,{value:m.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>y(`otlp`,`endpoint`,e.target.value),onBlur:()=>b(`otlp`,{endpoint:m.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:a(),checked:m.otlp.enabled??!0,onChange:e=>{y(`otlp`,`enabled`,e),b(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=y(f.integrations.otlpSecret.setOtlpHeaders),n=v(f.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(null),[s,c]=(0,P.useState)(!1),l=async()=>{c(!0),o(null);try{await t({headersJson:r}),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{c(!1)}};return(0,F.jsxs)(R,{label:m(),children:[(0,F.jsx)(M,{value:r,placeholder:e?k():b(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:s||r.trim().length===0,onClick:()=>void l(),children:p()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:s,onClick:()=>void n({}),children:D()}):null]}),a?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:C()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{Am as r,Bw as i,Dm as a,Em as o,Fm as s,Hw as c,Im as l,Lm as u,MM as d,Mm as f,Mw as p,Nm as m,Om as h,Pm as g,Tm as _,Vw as v,c as y,jm as b,jw as x,km as S,pT as C,wm as w,zw as T}from"./dist-Bh78J5oj.js";import{Xt as E,Yt as ee,a as te,n as ne,r as re,xt as D}from"./index-
|
|
1
|
+
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{Am as r,Bw as i,Dm as a,Em as o,Fm as s,Hw as c,Im as l,Lm as u,MM as d,Mm as f,Mw as p,Nm as m,Om as h,Pm as g,Tm as _,Vw as v,c as y,jm as b,jw as x,km as S,pT as C,wm as w,zw as T}from"./dist-Bh78J5oj.js";import{Xt as E,Yt as ee,a as te,n as ne,r as re,xt as D}from"./index-BoGVkzmD.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-DXiwL4WM.js";import{n as N,t as P}from"./TimeRangePicker-C3vWWVJs.js";var F=e(t(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=d(y.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=d(y.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:C()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:c()}),(0,I.jsx)(j,{children:i()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[x(),` p50 `,R(s.cP50),` `,v()]}),(0,I.jsxs)(`span`,{children:[p(),` p50 `,R(s.aP50),` `,v()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":c(),children:[(0,I.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:u(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:l(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:s(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:g(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:m(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:f(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=E({from:`/settings/kpi`}),t=ee({from:`/settings/kpi`}),n=re(e.from,e.to,ne,`now`),i=e=>void t({search:t=>({...t,...te(e)})}),{from:a,to:o}=N(n),{rowLimit:s,buckets:c}=K(a,o),l=d(y.kpi.listKpis,{limit:s,filter:{from:a,to:o}}),u=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>c&&e.set(t,n.slice(n.length-c));return e},[l,c]),f=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[b(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:r()})]}),(0,I.jsx)(J,{value:n,onChange:i})]});return l===void 0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]}):l.length===0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:h()})]}):(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(u.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:u.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:a({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:o()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:_({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":w({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$O as r,Ak as i,CM as a,Ck as o,D as s,Dk as c,Ek as l,M as u,MM as d,Mk as f,N as ee,Nk as te,Ok as ne,Pk as re,QO as ie,Sk as ae,Tk as oe,XO as se,Xx as ce,YO as le,ZO as ue,_ as p,_k as m,aM as h,ak as de,bk as fe,c as g,cM as pe,ck as _,dM as v,dk as y,ek as b,f as x,fM as S,fk as C,g as w,gk as T,h as E,hM as D,hk as O,ik as k,jM as A,jk as j,kk as M,lM as N,lk as P,m as F,mM as I,mk as L,n as R,nk as z,oM as B,ok as me,p as he,pM as ge,pk as _e,rk as ve,sM as ye,sk as be,tk as xe,uM as Se,uk as V,v as Ce,vM as we,vk as Te,wk as Ee,xk as De,y as Oe,yk as ke}from"./dist-Bh78J5oj.js";import{t as H}from"./button-BWtKy7q6.js";import{A as Ae,C as je,S as U,b as Me,bt as Ne,ct as W,lt as G,p as K,vt as Pe,w as Fe,x as Ie,xt as q,yt as Le,z as Re}from"./index-
|
|
1
|
+
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$O as r,Ak as i,CM as a,Ck as o,D as s,Dk as c,Ek as l,M as u,MM as d,Mk as f,N as ee,Nk as te,Ok as ne,Pk as re,QO as ie,Sk as ae,Tk as oe,XO as se,Xx as ce,YO as le,ZO as ue,_ as p,_k as m,aM as h,ak as de,bk as fe,c as g,cM as pe,ck as _,dM as v,dk as y,ek as b,f as x,fM as S,fk as C,g as w,gk as T,h as E,hM as D,hk as O,ik as k,jM as A,jk as j,kk as M,lM as N,lk as P,m as F,mM as I,mk as L,n as R,nk as z,oM as B,ok as me,p as he,pM as ge,pk as _e,rk as ve,sM as ye,sk as be,tk as xe,uM as Se,uk as V,v as Ce,vM as we,vk as Te,wk as Ee,xk as De,y as Oe,yk as ke}from"./dist-Bh78J5oj.js";import{t as H}from"./button-BWtKy7q6.js";import{A as Ae,C as je,S as U,b as Me,bt as Ne,ct as W,lt as G,p as K,vt as Pe,w as Fe,x as Ie,xt as q,yt as Le,z as Re}from"./index-BoGVkzmD.js";import{t as ze}from"./localePickerView-C2RmOS86.js";var J=e(t(),1),Y=n();function Be({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:R(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,Y.jsx)(`span`,{className:R(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var X=[{id:`messages`,label:()=>re()},{id:`composer`,label:()=>te()},{id:`sidebar`,label:()=>f()},{id:`notifications`,label:()=>O()},{id:`other`,label:()=>j()}],Z={showSource:{category:`messages`,label:()=>i(),help:()=>M()},showReport:{category:`messages`,label:()=>ne(),help:()=>c()},copyAssistant:{category:`messages`,label:()=>l()},copyUser:{category:`messages`,label:()=>oe()},showDelete:{category:`messages`,label:()=>Ee()},showTools:{category:`messages`,label:()=>o(),help:()=>ae()},voiceInput:{category:`composer`,label:()=>De(),help:()=>fe()},showUsage:{category:`composer`,label:()=>ke(),help:()=>Te()},autoReadAloud:{category:`composer`,label:()=>ee(),help:()=>u()},showChatAge:{category:`sidebar`,label:()=>m(),help:()=>T()},notifSound:{category:`notifications`,label:()=>L(),help:()=>_e()},notifSystem:{category:`notifications`,label:()=>C(),help:()=>y()},replySound:{category:`notifications`,label:()=>V(),help:()=>P()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ve(e,t){let n=Q(t.trim()),r=new Map(X.map(e=>[e.id,e.label()])),i=new Map(X.map(e=>[e.id,[]]));for(let t of e){let e=Z[t],a=e?.category??`other`;n&&!Q(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return X.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var He=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],Ue={voiceInput:`voiceInput`};function We(e){return He.includes(e)}function $(e){return e===`admin`}function Ge(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Ke(e){return e===`on`?!0:e===`off`?!1:null}function qe(e){return We(e)?Ue[e]:void 0}var Je={voiceInput:()=>r()};function Ye({prefKey:e,ui:t}){let n=A(g.admin.setUiPrefDefault),r=A(g.admin.setFeatureEnabled),i=qe(e),a=i?Je[e]?.():void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,Y.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ve()}),(0,Y.jsxs)(Me,{value:Ge(t.defaults[e]),onValueChange:t=>void n({key:e,value:Ke(t)}),children:[(0,Y.jsx)(je,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(Fe,{})}),(0,Y.jsxs)(Ie,{children:[(0,Y.jsx)(U,{value:`on`,children:ue()}),(0,Y.jsx)(U,{value:`off`,children:se()}),(0,Y.jsx)(U,{value:`inherit`,children:le()})]})]}),i?(0,Y.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,Y.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":z()}),z()]}):null]}),a?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Xe({current:e,enabled:t}){let n=A(g.me.setDictationShortcut),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Le(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,Y.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[Oe(),e?(0,Y.jsx)(W,{variant:`secondary`,children:Ne(e,Pe())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:a?w():r?p():Ce()})]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:x()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?he():e?F():E()})]})]})}function Ze(){let[e,t]=(0,J.useState)(``),[n,r]=(0,J.useState)(!1),i=d(g.me.getMe,{host:q}),o=i?.ui,c=$(i?.role)&&n,l=A(g.me.setUiPref).withOptimisticUpdate(Ae),u=(0,J.useMemo)(()=>o?Ve(Object.keys(o.effective),e):[],[o,e]);return o?(0,Y.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,Y.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,Y.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":k()}),k()]}):null,c?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:xe()}),(0,Y.jsx)(`p`,{children:b()}),(0,Y.jsx)(`p`,{children:ie()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:_(),"aria-label":_(),className:`mb-2`}),u.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:be()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:u.map(e=>(0,Y.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,Y.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Z[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],u=o.userOverrides[e]!==void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,Y.jsx)(W,{variant:`outline`,children:me()}):u?(0,Y.jsx)(W,{variant:`secondary`,children:s()}):null]}),r?(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&u?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:de()}):null,(0,Y.jsx)(Be,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),l({key:e,value:t})},"aria-label":n})]}),c?(0,Y.jsx)(Ye,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,Y.jsx)(Xe,{current:i?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:a()})}function Qe(){let e=d(g.me.getMe,{host:q}),t=A(g.me.setLocale),n=A(g.me.setMyName),r=Re(),i=e?.locale??`default`,a=e?.name??``,[o,s]=(0,J.useState)(null),c=o??a,l=c.trim()!==a.trim();async function u(){try{await n({name:c}),s(null),r.success(v())}catch(e){r.error(Se(),e)}}return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:D()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:I()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:c,maxLength:120,placeholder:ge(),onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l&&(e.preventDefault(),u())}}),(0,Y.jsx)(H,{size:`sm`,disabled:!l,onClick:()=>void u(),children:ce()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:S()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:N()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[ze().map(e=>(0,Y.jsx)(H,{variant:i===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(H,{variant:i==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:we()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ye()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:B()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(0,Y.jsx)(Ze,{})]})]})}export{Qe as PreferencesTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$h as r,Cg as i,Ft as a,Ji as o,MM as s,Nt as c,Pt as l,Qh as u,Qi as d,Sg as f,Xh as p,Xi as m,Yi as h,Zh as g,Zi as _,ag as v,c as y,cg as b,dg as x,dr as S,eg as C,fg as w,fr as T,hg as E,ig as D,jM as O,lg as ee,lr as k,mg as te,mr as ne,ng as re,og as ie,pg as ae,pr as A,rg as j,sg as M,tg as N,ug as P,ur as F}from"./dist-Bh78J5oj.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as H,u as U}from"./FieldLabel-
|
|
1
|
+
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$h as r,Cg as i,Ft as a,Ji as o,MM as s,Nt as c,Pt as l,Qh as u,Qi as d,Sg as f,Xh as p,Xi as m,Yi as h,Zh as g,Zi as _,ag as v,c as y,cg as b,dg as x,dr as S,eg as C,fg as w,fr as T,hg as E,ig as D,jM as O,lg as ee,lr as k,mg as te,mr as ne,ng as re,og as ie,pg as ae,pr as A,rg as j,sg as M,tg as N,ug as P,ur as F}from"./dist-Bh78J5oj.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as H,u as U}from"./FieldLabel-B-ZBXJZE.js";import{t as W}from"./button-BWtKy7q6.js";import{C as G,S as K,b as q,p as J,w as Y,x as X,xt as oe,z as se}from"./index-BoGVkzmD.js";import{r as Z,t as ce}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=e(t(),1),$=n(),ue={media_delivery:{label:P,help:ee},documentary_fetch:{label:b,help:M},inbound_files:{label:ie,help:v},history_summary:{label:d,help:_},file_curation:{label:ne,help:A}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
2
|
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
3
|
Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
|
|
4
4
|
- [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:u,references:g,files:p,previous_summary:m,new_messages:h,max_chars:o,file_name:T,budget_chars:S,feedback:F,content:k};function pe(){let e=s(y.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:j()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:E(),help:te()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:D()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsx)(X,{children:e.map(e=>(0,$.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=O(y.admin.upsertInstanceConfig),n=se(),r=s(y.me.getMe,{host:oe}),o=e.config??{},u=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[d,p]=(0,Q.useState)(()=>R(o,u));(0,Q.useEffect)(()=>{p(R(o,u))},[u,e._id]);let[m,h]=(0,Q.useState)(!1),g=d.promptInjections,_=(e,t)=>p({...d,promptInjections:{...g,[e]:{...g[e],...t}}});async function v(){h(!0);try{await t({instanceId:e._id,config:V(d,o,u)})}catch(e){n.error(f(),e)}finally{h(!1)}}async function b(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(f(),e)}}let x=e.config?.contentLocale??`default`,S=ce[Z(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:a()}),(0,$.jsxs)(q,{value:x,onValueChange:e=>void b(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{value:`default`,children:c({locale:S})}),le().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:l()})]}),U.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:g[e]??{enabled:!0,template:z[e].defaultTemplate[u]},contentLocale:u,onChange:t=>_(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void v(),disabled:m,children:i()})})]})}function he({injKey:e,def:t,i18n:n,row:i,contentLocale:a,onChange:o}){let[s,c]=(0,Q.useState)(!1),l=i.template.trim()!==t.defaultTemplate[a],u=t.togglable&&!i.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),f=I(e,i,a),p=f?L(f,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(J,{checked:i.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:w()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>o({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:x()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?N():re()}),l&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:ae()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:C()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:r()})})]})}export{pe as PromptInjectionsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$y as r,Ay as ee,By as i,Cy as a,Dy as o,Ey as te,Gy as s,Hy as c,Iy as l,Jy as u,Ky as d,Ly as f,MM as p,Oy as m,Qy as h,Rr as g,Ry as _,Sy as v,Ty as y,Uy as b,Vy as x,Wy as S,Xy as ne,Yy as re,Zy as ie,ab as C,c as w,cb as T,db as E,eb as D,ib as O,jM as k,ky as A,lb as j,nb as M,ob as N,qy as P,rb as F,sb as I,tb as L,ub as R,wy as ae,zy as z}from"./dist-Bh78J5oj.js";import{t as B}from"./button-BWtKy7q6.js";import{B as V,Rt as H,ct as U,lt as W,p as G,u as K,z as q}from"./index-
|
|
1
|
+
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$y as r,Ay as ee,By as i,Cy as a,Dy as o,Ey as te,Gy as s,Hy as c,Iy as l,Jy as u,Ky as d,Ly as f,MM as p,Oy as m,Qy as h,Rr as g,Ry as _,Sy as v,Ty as y,Uy as b,Vy as x,Wy as S,Xy as ne,Yy as re,Zy as ie,ab as C,c as w,cb as T,db as E,eb as D,ib as O,jM as k,ky as A,lb as j,nb as M,ob as N,qy as P,rb as F,sb as I,tb as L,ub as R,wy as ae,zy as z}from"./dist-Bh78J5oj.js";import{t as B}from"./button-BWtKy7q6.js";import{B as V,Rt as H,ct as U,lt as W,p as G,u as K,z as q}from"./index-BoGVkzmD.js";import{t as J}from"./roleDescriptions-BU7PB8ly.js";var Y=e(t(),1),X=n(),Z=[{group:()=>E(),keys:[{key:`traces.read`,label:()=>N()},{key:`traces.read.content`,label:()=>C(),phi:!0},{key:`traces.write`,label:()=>O()}]},{group:()=>R(),keys:[{key:`kpi.read`,label:()=>N()},{key:`kpi.write`,label:()=>O()}]},{group:()=>j(),keys:[{key:`openclaw.query`,label:()=>F()},{key:`anomalies.read`,label:()=>M()},{key:`anomalies.report`,label:()=>L()}]},{group:()=>T(),keys:[{key:`chats.read`,label:()=>N()},{key:`selfheal`,label:()=>r()},{key:`feedback.respond`,label:()=>g()}]},{group:()=>I(),keys:[{key:`admin.manage`,label:()=>D()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=p(w.apiKeys.listRoles,{}),t=k(w.apiKeys.createRole),n=k(w.apiKeys.ensureRolesSeeded),r=k(w.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(w.apiKeys.listRoles,{});r&&e.setQuery(w.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),g=V(),C=q(),[T,E]=(0,Y.useState)(!1),[D,O]=(0,Y.useState)($),[j,M]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{C.error(ie(),e)})},[n,C]);let N=e??[];async function F(e,t){if(Q(e.permissions)||j.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await g({title:ne({name:e.name}),description:re(),confirmLabel:u()}))){M(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){C.error(P(),e)}finally{M(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function I(){try{await t({key:D.key,name:D.name,description:D.description||void 0,permissions:[]}),O($),E(!1)}catch(e){C.error(d(),e)}}let L=e===void 0,R=!L&&N.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,S(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,b()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:c()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{O($),E(!0)},children:x()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:_()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?h({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:N.map(e=>{let t=Q(e.permissions),n=j.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,f()]}):(0,X.jsx)(U,{variant:`secondary`,children:l()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?ee():n?A():r,onCheckedChange:()=>void F(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(K,{open:T,onOpenChange:E,title:m(),description:o(),canSubmit:!!(D.key&&D.name),onSubmit:I,submitLabel:te(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:y()}),(0,X.jsx)(W,{value:D.key,placeholder:ae(),onChange:e=>O({...D,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,X.jsx)(W,{value:D.name,onChange:e=>O({...D,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:v()}),(0,X.jsx)(W,{value:D.description,onChange:e=>O({...D,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{CM as r,TM as i,_j as a,aj as o,bj as s,c,cj as l,dj as u,fj as d,gj as f,hj as p,kM as m,lj as h,mj as g,oj as _,pj as v,sj as y,uj as b,vj as x,yj as S}from"./dist-Bh78J5oj.js";import{t as C}from"./button-BWtKy7q6.js";import{Ft as w,ct as T}from"./index-
|
|
1
|
+
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{CM as r,TM as i,_j as a,aj as o,bj as s,c,cj as l,dj as u,fj as d,gj as f,hj as p,kM as m,lj as h,mj as g,oj as _,pj as v,sj as y,uj as b,vj as x,yj as S}from"./dist-Bh78J5oj.js";import{t as C}from"./button-BWtKy7q6.js";import{Ft as w,ct as T}from"./index-BoGVkzmD.js";import{a as E,i as D,n as O,o as k,r as A,t as j}from"./table-EVqhs7Hw.js";var M=e(t(),1),N=n();function P(){let e=m(c.scheduled.listMyCrons),[t,n]=(0,M.useState)(null),[P,F]=(0,M.useState)(!1),[I,L]=(0,M.useState)(!1),R=(0,M.useCallback)(async()=>{F(!0),L(!1);try{n(await e({}))}catch{L(!0)}finally{F(!1)}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=(0,M.useMemo)(()=>new Intl.DateTimeFormat(i(),{dateStyle:`medium`,timeStyle:`short`}),[]),B=t?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,N.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:s()}),(0,N.jsxs)(C,{variant:`ghost`,size:`sm`,onClick:()=>void R(),disabled:P,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,N.jsx)(w,{size:14,"aria-hidden":!0}),S()]})]}),t===null?(0,N.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":P,children:I?x():r()}):(0,N.jsxs)(N.Fragment,{children:[I?(0,N.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):null,t.length===0?(0,N.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):null,t.map(e=>(0,N.jsxs)(`section`,{style:{marginBottom:20},children:[t.length>1||e.error||!e.supported?(0,N.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,N.jsx)(T,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,N.jsx)(`p`,{className:`oc-admin__hint`,children:p({code:e.error})}):e.jobs.length===0?(0,N.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,N.jsxs)(j,{children:[(0,N.jsx)(E,{children:(0,N.jsxs)(k,{children:[(0,N.jsx)(D,{children:v()}),(0,N.jsx)(D,{children:d()}),(0,N.jsx)(D,{children:u()}),(0,N.jsx)(D,{children:b()}),(0,N.jsx)(D,{children:h()})]})}),(0,N.jsx)(O,{children:e.jobs.map((t,n)=>(0,N.jsxs)(k,{children:[(0,N.jsx)(A,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??l()}),(0,N.jsx)(A,{children:(0,N.jsx)(T,{variant:`secondary`,children:t.agentId})}),(0,N.jsx)(A,{className:`whitespace-nowrap`,style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(0,N.jsx)(A,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:z.format(t.nextRunAtMs)}),(0,N.jsxs)(A,{children:[t.enabled===!0?(0,N.jsx)(T,{variant:`secondary`,children:_()}):t.enabled===!1?(0,N.jsx)(T,{variant:`outline`,children:y()}):(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),t.lastRunStatus?(0,N.jsx)(`span`,{className:`text-muted-foreground`,style:{marginLeft:8,fontSize:`0.8rem`},children:t.lastRunStatus}):null]})]},t.id??`${e.instanceName}-${n}`))})]}):(0,N.jsx)(`p`,{className:`oc-admin__hint`,children:f()})]},e.instanceName)),B>0?(0,N.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:o()}):null]})]})}export{P as ScheduledTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$D as r,AD as i,AO as ee,BD as a,BO as te,CO as ne,DO as re,EO as ie,FD as o,FO as ae,GD as s,GO as oe,HD as c,HO as l,ID as u,IO as se,JD as d,JO as ce,KD as f,KO as le,LD as p,LO as ue,MD as m,MM as h,MO as de,ND as g,NO as fe,OD as pe,OO as me,PD as he,PO as ge,QD as _e,RD as _,RO as ve,SO as ye,TO as be,UD as v,UO as xe,VD as y,VO as Se,WD as b,WO as Ce,XD as x,YD as S,ZD as C,_O as we,aO as Te,bO as Ee,c as w,cO as De,dO as Oe,eO as ke,fO as Ae,gO as je,hO as Me,iO as Ne,jD as T,jM as E,jO as Pe,kD as D,kM as Fe,kO as Ie,lO as Le,mO as Re,nO as ze,oO as Be,pO as Ve,qD as O,qO as He,rO as Ue,sO as We,tO as Ge,uO as Ke,vO as qe,wO as Je,xO as Ye,yO as Xe,zD as k,zO as Ze}from"./dist-Bh78J5oj.js";import{n as A}from"./dist-CY9tmHrN.js";import{i as Qe}from"./dist-Cj3AsyfP.js";import{t as j}from"./button-BWtKy7q6.js";import{$ as M,B as $e,C as N,S as P,Wt as F,Xt as et,Yt as tt,b as I,ct as L,dt as R,et as z,ft as B,ht as V,lt as H,mt as U,pt as nt,qt as rt,u as it,ut as W,w as G,x as K,z as at}from"./index-Bk18lEVJ.js";import{t as ot}from"./FilterBar-CwLzwvAh.js";import{t as st}from"./DataTableShell-D64nWDBv.js";import{t as ct}from"./roleDescriptions-BU7PB8ly.js";var q=e(t(),1),J=n(),Y=[{value:`never`,label:()=>he(),days:null},{value:`30`,label:()=>g(),days:30},{value:`90`,label:()=>m(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=et({from:`/settings/serviceAccounts`}),t=tt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Z,[a,o]=(0,q.useState)(Z),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),u=h(w.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:i===Z?void 0:i===`disabled`}}),d=h(w.apiKeys.listKeys,{}),f=h(w.apiKeys.listRoles,{}),p=E(w.apiKeys.createServiceAccount),m=E(w.apiKeys.updateServiceAccount),g=E(w.apiKeys.deleteServiceAccount),pe=Fe(w.apiKeys.mintApiKey),he=E(w.apiKeys.revokeApiKey),_=$e(),v=at(),y=n!==``||a!==Z||i!==Z;function b(){o(Z),t({search:{},replace:!0})}let[x,S]=(0,q.useState)(!1),[C,T]=(0,q.useState)(Q),[D,O]=(0,q.useState)(null),[k,A]=(0,q.useState)(new Set),[M,F]=(0,q.useState)(null),R=(0,q.useRef)(!1),[z,B]=(0,q.useState)(new Set),[V,U]=(0,q.useState)({}),[nt,W]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function $(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{D?(await m({serviceAccountId:D,name:C.name,roleKey:C.roleKey,description:C.description}),v.success(Ae())):await p({name:C.name,roleKey:C.roleKey,description:C.description||void 0}),T(Q),O(null),S(!1)}catch(e){v.error(D?Ve():Re(),e)}}function ft(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),S(!0)}async function pt(e){if(R.current)return;R.current=!0;let t=V[e._id]??`never`,n=Y.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await pe({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(Oe(),e)}finally{R.current=!1,F(null)}}async function mt(e){if(await _({title:Ke(),description:(0,J.jsxs)(J.Fragment,{children:[Le(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,De(),` `,(0,J.jsx)(`strong`,{children:We()}),` `,Be()]}),confirmWord:e.name,confirmLabel:Te(),destructive:!0}))try{await g({serviceAccountId:e._id}),v.success(Ne(),e.name)}catch(e){v.error(Ue(),e)}}async function ht(e){if(await _({title:ze(),description:(0,J.jsxs)(J.Fragment,{children:[Ge(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ke()]}),confirmLabel:r(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await he({keyId:e._id})}catch(e){v.error(_e(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}),(0,J.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:He(),onReset:b,canReset:y,children:[(0,J.jsxs)(I,{value:a,onValueChange:o,children:[(0,J.jsx)(N,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:le()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:oe()}),(f??[]).map(e=>(0,J.jsx)(P,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(I,{value:i,onValueChange:c,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:Ce()}),(0,J.jsx)(P,{value:`active`,children:xe()}),(0,J.jsx)(P,{value:`disabled`,children:l()})]})]})]}),(0,J.jsx)(st,{title:Se(),rows:u,addLabel:te(),onAdd:()=>{T(Q),O(null),S(!0)},emptyHint:Ze(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:ae(),onSelect:()=>ft(e)},{label:ve(),onSelect:()=>void pt(e)},{label:k.has(e._id)?ue():se(),onSelect:()=>$(e._id)},{label:ge(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?fe():de(),onClick:()=>$(e._id),children:k.has(e._id)?(0,J.jsx)(Qe,{}):(0,J.jsx)(rt,{})})},{header:Pe(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:ee(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:Ie(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:l()}):(0,J.jsx)(L,{variant:`outline`,children:xe()})},{header:me(),cell:e=>(0,J.jsxs)(I,{value:V[e._id]??`never`,onValueChange:t=>U(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(N,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:Y.map(e=>(0,J.jsx)(P,{value:e.value,children:e.label()},e.value))})]})},{header:re(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?ie():be({count:t})})}}]}),(0,J.jsx)(it,{open:x,onOpenChange:e=>{S(e),e||O(null)},title:D?Je():Ye(),description:D?ne():Ee(),canSubmit:!!(C.name&&C.roleKey),onSubmit:dt,submitLabel:D?ye():Xe(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:qe()}),(0,J.jsx)(H,{value:C.name,onChange:e=>T({...C,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:we()}),(0,J.jsxs)(I,{value:C.roleKey||void 0,onValueChange:e=>T({...C,roleKey:e}),children:[(0,J.jsx)(N,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:je()})}),(0,J.jsx)(K,{children:(f??[]).map(e=>(0,J.jsxs)(P,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===C.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Me()}),(0,J.jsx)(H,{value:C.description,onChange:e=>T({...C,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:nt,onClose:()=>W(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[C(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:S()}),(0,J.jsx)(`th`,{children:d()}),(0,J.jsx)(`th`,{children:O()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{children:s()}),(0,J.jsx)(`th`,{children:b()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:z(t.createdAt)}),(0,J.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:pt(t.expiresAt)}),(0,J.jsx)(`td`,{children:mt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?v():c()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(W,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(R,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(U,{children:[(0,J.jsx)(V,{children:y()}),(0,J.jsx)(B,{children:a({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:k()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":_(),children:[n?(0,J.jsx)(A,{}):(0,J.jsx)(F,{}),n?p():u()]})]}),(0,J.jsx)(nt,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:o()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?T():z(e)}function pt(e){return e===null?`—`:M(e)}function mt(e){return e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:i()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(L,{variant:`outline`,children:D()}):(0,J.jsx)(L,{variant:`outline`,children:pe()})}export{$ as ServiceAccountsTab};
|
|
1
|
+
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$D as r,AD as i,AO as ee,BD as a,BO as te,CO as ne,DO as re,EO as ie,FD as o,FO as ae,GD as s,GO as oe,HD as c,HO as l,ID as u,IO as se,JD as d,JO as ce,KD as f,KO as le,LD as p,LO as ue,MD as m,MM as h,MO as de,ND as g,NO as fe,OD as pe,OO as me,PD as he,PO as ge,QD as _e,RD as _,RO as ve,SO as ye,TO as be,UD as v,UO as xe,VD as y,VO as Se,WD as b,WO as Ce,XD as x,YD as S,ZD as C,_O as we,aO as Te,bO as Ee,c as w,cO as De,dO as Oe,eO as ke,fO as Ae,gO as je,hO as Me,iO as Ne,jD as T,jM as E,jO as Pe,kD as D,kM as Fe,kO as Ie,lO as Le,mO as Re,nO as ze,oO as Be,pO as Ve,qD as O,qO as He,rO as Ue,sO as We,tO as Ge,uO as Ke,vO as qe,wO as Je,xO as Ye,yO as Xe,zD as k,zO as Ze}from"./dist-Bh78J5oj.js";import{n as A}from"./dist-CY9tmHrN.js";import{i as Qe}from"./dist-Cj3AsyfP.js";import{t as j}from"./button-BWtKy7q6.js";import{$ as M,B as $e,C as N,S as P,Wt as F,Xt as et,Yt as tt,b as I,ct as L,dt as R,et as z,ft as B,ht as V,lt as H,mt as U,pt as nt,qt as rt,u as it,ut as W,w as G,x as K,z as at}from"./index-BoGVkzmD.js";import{t as ot}from"./FilterBar-CTBZM__z.js";import{t as st}from"./DataTableShell-DTw-rOw3.js";import{t as ct}from"./roleDescriptions-BU7PB8ly.js";var q=e(t(),1),J=n(),Y=[{value:`never`,label:()=>he(),days:null},{value:`30`,label:()=>g(),days:30},{value:`90`,label:()=>m(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=et({from:`/settings/serviceAccounts`}),t=tt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Z,[a,o]=(0,q.useState)(Z),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),u=h(w.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:i===Z?void 0:i===`disabled`}}),d=h(w.apiKeys.listKeys,{}),f=h(w.apiKeys.listRoles,{}),p=E(w.apiKeys.createServiceAccount),m=E(w.apiKeys.updateServiceAccount),g=E(w.apiKeys.deleteServiceAccount),pe=Fe(w.apiKeys.mintApiKey),he=E(w.apiKeys.revokeApiKey),_=$e(),v=at(),y=n!==``||a!==Z||i!==Z;function b(){o(Z),t({search:{},replace:!0})}let[x,S]=(0,q.useState)(!1),[C,T]=(0,q.useState)(Q),[D,O]=(0,q.useState)(null),[k,A]=(0,q.useState)(new Set),[M,F]=(0,q.useState)(null),R=(0,q.useRef)(!1),[z,B]=(0,q.useState)(new Set),[V,U]=(0,q.useState)({}),[nt,W]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function $(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{D?(await m({serviceAccountId:D,name:C.name,roleKey:C.roleKey,description:C.description}),v.success(Ae())):await p({name:C.name,roleKey:C.roleKey,description:C.description||void 0}),T(Q),O(null),S(!1)}catch(e){v.error(D?Ve():Re(),e)}}function ft(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),S(!0)}async function pt(e){if(R.current)return;R.current=!0;let t=V[e._id]??`never`,n=Y.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await pe({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(Oe(),e)}finally{R.current=!1,F(null)}}async function mt(e){if(await _({title:Ke(),description:(0,J.jsxs)(J.Fragment,{children:[Le(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,De(),` `,(0,J.jsx)(`strong`,{children:We()}),` `,Be()]}),confirmWord:e.name,confirmLabel:Te(),destructive:!0}))try{await g({serviceAccountId:e._id}),v.success(Ne(),e.name)}catch(e){v.error(Ue(),e)}}async function ht(e){if(await _({title:ze(),description:(0,J.jsxs)(J.Fragment,{children:[Ge(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ke()]}),confirmLabel:r(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await he({keyId:e._id})}catch(e){v.error(_e(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}),(0,J.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:He(),onReset:b,canReset:y,children:[(0,J.jsxs)(I,{value:a,onValueChange:o,children:[(0,J.jsx)(N,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:le()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:oe()}),(f??[]).map(e=>(0,J.jsx)(P,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(I,{value:i,onValueChange:c,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:Ce()}),(0,J.jsx)(P,{value:`active`,children:xe()}),(0,J.jsx)(P,{value:`disabled`,children:l()})]})]})]}),(0,J.jsx)(st,{title:Se(),rows:u,addLabel:te(),onAdd:()=>{T(Q),O(null),S(!0)},emptyHint:Ze(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:ae(),onSelect:()=>ft(e)},{label:ve(),onSelect:()=>void pt(e)},{label:k.has(e._id)?ue():se(),onSelect:()=>$(e._id)},{label:ge(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?fe():de(),onClick:()=>$(e._id),children:k.has(e._id)?(0,J.jsx)(Qe,{}):(0,J.jsx)(rt,{})})},{header:Pe(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:ee(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:Ie(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:l()}):(0,J.jsx)(L,{variant:`outline`,children:xe()})},{header:me(),cell:e=>(0,J.jsxs)(I,{value:V[e._id]??`never`,onValueChange:t=>U(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(N,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:Y.map(e=>(0,J.jsx)(P,{value:e.value,children:e.label()},e.value))})]})},{header:re(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?ie():be({count:t})})}}]}),(0,J.jsx)(it,{open:x,onOpenChange:e=>{S(e),e||O(null)},title:D?Je():Ye(),description:D?ne():Ee(),canSubmit:!!(C.name&&C.roleKey),onSubmit:dt,submitLabel:D?ye():Xe(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:qe()}),(0,J.jsx)(H,{value:C.name,onChange:e=>T({...C,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:we()}),(0,J.jsxs)(I,{value:C.roleKey||void 0,onValueChange:e=>T({...C,roleKey:e}),children:[(0,J.jsx)(N,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:je()})}),(0,J.jsx)(K,{children:(f??[]).map(e=>(0,J.jsxs)(P,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===C.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Me()}),(0,J.jsx)(H,{value:C.description,onChange:e=>T({...C,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:nt,onClose:()=>W(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[C(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:S()}),(0,J.jsx)(`th`,{children:d()}),(0,J.jsx)(`th`,{children:O()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{children:s()}),(0,J.jsx)(`th`,{children:b()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:z(t.createdAt)}),(0,J.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:pt(t.expiresAt)}),(0,J.jsx)(`td`,{children:mt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?v():c()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(W,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(R,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(U,{children:[(0,J.jsx)(V,{children:y()}),(0,J.jsx)(B,{children:a({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:k()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":_(),children:[n?(0,J.jsx)(A,{}):(0,J.jsx)(F,{}),n?p():u()]})]}),(0,J.jsx)(nt,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:o()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?T():z(e)}function pt(e){return e===null?`—`:M(e)}function mt(e){return e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:i()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(L,{variant:`outline`,children:D()}):(0,J.jsx)(L,{variant:`outline`,children:pe()})}export{$ as ServiceAccountsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{Aa as r,Ba as i,Ca as a,Da as o,Ea as s,Fa as c,Ia as l,La as u,MM as d,Ma as f,Na as p,Oa as m,Pa as h,Ra as g,Sa as _,Ta as v,Va as y,_a as b,aa as x,ba as S,c as C,ca as w,da as T,fa as E,ga as D,ha as O,ia as k,jM as A,ja as j,ka as M,la as N,ma as P,oa as F,pa as I,ra as L,sa as ee,ua as R,va as z,wa as B,xa as V,ya as H,za as U}from"./dist-Bh78J5oj.js";import{t as W}from"./button-BWtKy7q6.js";import{B as G,et as K}from"./index-
|
|
1
|
+
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{Aa as r,Ba as i,Ca as a,Da as o,Ea as s,Fa as c,Ia as l,La as u,MM as d,Ma as f,Na as p,Oa as m,Pa as h,Ra as g,Sa as _,Ta as v,Va as y,_a as b,aa as x,ba as S,c as C,ca as w,da as T,fa as E,ga as D,ha as O,ia as k,jM as A,ja as j,ka as M,la as N,ma as P,oa as F,pa as I,ra as L,sa as ee,ua as R,va as z,wa as B,xa as V,ya as H,za as U}from"./dist-Bh78J5oj.js";import{t as W}from"./button-BWtKy7q6.js";import{B as G,et as K}from"./index-BoGVkzmD.js";import{t as q}from"./DataTableShell-DTw-rOw3.js";var J=e(t(),1),Y=n(),X={hung:()=>B(),wrong_result:()=>a(),error:()=>_(),other:()=>V()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=A(C.subAgentReports.respondToReport),[r,i]=(0,J.useState)(e.thread),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(!1);async function l(){let t=a.trim();if(!(!t||s)){c(!0);try{await n({reportId:e._id,text:t}),i(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),o(``)}finally{c(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,S({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?b():D()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:O()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:P(),value:a,maxLength:2e3,rows:3,onChange:e=>o(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void l(),disabled:!a.trim()||s,children:s?E():I()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[T({count:t.children.length}),t.childrenTruncated?` ${R()}`:``,t.textTruncated?` ${N()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${w()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ee()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=d(C.subAgentReports.listForAdmin,{}),t=A(C.subAgentReports.readReport),n=A(C.subAgentReports.deleteReport),a=G(),[_,b]=(0,J.useState)(null),[S,w]=(0,J.useState)({});async function T(e){if(_===e._id){b(null);return}if(!S[e._id]){let n=await t({reportId:e._id});w(t=>({...t,[e._id]:n}))}b(e._id)}async function E(e){await a({title:x(),description:k(),confirmLabel:L(),destructive:!0})&&(await n({reportId:e._id}),_===e._id&&b(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[U(),` `,(0,Y.jsx)(`strong`,{children:g()}),` `,u()]}),(0,Y.jsx)(q,{title:y(),rows:e,emptyHint:i(),isExpanded:e=>_===e._id&&!!S[e._id],renderExpanded:e=>S[e._id]?(0,Y.jsx)($,{data:S[e._id]}):null,columns:[{header:l(),cell:e=>K(e.at),sort:e=>e.at},{header:c(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:h(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:p(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${r({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:f(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:j(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:M()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:m()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:_===e._id?s():o(),onSelect:()=>void T(e)},{label:v(),onSelect:()=>void E(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$A as r,$i as i,$k as a,AA as o,BA as s,Bk as c,CA as l,DA as u,EA as d,FA as f,Fk as p,GA as m,Gk as h,HA as g,Hk as _,IA as v,Ik as y,JA as ee,Jk as te,KA as ne,Kk as re,LA as ie,Lk as ae,MA as oe,MM as b,NA as se,OA as ce,PA as le,QA as ue,Qk as de,RA as fe,Rk as pe,SA as me,TA as he,UA as ge,Uk as _e,VA as ve,Vk as ye,WA as be,Wk as xe,XA as Se,Xk as Ce,YA as we,Yk as Te,ZA as Ee,Zk as De,_A as Oe,aA as ke,bA as x,bM as Ae,c as S,cA as je,dA as Me,eA as Ne,ea as Pe,ej as Fe,fA as Ie,gA as Le,hA as Re,iA as ze,jA as Be,jM as C,kA as Ve,kM as He,l as Ue,lA as We,mA as Ge,n as Ke,nA as qe,na as w,nj as Je,oA as Ye,pA as Xe,qA as T,qk as Ze,rA as Qe,rj as $e,sA as et,tA as E,ta as D,tj as tt,uA as nt,vA as rt,wA as it,xA as at,xM as ot,yA as st,yM as ct,zA as lt,zk as O}from"./dist-Bh78J5oj.js";import{n as k}from"./dist-CY9tmHrN.js";import{t as A}from"./x-Dj2c0suA.js";import{t as j}from"./button-BWtKy7q6.js";import{C as M,Ht as N,S as P,Ut as ut,_t as dt,at as ft,b as F,ct as I,gt as pt,it as L,lt as R,nt as mt,ot as z,p as B,rt as ht,st as gt,w as V,x as H,xt as U}from"./index-Bk18lEVJ.js";import{t as _t}from"./localePickerView-C2RmOS86.js";import{a as vt,i as yt,n as bt,o as xt,r as St,t as Ct}from"./card-DXiwL4WM.js";import{a as wt,i as W,n as Tt,o as G,r as K,t as Et}from"./table-EVqhs7Hw.js";import{t as Dt}from"./TimeRangePicker-DVJCx8F-.js";import{t as Ot}from"./FilterBar-CwLzwvAh.js";import{t as kt}from"./AdvancedFilter-DyxLXUxk.js";var q=Ue(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),J=e(t(),1),At=.1,jt=[248,248,248],Mt=[24,24,24];function Nt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Pt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function Y(e,t,n){return Pt(e,t,n)>=At}function Ft(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function It(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ze());if(e.size>Lt)throw Error(Qe());let{source:n,width:r,height:i,cleanup:a}=await Ht(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Rt/r,zt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(E());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Nt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(E());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);Y(e.data,d.width,d.height)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(e.data),p.putImageData(e,0,0)}let m=Y(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Wt(f,`image/webp`,Bt)??await Wt(f,`image/png`);if(!h)throw Error(Ne());return{blob:h,hasAlpha:m}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return Ut(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Ut(e)}async function Ut(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(qe())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Wt(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Gt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Kt={kind:`relative`,from:`now-24h`,to:`now`},qt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Jt(e){return e===`light`?ot():e===`dark`?Ae():ct()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Zt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Ke(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(k,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Xt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":w(),title:w(),children:(0,X.jsx)(ut,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=b(S.charts.listMyCharts),r=C(S.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:we()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:T(),subtitle:ne(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?m():n.via===`owner`?be():ge({group:n.via.group});return(0,X.jsx)(Zt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Gt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:g()}):null]})}function $t(){let e=C(S.charts.importChart),[t,n]=(0,J.useState)(``),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1),[f,p]=(0,J.useState)(!1);async function m(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(x())}}}async function h(){if(o(null),c(!1),t.trim()===``){o(rt());return}let a;try{a=JSON.parse(r)}catch{o(x());return}p(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{p(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ce()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:u()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:d()}),(0,X.jsx)(R,{value:t,onChange:e=>n(e.target.value),placeholder:he(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:it()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:l(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(q,{className:`size-4`}),me(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void m(e)})]})}),(0,X.jsx)(j,{size:`sm`,disabled:f,onClick:()=>void h(),children:at()})]}),a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:st()}):null]})]})}function en({chart:e}){let t=He(S.charts.setChartLogo),n=C(S.charts.removeChartLogo),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Vt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Me():nt()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(q,{className:`size-4`}),t?je():We(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,X.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:Ye()}):null,t?(0,X.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:et()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ie()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(f,{mode:`light`}),(0,X.jsx)(f,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ke()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=b(S.me.getMe,{host:U}),n=C(S.charts.addChartDomain),r=C(S.charts.removeChartDomain),[i,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=i.trim();if(t!==``){c(null),u(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(t){c(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:a()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Te()}):d.map(e=>(0,X.jsxs)(I,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":te({domain:e}),onClick:()=>void p(e),children:(0,X.jsx)(A,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(R,{value:i,onChange:e=>o(e.target.value),placeholder:De(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,X.jsx)(j,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:Ce()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:de()}),s?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=C(S.charts.updateChart),n=C(S.charts.deleteChart),[r,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(e.name),[c,l]=(0,J.useState)(()=>$(e.tokens)),[u,d]=(0,J.useState)(e.tokens.bpm??0),[f,p]=(0,J.useState)(null),[m,g]=(0,J.useState)(!1);function _(){s(e.name),l($(e.tokens)),d(e.tokens.bpm??0),p(null),a(!0)}async function v(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(c)}catch{p(x());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:o.trim(),tokens:n}),a(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function y(){if(e.chartId!==void 0&&window.confirm(_e()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(j,{variant:`outline`,size:`sm`,onClick:_,children:Ge()}),(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void y(),children:Xe()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:h()}),(0,X.jsx)(R,{value:o,onChange:e=>s(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:D()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>d(Number(e.target.value)),"aria-label":D()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?Pe():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:i()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:xe()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{size:`sm`,disabled:m,onClick:()=>void v(),children:Ze()}),(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:re()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function rn(){let e=b(S.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Le()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=C(S.charts.addChartToGroupPool),r=C(S.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,s=new Set((a??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(I,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?le():e.kind===`custom`&&e.scope===`personal`?O():f()}),e.isGlobalDefault?(0,X.jsx)(I,{variant:`default`,children:se()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Be()}),(a??[]).map(e=>(0,X.jsxs)(I,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ve({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(A,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(F,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(M,{size:`sm`,className:`w-56`,children:(0,X.jsx)(V,{placeholder:o()})}),(0,X.jsx)(H,{children:c.map(e=>(0,X.jsx)(P,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:oe()}):null]})]})}function on({chart:e}){let t=C(S.charts.promoteChartToCommon),n=C(S.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(_e()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(I,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?pe():O()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:c({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:ae()}):null,(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:y()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let i=C(S.admin.setDefaultThemeMode),a=C(S.admin.setDefaultLocale),o=C(S.charts.setDefaultChart),c=b(S.charts.listChartsAdmin),l=b(S.groups.listGroups,{}),u=e??`system`,d=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ee()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:T()}),dt.map(e=>(0,X.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(c??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:lt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(an,{chart:e,groups:l??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ie()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:v()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(tn,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:_()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ye()})]}),(()=>{let e=(c??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:p()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(on,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:$e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Je()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(j,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void i({mode:e}),children:Jt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:tt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Fe()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:_t().map(e=>(0,X.jsx)(j,{variant:d===e.value?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:r()})]})]})}function cn(){let e=b(S.me.getMe,{host:U}),t=pt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)($t,{}),(0,X.jsx)(rn,{}),e?.role===`admin`?(0,X.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,J.useState)(!0),[n,r]=(0,J.useState)(`per-user`),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(Z),[c,l]=(0,J.useState)(Z),[u,d]=(0,J.useState)(Kt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Kt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(cn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:ue()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{children:`Default`}),(0,X.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(j,{variant:`outline`,children:`Outline`}),(0,X.jsx)(j,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(j,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(j,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{size:`sm`,children:`Small`}),(0,X.jsx)(j,{children:`Default`}),(0,X.jsx)(j,{size:`lg`,children:`Large`}),(0,X.jsx)(j,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(N,{})}),(0,X.jsx)(j,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{children:`Default`}),(0,X.jsx)(I,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(I,{variant:`outline`,children:`Outline`}),(0,X.jsx)(I,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(R,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(F,{value:n,onValueChange:r,children:[(0,X.jsx)(M,{className:`w-56`,children:(0,X.jsx)(V,{placeholder:`Select…`})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(P,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(B,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(F,{value:o,onValueChange:s,children:[(0,X.jsx)(M,{size:`sm`,children:(0,X.jsx)(V,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes directions`}),(0,X.jsx)(P,{value:`inbound`,children:`inbound`}),(0,X.jsx)(P,{value:`outbound`,children:`outbound`}),(0,X.jsx)(P,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(F,{value:c,onValueChange:l,children:[(0,X.jsx)(M,{size:`sm`,children:(0,X.jsx)(V,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(P,{value:`info`,children:`info`}),(0,X.jsx)(P,{value:`warn`,children:`warn`}),(0,X.jsx)(P,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(kt,{fields:qt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Dt,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(mt,{children:[(0,X.jsx)(gt,{asChild:!0,children:(0,X.jsx)(j,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(N,{})})}),(0,X.jsxs)(ht,{align:`start`,children:[(0,X.jsx)(ft,{children:`Actions`}),(0,X.jsx)(z,{}),(0,X.jsx)(L,{children:`Edit`}),(0,X.jsx)(L,{children:`Duplicate`}),(0,X.jsx)(z,{}),(0,X.jsx)(L,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(Ct,{className:`w-80`,children:[(0,X.jsxs)(vt,{children:[(0,X.jsx)(xt,{children:`Instance`}),(0,X.jsx)(St,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(bt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(yt,{className:`gap-2`,children:[(0,X.jsx)(j,{size:`sm`,children:`Save`}),(0,X.jsx)(j,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Et,{children:[(0,X.jsx)(wt,{children:(0,X.jsxs)(G,{children:[(0,X.jsx)(W,{className:`w-8`,children:(0,X.jsx)(B,{"aria-label":`select all`})}),(0,X.jsx)(W,{children:`Name`}),(0,X.jsx)(W,{children:`Mode`}),(0,X.jsx)(W,{className:`text-right`,children:`Status`}),(0,X.jsx)(W,{className:`w-8`})]})}),(0,X.jsx)(Tt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(G,{children:[(0,X.jsx)(K,{children:(0,X.jsx)(B,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(K,{className:`font-medium`,children:e.n}),(0,X.jsx)(K,{children:(0,X.jsx)(I,{variant:`secondary`,children:e.m})}),(0,X.jsx)(K,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(k,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(K,{children:(0,X.jsx)(j,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(N,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};
|
|
1
|
+
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$A as r,$i as i,$k as a,AA as o,BA as s,Bk as c,CA as l,DA as u,EA as d,FA as f,Fk as p,GA as m,Gk as h,HA as g,Hk as _,IA as v,Ik as y,JA as ee,Jk as te,KA as ne,Kk as re,LA as ie,Lk as ae,MA as oe,MM as b,NA as se,OA as ce,PA as le,QA as ue,Qk as de,RA as fe,Rk as pe,SA as me,TA as he,UA as ge,Uk as _e,VA as ve,Vk as ye,WA as be,Wk as xe,XA as Se,Xk as Ce,YA as we,Yk as Te,ZA as Ee,Zk as De,_A as Oe,aA as ke,bA as x,bM as Ae,c as S,cA as je,dA as Me,eA as Ne,ea as Pe,ej as Fe,fA as Ie,gA as Le,hA as Re,iA as ze,jA as Be,jM as C,kA as Ve,kM as He,l as Ue,lA as We,mA as Ge,n as Ke,nA as qe,na as w,nj as Je,oA as Ye,pA as Xe,qA as T,qk as Ze,rA as Qe,rj as $e,sA as et,tA as E,ta as D,tj as tt,uA as nt,vA as rt,wA as it,xA as at,xM as ot,yA as st,yM as ct,zA as lt,zk as O}from"./dist-Bh78J5oj.js";import{n as k}from"./dist-CY9tmHrN.js";import{t as A}from"./x-Dj2c0suA.js";import{t as j}from"./button-BWtKy7q6.js";import{C as M,Ht as N,S as P,Ut as ut,_t as dt,at as ft,b as F,ct as I,gt as pt,it as L,lt as R,nt as mt,ot as z,p as B,rt as ht,st as gt,w as V,x as H,xt as U}from"./index-BoGVkzmD.js";import{t as _t}from"./localePickerView-C2RmOS86.js";import{a as vt,i as yt,n as bt,o as xt,r as St,t as Ct}from"./card-DXiwL4WM.js";import{a as wt,i as W,n as Tt,o as G,r as K,t as Et}from"./table-EVqhs7Hw.js";import{t as Dt}from"./TimeRangePicker-C3vWWVJs.js";import{t as Ot}from"./FilterBar-CTBZM__z.js";import{t as kt}from"./AdvancedFilter-CXI70fDB.js";var q=Ue(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),J=e(t(),1),At=.1,jt=[248,248,248],Mt=[24,24,24];function Nt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Pt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function Y(e,t,n){return Pt(e,t,n)>=At}function Ft(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function It(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ze());if(e.size>Lt)throw Error(Qe());let{source:n,width:r,height:i,cleanup:a}=await Ht(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Rt/r,zt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(E());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Nt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(E());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);Y(e.data,d.width,d.height)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(e.data),p.putImageData(e,0,0)}let m=Y(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Wt(f,`image/webp`,Bt)??await Wt(f,`image/png`);if(!h)throw Error(Ne());return{blob:h,hasAlpha:m}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return Ut(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Ut(e)}async function Ut(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(qe())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Wt(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Gt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Kt={kind:`relative`,from:`now-24h`,to:`now`},qt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Jt(e){return e===`light`?ot():e===`dark`?Ae():ct()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Zt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Ke(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(k,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Xt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":w(),title:w(),children:(0,X.jsx)(ut,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=b(S.charts.listMyCharts),r=C(S.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:we()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:T(),subtitle:ne(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?m():n.via===`owner`?be():ge({group:n.via.group});return(0,X.jsx)(Zt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Gt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:g()}):null]})}function $t(){let e=C(S.charts.importChart),[t,n]=(0,J.useState)(``),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1),[f,p]=(0,J.useState)(!1);async function m(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(x())}}}async function h(){if(o(null),c(!1),t.trim()===``){o(rt());return}let a;try{a=JSON.parse(r)}catch{o(x());return}p(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{p(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ce()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:u()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:d()}),(0,X.jsx)(R,{value:t,onChange:e=>n(e.target.value),placeholder:he(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:it()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:l(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(q,{className:`size-4`}),me(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void m(e)})]})}),(0,X.jsx)(j,{size:`sm`,disabled:f,onClick:()=>void h(),children:at()})]}),a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:st()}):null]})]})}function en({chart:e}){let t=He(S.charts.setChartLogo),n=C(S.charts.removeChartLogo),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Vt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Me():nt()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(q,{className:`size-4`}),t?je():We(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,X.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:Ye()}):null,t?(0,X.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:et()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ie()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(f,{mode:`light`}),(0,X.jsx)(f,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ke()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=b(S.me.getMe,{host:U}),n=C(S.charts.addChartDomain),r=C(S.charts.removeChartDomain),[i,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=i.trim();if(t!==``){c(null),u(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(t){c(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:a()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Te()}):d.map(e=>(0,X.jsxs)(I,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":te({domain:e}),onClick:()=>void p(e),children:(0,X.jsx)(A,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(R,{value:i,onChange:e=>o(e.target.value),placeholder:De(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,X.jsx)(j,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:Ce()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:de()}),s?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=C(S.charts.updateChart),n=C(S.charts.deleteChart),[r,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(e.name),[c,l]=(0,J.useState)(()=>$(e.tokens)),[u,d]=(0,J.useState)(e.tokens.bpm??0),[f,p]=(0,J.useState)(null),[m,g]=(0,J.useState)(!1);function _(){s(e.name),l($(e.tokens)),d(e.tokens.bpm??0),p(null),a(!0)}async function v(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(c)}catch{p(x());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:o.trim(),tokens:n}),a(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function y(){if(e.chartId!==void 0&&window.confirm(_e()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(j,{variant:`outline`,size:`sm`,onClick:_,children:Ge()}),(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void y(),children:Xe()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:h()}),(0,X.jsx)(R,{value:o,onChange:e=>s(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:D()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>d(Number(e.target.value)),"aria-label":D()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?Pe():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:i()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:xe()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{size:`sm`,disabled:m,onClick:()=>void v(),children:Ze()}),(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:re()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function rn(){let e=b(S.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Le()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=C(S.charts.addChartToGroupPool),r=C(S.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,s=new Set((a??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(I,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?le():e.kind===`custom`&&e.scope===`personal`?O():f()}),e.isGlobalDefault?(0,X.jsx)(I,{variant:`default`,children:se()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Be()}),(a??[]).map(e=>(0,X.jsxs)(I,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ve({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(A,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(F,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(M,{size:`sm`,className:`w-56`,children:(0,X.jsx)(V,{placeholder:o()})}),(0,X.jsx)(H,{children:c.map(e=>(0,X.jsx)(P,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:oe()}):null]})]})}function on({chart:e}){let t=C(S.charts.promoteChartToCommon),n=C(S.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(_e()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(I,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?pe():O()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:c({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:ae()}):null,(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:y()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let i=C(S.admin.setDefaultThemeMode),a=C(S.admin.setDefaultLocale),o=C(S.charts.setDefaultChart),c=b(S.charts.listChartsAdmin),l=b(S.groups.listGroups,{}),u=e??`system`,d=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ee()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:T()}),dt.map(e=>(0,X.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(c??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:lt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(an,{chart:e,groups:l??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ie()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:v()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(tn,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:_()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ye()})]}),(()=>{let e=(c??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:p()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(on,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:$e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Je()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(j,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void i({mode:e}),children:Jt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:tt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Fe()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:_t().map(e=>(0,X.jsx)(j,{variant:d===e.value?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:r()})]})]})}function cn(){let e=b(S.me.getMe,{host:U}),t=pt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)($t,{}),(0,X.jsx)(rn,{}),e?.role===`admin`?(0,X.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,J.useState)(!0),[n,r]=(0,J.useState)(`per-user`),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(Z),[c,l]=(0,J.useState)(Z),[u,d]=(0,J.useState)(Kt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Kt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(cn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:ue()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{children:`Default`}),(0,X.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(j,{variant:`outline`,children:`Outline`}),(0,X.jsx)(j,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(j,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(j,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{size:`sm`,children:`Small`}),(0,X.jsx)(j,{children:`Default`}),(0,X.jsx)(j,{size:`lg`,children:`Large`}),(0,X.jsx)(j,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(N,{})}),(0,X.jsx)(j,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{children:`Default`}),(0,X.jsx)(I,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(I,{variant:`outline`,children:`Outline`}),(0,X.jsx)(I,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(R,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(F,{value:n,onValueChange:r,children:[(0,X.jsx)(M,{className:`w-56`,children:(0,X.jsx)(V,{placeholder:`Select…`})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(P,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(B,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(F,{value:o,onValueChange:s,children:[(0,X.jsx)(M,{size:`sm`,children:(0,X.jsx)(V,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes directions`}),(0,X.jsx)(P,{value:`inbound`,children:`inbound`}),(0,X.jsx)(P,{value:`outbound`,children:`outbound`}),(0,X.jsx)(P,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(F,{value:c,onValueChange:l,children:[(0,X.jsx)(M,{size:`sm`,children:(0,X.jsx)(V,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(P,{value:`info`,children:`info`}),(0,X.jsx)(P,{value:`warn`,children:`warn`}),(0,X.jsx)(P,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(kt,{fields:qt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Dt,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(mt,{children:[(0,X.jsx)(gt,{asChild:!0,children:(0,X.jsx)(j,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(N,{})})}),(0,X.jsxs)(ht,{align:`start`,children:[(0,X.jsx)(ft,{children:`Actions`}),(0,X.jsx)(z,{}),(0,X.jsx)(L,{children:`Edit`}),(0,X.jsx)(L,{children:`Duplicate`}),(0,X.jsx)(z,{}),(0,X.jsx)(L,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(Ct,{className:`w-80`,children:[(0,X.jsxs)(vt,{children:[(0,X.jsx)(xt,{children:`Instance`}),(0,X.jsx)(St,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(bt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(yt,{className:`gap-2`,children:[(0,X.jsx)(j,{size:`sm`,children:`Save`}),(0,X.jsx)(j,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Et,{children:[(0,X.jsx)(wt,{children:(0,X.jsxs)(G,{children:[(0,X.jsx)(W,{className:`w-8`,children:(0,X.jsx)(B,{"aria-label":`select all`})}),(0,X.jsx)(W,{children:`Name`}),(0,X.jsx)(W,{children:`Mode`}),(0,X.jsx)(W,{className:`text-right`,children:`Status`}),(0,X.jsx)(W,{className:`w-8`})]})}),(0,X.jsx)(Tt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(G,{children:[(0,X.jsx)(K,{children:(0,X.jsx)(B,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(K,{className:`font-medium`,children:e.n}),(0,X.jsx)(K,{children:(0,X.jsx)(I,{variant:`secondary`,children:e.m})}),(0,X.jsx)(K,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(k,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(K,{children:(0,X.jsx)(j,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(N,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$n as r,Bm as i,Gm as a,Hm as o,Jm as s,Km as c,Qn as l,Rm as u,Um as d,Vm as f,Wm as p,Xm as m,Xn as h,Ym as g,Yn as _,Zn as v,er as y,qm as b,tr as x,zm as S}from"./dist-Bh78J5oj.js";import{t as C}from"./button-BWtKy7q6.js";import{Ct as w,Gt as T,Pt as E,St as D,Tt as O,et as k,lt as A,wt as j}from"./index-
|
|
1
|
+
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$n as r,Bm as i,Gm as a,Hm as o,Jm as s,Km as c,Qn as l,Rm as u,Um as d,Vm as f,Wm as p,Xm as m,Xn as h,Ym as g,Yn as _,Zn as v,er as y,qm as b,tr as x,zm as S}from"./dist-Bh78J5oj.js";import{t as C}from"./button-BWtKy7q6.js";import{Ct as w,Gt as T,Pt as E,St as D,Tt as O,et as k,lt as A,wt as j}from"./index-BoGVkzmD.js";var M=e(t(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:m(),from:`now-5m`},{label:g(),from:`now-15m`},{label:s(),from:`now-30m`},{label:b(),from:`now-1h`},{label:c(),from:`now-3h`},{label:a(),from:`now-6h`},{label:p(),from:`now-12h`},{label:d(),from:`now-24h`},{label:o(),from:`now-2d`},{label:f(),from:`now-7d`},{label:i(),from:`now-30d`},{label:S(),from:`now-90d`},{label:u(),from:`now-520w`}];function L(e){return k(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,i]=(0,M.useState)(!1),[a,o]=(0,M.useState)(``),s=F(e),[c,u]=(0,M.useState)(()=>z(s.from)),[d,f]=(0,M.useState)(()=>z(s.to));function p(t){if(t){let t=F(e);u(z(t.from)),f(z(t.to)),o(``)}i(t)}function m(e){t({kind:`relative`,from:e,to:`now`}),i(!1)}function g(){let e=B(c),n=B(d);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),i(!1))}let b=(0,M.useMemo)(()=>{let e=a.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[a]),S=B(c)!==null&&B(d)!==null;return(0,H.jsxs)(j,{open:n,onOpenChange:p,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(T,{}),R(e)]})}),(0,H.jsx)(w,{children:(0,H.jsx)(D,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:x()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:y()}),(0,H.jsx)(A,{type:`datetime-local`,value:c,onChange:e=>u(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,H.jsx)(A,{type:`datetime-local`,value:d,onChange:e=>f(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!S,onClick:g,children:l()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(E,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(A,{value:a,onChange:e=>o(e.target.value),placeholder:v(),"aria-label":h()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:_()}):b.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>m(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$_ as r,$w as i,A_ as a,Aw as o,B_ as s,C_ as c,D_ as l,Dw as u,E_ as d,Ew as f,F_ as p,Fw as m,G_ as h,Gw as g,H_ as _,I_ as v,Iw as y,J_ as ee,Jw as b,K_ as te,Kw as x,L_ as ne,Lw as re,MM as S,M_ as ie,Mw as C,N_ as ae,Nw as w,O_ as oe,Ow as T,P_ as se,Pw as ce,Q_ as le,Qt as E,Qw as ue,R_ as de,Rw as fe,S_ as pe,T_ as me,Tw as he,U_ as ge,Uw as _e,V_ as ve,W_ as ye,Ww as D,X_ as be,Xt as xe,Xw as Se,Y_ as Ce,Yw as O,Z_ as we,Zt as k,Zw as Te,__ as A,aT as Ee,b_ as De,c as j,cT as Oe,dT as ke,eT as M,ev as Ae,fT as je,iT as N,jM as P,j_ as Me,jw as F,k_ as Ne,kw as Pe,l as I,lT as Fe,nT as Ie,oT as Le,pT as Re,q_ as ze,qw as Be,rT as Ve,sT as He,tT as L,tv as Ue,uT as We,v_ as Ge,w_ as Ke,ww as qe,x_ as Je,y_ as Ye,z_ as Xe}from"./dist-Bh78J5oj.js";import{n as Ze}from"./dist-CY9tmHrN.js";import{t as Qe}from"./x-Dj2c0suA.js";import{i as R,n as z,r as $e,t as et}from"./tabs-eWt8KqrV.js";import{t as B}from"./button-BWtKy7q6.js";import{Bt as tt,C as V,S as H,Vt as nt,Wt as rt,Xt as it,Yt as at,a as ot,b as U,ct as W,dt as st,et as G,ft as ct,ht as lt,i as ut,j as dt,mt as ft,o as pt,r as mt,tt as ht,ut as gt,w as K,x as q,xt as _t}from"./index-Bk18lEVJ.js";import{n as vt}from"./TimeRangePicker-DVJCx8F-.js";import{t as yt}from"./FilterBar-CwLzwvAh.js";import{t as bt}from"./AdvancedFilter-DyxLXUxk.js";import{t as xt}from"./DataTableShell-D64nWDBv.js";var St=I(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ct=I(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),J=e(t(),1),Y=n(),X={kind:`relative`,from:`now-520w`,to:`now`},Z=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?b():n===`agent`?`${Be()} - ${r}`:e}function Tt(){let e=S(j.me.getMe,{host:_t})?.role===`admin`,t=S(j.deliveryTiming.getDeliveryStatus,{}),n=P(j.deliveryTiming.startDeliveryRecord),r=P(j.deliveryTiming.stopDeliveryRecord),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!1)}};return(0,Y.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:Re()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:je()})]}),e?(0,Y.jsx)(B,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?We():ke()}):null]}),c?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(W,{variant:`secondary`,children:Fe()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:Oe({time:ht(t.startedAt)})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?Ee():Le()})}),i?(0,Y.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=S(j.deliveryTiming.listDeliverySessions,{}),n=P(j.deliveryTiming.deleteDeliverySessions),[r,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(`all`),[c,l]=(0,J.useState)(X),[u,d]=(0,J.useState)(null),{from:f,to:p}=vt(c),m=c.to===`now`?1/0:p,h=r.trim()!==``||o!==`all`||c!==X,_=()=>{a(``),s(`all`),l(X)},v=(0,J.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=m).map(e=>({...e,_id:e.sessionId}))},[t,r,o,f,m]),y=e=>{let t=new Set((v??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(yt,{q:r,onQChange:a,searchPlaceholder:Ve(),timeRange:c,onTimeRangeChange:l,onReset:_,canReset:h,children:(0,Y.jsxs)(U,{value:o,onValueChange:e=>s(e),children:[(0,Y.jsx)(V,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(K,{})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:`all`,children:Ie()}),(0,Y.jsx)(H,{value:`active`,children:L()}),(0,Y.jsx)(H,{value:`stopped`,children:M()})]})]})}),(0,Y.jsx)(xt,{title:N(),rows:v,emptyHint:he(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(B,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?g():x(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,Y.jsx)(St,{size:15,"aria-hidden":!0}):(0,Y.jsx)(nt,{size:15,"aria-hidden":!0})})},{header:i(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:ue(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,Y.jsx)(`span`,{className:`tabular-nums`,children:G(e.stoppedAt)})},{header:Te(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:Se(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:O(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(W,{variant:`secondary`,children:L()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:M()})}],rowActions:e?e=>[{label:D(),variant:`destructive`,onSelect:()=>y([e.sessionId])}]:void 0,bulkActions:e?[{label:D(),variant:`destructive`,onSelect:e=>y(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,Y.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=S(j.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(dt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:_e()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:He()});let r=e.segments,i=(e,t)=>(0,Y.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,Y.jsx)(`td`,{className:`py-1`,children:e}),(0,Y.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,Y.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[Z(t.p50),` / `,Z(t.p95),` / `,Z(t.max)]})]});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,qe()]}),(0,Y.jsxs)(B,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(Ze,{size:13,"aria-hidden":!0}):(0,Y.jsx)(rt,{size:13,"aria-hidden":!0}),t?f():u()]})]}),(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,Y.jsx)(`th`,{className:`py-1 font-medium`,children:y()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:m()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:ce()})]})}),(0,Y.jsxs)(`tbody`,{children:[i(w(),r.bridge),i(C(),r.A),i(F(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()})]})}var kt=[50,100,200,500],At=`all`,Q=`__all__`,jt=[`2xx`,`4xx`,`5xx`],Mt=[`user`,`service`,`system`],Nt=[`inbound`,`outbound`,`internal`],Pt={kind:`relative`,from:`now-30d`,to:`now`},Ft=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:E()},{value:`principalType`,label:k()},{value:`direction`,label:`direction`},{value:`roleKey`,label:xe()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=it({from:`/settings/traces`}),t=at({from:`/settings/traces`}),n=e.limit,i=e.kind,o=e.statusClass??Q,u=e.principalType??Q,f=e.direction??Q,m=e.roleKey??Q,g=e.q??``,y=mt(e.from,e.to),b=(0,J.useMemo)(()=>pt(e.adv),[e.adv]),{from:x,to:C}=vt(y),[w,T]=(0,J.useState)(null),[ce,E]=(0,J.useState)(null),ue=e=>void t({search:t=>({...t,limit:e})}),he=e=>void t({search:t=>({...t,kind:e})}),_e=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),D=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),xe=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),Se=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),O=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,...ot(e)})}),Te=e=>void t({search:t=>({...t,adv:ut(e)}),replace:!0}),A=S(j.observability.listEvents,{limit:n}),Ee=S(j.observability.listEvents,{limit:n,kind:i===At?void 0:i,filter:{q:g||void 0,from:x,to:C,statusClass:o===Q?void 0:o,principalType:u===Q?void 0:u,direction:f===Q?void 0:f,roleKey:m===Q?void 0:m,advanced:b.length>0?b:void 0}}),Oe=(0,J.useMemo)(()=>{let e=new Set;for(let t of A??[])e.add(t.kind);return[...e].sort()},[A]),ke=(0,J.useMemo)(()=>{let e=new Set;for(let t of A??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[A]),M=g!==``||o!==Q||u!==Q||f!==Q||m!==Q||b.length>0||y.kind!==`relative`||y.from!==Pt.from;function je(){t({search:{limit:100,kind:`all`},replace:!0})}let N=w?A?.filter(e=>e.correlationId===w):Ee,P=e.section,F=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,Y.jsxs)(et,{value:P,onValueChange:e=>F(e),children:[(0,Y.jsxs)($e,{className:`w-full`,children:[(0,Y.jsxs)(R,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(tt,{size:13,"aria-hidden":!0}),fe()]}),(0,Y.jsxs)(R,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(Ct,{size:13,"aria-hidden":!0}),re()]})]}),(0,Y.jsx)(z,{value:`latency`,children:(0,Y.jsx)(Tt,{})}),(0,Y.jsxs)(z,{value:`events`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ue(),(0,Y.jsx)(`strong`,{children:Ae()}),r(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:le()})]}),(0,Y.jsxs)(yt,{q:g,onQChange:_e,searchPlaceholder:we(),timeRange:y,onTimeRangeChange:k,onReset:je,canReset:M,children:[(0,Y.jsxs)(U,{value:o,onValueChange:D,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:be()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:Ce()}),jt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:u,onValueChange:xe,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:ee()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:ze()}),Mt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:f,onValueChange:Se,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:te()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:h()}),Nt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:m,onValueChange:O,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(K,{placeholder:ye()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:ge()}),ke.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:i,onValueChange:he,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(K,{placeholder:_()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:At,children:ve()}),Oe.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:String(n),onValueChange:e=>ue(Number(e)),children:[(0,Y.jsx)(V,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(K,{})}),(0,Y.jsx)(q,{children:kt.map(e=>(0,Y.jsx)(H,{value:String(e),children:s({count:e})},e))})]})]}),(0,Y.jsx)(bt,{fields:Ft,seed:b,onChange:Te}),w?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>T(null),title:Xe(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[de(),(0,Y.jsx)(`code`,{children:$(w)})]}),(0,Y.jsx)(Qe,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:ne()})]})}):null,(0,Y.jsx)(xt,{title:v(),rows:N,emptyHint:w?p():se(),columns:[{header:ae(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:ie(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(W,{variant:`secondary`,children:e.kind})},{header:Me(),sort:e=>Rt(e)??null,cell:e=>{let t=Rt(e);return t?(0,Y.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,Y.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":a(),children:`✓`})}},{header:Ne(),sort:e=>e.direction,cell:e=>e.direction?(0,Y.jsx)(W,{variant:`outline`,children:e.direction}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:oe(),sort:e=>e.principalType,cell:e=>(0,Y.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,Y.jsx)(W,{variant:`outline`,children:e.principalType}),e.principalId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:l(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,Y.jsx)(W,{variant:`secondary`,children:e.roleKey}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:d(),sort:e=>e.route,cell:e=>e.route?(0,Y.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,Y.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:me(),sort:e=>e.status,cell:e=>e.status===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsx)(`span`,{className:`oc-traces__status ${Lt(e.status)}`,children:e.status})},{header:Ke(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:c(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:pe(),onClick:()=>T(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Je(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>E(e),children:De()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(zt,{row:ce,onClose:()=>E(null)})]})]})}function Lt(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Rt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function zt({row:e,onClose:t}){let n=(0,J.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,Y.jsx)(gt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(st,{className:`max-w-lg`,children:[(0,Y.jsxs)(ft,{children:[(0,Y.jsxs)(lt,{className:`oc-traces__meta-title`,children:[Ye(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(W,{variant:`outline`,children:Ge()})]}),(0,Y.jsx)(ct,{children:A()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{It as TracesTab};
|
|
1
|
+
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$_ as r,$w as i,A_ as a,Aw as o,B_ as s,C_ as c,D_ as l,Dw as u,E_ as d,Ew as f,F_ as p,Fw as m,G_ as h,Gw as g,H_ as _,I_ as v,Iw as y,J_ as ee,Jw as b,K_ as te,Kw as x,L_ as ne,Lw as re,MM as S,M_ as ie,Mw as C,N_ as ae,Nw as w,O_ as oe,Ow as T,P_ as se,Pw as ce,Q_ as le,Qt as E,Qw as ue,R_ as de,Rw as fe,S_ as pe,T_ as me,Tw as he,U_ as ge,Uw as _e,V_ as ve,W_ as ye,Ww as D,X_ as be,Xt as xe,Xw as Se,Y_ as Ce,Yw as O,Z_ as we,Zt as k,Zw as Te,__ as A,aT as Ee,b_ as De,c as j,cT as Oe,dT as ke,eT as M,ev as Ae,fT as je,iT as N,jM as P,j_ as Me,jw as F,k_ as Ne,kw as Pe,l as I,lT as Fe,nT as Ie,oT as Le,pT as Re,q_ as ze,qw as Be,rT as Ve,sT as He,tT as L,tv as Ue,uT as We,v_ as Ge,w_ as Ke,ww as qe,x_ as Je,y_ as Ye,z_ as Xe}from"./dist-Bh78J5oj.js";import{n as Ze}from"./dist-CY9tmHrN.js";import{t as Qe}from"./x-Dj2c0suA.js";import{i as R,n as z,r as $e,t as et}from"./tabs-BQAkx85P.js";import{t as B}from"./button-BWtKy7q6.js";import{Bt as tt,C as V,S as H,Vt as nt,Wt as rt,Xt as it,Yt as at,a as ot,b as U,ct as W,dt as st,et as G,ft as ct,ht as lt,i as ut,j as dt,mt as ft,o as pt,r as mt,tt as ht,ut as gt,w as K,x as q,xt as _t}from"./index-BoGVkzmD.js";import{n as vt}from"./TimeRangePicker-C3vWWVJs.js";import{t as yt}from"./FilterBar-CTBZM__z.js";import{t as bt}from"./AdvancedFilter-CXI70fDB.js";import{t as xt}from"./DataTableShell-DTw-rOw3.js";var St=I(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ct=I(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),J=e(t(),1),Y=n(),X={kind:`relative`,from:`now-520w`,to:`now`},Z=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?b():n===`agent`?`${Be()} - ${r}`:e}function Tt(){let e=S(j.me.getMe,{host:_t})?.role===`admin`,t=S(j.deliveryTiming.getDeliveryStatus,{}),n=P(j.deliveryTiming.startDeliveryRecord),r=P(j.deliveryTiming.stopDeliveryRecord),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!1)}};return(0,Y.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:Re()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:je()})]}),e?(0,Y.jsx)(B,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?We():ke()}):null]}),c?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(W,{variant:`secondary`,children:Fe()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:Oe({time:ht(t.startedAt)})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?Ee():Le()})}),i?(0,Y.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=S(j.deliveryTiming.listDeliverySessions,{}),n=P(j.deliveryTiming.deleteDeliverySessions),[r,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(`all`),[c,l]=(0,J.useState)(X),[u,d]=(0,J.useState)(null),{from:f,to:p}=vt(c),m=c.to===`now`?1/0:p,h=r.trim()!==``||o!==`all`||c!==X,_=()=>{a(``),s(`all`),l(X)},v=(0,J.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=m).map(e=>({...e,_id:e.sessionId}))},[t,r,o,f,m]),y=e=>{let t=new Set((v??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(yt,{q:r,onQChange:a,searchPlaceholder:Ve(),timeRange:c,onTimeRangeChange:l,onReset:_,canReset:h,children:(0,Y.jsxs)(U,{value:o,onValueChange:e=>s(e),children:[(0,Y.jsx)(V,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(K,{})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:`all`,children:Ie()}),(0,Y.jsx)(H,{value:`active`,children:L()}),(0,Y.jsx)(H,{value:`stopped`,children:M()})]})]})}),(0,Y.jsx)(xt,{title:N(),rows:v,emptyHint:he(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(B,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?g():x(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,Y.jsx)(St,{size:15,"aria-hidden":!0}):(0,Y.jsx)(nt,{size:15,"aria-hidden":!0})})},{header:i(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:ue(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,Y.jsx)(`span`,{className:`tabular-nums`,children:G(e.stoppedAt)})},{header:Te(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:Se(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:O(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(W,{variant:`secondary`,children:L()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:M()})}],rowActions:e?e=>[{label:D(),variant:`destructive`,onSelect:()=>y([e.sessionId])}]:void 0,bulkActions:e?[{label:D(),variant:`destructive`,onSelect:e=>y(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,Y.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=S(j.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(dt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:_e()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:He()});let r=e.segments,i=(e,t)=>(0,Y.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,Y.jsx)(`td`,{className:`py-1`,children:e}),(0,Y.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,Y.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[Z(t.p50),` / `,Z(t.p95),` / `,Z(t.max)]})]});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,qe()]}),(0,Y.jsxs)(B,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(Ze,{size:13,"aria-hidden":!0}):(0,Y.jsx)(rt,{size:13,"aria-hidden":!0}),t?f():u()]})]}),(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,Y.jsx)(`th`,{className:`py-1 font-medium`,children:y()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:m()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:ce()})]})}),(0,Y.jsxs)(`tbody`,{children:[i(w(),r.bridge),i(C(),r.A),i(F(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()})]})}var kt=[50,100,200,500],At=`all`,Q=`__all__`,jt=[`2xx`,`4xx`,`5xx`],Mt=[`user`,`service`,`system`],Nt=[`inbound`,`outbound`,`internal`],Pt={kind:`relative`,from:`now-30d`,to:`now`},Ft=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:E()},{value:`principalType`,label:k()},{value:`direction`,label:`direction`},{value:`roleKey`,label:xe()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=it({from:`/settings/traces`}),t=at({from:`/settings/traces`}),n=e.limit,i=e.kind,o=e.statusClass??Q,u=e.principalType??Q,f=e.direction??Q,m=e.roleKey??Q,g=e.q??``,y=mt(e.from,e.to),b=(0,J.useMemo)(()=>pt(e.adv),[e.adv]),{from:x,to:C}=vt(y),[w,T]=(0,J.useState)(null),[ce,E]=(0,J.useState)(null),ue=e=>void t({search:t=>({...t,limit:e})}),he=e=>void t({search:t=>({...t,kind:e})}),_e=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),D=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),xe=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),Se=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),O=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,...ot(e)})}),Te=e=>void t({search:t=>({...t,adv:ut(e)}),replace:!0}),A=S(j.observability.listEvents,{limit:n}),Ee=S(j.observability.listEvents,{limit:n,kind:i===At?void 0:i,filter:{q:g||void 0,from:x,to:C,statusClass:o===Q?void 0:o,principalType:u===Q?void 0:u,direction:f===Q?void 0:f,roleKey:m===Q?void 0:m,advanced:b.length>0?b:void 0}}),Oe=(0,J.useMemo)(()=>{let e=new Set;for(let t of A??[])e.add(t.kind);return[...e].sort()},[A]),ke=(0,J.useMemo)(()=>{let e=new Set;for(let t of A??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[A]),M=g!==``||o!==Q||u!==Q||f!==Q||m!==Q||b.length>0||y.kind!==`relative`||y.from!==Pt.from;function je(){t({search:{limit:100,kind:`all`},replace:!0})}let N=w?A?.filter(e=>e.correlationId===w):Ee,P=e.section,F=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,Y.jsxs)(et,{value:P,onValueChange:e=>F(e),children:[(0,Y.jsxs)($e,{className:`w-full`,children:[(0,Y.jsxs)(R,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(tt,{size:13,"aria-hidden":!0}),fe()]}),(0,Y.jsxs)(R,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(Ct,{size:13,"aria-hidden":!0}),re()]})]}),(0,Y.jsx)(z,{value:`latency`,children:(0,Y.jsx)(Tt,{})}),(0,Y.jsxs)(z,{value:`events`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ue(),(0,Y.jsx)(`strong`,{children:Ae()}),r(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:le()})]}),(0,Y.jsxs)(yt,{q:g,onQChange:_e,searchPlaceholder:we(),timeRange:y,onTimeRangeChange:k,onReset:je,canReset:M,children:[(0,Y.jsxs)(U,{value:o,onValueChange:D,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:be()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:Ce()}),jt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:u,onValueChange:xe,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:ee()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:ze()}),Mt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:f,onValueChange:Se,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{placeholder:te()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:h()}),Nt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:m,onValueChange:O,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(K,{placeholder:ye()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:Q,children:ge()}),ke.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:i,onValueChange:he,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(K,{placeholder:_()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(H,{value:At,children:ve()}),Oe.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:String(n),onValueChange:e=>ue(Number(e)),children:[(0,Y.jsx)(V,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(K,{})}),(0,Y.jsx)(q,{children:kt.map(e=>(0,Y.jsx)(H,{value:String(e),children:s({count:e})},e))})]})]}),(0,Y.jsx)(bt,{fields:Ft,seed:b,onChange:Te}),w?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>T(null),title:Xe(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[de(),(0,Y.jsx)(`code`,{children:$(w)})]}),(0,Y.jsx)(Qe,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:ne()})]})}):null,(0,Y.jsx)(xt,{title:v(),rows:N,emptyHint:w?p():se(),columns:[{header:ae(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:ie(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(W,{variant:`secondary`,children:e.kind})},{header:Me(),sort:e=>Rt(e)??null,cell:e=>{let t=Rt(e);return t?(0,Y.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,Y.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":a(),children:`✓`})}},{header:Ne(),sort:e=>e.direction,cell:e=>e.direction?(0,Y.jsx)(W,{variant:`outline`,children:e.direction}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:oe(),sort:e=>e.principalType,cell:e=>(0,Y.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,Y.jsx)(W,{variant:`outline`,children:e.principalType}),e.principalId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:l(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,Y.jsx)(W,{variant:`secondary`,children:e.roleKey}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:d(),sort:e=>e.route,cell:e=>e.route?(0,Y.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,Y.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:me(),sort:e=>e.status,cell:e=>e.status===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsx)(`span`,{className:`oc-traces__status ${Lt(e.status)}`,children:e.status})},{header:Ke(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:c(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:pe(),onClick:()=>T(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Je(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>E(e),children:De()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(zt,{row:ce,onClose:()=>E(null)})]})]})}function Lt(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Rt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function zt({row:e,onClose:t}){let n=(0,J.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,Y.jsx)(gt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(st,{className:`max-w-lg`,children:[(0,Y.jsxs)(ft,{children:[(0,Y.jsxs)(lt,{className:`oc-traces__meta-title`,children:[Ye(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(W,{variant:`outline`,children:Ge()})]}),(0,Y.jsx)(ct,{children:A()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{It as TracesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{AS as r,BS as i,Bg as a,CS as o,DS as s,ES as c,FS as l,Fg as u,HS as d,Hg as f,IS as p,Ig as m,LS as h,Lg as g,MM as _,MS as ee,Mg as v,NS as te,Ng as y,OS as b,PS as ne,Pg as x,RS as re,Rg as S,SS as ie,TS as ae,US as C,Ug as w,VS as T,Vg as E,Xx as oe,_S as se,au as D,bS as ce,c as O,gS as le,hS as ue,iu as k,jM as A,jS as de,jg as j,kS as fe,ru as M,vS as pe,wS as me,xS as he,yS as ge,zS as _e,zg as N}from"./dist-Bh78J5oj.js";import{t as P}from"./button-BWtKy7q6.js";import{B as F,C as I,Mt as L,Nt as R,S as z,V as ve,Xt as ye,Yt as be,at as B,b as V,c as xe,ct as H,dt as Se,ft as Ce,ht as we,it as Te,l as U,mt as Ee,nt as De,p as W,rt as Oe,s as G,st as ke,ut as Ae,w as K,x as q,xt as J,z as Y}from"./index-
|
|
1
|
+
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{AS as r,BS as i,Bg as a,CS as o,DS as s,ES as c,FS as l,Fg as u,HS as d,Hg as f,IS as p,Ig as m,LS as h,Lg as g,MM as _,MS as ee,Mg as v,NS as te,Ng as y,OS as b,PS as ne,Pg as x,RS as re,Rg as S,SS as ie,TS as ae,US as C,Ug as w,VS as T,Vg as E,Xx as oe,_S as se,au as D,bS as ce,c as O,gS as le,hS as ue,iu as k,jM as A,jS as de,jg as j,kS as fe,ru as M,vS as pe,wS as me,xS as he,yS as ge,zS as _e,zg as N}from"./dist-Bh78J5oj.js";import{t as P}from"./button-BWtKy7q6.js";import{B as F,C as I,Mt as L,Nt as R,S as z,V as ve,Xt as ye,Yt as be,at as B,b as V,c as xe,ct as H,dt as Se,ft as Ce,ht as we,it as Te,l as U,mt as Ee,nt as De,p as W,rt as Oe,s as G,st as ke,ut as Ae,w as K,x as q,xt as J,z as Y}from"./index-BoGVkzmD.js";import{t as je}from"./FilterBar-CTBZM__z.js";import{t as Me}from"./DataTableShell-DTw-rOw3.js";import{t as Ne}from"./DetailChips-BviEGC5c.js";var X=e(t(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=_(O.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=_(O.agents.listUserAgents,n&&e?{profileId:e}:`skip`),s=new Set((o??[]).map(e=>`${e.instanceName}/${e.agentId}`)),c=(o??[]).find(e=>e.isDefault)??null,l=c?`${c.instanceName}/${c.agentId}`:null,u=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),d=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(o??[]).filter(e=>!u.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,enabled:e.enabled,state:e.state,outOfPool:!0}))],p=new Map;for(let e of d){let t=p.get(e.instanceName)??[];t.push(e),p.set(e.instanceName,t)}return(0,Z.jsx)(Ae,{open:n,onOpenChange:r,children:(0,Z.jsxs)(Se,{className:`oc-access`,children:[(0,Z.jsxs)(Ee,{children:[(0,Z.jsx)(we,{children:w({user:t})}),(0,Z.jsx)(Ce,{children:f()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?E():a()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:N()}):d.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:m()}):[...p.entries()].map(([t,n])=>(0,Z.jsx)(Fe,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:l},t))})]})})}function Fe({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=A(O.agents.assignAgent),s=A(O.agents.removeAgent),c=A(O.agents.setDefaultAgent),l=Y();if(!e)return null;async function d(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(S(),e)}}async function f(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(g(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(R,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),o=a===n,s=e.state===`deleted`,c=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${c?` is-disabled`:``}`,children:[(0,Z.jsx)(W,{checked:r,disabled:(s||c)&&!r,onCheckedChange:()=>void d(e.agentId,r),"aria-label":u({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,s?(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:x()}):null,e.outOfPool?(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:y()}):null,r?o?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":v(),title:v(),children:(0,Z.jsx)(L,{size:14,fill:`currentColor`})}):(0,Z.jsx)(P,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":j(),title:j(),disabled:c,onClick:()=>void f(e.agentId),children:(0,Z.jsx)(L,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return M();case`user`:return k();case`admin`:return D();default:return e}}function Ie({granted:e,onToggle:t}){let n=new Set(e),r=G.filter(e=>n.has(U[e])).length;return(0,Z.jsxs)(De,{children:[(0,Z.jsx)(ke,{asChild:!0,children:(0,Z.jsx)(P,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?C():d({count:r})})}),(0,Z.jsxs)(Oe,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(B,{children:T()}),G.map(e=>{let r=U[e];return(0,Z.jsxs)(Te,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(W,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:xe[e]()})]},e)})]})]})}function Le(){let e=ye({from:`/settings/users`}),t=be({from:`/settings/users`}),n=e.q??``,a=e.role??Q,u=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),d=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),f=_(O.admin.listUsers,{filter:{q:n||void 0,role:a===Q?void 0:a},withAgents:!0}),m=_(O.me.getMe,{host:J}),g=A(O.admin.setRole),v=A(O.admin.setUserPermissions),y=A(O.admin.startImpersonation),x=A(O.admin.deleteUser),S=A(O.admin.setUserName),C=F(),w=ve(),T=Y(),[E,D]=(0,X.useState)(null),k=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of f??[])e.add(t.role);return[...e]},[f]),j=n!==``||a!==Q;function M(){t({search:{},replace:!0})}async function N(e){try{await g(e)}catch(e){T.error(i(),e)}}async function P(e){try{await v(e)}catch(e){T.error(_e(),e)}}async function L(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await C({title:ee(),description:de({user:t}),confirmWord:r(),confirmLabel:fe(),destructive:!0}))try{await x({profileId:e._id}),T.success(s({user:t}))}catch(e){T.error(b(),e)}}async function B(e){let t=e.email||e.name||e.userId.slice(0,8),n=await w({title:ae(),label:me({user:t}),placeholder:o(),defaultValue:e.name??``,confirmLabel:oe()});if(n!==null)try{await S({profileId:e._id,name:n}),T.success(ie())}catch(e){T.error(he(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{q:n,onQChange:u,searchPlaceholder:re(),onReset:M,canReset:j,children:(0,Z.jsxs)(V,{value:a,onValueChange:d,children:[(0,Z.jsx)(I,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(z,{value:Q,children:h()}),k.map(e=>(0,Z.jsx)(z,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:p(),rows:f,emptyHint:l(),rowActions:e=>{let t=[{label:ue(),onSelect:()=>D({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:c(),onSelect:()=>void B(e)}];return e.userId!==m?.userId&&t.push({label:ne(),onSelect:()=>void y({profileId:e._id})},{label:te(),variant:`destructive`,onSelect:()=>void L(e)}),t},columns:[{header:ce(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{children:t}),n?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:ge(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(V,{value:e.role,onValueChange:t=>void N({profileId:e._id,role:t}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(z,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(z,{value:`user`,children:$(`user`)}),(0,Z.jsx)(z,{value:`admin`,children:$(`admin`)})]})]})},{header:pe(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:se()}):(0,Z.jsx)(Ie,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),P({profileId:e._id,permissions:[...n]})}})},{header:le(),cell:e=>(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(R,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Pe,{profileId:E?.profileId??null,userLabel:E?.label??``,open:E!==null,onOpenChange:e=>{e||D(null)}})]})}export{Le as UsersTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$ as r,A as i,C as a,CM as o,E as s,F as c,I as l,J as u,K as d,L as f,MM as p,O as m,P as h,Q as g,R as ee,T as te,TM as ne,X as _,Y as re,Ys as ie,Z as ae,Zs as oe,_l as v,_t as se,at as ce,c as y,ct as b,d as x,dt as S,et as C,ft as w,gt as le,ht as ue,it as T,j as E,jM as D,k as de,kM as fe,l as pe,lt as O,mt as me,nt as k,ot as A,pt as j,q as M,rt as N,st as P,tt as F,ut as I,w as L}from"./dist-Bh78J5oj.js";import{i as R,n as z,r as he,t as B}from"./tabs-
|
|
1
|
+
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{$ as r,A as i,C as a,CM as o,E as s,F as c,I as l,J as u,K as d,L as f,MM as p,O as m,P as h,Q as g,R as ee,T as te,TM as ne,X as _,Y as re,Ys as ie,Z as ae,Zs as oe,_l as v,_t as se,at as ce,c as y,ct as b,d as x,dt as S,et as C,ft as w,gt as le,ht as ue,it as T,j as E,jM as D,k as de,kM as fe,l as pe,lt as O,mt as me,nt as k,ot as A,pt as j,q as M,rt as N,st as P,tt as F,ut as I,w as L}from"./dist-Bh78J5oj.js";import{i as R,n as z,r as he,t as B}from"./tabs-BQAkx85P.js";import{t as V}from"./button-BWtKy7q6.js";import{C as H,F as ge,I as U,L as W,Lt as _e,M as ve,N as ye,P as be,R as xe,S as G,Xt as Se,Yt as Ce,b as K,ct as q,kt as we,p as J,w as Y,x as X,xt as Te}from"./index-BoGVkzmD.js";/* empty css */var Ee=pe(`audio-lines`,[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]),Z=e(t(),1),Q=n(),De=[[`auto`,()=>I()],[`fr-FR`,()=>ee()],[`en-US`,()=>f()],[`en-GB`,()=>l()],[`de-DE`,()=>c()],[`es-ES`,()=>h()]],Oe=[[`0.75`,()=>b()],[`1`,()=>P()],[`1.25`,()=>A()],[`1.5`,()=>ce()]],$=0;function ke({instance:e}){let t=D(y.admin.upsertInstanceConfig),n=e.config??{},r={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[i,o]=(0,Z.useState)(r),[c,l]=(0,Z.useState)(`idle`),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),m=fe(y.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{o({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),l(`idle`)},[e._id]);let h=i.enabled!==r.enabled||i.engine!==r.engine||i.lang!==r.lang||i.rate!==r.rate||i.autoRead!==r.autoRead;async function g(){l(`saving`);try{let n={...e.config??{}};n.voiceEnabled=i.enabled,i.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,i.lang===`auto`?delete n.voiceLang:n.voiceLang=i.lang;let r=Number.parseFloat(i.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,i.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),l(`idle`)}catch{l(`error`)}}return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(q,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(J,{checked:i.enabled,onCheckedChange:e=>o({...i,enabled:e===!0}),"aria-label":w()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:w()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,Q.jsxs)(K,{value:i.engine,onValueChange:e=>o({...i,engine:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":s(),children:(0,Q.jsx)(Y,{})}),(0,Q.jsxs)(X,{children:[(0,Q.jsx)(G,{value:`browser`,children:te()}),e.kind===`hermes`?null:(0,Q.jsx)(G,{value:`gateway`,children:L()})]})]})]}),i.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:a()}):null,i.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,Q.jsxs)(K,{value:i.lang,onValueChange:e=>o({...i,lang:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":S(),children:(0,Q.jsx)(Y,{})}),(0,Q.jsx)(X,{children:De.map(([e,t])=>(0,Q.jsx)(G,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,Q.jsxs)(K,{value:i.rate,onValueChange:e=>o({...i,rate:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":O(),children:(0,Q.jsx)(Y,{})}),(0,Q.jsx)(X,{children:Oe.map(([e,t])=>(0,Q.jsx)(G,{value:e,children:t()},e))})]})]}),i.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(J,{checked:i.autoRead,onCheckedChange:e=>o({...i,autoRead:e===!0}),disabled:!i.enabled,"aria-label":T()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:N()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(V,{size:`sm`,disabled:!h||c===`saving`,onClick:()=>void g(),children:c===`saving`?v():oe()}),(0,Q.jsx)(V,{variant:`outline`,size:`sm`,disabled:!i.enabled||u,onClick:()=>{let t=Number.parseFloat(i.rate)||1,n=++$;if(p(!1),W(),U(),i.engine!==`gateway`){ge(C(),{lang:be(i.lang,ne()),rate:t});return}d(!0),m({instanceName:e.name,text:C()}).then(({mime:e,audioBase64:r})=>{n===$&&ye(r,e,{rate:t})}).catch(()=>{n===$&&p(!0)}).finally(()=>d(!1))},children:u?v():k()}),(0,Q.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>{$++,d(!1),W(),U()},children:F()})]}),c===`error`||f?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:f?x():ie()}):null]})}function Ae({stt:e}){let t=p(y.me.getMe,{host:Te}),n=D(y.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,a=t?.role===`admin`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:g()}),(0,Q.jsx)(q,{variant:e?`secondary`:`outline`,children:e?M():d()}),(0,Q.jsx)(q,{variant:r?`secondary`:`destructive`,children:r?i():de()})]}),a?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(J,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":E()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ae()})]})}function je(){let e=p(y.admin.listInstances,{}),t=(0,Z.useMemo)(()=>xe(),[]),n=(0,Z.useMemo)(()=>ve(),[]),{section:i}=Se({from:`/settings/voice`}),a=Ce({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(q,{variant:t?`secondary`:`destructive`,children:t?le():ue()}),(0,Q.jsx)(q,{variant:n?`secondary`:`destructive`,children:n?me():j()})]}),(0,Q.jsxs)(B,{value:i,onValueChange:e=>void a({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(he,{className:`w-full`,children:[(0,Q.jsxs)(R,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(we,{size:13,"aria-hidden":!0}),m()]}),(0,Q.jsxs)(R,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(_e,{size:13,"aria-hidden":!0}),g()]}),(0,Q.jsxs)(R,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ee,{size:13,"aria-hidden":!0}),_()]})]}),(0,Q.jsx)(z,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(z,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsx)(z,{value:`talk`,children:(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:_()}),(0,Q.jsx)(q,{variant:`outline`,children:re()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:u()})]})})]})]})}export{je as VoiceTab};
|
package/dist/assets/{highlighted-body-OFNGDK62-CaUQ2KWd.js → highlighted-body-OFNGDK62-DoH8U-bo.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{D as r,E as i,T as a}from"./index-
|
|
1
|
+
import{c as e,i as t,r as n}from"./bundle-mjs-BJq7W7j9.js";import{D as r,E as i,T as a}from"./index-BoGVkzmD.js";var o=e(t(),1),s=n(),c=({code:e,language:t,raw:n,className:c,startLine:l,lineNumbers:u,...d})=>{let{shikiTheme:f}=(0,o.useContext)(r),p=i(),[m,h]=(0,o.useState)(n);return(0,o.useEffect)(()=>{if(!p){h(n);return}let r=p.highlight({code:e,language:t,themes:f},e=>{h(e)});r&&h(r)},[e,t,f,p,n]),(0,s.jsx)(a,{className:c,language:t,lineNumbers:u,result:m,startLine:l,...d})};export{c as HighlightedCodeBlockBody};
|