@lacneu/atrium 0.44.0 → 0.44.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.
Files changed (35) hide show
  1. package/dist/assets/{AccessTab-DIQGYONr.js → AccessTab-D0JX5_mH.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-DvEno3Aq.js → AdvancedFilter-C2V1UpGN.js} +1 -1
  3. package/dist/assets/{AgentFilesTab-D58Ewnxq.js → AgentFilesTab-C3K357SP.js} +1 -1
  4. package/dist/assets/{AnomaliesTab-BlhZZGZK.js → AnomaliesTab-DrZDQWE-.js} +1 -1
  5. package/dist/assets/{AuditTab-BvVSi2_w.js → AuditTab-Dya-8fsa.js} +1 -1
  6. package/dist/assets/{BridgeTab-D2Qg8iKI.js → BridgeTab-hb74bUWf.js} +1 -1
  7. package/dist/assets/{ChatDefaultsTab-CidvTjIU.js → ChatDefaultsTab-Dew3JIDA.js} +1 -1
  8. package/dist/assets/{DataTableShell-C_uiwnG-.js → DataTableShell-BYoFVC-r.js} +1 -1
  9. package/dist/assets/{DetailChips-Bi7POigs.js → DetailChips-CTEdEWG0.js} +1 -1
  10. package/dist/assets/{FeedbacksTab-DK6ZRozw.js → FeedbacksTab-Cev0HZud.js} +1 -1
  11. package/dist/assets/{FieldLabel-aA5o4R2f.js → FieldLabel-DGjTbsLi.js} +1 -1
  12. package/dist/assets/{FilesTab-N0bxhD0W.js → FilesTab-kPVOWWll.js} +1 -1
  13. package/dist/assets/{FilterBar-hVahB9Hp.js → FilterBar-CVU7c-v_.js} +1 -1
  14. package/dist/assets/{GroupsTab-D-5SYzK-.js → GroupsTab-BitxCqvs.js} +1 -1
  15. package/dist/assets/{InstancesTab-BuWsscmq.js → InstancesTab-C2LweWWX.js} +1 -1
  16. package/dist/assets/{IntegrationsTab-x8t35z2u.js → IntegrationsTab-C9agAKR0.js} +1 -1
  17. package/dist/assets/{KpiTab-DYi2oDFh.js → KpiTab-EJ3olSOM.js} +1 -1
  18. package/dist/assets/{PreferencesTab-DIS_GpwC.js → PreferencesTab-CQXSbXS3.js} +1 -1
  19. package/dist/assets/{PromptInjectionsTab-BKs4VaBY.js → PromptInjectionsTab-Gwd3CkwY.js} +1 -1
  20. package/dist/assets/{RolesTab-oG79jIyV.js → RolesTab-DnckeL9t.js} +1 -1
  21. package/dist/assets/{ServiceAccountsTab-OLN1AmBk.js → ServiceAccountsTab-CoF3np7F.js} +1 -1
  22. package/dist/assets/{SubAgentReportsTab-B5Jv9cGp.js → SubAgentReportsTab-DXymt-IL.js} +1 -1
  23. package/dist/assets/{ThemeShowroom-jXfQmTvF.js → ThemeShowroom-B0VjVJkx.js} +1 -1
  24. package/dist/assets/{TimeRangePicker-Ys5YJrFa.js → TimeRangePicker-BlUshfcd.js} +1 -1
  25. package/dist/assets/{TracesTab-DS0dtQjd.js → TracesTab-CfJUlNIH.js} +1 -1
  26. package/dist/assets/{UsersTab-CtJNzVXo.js → UsersTab-DGaxkYl7.js} +1 -1
  27. package/dist/assets/{VoiceTab-CPvagmjD.js → VoiceTab-Bt3Lxg8m.js} +1 -1
  28. package/dist/assets/{highlighted-body-OFNGDK62-YEbKkO5h.js → highlighted-body-OFNGDK62-CS3Oy50y.js} +1 -1
  29. package/dist/assets/{index-BygEdn-c.js → index-Cw1UFCV-.js} +4 -4
  30. package/dist/assets/{index-EeiigULY.css → index-DOTJd3Hv.css} +1 -1
  31. package/dist/assets/mermaid-GHXKKRXX-DhO1q99Q.js +1 -0
  32. package/dist/assets/{tabs-1TpabOuW.js → tabs-DYLGMjrm.js} +1 -1
  33. package/dist/index.html +13 -2
  34. package/package.json +1 -1
  35. package/dist/assets/mermaid-GHXKKRXX-a-Uqa-4Y.js +0 -1
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,CC as i,E as a,EC as o,Ga as s,Ja as c,Ka as l,Qa as u,SC as d,Sj as f,TC as p,Xa as m,Ya as h,Za as g,_C as _,bC as v,gC as y,hC as b,mC as x,pC as S,qa as C,vC as w,wC as T,xC as E,xj as D,yC as O,yj as k}from"./dist-C2CRpdq8.js";import{t as A}from"./button-B39xibrh.js";import{ct as j,p as M,st as N}from"./index-BygEdn-c.js";var P=t(e(),1),F=n();function I(){let e=f(a.integrations.status.status,{}),t=D(a.admin.setIntegrationConfig),[n,s]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&s(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:o()});let c=n,l=(e,t,n)=>s({...c,[e]:{...c[e],[t]:n}}),m=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[p(),` `,(0,F.jsx)(`strong`,{children:T()}),` `,i()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:d()}):(0,F.jsx)(N,{variant:`outline`,children:E()}):(0,F.jsx)(N,{variant:`outline`,children:v()}),note:O(),children:[(0,F.jsx)(R,{label:_(),children:(0,F.jsx)(j,{value:c.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>l(`langfuse`,`host`,e.target.value),onBlur:()=>m(`langfuse`,{host:c.langfuse.host??``})})}),(0,F.jsx)(z,{label:S(),checked:c.langfuse.enabled??!0,onChange:e=>{l(`langfuse`,`enabled`,e),m(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:d()}):(0,F.jsx)(N,{variant:`outline`,children:E()}):(0,F.jsx)(N,{variant:`outline`,children:v()}),note:w(),children:[(0,F.jsx)(R,{label:y(),children:(0,F.jsx)(j,{value:c.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>l(`opik`,`baseUrl`,e.target.value),onBlur:()=>m(`opik`,{baseUrl:c.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:b(),children:(0,F.jsx)(j,{value:c.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||x(),onChange:e=>l(`opik`,`workspace`,e.target.value),onBlur:()=>m(`opik`,{workspace:c.opik.workspace??``})})}),(0,F.jsx)(z,{label:S(),checked:c.opik.enabled??!0,onChange:e=>{l(`opik`,`enabled`,e),m(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:d()}):(0,F.jsx)(N,{variant:`outline`,children:E()}):(0,F.jsx)(N,{variant:`outline`,children:r()}),note:u(),children:[(0,F.jsx)(R,{label:g(),children:(0,F.jsx)(j,{value:c.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>l(`otlp`,`endpoint`,e.target.value),onBlur:()=>m(`otlp`,{endpoint:c.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:S(),checked:c.otlp.enabled??!0,onChange:e=>{l(`otlp`,`enabled`,e),m(`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)(M,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=k(a.integrations.otlpSecret.setOtlpHeaders),n=D(a.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[o,u]=(0,P.useState)(null),[d,f]=(0,P.useState)(!1),p=async()=>{f(!0),u(null);try{await t({headersJson:r}),i(``)}catch(e){u(e instanceof Error?e.message:String(e))}finally{f(!1)}};return(0,F.jsxs)(R,{label:m(),children:[(0,F.jsx)(j,{value:r,placeholder:e?h():c(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:d||r.trim().length===0,onClick:()=>void p(),children:C()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:d,onClick:()=>void n({}),children:l()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:s()})]})}export{I as IntegrationsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,CC as i,E as a,EC as o,Ga as s,Ja as c,Ka as l,Qa as u,SC as d,Sj as f,TC as p,Xa as m,Ya as h,Za as g,_C as _,bC as v,gC as y,hC as b,mC as x,pC as S,qa as C,vC as w,wC as T,xC as E,xj as D,yC as O,yj as k}from"./dist-C2CRpdq8.js";import{t as A}from"./button-B39xibrh.js";import{ct as j,p as M,st as N}from"./index-Cw1UFCV-.js";var P=t(e(),1),F=n();function I(){let e=f(a.integrations.status.status,{}),t=D(a.admin.setIntegrationConfig),[n,s]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&s(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:o()});let c=n,l=(e,t,n)=>s({...c,[e]:{...c[e],[t]:n}}),m=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[p(),` `,(0,F.jsx)(`strong`,{children:T()}),` `,i()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:d()}):(0,F.jsx)(N,{variant:`outline`,children:E()}):(0,F.jsx)(N,{variant:`outline`,children:v()}),note:O(),children:[(0,F.jsx)(R,{label:_(),children:(0,F.jsx)(j,{value:c.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>l(`langfuse`,`host`,e.target.value),onBlur:()=>m(`langfuse`,{host:c.langfuse.host??``})})}),(0,F.jsx)(z,{label:S(),checked:c.langfuse.enabled??!0,onChange:e=>{l(`langfuse`,`enabled`,e),m(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:d()}):(0,F.jsx)(N,{variant:`outline`,children:E()}):(0,F.jsx)(N,{variant:`outline`,children:v()}),note:w(),children:[(0,F.jsx)(R,{label:y(),children:(0,F.jsx)(j,{value:c.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>l(`opik`,`baseUrl`,e.target.value),onBlur:()=>m(`opik`,{baseUrl:c.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:b(),children:(0,F.jsx)(j,{value:c.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||x(),onChange:e=>l(`opik`,`workspace`,e.target.value),onBlur:()=>m(`opik`,{workspace:c.opik.workspace??``})})}),(0,F.jsx)(z,{label:S(),checked:c.opik.enabled??!0,onChange:e=>{l(`opik`,`enabled`,e),m(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:d()}):(0,F.jsx)(N,{variant:`outline`,children:E()}):(0,F.jsx)(N,{variant:`outline`,children:r()}),note:u(),children:[(0,F.jsx)(R,{label:g(),children:(0,F.jsx)(j,{value:c.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>l(`otlp`,`endpoint`,e.target.value),onBlur:()=>m(`otlp`,{endpoint:c.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:S(),checked:c.otlp.enabled??!0,onChange:e=>{l(`otlp`,`enabled`,e),m(`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)(M,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=k(a.integrations.otlpSecret.setOtlpHeaders),n=D(a.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[o,u]=(0,P.useState)(null),[d,f]=(0,P.useState)(!1),p=async()=>{f(!0),u(null);try{await t({headersJson:r}),i(``)}catch(e){u(e instanceof Error?e.message:String(e))}finally{f(!1)}};return(0,F.jsxs)(R,{label:m(),children:[(0,F.jsx)(j,{value:r,placeholder:e?h():c(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:d||r.trim().length===0,onClick:()=>void p(),children:C()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:d,onClick:()=>void n({}),children:l()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:s()})]})}export{I as IntegrationsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,E as i,Pw as a,QC as o,Sj as s,am as c,cm as l,cw as u,dm as d,em as f,fm as p,im as m,lm as h,lw as g,nm as _,om as v,ow as y,pm as b,rm as x,sm as S,sw as C,tm as w,um as T}from"./dist-C2CRpdq8.js";import{Jt as E,a as ee,bt as te,n as ne,qt as re,r as D}from"./index-BygEdn-c.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-BV_9rQvt.js";import{n as N,t as P}from"./TimeRangePicker-Ys5YJrFa.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=s(i.me.getMe,{host:te})?.permissions?.includes(`traces.read`)??!1,t=s(i.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:a()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:g()}),(0,I.jsx)(j,{children:C()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),i=Math.max(1,...t,...n),a=t=>6+t*468/(e.length-1),s=e=>74-e*68/i,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${a(t).toFixed(1)},${s(e).toFixed(1)}`).join(` `),l=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:[o(),` p50 `,R(l.cP50),` `,u()]}),(0,I.jsxs)(`span`,{children:[r(),` p50 `,R(l.aP50),` `,u()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":g(),children:[(0,I.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:b(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:p(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:d(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:T(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:h(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:l(),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=re({from:`/settings/kpi`}),n=D(e.from,e.to,ne,`now`),r=e=>void t({search:t=>({...t,...ee(e)})}),{from:a,to:o}=N(n),{rowLimit:l,buckets:u}=K(a,o),d=s(i.kpi.listKpis,{limit:l,filter:{from:a,to:o}}),f=(0,F.useMemo)(()=>{let e=new Map;for(let t of d??[]){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>u&&e.set(t,n.slice(n.length-u));return e},[d,u]),p=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:v()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return d===void 0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):d.length===0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]}):(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(f.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:f.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:x({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:_()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:w({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":f({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
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,E as i,Pw as a,QC as o,Sj as s,am as c,cm as l,cw as u,dm as d,em as f,fm as p,im as m,lm as h,lw as g,nm as _,om as v,ow as y,pm as b,rm as x,sm as S,sw as C,tm as w,um as T}from"./dist-C2CRpdq8.js";import{Jt as E,a as ee,bt as te,n as ne,qt as re,r as D}from"./index-Cw1UFCV-.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-BV_9rQvt.js";import{n as N,t as P}from"./TimeRangePicker-BlUshfcd.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=s(i.me.getMe,{host:te})?.permissions?.includes(`traces.read`)??!1,t=s(i.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:a()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:g()}),(0,I.jsx)(j,{children:C()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),i=Math.max(1,...t,...n),a=t=>6+t*468/(e.length-1),s=e=>74-e*68/i,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${a(t).toFixed(1)},${s(e).toFixed(1)}`).join(` `),l=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:[o(),` p50 `,R(l.cP50),` `,u()]}),(0,I.jsxs)(`span`,{children:[r(),` p50 `,R(l.aP50),` `,u()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":g(),children:[(0,I.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:b(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:p(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:d(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:T(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:h(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:l(),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=re({from:`/settings/kpi`}),n=D(e.from,e.to,ne,`now`),r=e=>void t({search:t=>({...t,...ee(e)})}),{from:a,to:o}=N(n),{rowLimit:l,buckets:u}=K(a,o),d=s(i.kpi.listKpis,{limit:l,filter:{from:a,to:o}}),f=(0,F.useMemo)(()=>{let e=new Map;for(let t of d??[]){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>u&&e.set(t,n.slice(n.length-u));return e},[d,u]),p=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:v()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return d===void 0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):d.length===0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]}):(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(f.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:f.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:x({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:_()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:w({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":f({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{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,A as i,AO as a,BO as o,CO as s,DO as c,E as l,EO as u,F as d,FO as f,G as ee,I as te,IO as ne,L as re,LO as ie,M as ae,MO as oe,N as se,NO as ce,OO as le,P as ue,PO as p,QA as m,RO as h,SO as g,Sj as _,TO as de,VO as fe,X as pe,XA as me,YA as v,Z as y,ZA as b,_O as x,_x as S,aj as C,bO as w,cO as T,cj as E,dO as D,ej as O,fO as k,gO as A,hO as j,ij as M,j as N,jO as P,kO as F,lO as I,mO as L,n as R,nj as z,pO as he,pj as ge,rj as _e,sO as ve,tj as ye,uO as be,vO as xe,wO as Se,xO as Ce,xj as B,yO as V,zO as we}from"./dist-C2CRpdq8.js";import{t as H}from"./button-B39xibrh.js";import{C as Te,M as Ee,S as U,V as De,_t as Oe,b as ke,bt as W,ct as G,p as K,st as q,vt as Ae,w as je,x as Me,yt as Ne}from"./index-BygEdn-c.js";import{t as Pe}from"./localePickerView-C2RmOS86.js";var J=t(e(),1),Y=n();function Fe({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:()=>fe()},{id:`composer`,label:()=>o()},{id:`sidebar`,label:()=>we()},{id:`other`,label:()=>h()}],Z={showSource:{category:`messages`,label:()=>ie(),help:()=>ne()},showReport:{category:`messages`,label:()=>f(),help:()=>p()},copyAssistant:{category:`messages`,label:()=>ce()},copyUser:{category:`messages`,label:()=>oe()},showDelete:{category:`messages`,label:()=>P()},showTools:{category:`messages`,label:()=>a(),help:()=>F()},voiceInput:{category:`composer`,label:()=>le(),help:()=>c()},showUsage:{category:`composer`,label:()=>u(),help:()=>de()},autoReadAloud:{category:`composer`,label:()=>y(),help:()=>pe()},showChatAge:{category:`sidebar`,label:()=>Se(),help:()=>s()},showChatProvider:{category:`sidebar`,label:()=>g(),help:()=>Ce()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ie(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 Le=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`,`showUsage`,`autoReadAloud`],Re={voiceInput:`voiceInput`};function ze(e){return Le.includes(e)}function $(e){return e===`admin`}function Be(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Ve(e){return e===`on`?!0:e===`off`?!1:null}function He(e){return ze(e)?Re[e]:void 0}var Ue={voiceInput:()=>D()};function We({prefKey:e,ui:t}){let n=B(l.admin.setUiPrefDefault),r=B(l.admin.setFeatureEnabled),i=He(e),a=i?Ue[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:j()}),(0,Y.jsxs)(ke,{value:Be(t.defaults[e]),onValueChange:t=>void n({key:e,value:Ve(t)}),children:[(0,Y.jsx)(Te,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(je,{})}),(0,Y.jsxs)(Me,{children:[(0,Y.jsx)(U,{value:`on`,children:I()}),(0,Y.jsx)(U,{value:`off`,children:T()}),(0,Y.jsx)(U,{value:`inherit`,children:ve()})]})]}),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":L()}),L()]}):null]}),a?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Ge({current:e,enabled:t}){let n=B(l.me.setDictationShortcut),[r,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Ae(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}a(!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:[re(),e?(0,Y.jsx)(q,{variant:`secondary`,children:Ne(e,Oe())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:o?ue():r?d():te()})]}),(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:i()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?N():e?ae():se()})]})]})}function Ke(){let[e,t]=(0,J.useState)(``),[n,r]=(0,J.useState)(!1),i=_(l.me.getMe,{host:W}),a=i?.ui,o=$(i?.role)&&n,s=B(l.me.setUiPref).withOptimisticUpdate(Ee),c=(0,J.useMemo)(()=>a?Ie(Object.keys(a.effective),e):[],[a,e]);return a?(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":A()}),A()]}):null,o?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:he()}),(0,Y.jsx)(`p`,{children:k()}),(0,Y.jsx)(`p`,{children:be()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:w(),"aria-label":w(),className:`mb-2`}),c.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:V()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:c.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=a.locked[e],c=a.effective[e],l=a.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)(q,{variant:`outline`,children:xe()}):l?(0,Y.jsx)(q,{variant:`secondary`,children:ee()}):null]}),r?(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:x()}):null,(0,Y.jsx)(Fe,{checked:c,disabled:i,onCheckedChange:t=>void s({key:e,value:t}),"aria-label":n})]}),o?(0,Y.jsx)(We,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,Y.jsx)(Ge,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:ge()})}function qe(){let e=_(l.me.getMe,{host:W}),t=B(l.me.setLocale),n=B(l.me.setMyName),i=De(),a=e?.locale??`default`,o=e?.name??``,[s,c]=(0,J.useState)(null),u=s??o,d=u.trim()!==o.trim();async function f(){try{await n({name:u}),c(null),i.success(ye())}catch(e){i.error(O(),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:C()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:M()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:u,maxLength:120,placeholder:_e(),onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),f())}}),(0,Y.jsx)(H,{size:`sm`,disabled:!d,onClick:()=>void f(),children:S()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:z()})]}),(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:r()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:m()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[Pe().map(e=>(0,Y.jsx)(H,{variant:a===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(H,{variant:a==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:E()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:b()})]}),(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:me()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:v()})]}),(0,Y.jsx)(Ke,{})]})]})}export{qe as PreferencesTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,A as i,AO as a,BO as o,CO as s,DO as c,E as l,EO as u,F as d,FO as f,G as ee,I as te,IO as ne,L as re,LO as ie,M as ae,MO as oe,N as se,NO as ce,OO as le,P as ue,PO as p,QA as m,RO as h,SO as g,Sj as _,TO as de,VO as fe,X as pe,XA as me,YA as v,Z as y,ZA as b,_O as x,_x as S,aj as C,bO as w,cO as T,cj as E,dO as D,ej as O,fO as k,gO as A,hO as j,ij as M,j as N,jO as P,kO as F,lO as I,mO as L,n as R,nj as z,pO as he,pj as ge,rj as _e,sO as ve,tj as ye,uO as be,vO as xe,wO as Se,xO as Ce,xj as B,yO as V,zO as we}from"./dist-C2CRpdq8.js";import{t as H}from"./button-B39xibrh.js";import{C as Te,M as Ee,S as U,V as De,_t as Oe,b as ke,bt as W,ct as G,p as K,st as q,vt as Ae,w as je,x as Me,yt as Ne}from"./index-Cw1UFCV-.js";import{t as Pe}from"./localePickerView-C2RmOS86.js";var J=t(e(),1),Y=n();function Fe({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:()=>fe()},{id:`composer`,label:()=>o()},{id:`sidebar`,label:()=>we()},{id:`other`,label:()=>h()}],Z={showSource:{category:`messages`,label:()=>ie(),help:()=>ne()},showReport:{category:`messages`,label:()=>f(),help:()=>p()},copyAssistant:{category:`messages`,label:()=>ce()},copyUser:{category:`messages`,label:()=>oe()},showDelete:{category:`messages`,label:()=>P()},showTools:{category:`messages`,label:()=>a(),help:()=>F()},voiceInput:{category:`composer`,label:()=>le(),help:()=>c()},showUsage:{category:`composer`,label:()=>u(),help:()=>de()},autoReadAloud:{category:`composer`,label:()=>y(),help:()=>pe()},showChatAge:{category:`sidebar`,label:()=>Se(),help:()=>s()},showChatProvider:{category:`sidebar`,label:()=>g(),help:()=>Ce()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ie(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 Le=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`,`showUsage`,`autoReadAloud`],Re={voiceInput:`voiceInput`};function ze(e){return Le.includes(e)}function $(e){return e===`admin`}function Be(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Ve(e){return e===`on`?!0:e===`off`?!1:null}function He(e){return ze(e)?Re[e]:void 0}var Ue={voiceInput:()=>D()};function We({prefKey:e,ui:t}){let n=B(l.admin.setUiPrefDefault),r=B(l.admin.setFeatureEnabled),i=He(e),a=i?Ue[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:j()}),(0,Y.jsxs)(ke,{value:Be(t.defaults[e]),onValueChange:t=>void n({key:e,value:Ve(t)}),children:[(0,Y.jsx)(Te,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(je,{})}),(0,Y.jsxs)(Me,{children:[(0,Y.jsx)(U,{value:`on`,children:I()}),(0,Y.jsx)(U,{value:`off`,children:T()}),(0,Y.jsx)(U,{value:`inherit`,children:ve()})]})]}),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":L()}),L()]}):null]}),a?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Ge({current:e,enabled:t}){let n=B(l.me.setDictationShortcut),[r,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Ae(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}a(!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:[re(),e?(0,Y.jsx)(q,{variant:`secondary`,children:Ne(e,Oe())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:o?ue():r?d():te()})]}),(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:i()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?N():e?ae():se()})]})]})}function Ke(){let[e,t]=(0,J.useState)(``),[n,r]=(0,J.useState)(!1),i=_(l.me.getMe,{host:W}),a=i?.ui,o=$(i?.role)&&n,s=B(l.me.setUiPref).withOptimisticUpdate(Ee),c=(0,J.useMemo)(()=>a?Ie(Object.keys(a.effective),e):[],[a,e]);return a?(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":A()}),A()]}):null,o?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:he()}),(0,Y.jsx)(`p`,{children:k()}),(0,Y.jsx)(`p`,{children:be()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:w(),"aria-label":w(),className:`mb-2`}),c.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:V()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:c.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=a.locked[e],c=a.effective[e],l=a.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)(q,{variant:`outline`,children:xe()}):l?(0,Y.jsx)(q,{variant:`secondary`,children:ee()}):null]}),r?(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:x()}):null,(0,Y.jsx)(Fe,{checked:c,disabled:i,onCheckedChange:t=>void s({key:e,value:t}),"aria-label":n})]}),o?(0,Y.jsx)(We,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,Y.jsx)(Ge,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:ge()})}function qe(){let e=_(l.me.getMe,{host:W}),t=B(l.me.setLocale),n=B(l.me.setMyName),i=De(),a=e?.locale??`default`,o=e?.name??``,[s,c]=(0,J.useState)(null),u=s??o,d=u.trim()!==o.trim();async function f(){try{await n({name:u}),c(null),i.success(ye())}catch(e){i.error(O(),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:C()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:M()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:u,maxLength:120,placeholder:_e(),onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),f())}}),(0,Y.jsx)(H,{size:`sm`,disabled:!d,onClick:()=>void f(),children:S()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:z()})]}),(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:r()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:m()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[Pe().map(e=>(0,Y.jsx)(H,{variant:a===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(H,{variant:a==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:E()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:b()})]}),(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:me()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:v()})]}),(0,Y.jsx)(Ke,{})]})]})}export{qe as PreferencesTab};
@@ -1,4 +1,4 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$n as r,$t as i,Ah as a,Bh as o,Dh as s,E as c,Eh as l,Fh as u,Fi as d,Hh as f,Ih as p,Ii as m,Lh as h,Li as g,Mh as _,Nh as v,Ni as ee,Oh as y,Ph as b,Pi as x,Qn as S,Qt as C,Rh as w,Sj as T,Th as te,Uh as ne,Vh as re,Xh as E,Zh as ie,Zn as ae,Zt as D,er as O,jh as k,kh as A,nr as j,tr as M,wh as N,xj as P,zh as F}from"./dist-C2CRpdq8.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 oe}from"./FieldLabel-aA5o4R2f.js";import{t as U}from"./button-B39xibrh.js";import{C as W,S as G,V as K,b as q,bt as se,p as ce,w as J,x as Y}from"./index-BygEdn-c.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:w,help:h},documentary_fetch:{label:p,help:u},inbound_files:{label:b,help:v},history_summary:{label:g,help:m},file_curation:{label:j,help:M}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$n as r,$t as i,Ah as a,Bh as o,Dh as s,E as c,Eh as l,Fh as u,Fi as d,Hh as f,Ih as p,Ii as m,Lh as h,Li as g,Mh as _,Nh as v,Ni as ee,Oh as y,Ph as b,Pi as x,Qn as S,Qt as C,Rh as w,Sj as T,Th as te,Uh as ne,Vh as re,Xh as E,Zh as ie,Zn as ae,Zt as D,er as O,jh as k,kh as A,nr as j,tr as M,wh as N,xj as P,zh as F}from"./dist-C2CRpdq8.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 oe}from"./FieldLabel-DGjTbsLi.js";import{t as U}from"./button-B39xibrh.js";import{C as W,S as G,V as K,b as q,bt as se,p as ce,w as J,x as Y}from"./index-Cw1UFCV-.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:w,help:h},documentary_fetch:{label:p,help:u},inbound_files:{label:b,help:v},history_summary:{label:g,help:m},file_curation:{label:j,help:M}},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:l,references:te,files:N,previous_summary:d,new_messages:x,max_chars:ee,file_name:O,budget_chars:r,feedback:S,content:ae};function pe(){let e=T(c.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:k()})});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:ne(),help:f()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:_()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(J,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=P(c.admin.upsertInstanceConfig),n=K(),r=T(c.me.getMe,{host:se}),a=e.config??{},o=X(e.config?.contentLocale,r?.defaultLocale??void 0),[s,l]=(0,Q.useState)(()=>R(a,o));(0,Q.useEffect)(()=>{l(R(a,o))},[o,e._id]);let[u,d]=(0,Q.useState)(!1),f=s.promptInjections,p=(e,t)=>l({...s,promptInjections:{...f,[e]:{...f[e],...t}}});async function m(){d(!0);try{await t({instanceId:e._id,config:V(s,a,o)})}catch(e){n.error(E(),e)}finally{d(!1)}}async function h(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(E(),e)}}let g=e.config?.contentLocale??`default`,_=Z[X(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:i()}),(0,$.jsxs)(q,{value:g,onValueChange:e=>void h(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(J,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(G,{value:`default`,children:D({locale:_})}),le().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:C()})]}),oe.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:f[e]??{enabled:!0,template:z[e].defaultTemplate[o]},contentLocale:o,onChange:t=>p(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void m(),disabled:u,children:ie()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:c}){let[l,u]=(0,Q.useState)(!1),d=r.template.trim()!==t.defaultTemplate[i],f=t.togglable&&!r.enabled,p=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),m=I(e,r,i),h=m?L(m,p):``;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)(ce,{checked:r.enabled,onCheckedChange:e=>c({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),d&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:o()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:f,rows:8,spellCheck:!1,onChange:e=>c({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:F()}),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)(U,{variant:`ghost`,size:`sm`,onClick:()=>u(e=>!e),children:l?A():a()}),d&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>c({template:t.defaultTemplate[i]}),children:re()})]})]}),l&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:y()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:s()})})]})}export{pe as PromptInjectionsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Ay as i,Cy as a,Dy as o,E as s,Er as c,Ey as l,Fy as u,Jv as d,Kv as f,My as p,Ny as m,Oy as h,Py as g,Qv as _,Sj as v,Sy as y,Ty as b,Xv as x,Yv as S,Zv as C,_y as ee,by as te,cy as ne,dy as re,ey as ie,fy as w,gy as T,hy as E,jy as D,ky as O,ly as k,my as A,oy as j,py as M,qv as N,sy as P,uy as F,vy as I,wy as L,xj as R,xy as z,yy as ae}from"./dist-C2CRpdq8.js";import{t as B}from"./button-B39xibrh.js";import{H as V,Lt as H,V as U,ct as W,p as G,st as K,u as q}from"./index-BygEdn-c.js";import{t as J}from"./roleDescriptions-BU3_Xc_1.js";var Y=t(e(),1),X=n(),Z=[{group:()=>u(),keys:[{key:`traces.read`,label:()=>i()},{key:`traces.read.content`,label:()=>O(),phi:!0},{key:`traces.write`,label:()=>h()}]},{group:()=>g(),keys:[{key:`kpi.read`,label:()=>i()},{key:`kpi.write`,label:()=>h()}]},{group:()=>m(),keys:[{key:`openclaw.query`,label:()=>o()},{key:`anomalies.read`,label:()=>l()},{key:`anomalies.report`,label:()=>b()}]},{group:()=>p(),keys:[{key:`chats.read`,label:()=>i()},{key:`selfheal`,label:()=>a()},{key:`feedback.respond`,label:()=>c()}]},{group:()=>D(),keys:[{key:`admin.manage`,label:()=>L()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=v(s.apiKeys.listRoles,{}),t=R(s.apiKeys.createRole),n=R(s.apiKeys.ensureRolesSeeded),i=R(s.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(s.apiKeys.listRoles,{});r&&e.setQuery(s.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=V(),o=U(),[c,l]=(0,Y.useState)(!1),[u,p]=(0,Y.useState)($),[m,h]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{o.error(z(),e)})},[n,o]);let g=e??[];async function b(e,t){if(Q(e.permissions)||m.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await a({title:te({name:e.name}),description:ae(),confirmLabel:I()}))){h(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){o.error(ee(),e)}finally{h(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function D(){try{await t({key:u.key,name:u.name,description:u.description||void 0,permissions:[]}),p($),l(!1)}catch(e){o.error(T(),e)}}let O=e===void 0,L=!O&&g.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,A(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,M()]}),(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:w()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{p($),l(!0)},children:re()})})]}),O?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:F()}):L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):(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:ne()}),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?y({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:g.map(e=>{let t=Q(e.permissions),n=m.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)(K,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,P()]}):(0,X.jsx)(K,{variant:`secondary`,children:j()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(i=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(i),disabled:t||n,"aria-label":`${e.key} · ${i}`,title:t?ie():n?r():i,onCheckedChange:()=>void b(e,i)})},i))]},e.key)})})]})})]}),(0,X.jsx)(q,{open:c,onOpenChange:l,title:_(),description:C(),canSubmit:!!(u.key&&u.name),onSubmit:D,submitLabel:x(),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:S()}),(0,X.jsx)(W,{value:u.key,placeholder:d(),onChange:e=>p({...u,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:N()}),(0,X.jsx)(W,{value:u.name,onChange:e=>p({...u,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:f()}),(0,X.jsx)(W,{value:u.description,onChange:e=>p({...u,description:e.target.value})})]})]})})]})}export{se as RolesTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Ay as i,Cy as a,Dy as o,E as s,Er as c,Ey as l,Fy as u,Jv as d,Kv as f,My as p,Ny as m,Oy as h,Py as g,Qv as _,Sj as v,Sy as y,Ty as b,Xv as x,Yv as S,Zv as C,_y as ee,by as te,cy as ne,dy as re,ey as ie,fy as w,gy as T,hy as E,jy as D,ky as O,ly as k,my as A,oy as j,py as M,qv as N,sy as P,uy as F,vy as I,wy as L,xj as R,xy as z,yy as ae}from"./dist-C2CRpdq8.js";import{t as B}from"./button-B39xibrh.js";import{H as V,Lt as H,V as U,ct as W,p as G,st as K,u as q}from"./index-Cw1UFCV-.js";import{t as J}from"./roleDescriptions-BU3_Xc_1.js";var Y=t(e(),1),X=n(),Z=[{group:()=>u(),keys:[{key:`traces.read`,label:()=>i()},{key:`traces.read.content`,label:()=>O(),phi:!0},{key:`traces.write`,label:()=>h()}]},{group:()=>g(),keys:[{key:`kpi.read`,label:()=>i()},{key:`kpi.write`,label:()=>h()}]},{group:()=>m(),keys:[{key:`openclaw.query`,label:()=>o()},{key:`anomalies.read`,label:()=>l()},{key:`anomalies.report`,label:()=>b()}]},{group:()=>p(),keys:[{key:`chats.read`,label:()=>i()},{key:`selfheal`,label:()=>a()},{key:`feedback.respond`,label:()=>c()}]},{group:()=>D(),keys:[{key:`admin.manage`,label:()=>L()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=v(s.apiKeys.listRoles,{}),t=R(s.apiKeys.createRole),n=R(s.apiKeys.ensureRolesSeeded),i=R(s.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(s.apiKeys.listRoles,{});r&&e.setQuery(s.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=V(),o=U(),[c,l]=(0,Y.useState)(!1),[u,p]=(0,Y.useState)($),[m,h]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{o.error(z(),e)})},[n,o]);let g=e??[];async function b(e,t){if(Q(e.permissions)||m.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await a({title:te({name:e.name}),description:ae(),confirmLabel:I()}))){h(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){o.error(ee(),e)}finally{h(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function D(){try{await t({key:u.key,name:u.name,description:u.description||void 0,permissions:[]}),p($),l(!1)}catch(e){o.error(T(),e)}}let O=e===void 0,L=!O&&g.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,A(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,M()]}),(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:w()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{p($),l(!0)},children:re()})})]}),O?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:F()}):L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):(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:ne()}),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?y({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:g.map(e=>{let t=Q(e.permissions),n=m.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)(K,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,P()]}):(0,X.jsx)(K,{variant:`secondary`,children:j()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(i=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(i),disabled:t||n,"aria-label":`${e.key} · ${i}`,title:t?ie():n?r():i,onCheckedChange:()=>void b(e,i)})},i))]},e.key)})})]})})]}),(0,X.jsx)(q,{open:c,onOpenChange:l,title:_(),description:C(),canSubmit:!!(u.key&&u.name),onSubmit:D,submitLabel:x(),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:S()}),(0,X.jsx)(W,{value:u.key,placeholder:d(),onChange:e=>p({...u,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:N()}),(0,X.jsx)(W,{value:u.name,onChange:e=>p({...u,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:f()}),(0,X.jsx)(W,{value:u.description,onChange:e=>p({...u,description:e.target.value})})]})]})})]})}export{se as RolesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,$E as i,AD as a,BD as ee,BE as o,CD as te,DD as ne,E as s,ED as re,FD as ie,GD as ae,GE as c,HD as oe,HE as l,ID as se,JD as ce,JE as u,KD as le,KE as d,LD as ue,MD as de,ND as fe,OD as pe,PD as me,QD as he,QE as f,RD as ge,SD as _e,Sj as p,TD as ve,UD as ye,UE as m,VD as be,VE as xe,WD as Se,WE as Ce,XD as we,XE as Te,YD as Ee,YE as h,ZD as De,ZE as g,_D as Oe,aD as _,aO as ke,bD as Ae,cD as v,dD as je,eD as y,eO as b,fD as Me,gD as Ne,hD as Pe,iD as x,iO as Fe,jD as Ie,kD as Le,lD as S,mD as Re,nD as C,nO as ze,oD as w,oO as Be,pD as Ve,qD as He,qE as T,rD as E,rO as Ue,sD as D,tD as O,tO as k,uD as We,vD as Ge,wD as Ke,xD as qe,xj as A,yD as Je,yj as Ye,zD as Xe}from"./dist-C2CRpdq8.js";import{n as j}from"./dist-BB8NhuRg.js";import{i as Ze}from"./dist-uBTiN353.js";import{t as M}from"./button-B39xibrh.js";import{A as N,C as P,H as Qe,Jt as $e,Kt as et,S as F,Ut as I,V as tt,b as L,ct as R,dt as z,ft as B,k as V,lt as H,mt as nt,pt as rt,qt as it,st as U,u as at,ut as W,w as G,x as K}from"./index-BygEdn-c.js";import{t as ot}from"./FilterBar-hVahB9Hp.js";import{t as st}from"./DataTableShell-C_uiwnG-.js";import{t as ct}from"./roleDescriptions-BU3_Xc_1.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>d(),days:null},{value:`30`,label:()=>c(),days:30},{value:`90`,label:()=>Ce(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=$e({from:`/settings/serviceAccounts`}),t=it({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Z,[o,c]=(0,q.useState)(Z),l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),d=p(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===Z?void 0:o,disabled:i===Z?void 0:i===`disabled`}}),f=p(s.apiKeys.listKeys,{}),m=p(s.apiKeys.listRoles,{}),xe=A(s.apiKeys.createServiceAccount),Ce=A(s.apiKeys.updateServiceAccount),Te=A(s.apiKeys.deleteServiceAccount),h=Ye(s.apiKeys.mintApiKey),g=A(s.apiKeys.revokeApiKey),_=Qe(),v=tt(),y=n!==``||o!==Z||i!==Z;function x(){c(Z),t({search:{},replace:!0})}let[S,C]=(0,q.useState)(!1),[w,T]=(0,q.useState)(Q),[E,D]=(0,q.useState)(null),[O,j]=(0,q.useState)(new Set),[N,I]=(0,q.useState)(null),z=(0,q.useRef)(!1),[B,V]=(0,q.useState)(new Set),[H,nt]=(0,q.useState)({}),[rt,W]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[f]);function $(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{E?(await Ce({serviceAccountId:E,name:w.name,roleKey:w.roleKey,description:w.description}),v.success(Ke())):await xe({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Q),D(null),C(!1)}catch(e){v.error(E?ve():re(),e)}}function ft(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),D(e._id),C(!0)}async function pt(e){if(z.current)return;z.current=!0;let t=H[e._id]??`never`,n=Y.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;I(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(te(),e)}finally{z.current=!1,I(null)}}async function mt(e){if(await _({title:_e(),description:(0,J.jsxs)(J.Fragment,{children:[qe(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Ae(),` `,(0,J.jsx)(`strong`,{children:Je()}),` `,Ge()]}),confirmWord:e.name,confirmLabel:Oe(),destructive:!0}))try{await Te({serviceAccountId:e._id}),v.success(Ne(),e.name)}catch(e){v.error(Pe(),e)}}async function ht(e){if(await _({title:Re(),description:(0,J.jsxs)(J.Fragment,{children:[Ve(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Me()]}),confirmLabel:je(),destructive:!0})&&!B.has(e._id)){V(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){v.error(We(),e)}finally{V(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:Be()}),(0,J.jsxs)(ot,{q:n,onQChange:l,searchPlaceholder:ke(),onReset:x,canReset:y,children:[(0,J.jsxs)(L,{value:o,onValueChange:c,children:[(0,J.jsx)(P,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:Fe()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(F,{value:Z,children:Ue()}),(m??[]).map(e=>(0,J.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(L,{value:i,onValueChange:u,children:[(0,J.jsx)(P,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(F,{value:Z,children:ze()}),(0,J.jsx)(F,{value:`active`,children:k()}),(0,J.jsx)(F,{value:`disabled`,children:b()})]})]})]}),(0,J.jsx)(st,{title:r(),rows:d,addLabel:he(),onAdd:()=>{T(Q),D(null),C(!0)},emptyHint:De(),isExpanded:e=>O.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:B}),rowActions:e=>[{label:He(),onSelect:()=>ft(e)},{label:we(),onSelect:()=>void pt(e)},{label:O.has(e._id)?Ee():ce(),onSelect:()=>$(e._id)},{label:le(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":O.has(e._id)?ae():Se(),onClick:()=>$(e._id),children:O.has(e._id)?(0,J.jsx)(Ze,{}):(0,J.jsx)(et,{})})},{header:ye(),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:oe(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(U,{variant:`secondary`,children:e.roleKey})},{header:be(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(U,{variant:`destructive`,children:b()}):(0,J.jsx)(U,{variant:`outline`,children:k()})},{header:ee(),cell:e=>(0,J.jsxs)(L,{value:H[e._id]??`never`,onValueChange:t=>nt(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(P,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:Y.map(e=>(0,J.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:Xe(),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:N===e._id?ge():ue({count:t})})}}]}),(0,J.jsx)(at,{open:S,onOpenChange:e=>{C(e),e||D(null)},title:E?se():fe(),description:E?ie():de(),canSubmit:!!(w.name&&w.roleKey),onSubmit:dt,submitLabel:E?me():Ie(),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:a()}),(0,J.jsx)(R,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Le()}),(0,J.jsxs)(L,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,J.jsx)(P,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:pe()})}),(0,J.jsx)(K,{children:(m??[]).map(e=>(0,J.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(m??[]).find(e=>e.key===w.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:ne()}),(0,J.jsx)(R,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:rt,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:[S(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:D()}),(0,J.jsx)(`th`,{children:w()}),(0,J.jsx)(`th`,{children:_()}),(0,J.jsx)(`th`,{children:x()}),(0,J.jsx)(`th`,{children:E()}),(0,J.jsx)(`th`,{children:C()}),(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)(U,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:N(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)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?O():y()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function a(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(H,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(W,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(rt,{children:[(0,J.jsx)(nt,{children:i()}),(0,J.jsx)(z,{children:f({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:g()}),(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)(M,{variant:`outline`,size:`sm`,onClick:()=>void a(),"aria-label":Te(),children:[n?(0,J.jsx)(j,{}):(0,J.jsx)(I,{}),n?h():u()]})]}),(0,J.jsx)(B,{children:(0,J.jsx)(M,{onClick:()=>{r(!1),t()},children:T()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?m():N(e)}function pt(e){return e===null?`—`:V(e)}function mt(e){return e.disabled?(0,J.jsx)(U,{variant:`destructive`,children:l()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(U,{variant:`outline`,children:xe()}):(0,J.jsx)(U,{variant:`outline`,children:o()})}export{$ as ServiceAccountsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,$E as i,AD as a,BD as ee,BE as o,CD as te,DD as ne,E as s,ED as re,FD as ie,GD as ae,GE as c,HD as oe,HE as l,ID as se,JD as ce,JE as u,KD as le,KE as d,LD as ue,MD as de,ND as fe,OD as pe,PD as me,QD as he,QE as f,RD as ge,SD as _e,Sj as p,TD as ve,UD as ye,UE as m,VD as be,VE as xe,WD as Se,WE as Ce,XD as we,XE as Te,YD as Ee,YE as h,ZD as De,ZE as g,_D as Oe,aD as _,aO as ke,bD as Ae,cD as v,dD as je,eD as y,eO as b,fD as Me,gD as Ne,hD as Pe,iD as x,iO as Fe,jD as Ie,kD as Le,lD as S,mD as Re,nD as C,nO as ze,oD as w,oO as Be,pD as Ve,qD as He,qE as T,rD as E,rO as Ue,sD as D,tD as O,tO as k,uD as We,vD as Ge,wD as Ke,xD as qe,xj as A,yD as Je,yj as Ye,zD as Xe}from"./dist-C2CRpdq8.js";import{n as j}from"./dist-BB8NhuRg.js";import{i as Ze}from"./dist-uBTiN353.js";import{t as M}from"./button-B39xibrh.js";import{A as N,C as P,H as Qe,Jt as $e,Kt as et,S as F,Ut as I,V as tt,b as L,ct as R,dt as z,ft as B,k as V,lt as H,mt as nt,pt as rt,qt as it,st as U,u as at,ut as W,w as G,x as K}from"./index-Cw1UFCV-.js";import{t as ot}from"./FilterBar-CVU7c-v_.js";import{t as st}from"./DataTableShell-BYoFVC-r.js";import{t as ct}from"./roleDescriptions-BU3_Xc_1.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>d(),days:null},{value:`30`,label:()=>c(),days:30},{value:`90`,label:()=>Ce(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=$e({from:`/settings/serviceAccounts`}),t=it({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Z,[o,c]=(0,q.useState)(Z),l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),d=p(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===Z?void 0:o,disabled:i===Z?void 0:i===`disabled`}}),f=p(s.apiKeys.listKeys,{}),m=p(s.apiKeys.listRoles,{}),xe=A(s.apiKeys.createServiceAccount),Ce=A(s.apiKeys.updateServiceAccount),Te=A(s.apiKeys.deleteServiceAccount),h=Ye(s.apiKeys.mintApiKey),g=A(s.apiKeys.revokeApiKey),_=Qe(),v=tt(),y=n!==``||o!==Z||i!==Z;function x(){c(Z),t({search:{},replace:!0})}let[S,C]=(0,q.useState)(!1),[w,T]=(0,q.useState)(Q),[E,D]=(0,q.useState)(null),[O,j]=(0,q.useState)(new Set),[N,I]=(0,q.useState)(null),z=(0,q.useRef)(!1),[B,V]=(0,q.useState)(new Set),[H,nt]=(0,q.useState)({}),[rt,W]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[f]);function $(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{E?(await Ce({serviceAccountId:E,name:w.name,roleKey:w.roleKey,description:w.description}),v.success(Ke())):await xe({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Q),D(null),C(!1)}catch(e){v.error(E?ve():re(),e)}}function ft(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),D(e._id),C(!0)}async function pt(e){if(z.current)return;z.current=!0;let t=H[e._id]??`never`,n=Y.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;I(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(te(),e)}finally{z.current=!1,I(null)}}async function mt(e){if(await _({title:_e(),description:(0,J.jsxs)(J.Fragment,{children:[qe(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Ae(),` `,(0,J.jsx)(`strong`,{children:Je()}),` `,Ge()]}),confirmWord:e.name,confirmLabel:Oe(),destructive:!0}))try{await Te({serviceAccountId:e._id}),v.success(Ne(),e.name)}catch(e){v.error(Pe(),e)}}async function ht(e){if(await _({title:Re(),description:(0,J.jsxs)(J.Fragment,{children:[Ve(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Me()]}),confirmLabel:je(),destructive:!0})&&!B.has(e._id)){V(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){v.error(We(),e)}finally{V(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:Be()}),(0,J.jsxs)(ot,{q:n,onQChange:l,searchPlaceholder:ke(),onReset:x,canReset:y,children:[(0,J.jsxs)(L,{value:o,onValueChange:c,children:[(0,J.jsx)(P,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:Fe()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(F,{value:Z,children:Ue()}),(m??[]).map(e=>(0,J.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(L,{value:i,onValueChange:u,children:[(0,J.jsx)(P,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(F,{value:Z,children:ze()}),(0,J.jsx)(F,{value:`active`,children:k()}),(0,J.jsx)(F,{value:`disabled`,children:b()})]})]})]}),(0,J.jsx)(st,{title:r(),rows:d,addLabel:he(),onAdd:()=>{T(Q),D(null),C(!0)},emptyHint:De(),isExpanded:e=>O.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:B}),rowActions:e=>[{label:He(),onSelect:()=>ft(e)},{label:we(),onSelect:()=>void pt(e)},{label:O.has(e._id)?Ee():ce(),onSelect:()=>$(e._id)},{label:le(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":O.has(e._id)?ae():Se(),onClick:()=>$(e._id),children:O.has(e._id)?(0,J.jsx)(Ze,{}):(0,J.jsx)(et,{})})},{header:ye(),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:oe(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(U,{variant:`secondary`,children:e.roleKey})},{header:be(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(U,{variant:`destructive`,children:b()}):(0,J.jsx)(U,{variant:`outline`,children:k()})},{header:ee(),cell:e=>(0,J.jsxs)(L,{value:H[e._id]??`never`,onValueChange:t=>nt(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(P,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:Y.map(e=>(0,J.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:Xe(),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:N===e._id?ge():ue({count:t})})}}]}),(0,J.jsx)(at,{open:S,onOpenChange:e=>{C(e),e||D(null)},title:E?se():fe(),description:E?ie():de(),canSubmit:!!(w.name&&w.roleKey),onSubmit:dt,submitLabel:E?me():Ie(),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:a()}),(0,J.jsx)(R,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Le()}),(0,J.jsxs)(L,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,J.jsx)(P,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:pe()})}),(0,J.jsx)(K,{children:(m??[]).map(e=>(0,J.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(m??[]).find(e=>e.key===w.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:ne()}),(0,J.jsx)(R,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:rt,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:[S(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:D()}),(0,J.jsx)(`th`,{children:w()}),(0,J.jsx)(`th`,{children:_()}),(0,J.jsx)(`th`,{children:x()}),(0,J.jsx)(`th`,{children:E()}),(0,J.jsx)(`th`,{children:C()}),(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)(U,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:N(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)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?O():y()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function a(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(H,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(W,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(rt,{children:[(0,J.jsx)(nt,{children:i()}),(0,J.jsx)(z,{children:f({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:g()}),(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)(M,{variant:`outline`,size:`sm`,onClick:()=>void a(),"aria-label":Te(),children:[n?(0,J.jsx)(j,{}):(0,J.jsx)(I,{}),n?h():u()]})]}),(0,J.jsx)(B,{children:(0,J.jsx)(M,{onClick:()=>{r(!1),t()},children:T()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?m():N(e)}function pt(e){return e===null?`—`:V(e)}function mt(e){return e.disabled?(0,J.jsx)(U,{variant:`destructive`,children:l()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(U,{variant:`outline`,children:xe()}):(0,J.jsx)(U,{variant:`outline`,children:o()})}export{$ as ServiceAccountsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,Ca as i,E as a,Ea as o,Gi as s,Hi as c,Ji as l,Ki as u,Qi as d,Sa as f,Sj as p,Ta as m,Ui as h,Wi as g,Xi as _,Yi as v,Zi as y,_a as b,aa as x,ba as S,ca as C,da as w,ea as T,fa as E,ga as D,ha as O,ia as k,la as A,ma as j,na as M,oa as N,pa as P,qi as F,ra as I,sa as L,ta as R,ua as ee,va as z,wa as B,xa as V,xj as H,ya as U}from"./dist-C2CRpdq8.js";import{t as W}from"./button-B39xibrh.js";import{A as G,H as K}from"./index-BygEdn-c.js";import{t as q}from"./DataTableShell-C_uiwnG-.js";var J=t(e(),1),Y=n(),X={hung:()=>A(),wrong_result:()=>C(),error:()=>L(),other:()=>N()},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=H(a.subAgentReports.respondToReport),[i,o]=(0,J.useState)(e.thread),[c,f]=(0,J.useState)(``),[p,m]=(0,J.useState)(!1);async function h(){let t=c.trim();if(!(!t||p)){m(!0);try{await n({reportId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{m(!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),` · `,x({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:k()}),(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:I()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.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`?M():R()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:T()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:r(),value:c,maxLength:2e3,rows:3,onChange:e=>f(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 h(),disabled:!c.trim()||p,children:p?y():d()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[_({count:t.children.length}),t.childrenTruncated?` ${v()}`:``,t.textTruncated?` ${l()}`:``]}),(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?` · ${F()}`:``]}),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:u()}),(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:s()}),(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=p(a.subAgentReports.listForAdmin,{}),t=H(a.subAgentReports.readReport),n=H(a.subAgentReports.deleteReport),r=K(),[s,l]=(0,J.useState)(null),[u,d]=(0,J.useState)({});async function _(e){if(s===e._id){l(null);return}if(!u[e._id]){let n=await t({reportId:e._id});d(t=>({...t,[e._id]:n}))}l(e._id)}async function v(e){await r({title:g(),description:h(),confirmLabel:c(),destructive:!0})&&(await n({reportId:e._id}),s===e._id&&l(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[B(),` `,(0,Y.jsx)(`strong`,{children:i()}),` `,f()]}),(0,Y.jsx)(q,{title:o(),rows:e,emptyHint:m(),isExpanded:e=>s===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Y.jsx)($,{data:u[e._id]}):null,columns:[{header:V(),cell:e=>G(e.at),sort:e=>e.at},{header:S(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:U(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:z(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${O({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:b(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:D(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:j()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:P()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:s===e._id?w():E(),onSelect:()=>void _(e)},{label:ee(),onSelect:()=>void v(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,Ca as i,E as a,Ea as o,Gi as s,Hi as c,Ji as l,Ki as u,Qi as d,Sa as f,Sj as p,Ta as m,Ui as h,Wi as g,Xi as _,Yi as v,Zi as y,_a as b,aa as x,ba as S,ca as C,da as w,ea as T,fa as E,ga as D,ha as O,ia as k,la as A,ma as j,na as M,oa as N,pa as P,qi as F,ra as I,sa as L,ta as R,ua as ee,va as z,wa as B,xa as V,xj as H,ya as U}from"./dist-C2CRpdq8.js";import{t as W}from"./button-B39xibrh.js";import{A as G,H as K}from"./index-Cw1UFCV-.js";import{t as q}from"./DataTableShell-BYoFVC-r.js";var J=t(e(),1),Y=n(),X={hung:()=>A(),wrong_result:()=>C(),error:()=>L(),other:()=>N()},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=H(a.subAgentReports.respondToReport),[i,o]=(0,J.useState)(e.thread),[c,f]=(0,J.useState)(``),[p,m]=(0,J.useState)(!1);async function h(){let t=c.trim();if(!(!t||p)){m(!0);try{await n({reportId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{m(!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),` · `,x({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:k()}),(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:I()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.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`?M():R()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:T()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:r(),value:c,maxLength:2e3,rows:3,onChange:e=>f(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 h(),disabled:!c.trim()||p,children:p?y():d()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[_({count:t.children.length}),t.childrenTruncated?` ${v()}`:``,t.textTruncated?` ${l()}`:``]}),(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?` · ${F()}`:``]}),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:u()}),(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:s()}),(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=p(a.subAgentReports.listForAdmin,{}),t=H(a.subAgentReports.readReport),n=H(a.subAgentReports.deleteReport),r=K(),[s,l]=(0,J.useState)(null),[u,d]=(0,J.useState)({});async function _(e){if(s===e._id){l(null);return}if(!u[e._id]){let n=await t({reportId:e._id});d(t=>({...t,[e._id]:n}))}l(e._id)}async function v(e){await r({title:g(),description:h(),confirmLabel:c(),destructive:!0})&&(await n({reportId:e._id}),s===e._id&&l(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[B(),` `,(0,Y.jsx)(`strong`,{children:i()}),` `,f()]}),(0,Y.jsx)(q,{title:o(),rows:e,emptyHint:m(),isExpanded:e=>s===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Y.jsx)($,{data:u[e._id]}):null,columns:[{header:V(),cell:e=>G(e.at),sort:e=>e.at},{header:S(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:U(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:z(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${O({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:b(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:D(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:j()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:P()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:s===e._id?w():E(),onSelect:()=>void _(e)},{label:ee(),onSelect:()=>void v(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,$k as i,Ak as a,Bi as o,Bk as s,Ck as c,D as l,Dk as u,E as d,Ek as f,Fk as p,GO as m,Gk as h,HO as g,Hk as _,Ik as v,JO as y,Jk as ee,KO as b,Kk as te,Lk as ne,Mk as re,Nk as ie,Ok as ae,Pk as oe,QO as se,Qk as ce,Ri as le,Rk as ue,Sj as x,Sk as de,Tk as fe,UO as pe,Uk as me,Vi as S,Vk as he,WO as ge,Wk as _e,XO as C,Xk as ve,YO as ye,Yk as be,ZO as xe,Zk as Se,_k as Ce,aA as we,ak as Te,bk as Ee,cA as De,ck as w,dj as Oe,dk as ke,eA as T,ek as Ae,fk as je,gk as Me,hk as Ne,iA as Pe,ik as Fe,jk as Ie,kk as Le,lA as Re,lj as ze,lk as Be,mk as Ve,n as He,nA as Ue,nk as We,oA as Ge,ok as Ke,pk as qe,qO as Je,qk as Ye,rA as Xe,rk as Ze,sA as Qe,sk as $e,tA as et,tk as tt,uA as nt,uj as rt,uk as it,vk as at,wk as ot,xj as E,xk as st,yj as ct,yk as lt,zi as ut,zk as dt}from"./dist-C2CRpdq8.js";import{n as D}from"./dist-BB8NhuRg.js";import{t as O}from"./x-BbitkL6D.js";import{t as k}from"./button-B39xibrh.js";import{C as A,Ht as ft,S as j,Vt as M,at as N,b as P,bt as F,ct as I,gt as pt,ht as mt,it as ht,nt as gt,ot as _t,p as L,rt as R,st as z,tt as vt,w as B,x as V}from"./index-BygEdn-c.js";import{t as yt}from"./localePickerView-C2RmOS86.js";import{a as bt,i as xt,n as St,o as Ct,r as wt,t as Tt}from"./card-BV_9rQvt.js";import{a as Et,i as H,n as Dt,o as U,r as W,t as Ot}from"./table-BNCY2kTQ.js";import{t as kt}from"./TimeRangePicker-Ys5YJrFa.js";import{t as At}from"./FilterBar-hVahB9Hp.js";import{t as jt}from"./AdvancedFilter-DvEno3Aq.js";var G=l(`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`}]]),K=t(e(),1),Mt=.1,Nt=[248,248,248],Pt=[24,24,24];function Ft(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 It(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 q(e,t,n){return It(e,t,n)>=Mt}function Lt(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 Rt(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 zt=12*1024*1024,Bt=480,Vt=160,Ht=.92;async function Ut(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ke());if(e.size>zt)throw Error(it());let{source:n,width:r,height:i,cleanup:a}=await Wt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Bt/r,Vt/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(w());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Ft(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(w());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);q(e.data,d.width,d.height)?Lt(e.data,t.variantFor===`dark`?Nt:Pt):Rt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Ht)??await Y(f,`image/png`);if(!h)throw Error($e());return{blob:h,hasAlpha:m}}finally{a()}}async function Wt(e){if(e.type===`image/svg+xml`)return J(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 J(e)}async function J(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(Be())),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 Y(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__`,Q={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({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 qt(e){return e===`light`?Oe():e===`dark`?rt():ze()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({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:He(`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)(D,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{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)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":S(),title:S(),children:(0,X.jsx)(ft,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=x(d.charts.listMyCharts),r=E(d.charts.setMyChart);async function a(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:Ue()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:et()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:T(),subtitle:i(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?ce():n.via===`owner`?Se():ve({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(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:be()}):null]})}function Qt(){let e=E(d.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[m,h]=(0,K.useState)(!1);async function g(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(u())}}}async function _(){if(s(null),l(!1),t.trim()===``){s(fe());return}let a;try{a=JSON.parse(r)}catch{s(u());return}h(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{h(!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:p()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(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:ie()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:re(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ie()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:a(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),Le(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void g(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:m,onClick:()=>void _(),children:ae()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:f()}):null]})]})}function $t({chart:e}){let t=ct(d.charts.setChartLogo),n=E(d.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.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 Ut(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 f(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 p({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`?at():Ce()}),(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)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?Ne():Me(),(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)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:qe()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Ve()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:lt()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:je()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=x(d.me.getMe,{host:F}),n=E(d.charts.addChartDomain),r=E(d.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function f(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function p(t){s(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:Ke()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:We()}):u.map(e=>(0,X.jsxs)(z,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":tt({domain:e}),onClick:()=>void p(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{value:i,onChange:e=>a(e.target.value),placeholder:Fe(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void f(),children:Ze()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Te()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function tn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=E(d.charts.updateChart),n=E(d.charts.deleteChart),[i,a]=(0,K.useState)(!1),[s,c]=(0,K.useState)(e.name),[l,f]=(0,K.useState)(()=>tn(e.tokens)),[p,m]=(0,K.useState)(e.tokens.bpm??0),[h,g]=(0,K.useState)(null),[_,v]=(0,K.useState)(!1);function y(){c(e.name),f(tn(e.tokens)),m(e.tokens.bpm??0),g(null),a(!0)}async function ee(){if(e.chartId===void 0)return;g(null);let n;try{n=JSON.parse(l)}catch{g(u());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;p>0?e.bpm=p:delete e.bpm}v(!0);try{await t({chartId:e.chartId,name:s.trim(),tokens:n}),a(!1)}catch(e){g(e instanceof Error?e.message:String(e))}finally{v(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(C()))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:i?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:y,children:st()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:Ee()})]})})]}),i?(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:se()}),(0,X.jsx)(I,{value:s,onChange:e=>c(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:o()}),(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:p,onChange:e=>m(Number(e.target.value)),"aria-label":o()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:p===0?ut():`${p} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:le()})]}),(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:l,onChange:e=>f(e.target.value),rows:10,spellCheck:!1})]}),h?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:h}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:_,onClick:()=>void ee(),children:Ae()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:r()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function rn(){let e=x(d.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:ot()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:de()}):(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=E(d.charts.addChartToGroupPool),r=E(d.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),c=t.filter(e=>!o.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)(z,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?he():e.kind===`custom`&&e.scope===`personal`?b():_()}),e.isGlobalDefault?(0,X.jsx)(z,{variant:`default`,children:s()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ue()}),(a??[]).map(e=>(0,X.jsxs)(z,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":v({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(P,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(A,{size:`sm`,className:`w-56`,children:(0,X.jsx)(B,{placeholder:ne()})}),(0,X.jsx)(V,{children:c.map(e=>(0,X.jsx)(j,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:dt()}):null]})]})}function on({chart:e}){let t=E(d.charts.promoteChartToCommon),n=E(d.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(C()))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)(z,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?m():b()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Je({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:ge()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:pe()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=E(d.admin.setDefaultThemeMode),i=E(d.admin.setDefaultLocale),a=E(d.charts.setDefaultChart),o=x(d.charts.listChartsAdmin),s=x(d.groups.listGroups,{}),c=e??`system`,l=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:Pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(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:ee()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ye()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:T()}),pt.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({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:te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(an,{chart:e,groups:s??[]},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:me()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).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)(en,{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:ye()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:g()}):(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:nt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:c===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(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:De()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Qe()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:yt().map(e=>(0,X.jsx)(k,{variant:l===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ge()})]})]})}function cn(){let e=x(d.me.getMe,{host:F}),t=mt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(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,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.useState)(Q),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Q)}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:we()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(M,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)($,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(z,{children:`Default`}),(0,X.jsx)(z,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(z,{variant:`outline`,children:`Outline`}),(0,X.jsx)(z,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)($,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(I,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(P,{value:n,onValueChange:r,children:[(0,X.jsx)(A,{className:`w-56`,children:(0,X.jsx)(B,{placeholder:`Select…`})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(j,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(j,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(L,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)($,{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)(At,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(P,{value:o,onValueChange:s,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(j,{value:Z,children:`Toutes directions`}),(0,X.jsx)(j,{value:`inbound`,children:`inbound`}),(0,X.jsx)(j,{value:`outbound`,children:`outbound`}),(0,X.jsx)(j,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(P,{value:c,onValueChange:l,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(j,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(j,{value:`info`,children:`info`}),(0,X.jsx)(j,{value:`warn`,children:`warn`}),(0,X.jsx)(j,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(jt,{fields:Kt,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)(kt,{value:u,onChange:d})]})]})}),(0,X.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(vt,{children:[(0,X.jsx)(_t,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(M,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(ht,{children:`Actions`}),(0,X.jsx)(N,{}),(0,X.jsx)(R,{children:`Edit`}),(0,X.jsx)(R,{children:`Duplicate`}),(0,X.jsx)(N,{}),(0,X.jsx)(R,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Tt,{className:`w-80`,children:[(0,X.jsxs)(bt,{children:[(0,X.jsx)(Ct,{children:`Instance`}),(0,X.jsx)(wt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(St,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(xt,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(Ot,{children:[(0,X.jsx)(Et,{children:(0,X.jsxs)(U,{children:[(0,X.jsx)(H,{className:`w-8`,children:(0,X.jsx)(L,{"aria-label":`select all`})}),(0,X.jsx)(H,{children:`Name`}),(0,X.jsx)(H,{children:`Mode`}),(0,X.jsx)(H,{className:`text-right`,children:`Status`}),(0,X.jsx)(H,{className:`w-8`})]})}),(0,X.jsx)(Dt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{children:(0,X.jsx)(L,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(z,{variant:`secondary`,children:e.m})}),(0,X.jsx)(W,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(D,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(M,{})})})]},e.n))})]})}),(0,X.jsx)($,{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{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,$k as i,Ak as a,Bi as o,Bk as s,Ck as c,D as l,Dk as u,E as d,Ek as f,Fk as p,GO as m,Gk as h,HO as g,Hk as _,Ik as v,JO as y,Jk as ee,KO as b,Kk as te,Lk as ne,Mk as re,Nk as ie,Ok as ae,Pk as oe,QO as se,Qk as ce,Ri as le,Rk as ue,Sj as x,Sk as de,Tk as fe,UO as pe,Uk as me,Vi as S,Vk as he,WO as ge,Wk as _e,XO as C,Xk as ve,YO as ye,Yk as be,ZO as xe,Zk as Se,_k as Ce,aA as we,ak as Te,bk as Ee,cA as De,ck as w,dj as Oe,dk as ke,eA as T,ek as Ae,fk as je,gk as Me,hk as Ne,iA as Pe,ik as Fe,jk as Ie,kk as Le,lA as Re,lj as ze,lk as Be,mk as Ve,n as He,nA as Ue,nk as We,oA as Ge,ok as Ke,pk as qe,qO as Je,qk as Ye,rA as Xe,rk as Ze,sA as Qe,sk as $e,tA as et,tk as tt,uA as nt,uj as rt,uk as it,vk as at,wk as ot,xj as E,xk as st,yj as ct,yk as lt,zi as ut,zk as dt}from"./dist-C2CRpdq8.js";import{n as D}from"./dist-BB8NhuRg.js";import{t as O}from"./x-BbitkL6D.js";import{t as k}from"./button-B39xibrh.js";import{C as A,Ht as ft,S as j,Vt as M,at as N,b as P,bt as F,ct as I,gt as pt,ht as mt,it as ht,nt as gt,ot as _t,p as L,rt as R,st as z,tt as vt,w as B,x as V}from"./index-Cw1UFCV-.js";import{t as yt}from"./localePickerView-C2RmOS86.js";import{a as bt,i as xt,n as St,o as Ct,r as wt,t as Tt}from"./card-BV_9rQvt.js";import{a as Et,i as H,n as Dt,o as U,r as W,t as Ot}from"./table-BNCY2kTQ.js";import{t as kt}from"./TimeRangePicker-BlUshfcd.js";import{t as At}from"./FilterBar-CVU7c-v_.js";import{t as jt}from"./AdvancedFilter-C2V1UpGN.js";var G=l(`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`}]]),K=t(e(),1),Mt=.1,Nt=[248,248,248],Pt=[24,24,24];function Ft(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 It(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 q(e,t,n){return It(e,t,n)>=Mt}function Lt(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 Rt(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 zt=12*1024*1024,Bt=480,Vt=160,Ht=.92;async function Ut(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ke());if(e.size>zt)throw Error(it());let{source:n,width:r,height:i,cleanup:a}=await Wt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Bt/r,Vt/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(w());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Ft(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(w());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);q(e.data,d.width,d.height)?Lt(e.data,t.variantFor===`dark`?Nt:Pt):Rt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Ht)??await Y(f,`image/png`);if(!h)throw Error($e());return{blob:h,hasAlpha:m}}finally{a()}}async function Wt(e){if(e.type===`image/svg+xml`)return J(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 J(e)}async function J(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(Be())),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 Y(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__`,Q={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({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 qt(e){return e===`light`?Oe():e===`dark`?rt():ze()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({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:He(`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)(D,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{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)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":S(),title:S(),children:(0,X.jsx)(ft,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=x(d.charts.listMyCharts),r=E(d.charts.setMyChart);async function a(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:Ue()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:et()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:T(),subtitle:i(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?ce():n.via===`owner`?Se():ve({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(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:be()}):null]})}function Qt(){let e=E(d.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[m,h]=(0,K.useState)(!1);async function g(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(u())}}}async function _(){if(s(null),l(!1),t.trim()===``){s(fe());return}let a;try{a=JSON.parse(r)}catch{s(u());return}h(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{h(!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:p()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(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:ie()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:re(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ie()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:a(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),Le(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void g(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:m,onClick:()=>void _(),children:ae()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:f()}):null]})]})}function $t({chart:e}){let t=ct(d.charts.setChartLogo),n=E(d.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.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 Ut(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 f(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 p({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`?at():Ce()}),(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)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?Ne():Me(),(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)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:qe()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Ve()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:lt()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:je()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=x(d.me.getMe,{host:F}),n=E(d.charts.addChartDomain),r=E(d.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function f(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function p(t){s(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:Ke()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:We()}):u.map(e=>(0,X.jsxs)(z,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":tt({domain:e}),onClick:()=>void p(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{value:i,onChange:e=>a(e.target.value),placeholder:Fe(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void f(),children:Ze()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Te()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function tn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=E(d.charts.updateChart),n=E(d.charts.deleteChart),[i,a]=(0,K.useState)(!1),[s,c]=(0,K.useState)(e.name),[l,f]=(0,K.useState)(()=>tn(e.tokens)),[p,m]=(0,K.useState)(e.tokens.bpm??0),[h,g]=(0,K.useState)(null),[_,v]=(0,K.useState)(!1);function y(){c(e.name),f(tn(e.tokens)),m(e.tokens.bpm??0),g(null),a(!0)}async function ee(){if(e.chartId===void 0)return;g(null);let n;try{n=JSON.parse(l)}catch{g(u());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;p>0?e.bpm=p:delete e.bpm}v(!0);try{await t({chartId:e.chartId,name:s.trim(),tokens:n}),a(!1)}catch(e){g(e instanceof Error?e.message:String(e))}finally{v(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(C()))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:i?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:y,children:st()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:Ee()})]})})]}),i?(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:se()}),(0,X.jsx)(I,{value:s,onChange:e=>c(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:o()}),(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:p,onChange:e=>m(Number(e.target.value)),"aria-label":o()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:p===0?ut():`${p} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:le()})]}),(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:l,onChange:e=>f(e.target.value),rows:10,spellCheck:!1})]}),h?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:h}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:_,onClick:()=>void ee(),children:Ae()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:r()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function rn(){let e=x(d.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:ot()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:de()}):(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=E(d.charts.addChartToGroupPool),r=E(d.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),c=t.filter(e=>!o.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)(z,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?he():e.kind===`custom`&&e.scope===`personal`?b():_()}),e.isGlobalDefault?(0,X.jsx)(z,{variant:`default`,children:s()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ue()}),(a??[]).map(e=>(0,X.jsxs)(z,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":v({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(P,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(A,{size:`sm`,className:`w-56`,children:(0,X.jsx)(B,{placeholder:ne()})}),(0,X.jsx)(V,{children:c.map(e=>(0,X.jsx)(j,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:dt()}):null]})]})}function on({chart:e}){let t=E(d.charts.promoteChartToCommon),n=E(d.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(C()))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)(z,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?m():b()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Je({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:ge()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:pe()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=E(d.admin.setDefaultThemeMode),i=E(d.admin.setDefaultLocale),a=E(d.charts.setDefaultChart),o=x(d.charts.listChartsAdmin),s=x(d.groups.listGroups,{}),c=e??`system`,l=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:Pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(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:ee()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ye()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:T()}),pt.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({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:te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(an,{chart:e,groups:s??[]},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:me()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).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)(en,{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:ye()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:g()}):(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:nt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:c===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(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:De()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Qe()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:yt().map(e=>(0,X.jsx)(k,{variant:l===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ge()})]})]})}function cn(){let e=x(d.me.getMe,{host:F}),t=mt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(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,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.useState)(Q),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Q)}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:we()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(M,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)($,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(z,{children:`Default`}),(0,X.jsx)(z,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(z,{variant:`outline`,children:`Outline`}),(0,X.jsx)(z,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)($,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(I,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(P,{value:n,onValueChange:r,children:[(0,X.jsx)(A,{className:`w-56`,children:(0,X.jsx)(B,{placeholder:`Select…`})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(j,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(j,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(L,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)($,{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)(At,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(P,{value:o,onValueChange:s,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(j,{value:Z,children:`Toutes directions`}),(0,X.jsx)(j,{value:`inbound`,children:`inbound`}),(0,X.jsx)(j,{value:`outbound`,children:`outbound`}),(0,X.jsx)(j,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(P,{value:c,onValueChange:l,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(j,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(j,{value:`info`,children:`info`}),(0,X.jsx)(j,{value:`warn`,children:`warn`}),(0,X.jsx)(j,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(jt,{fields:Kt,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)(kt,{value:u,onChange:d})]})]})}),(0,X.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(vt,{children:[(0,X.jsx)(_t,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(M,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(ht,{children:`Actions`}),(0,X.jsx)(N,{}),(0,X.jsx)(R,{children:`Edit`}),(0,X.jsx)(R,{children:`Duplicate`}),(0,X.jsx)(N,{}),(0,X.jsx)(R,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Tt,{className:`w-80`,children:[(0,X.jsxs)(bt,{children:[(0,X.jsx)(Ct,{children:`Instance`}),(0,X.jsx)(wt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(St,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(xt,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(Ot,{children:[(0,X.jsx)(Et,{children:(0,X.jsxs)(U,{children:[(0,X.jsx)(H,{className:`w-8`,children:(0,X.jsx)(L,{"aria-label":`select all`})}),(0,X.jsx)(H,{children:`Name`}),(0,X.jsx)(H,{children:`Mode`}),(0,X.jsx)(H,{className:`text-right`,children:`Status`}),(0,X.jsx)(H,{className:`w-8`})]})}),(0,X.jsx)(Dt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{children:(0,X.jsx)(L,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(z,{variant:`secondary`,children:e.m})}),(0,X.jsx)(W,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(D,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(M,{})})})]},e.n))})]})}),(0,X.jsx)($,{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{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bn as r,Cm as i,Em as a,Hn as o,Ln as s,Rn as c,Sm as l,Tm as u,Un as d,Vn as f,_m as p,bm as m,gm as h,hm as g,mm as _,vm as v,wm as y,xm as b,ym as x,zn as S}from"./dist-C2CRpdq8.js";import{t as C}from"./button-B39xibrh.js";import{A as w,Ct as T,Nt as E,St as D,Wt as O,ct as k,wt as A,xt as j}from"./index-BygEdn-c.js";var M=t(e(),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:a(),from:`now-5m`},{label:u(),from:`now-15m`},{label:y(),from:`now-30m`},{label:i(),from:`now-1h`},{label:l(),from:`now-3h`},{label:b(),from:`now-6h`},{label:m(),from:`now-12h`},{label:x(),from:`now-24h`},{label:v(),from:`now-2d`},{label:p(),from:`now-7d`},{label:h(),from:`now-30d`},{label:g(),from:`now-90d`},{label:_(),from:`now-520w`}];function L(e){return w(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,l]=(0,M.useState)(``),u=F(e),[p,m]=(0,M.useState)(()=>z(u.from)),[h,g]=(0,M.useState)(()=>z(u.to));function _(t){if(t){let t=F(e);m(z(t.from)),g(z(t.to)),l(``)}i(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),i(!1)}function y(){let e=B(p),n=B(h);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]),x=B(p)!==null&&B(h)!==null;return(0,H.jsxs)(T,{open:n,onOpenChange:_,children:[(0,H.jsx)(A,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(O,{}),R(e)]})}),(0,H.jsx)(D,{children:(0,H.jsx)(j,{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:d()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,H.jsx)(k,{type:`datetime-local`,value:p,onChange:e=>m(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:f()}),(0,H.jsx)(k,{type:`datetime-local`,value:h,onChange:e=>g(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!x,onClick:y,children:r()})]}),(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)(k,{value:a,onChange:e=>l(e.target.value),placeholder:S(),"aria-label":c()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:s()}):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:()=>v(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bn as r,Cm as i,Em as a,Hn as o,Ln as s,Rn as c,Sm as l,Tm as u,Un as d,Vn as f,_m as p,bm as m,gm as h,hm as g,mm as _,vm as v,wm as y,xm as b,ym as x,zn as S}from"./dist-C2CRpdq8.js";import{t as C}from"./button-B39xibrh.js";import{A as w,Ct as T,Nt as E,St as D,Wt as O,ct as k,wt as A,xt as j}from"./index-Cw1UFCV-.js";var M=t(e(),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:a(),from:`now-5m`},{label:u(),from:`now-15m`},{label:y(),from:`now-30m`},{label:i(),from:`now-1h`},{label:l(),from:`now-3h`},{label:b(),from:`now-6h`},{label:m(),from:`now-12h`},{label:x(),from:`now-24h`},{label:v(),from:`now-2d`},{label:p(),from:`now-7d`},{label:h(),from:`now-30d`},{label:g(),from:`now-90d`},{label:_(),from:`now-520w`}];function L(e){return w(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,l]=(0,M.useState)(``),u=F(e),[p,m]=(0,M.useState)(()=>z(u.from)),[h,g]=(0,M.useState)(()=>z(u.to));function _(t){if(t){let t=F(e);m(z(t.from)),g(z(t.to)),l(``)}i(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),i(!1)}function y(){let e=B(p),n=B(h);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]),x=B(p)!==null&&B(h)!==null;return(0,H.jsxs)(T,{open:n,onOpenChange:_,children:[(0,H.jsx)(A,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(O,{}),R(e)]})}),(0,H.jsx)(D,{children:(0,H.jsx)(j,{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:d()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,H.jsx)(k,{type:`datetime-local`,value:p,onChange:e=>m(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:f()}),(0,H.jsx)(k,{type:`datetime-local`,value:h,onChange:e=>g(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!x,onClick:y,children:r()})]}),(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)(k,{value:a,onChange:e=>l(e.target.value),placeholder:S(),"aria-label":c()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:s()}):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:()=>v(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,$g as i,Aw as a,C_ as o,Cw as s,D as c,D_ as l,Dw as u,E as d,E_ as f,Ew as p,GC as m,Gg as h,JC as g,Jg as _,KC as v,Kg as y,Mw as b,Nw as x,O_ as ee,Ow as S,Pw as C,QC as w,Qg as te,S_ as ne,Sj as T,Sw as E,T_ as re,Tw as ie,XC as ae,Xg as oe,YC as se,Yg as ce,ZC as le,Zg as ue,__ as de,_w as fe,a_ as pe,aw as me,b_ as he,bw as ge,c_ as _e,d_ as ve,dw as D,e_ as ye,ew as O,f_ as be,fw as k,g_ as xe,gn as A,gw as j,h_ as Se,hn as M,hw as Ce,i_ as we,iw as Te,jw as N,k_ as Ee,kw as P,l_ as De,m_ as Oe,mn as ke,mw as Ae,n_ as je,nw as Me,o_ as Ne,p_ as Pe,pw as Fe,qC as Ie,qg as Le,r_ as Re,rw as ze,s_ as Be,t_ as Ve,tw as He,u_ as Ue,uw as We,v_ as Ge,vw as Ke,w_ as qe,ww as Je,x_ as Ye,xj as F,xw as I,y_ as Xe,yw as Ze}from"./dist-C2CRpdq8.js";import{n as Qe}from"./dist-BB8NhuRg.js";import{t as $e}from"./x-BbitkL6D.js";import{i as L,n as R,r as et,t as tt}from"./tabs-1TpabOuW.js";import{t as z}from"./button-B39xibrh.js";import{A as B,Bt as nt,C as V,Jt as rt,N as it,S as H,Ut as at,a as ot,b as U,bt as st,dt as ct,i as lt,j as ut,lt as dt,mt as ft,o as pt,pt as mt,qt as ht,r as gt,st as W,ut as _t,w as G,x as K,zt as vt}from"./index-BygEdn-c.js";import{n as q}from"./TimeRangePicker-Ys5YJrFa.js";import{t as yt}from"./FilterBar-hVahB9Hp.js";import{t as bt}from"./AdvancedFilter-DvEno3Aq.js";import{t as xt}from"./DataTableShell-C_uiwnG-.js";var St=c(`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=c(`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=t(e(),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`?Ce():n===`agent`?`${Ae()} - ${r}`:e}function Tt(){let e=T(d.me.getMe,{host:st})?.role===`admin`,t=T(d.deliveryTiming.getDeliveryStatus,{}),n=F(d.deliveryTiming.startDeliveryRecord),r=F(d.deliveryTiming.stopDeliveryRecord),[i,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),l=t?.recording??!1,f=async()=>{c(!0);try{l?await r({}):await n({})}finally{c(!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:C()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:x()})]}),e?(0,Y.jsx)(z,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void f(),children:l?N():b()}):null]}),l?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(W,{variant:`secondary`,children:a()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:P({time:ut(t.startedAt)})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:i?p():u()})}),i?(0,Y.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=T(d.deliveryTiming.listDeliverySessions,{}),n=F(d.deliveryTiming.deleteDeliverySessions),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(`all`),[c,l]=(0,J.useState)(X),[u,f]=(0,J.useState)(null),{from:p,to:m}=q(c),h=c.to===`now`?1/0:m,g=r.trim()!==``||a!==`all`||c!==X,_=()=>{i(``),o(`all`),l(X)},y=(0,J.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=p&&t.startedAt<=h).map(e=>({...e,_id:e.sessionId}))},[t,r,a,p,h]),b=e=>{let t=new Set((y??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&f(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(yt,{q:r,onQChange:i,searchPlaceholder:Je(),timeRange:c,onTimeRangeChange:l,onReset:_,canReset:g,children:(0,Y.jsxs)(U,{value:a,onValueChange:e=>o(e),children:[(0,Y.jsx)(V,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(G,{})}),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(H,{value:`all`,children:s()}),(0,Y.jsx)(H,{value:`active`,children:E()}),(0,Y.jsx)(H,{value:`stopped`,children:I()})]})]})}),(0,Y.jsx)(xt,{title:ie(),rows:y,emptyHint:v(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?k():Fe(),onClick:()=>f(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:ge(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:B(e.startedAt)})},{header:Ze(),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:B(e.stoppedAt)})},{header:Ke(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:fe(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:j(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(W,{variant:`secondary`,children:E()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:I()})}],rowActions:e?e=>[{label:D(),variant:`destructive`,onSelect:()=>b([e.sessionId])}]:void 0,bulkActions:e?[{label:D(),variant:`destructive`,onSelect:e=>b(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,Y.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=T(d.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(it(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:We()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:S()});let i=e.segments,a=(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,` `,m()]}),(0,Y.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(Qe,{size:13,"aria-hidden":!0}):(0,Y.jsx)(at,{size:13,"aria-hidden":!0}),t?Ie():g()]})]}),(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:ze()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Me()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:He()})]})}),(0,Y.jsxs)(`tbody`,{children:[a(O(),i.bridge),a(r(),i.A),a(w(),i.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:le()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ae()})]})}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:A()},{value:`principalType`,label:M()},{value:`direction`,label:`direction`},{value:`roleKey`,label:ke()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=rt({from:`/settings/traces`}),t=ht({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,s=e.principalType??Q,c=e.direction??Q,u=e.roleKey??Q,p=e.q??``,m=gt(e.from,e.to),h=(0,J.useMemo)(()=>pt(e.adv),[e.adv]),{from:g,to:v}=q(m),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),C=e=>void t({search:t=>({...t,limit:e})}),w=e=>void t({search:t=>({...t,kind:e})}),E=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),ie=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),ae=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})}),le=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),fe=e=>void t({search:t=>({...t,...ot(e)})}),ge=e=>void t({search:t=>({...t,adv:lt(e)}),replace:!0}),D=T(d.observability.listEvents,{limit:n}),O=T(d.observability.listEvents,{limit:n,kind:r===At?void 0:r,filter:{q:p||void 0,from:g,to:v,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:c===Q?void 0:c,roleKey:u===Q?void 0:u,advanced:h.length>0?h:void 0}}),k=(0,J.useMemo)(()=>{let e=new Set;for(let t of D??[])e.add(t.kind);return[...e].sort()},[D]),A=(0,J.useMemo)(()=>{let e=new Set;for(let t of D??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[D]),j=p!==``||a!==Q||s!==Q||c!==Q||u!==Q||h.length>0||m.kind!==`relative`||m.from!==Pt.from;function M(){t({search:{limit:100,kind:`all`},replace:!0})}let Ce=y?D?.filter(e=>e.correlationId===y):O,N=e.section,P=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,Y.jsxs)(tt,{value:N,onValueChange:e=>P(e),children:[(0,Y.jsxs)(et,{className:`w-full`,children:[(0,Y.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(vt,{size:13,"aria-hidden":!0}),me()]}),(0,Y.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(Ct,{size:13,"aria-hidden":!0}),Te()]})]}),(0,Y.jsx)(R,{value:`latency`,children:(0,Y.jsx)(Tt,{})}),(0,Y.jsxs)(R,{value:`events`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ee(),(0,Y.jsx)(`strong`,{children:ee()}),l(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:f()})]}),(0,Y.jsxs)(yt,{q:p,onQChange:E,searchPlaceholder:re(),timeRange:m,onTimeRangeChange:fe,onReset:M,canReset:j,children:[(0,Y.jsxs)(U,{value:a,onValueChange:ie,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(G,{placeholder:qe()})}),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(H,{value:Q,children:o()}),jt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:s,onValueChange:ae,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(G,{placeholder:ne()})}),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(H,{value:Q,children:Ye()}),Mt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:c,onValueChange:se,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(G,{placeholder:he()})}),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(H,{value:Q,children:Xe()}),Nt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:u,onValueChange:le,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(G,{placeholder:Ge()})}),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(H,{value:Q,children:de()}),A.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:r,onValueChange:w,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(G,{placeholder:xe()})}),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(H,{value:At,children:Se()}),k.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:String(n),onValueChange:e=>C(Number(e)),children:[(0,Y.jsx)(V,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(G,{})}),(0,Y.jsx)(K,{children:kt.map(e=>(0,Y.jsx)(H,{value:String(e),children:Oe({count:e})},e))})]})]}),(0,Y.jsx)(bt,{fields:Ft,seed:h,onChange:ge}),y?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>b(null),title:Pe(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[be(),(0,Y.jsx)(`code`,{children:$(y)})]}),(0,Y.jsx)($e,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:ve()})]})}):null,(0,Y.jsx)(xt,{title:Ue(),rows:Ce,emptyHint:y?De():_e(),columns:[{header:Be(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:B(e.at)})},{header:Ne(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(W,{variant:`secondary`,children:e.kind})},{header:pe(),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":we(),children:`✓`})}},{header:Re(),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:je(),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:Ve(),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:ye(),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:i(),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:te(),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:ue(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:oe(),onClick:()=>b(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ce(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>S(e),children:_()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(zt,{row:x,onClose:()=>S(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)(dt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(_t,{className:`max-w-lg`,children:[(0,Y.jsxs)(mt,{children:[(0,Y.jsxs)(ft,{className:`oc-traces__meta-title`,children:[Le(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(W,{variant:`outline`,children:y()})]}),(0,Y.jsx)(ct,{children:h()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{It as TracesTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,$g as i,Aw as a,C_ as o,Cw as s,D as c,D_ as l,Dw as u,E as d,E_ as f,Ew as p,GC as m,Gg as h,JC as g,Jg as _,KC as v,Kg as y,Mw as b,Nw as x,O_ as ee,Ow as S,Pw as C,QC as w,Qg as te,S_ as ne,Sj as T,Sw as E,T_ as re,Tw as ie,XC as ae,Xg as oe,YC as se,Yg as ce,ZC as le,Zg as ue,__ as de,_w as fe,a_ as pe,aw as me,b_ as he,bw as ge,c_ as _e,d_ as ve,dw as D,e_ as ye,ew as O,f_ as be,fw as k,g_ as xe,gn as A,gw as j,h_ as Se,hn as M,hw as Ce,i_ as we,iw as Te,jw as N,k_ as Ee,kw as P,l_ as De,m_ as Oe,mn as ke,mw as Ae,n_ as je,nw as Me,o_ as Ne,p_ as Pe,pw as Fe,qC as Ie,qg as Le,r_ as Re,rw as ze,s_ as Be,t_ as Ve,tw as He,u_ as Ue,uw as We,v_ as Ge,vw as Ke,w_ as qe,ww as Je,x_ as Ye,xj as F,xw as I,y_ as Xe,yw as Ze}from"./dist-C2CRpdq8.js";import{n as Qe}from"./dist-BB8NhuRg.js";import{t as $e}from"./x-BbitkL6D.js";import{i as L,n as R,r as et,t as tt}from"./tabs-DYLGMjrm.js";import{t as z}from"./button-B39xibrh.js";import{A as B,Bt as nt,C as V,Jt as rt,N as it,S as H,Ut as at,a as ot,b as U,bt as st,dt as ct,i as lt,j as ut,lt as dt,mt as ft,o as pt,pt as mt,qt as ht,r as gt,st as W,ut as _t,w as G,x as K,zt as vt}from"./index-Cw1UFCV-.js";import{n as q}from"./TimeRangePicker-BlUshfcd.js";import{t as yt}from"./FilterBar-CVU7c-v_.js";import{t as bt}from"./AdvancedFilter-C2V1UpGN.js";import{t as xt}from"./DataTableShell-BYoFVC-r.js";var St=c(`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=c(`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=t(e(),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`?Ce():n===`agent`?`${Ae()} - ${r}`:e}function Tt(){let e=T(d.me.getMe,{host:st})?.role===`admin`,t=T(d.deliveryTiming.getDeliveryStatus,{}),n=F(d.deliveryTiming.startDeliveryRecord),r=F(d.deliveryTiming.stopDeliveryRecord),[i,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),l=t?.recording??!1,f=async()=>{c(!0);try{l?await r({}):await n({})}finally{c(!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:C()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:x()})]}),e?(0,Y.jsx)(z,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void f(),children:l?N():b()}):null]}),l?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(W,{variant:`secondary`,children:a()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:P({time:ut(t.startedAt)})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:i?p():u()})}),i?(0,Y.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=T(d.deliveryTiming.listDeliverySessions,{}),n=F(d.deliveryTiming.deleteDeliverySessions),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(`all`),[c,l]=(0,J.useState)(X),[u,f]=(0,J.useState)(null),{from:p,to:m}=q(c),h=c.to===`now`?1/0:m,g=r.trim()!==``||a!==`all`||c!==X,_=()=>{i(``),o(`all`),l(X)},y=(0,J.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=p&&t.startedAt<=h).map(e=>({...e,_id:e.sessionId}))},[t,r,a,p,h]),b=e=>{let t=new Set((y??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&f(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(yt,{q:r,onQChange:i,searchPlaceholder:Je(),timeRange:c,onTimeRangeChange:l,onReset:_,canReset:g,children:(0,Y.jsxs)(U,{value:a,onValueChange:e=>o(e),children:[(0,Y.jsx)(V,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(G,{})}),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(H,{value:`all`,children:s()}),(0,Y.jsx)(H,{value:`active`,children:E()}),(0,Y.jsx)(H,{value:`stopped`,children:I()})]})]})}),(0,Y.jsx)(xt,{title:ie(),rows:y,emptyHint:v(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?k():Fe(),onClick:()=>f(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:ge(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:B(e.startedAt)})},{header:Ze(),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:B(e.stoppedAt)})},{header:Ke(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:fe(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:j(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(W,{variant:`secondary`,children:E()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:I()})}],rowActions:e?e=>[{label:D(),variant:`destructive`,onSelect:()=>b([e.sessionId])}]:void 0,bulkActions:e?[{label:D(),variant:`destructive`,onSelect:e=>b(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,Y.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=T(d.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(it(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:We()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:S()});let i=e.segments,a=(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,` `,m()]}),(0,Y.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(Qe,{size:13,"aria-hidden":!0}):(0,Y.jsx)(at,{size:13,"aria-hidden":!0}),t?Ie():g()]})]}),(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:ze()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Me()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:He()})]})}),(0,Y.jsxs)(`tbody`,{children:[a(O(),i.bridge),a(r(),i.A),a(w(),i.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:le()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ae()})]})}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:A()},{value:`principalType`,label:M()},{value:`direction`,label:`direction`},{value:`roleKey`,label:ke()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=rt({from:`/settings/traces`}),t=ht({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,s=e.principalType??Q,c=e.direction??Q,u=e.roleKey??Q,p=e.q??``,m=gt(e.from,e.to),h=(0,J.useMemo)(()=>pt(e.adv),[e.adv]),{from:g,to:v}=q(m),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),C=e=>void t({search:t=>({...t,limit:e})}),w=e=>void t({search:t=>({...t,kind:e})}),E=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),ie=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),ae=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})}),le=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),fe=e=>void t({search:t=>({...t,...ot(e)})}),ge=e=>void t({search:t=>({...t,adv:lt(e)}),replace:!0}),D=T(d.observability.listEvents,{limit:n}),O=T(d.observability.listEvents,{limit:n,kind:r===At?void 0:r,filter:{q:p||void 0,from:g,to:v,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:c===Q?void 0:c,roleKey:u===Q?void 0:u,advanced:h.length>0?h:void 0}}),k=(0,J.useMemo)(()=>{let e=new Set;for(let t of D??[])e.add(t.kind);return[...e].sort()},[D]),A=(0,J.useMemo)(()=>{let e=new Set;for(let t of D??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[D]),j=p!==``||a!==Q||s!==Q||c!==Q||u!==Q||h.length>0||m.kind!==`relative`||m.from!==Pt.from;function M(){t({search:{limit:100,kind:`all`},replace:!0})}let Ce=y?D?.filter(e=>e.correlationId===y):O,N=e.section,P=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,Y.jsxs)(tt,{value:N,onValueChange:e=>P(e),children:[(0,Y.jsxs)(et,{className:`w-full`,children:[(0,Y.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(vt,{size:13,"aria-hidden":!0}),me()]}),(0,Y.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(Ct,{size:13,"aria-hidden":!0}),Te()]})]}),(0,Y.jsx)(R,{value:`latency`,children:(0,Y.jsx)(Tt,{})}),(0,Y.jsxs)(R,{value:`events`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ee(),(0,Y.jsx)(`strong`,{children:ee()}),l(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:f()})]}),(0,Y.jsxs)(yt,{q:p,onQChange:E,searchPlaceholder:re(),timeRange:m,onTimeRangeChange:fe,onReset:M,canReset:j,children:[(0,Y.jsxs)(U,{value:a,onValueChange:ie,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(G,{placeholder:qe()})}),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(H,{value:Q,children:o()}),jt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:s,onValueChange:ae,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(G,{placeholder:ne()})}),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(H,{value:Q,children:Ye()}),Mt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:c,onValueChange:se,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(G,{placeholder:he()})}),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(H,{value:Q,children:Xe()}),Nt.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:u,onValueChange:le,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(G,{placeholder:Ge()})}),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(H,{value:Q,children:de()}),A.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:r,onValueChange:w,children:[(0,Y.jsx)(V,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(G,{placeholder:xe()})}),(0,Y.jsxs)(K,{children:[(0,Y.jsx)(H,{value:At,children:Se()}),k.map(e=>(0,Y.jsx)(H,{value:e,children:e},e))]})]}),(0,Y.jsxs)(U,{value:String(n),onValueChange:e=>C(Number(e)),children:[(0,Y.jsx)(V,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(G,{})}),(0,Y.jsx)(K,{children:kt.map(e=>(0,Y.jsx)(H,{value:String(e),children:Oe({count:e})},e))})]})]}),(0,Y.jsx)(bt,{fields:Ft,seed:h,onChange:ge}),y?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>b(null),title:Pe(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[be(),(0,Y.jsx)(`code`,{children:$(y)})]}),(0,Y.jsx)($e,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:ve()})]})}):null,(0,Y.jsx)(xt,{title:Ue(),rows:Ce,emptyHint:y?De():_e(),columns:[{header:Be(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:B(e.at)})},{header:Ne(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(W,{variant:`secondary`,children:e.kind})},{header:pe(),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":we(),children:`✓`})}},{header:Re(),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:je(),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:Ve(),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:ye(),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:i(),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:te(),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:ue(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:oe(),onClick:()=>b(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ce(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>S(e),children:_()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(zt,{row:x,onClose:()=>S(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)(dt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(_t,{className:`max-w-lg`,children:[(0,Y.jsxs)(mt,{children:[(0,Y.jsxs)(ft,{className:`oc-traces__meta-title`,children:[Le(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(W,{variant:`outline`,children:y()})]}),(0,Y.jsx)(ct,{children:h()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{It as TracesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,Bx as i,E as a,Gx as o,Hl as s,Hx as c,Ix as l,Jx as u,Kx as d,Lx as f,Qx as ee,Rx as te,Sj as p,Ul as m,Ux as ne,Vl as h,Vx as re,Wx as ie,Xx as ae,Yx as oe,Zx as se,_g as g,_x as ce,aS as le,ag as _,cS as v,cg as y,dg as b,eS as ue,fg as x,gg as S,hg as C,iS as de,lS as w,lg as T,mg as E,nS as fe,oS as pe,og as D,pg as O,qx as me,rS as he,sS as ge,sg as k,tS as _e,uS as A,ug as j,xj as M,zx as ve}from"./dist-C2CRpdq8.js";import{t as N}from"./button-B39xibrh.js";import{C as P,H as F,Jt as ye,Mt as I,S as L,U as be,V as R,b as z,bt as xe,c as B,dt as V,it as Se,jt as H,l as U,lt as Ce,mt as we,nt as Te,ot as Ee,p as W,pt as De,qt as Oe,rt as ke,s as G,st as K,tt as Ae,ut as je,w as q,x as J}from"./index-BygEdn-c.js";import{t as Y}from"./FilterBar-hVahB9Hp.js";import{t as Me}from"./DataTableShell-C_uiwnG-.js";import{t as Ne}from"./DetailChips-Bi7POigs.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=p(a.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=p(a.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}))],f=new Map;for(let e of d){let t=f.get(e.instanceName)??[];t.push(e),f.set(e.instanceName,t)}return(0,Z.jsx)(Ce,{open:n,onOpenChange:r,children:(0,Z.jsxs)(je,{className:`oc-access`,children:[(0,Z.jsxs)(De,{children:[(0,Z.jsx)(we,{children:g({user:t})}),(0,Z.jsx)(V,{children:S()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?C():E()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:O()}):d.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:j()}):[...f.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:o}){let s=M(a.agents.assignAgent),c=M(a.agents.removeAgent),l=M(a.agents.setDefaultAgent),u=R();if(!e)return null;async function d(n,r){try{r?await c({profileId:e,instanceName:t,agentId:n}):await s({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(x(),e)}}async function f(n){try{await l({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(b(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(I,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),a=o===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":T({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)(K,{variant:`outline`,className:`oc-access__gone`,children:y()}):null,e.outOfPool?(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:k()}):null,r?a?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":D(),title:D(),children:(0,Z.jsx)(H,{size:14,fill:`currentColor`})}):(0,Z.jsx)(N,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":_(),title:_(),disabled:c,onClick:()=>void f(e.agentId),children:(0,Z.jsx)(H,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return h();case`user`:return s();case`admin`:return m();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)(Ae,{children:[(0,Z.jsx)(Ee,{asChild:!0,children:(0,Z.jsx)(N,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?A():w({count:r})})}),(0,Z.jsxs)(Te,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(Se,{children:v()}),G.map(e=>{let r=U[e];return(0,Z.jsxs)(ke,{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:B[e]()})]},e)})]})]})}function Le(){let e=ye({from:`/settings/users`}),t=Oe({from:`/settings/users`}),n=e.q??``,s=e.role??Q,m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),h=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),g=p(a.admin.listUsers,{filter:{q:n||void 0,role:s===Q?void 0:s},withAgents:!0}),_=p(a.me.getMe,{host:xe}),v=M(a.admin.setRole),y=M(a.admin.setUserPermissions),b=M(a.admin.startImpersonation),x=M(a.admin.deleteUser),S=M(a.admin.setUserName),C=F(),w=be(),T=R(),[E,D]=(0,X.useState)(null),O=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of g??[])e.add(t.role);return[...e]},[g]),k=n!==``||s!==Q;function A(){t({search:{},replace:!0})}async function j(e){try{await v(e)}catch(e){T.error(ge(),e)}}async function N(e){try{await y(e)}catch(e){T.error(pe(),e)}}async function B(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await C({title:r(),description:ee({user:t}),confirmWord:se(),confirmLabel:ae(),destructive:!0}))try{await x({profileId:e._id}),T.success(u({user:t}))}catch(e){T.error(oe(),e)}}async function V(e){let t=e.email||e.name||e.userId.slice(0,8),n=await w({title:d(),label:o({user:t}),placeholder:ie(),defaultValue:e.name??``,confirmLabel:ce()});if(n!==null)try{await S({profileId:e._id,name:n}),T.success(ne())}catch(e){T.error(c(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{q:n,onQChange:m,searchPlaceholder:le(),onReset:A,canReset:k,children:(0,Z.jsxs)(z,{value:s,onValueChange:h,children:[(0,Z.jsx)(P,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(L,{value:Q,children:de()}),O.map(e=>(0,Z.jsx)(L,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:he(),rows:g,emptyHint:fe(),rowActions:e=>{let t=[{label:l(),onSelect:()=>D({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:me(),onSelect:()=>void V(e)}];return e.userId!==_?.userId&&t.push({label:_e(),onSelect:()=>void b({profileId:e._id})},{label:ue(),variant:`destructive`,onSelect:()=>void B(e)}),t},columns:[{header:re(),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:i(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(z,{value:e.role,onValueChange:t=>void j({profileId:e._id,role:t}),children:[(0,Z.jsx)(P,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(L,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(L,{value:`user`,children:$(`user`)}),(0,Z.jsx)(L,{value:`admin`,children:$(`admin`)})]})]})},{header:ve(),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:te()}):(0,Z.jsx)(Ie,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),N({profileId:e._id,permissions:[...n]})}})},{header:f(),cell:e=>(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(I,{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
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,Bx as i,E as a,Gx as o,Hl as s,Hx as c,Ix as l,Jx as u,Kx as d,Lx as f,Qx as ee,Rx as te,Sj as p,Ul as m,Ux as ne,Vl as h,Vx as re,Wx as ie,Xx as ae,Yx as oe,Zx as se,_g as g,_x as ce,aS as le,ag as _,cS as v,cg as y,dg as b,eS as ue,fg as x,gg as S,hg as C,iS as de,lS as w,lg as T,mg as E,nS as fe,oS as pe,og as D,pg as O,qx as me,rS as he,sS as ge,sg as k,tS as _e,uS as A,ug as j,xj as M,zx as ve}from"./dist-C2CRpdq8.js";import{t as N}from"./button-B39xibrh.js";import{C as P,H as F,Jt as ye,Mt as I,S as L,U as be,V as R,b as z,bt as xe,c as B,dt as V,it as Se,jt as H,l as U,lt as Ce,mt as we,nt as Te,ot as Ee,p as W,pt as De,qt as Oe,rt as ke,s as G,st as K,tt as Ae,ut as je,w as q,x as J}from"./index-Cw1UFCV-.js";import{t as Y}from"./FilterBar-CVU7c-v_.js";import{t as Me}from"./DataTableShell-BYoFVC-r.js";import{t as Ne}from"./DetailChips-CTEdEWG0.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=p(a.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=p(a.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}))],f=new Map;for(let e of d){let t=f.get(e.instanceName)??[];t.push(e),f.set(e.instanceName,t)}return(0,Z.jsx)(Ce,{open:n,onOpenChange:r,children:(0,Z.jsxs)(je,{className:`oc-access`,children:[(0,Z.jsxs)(De,{children:[(0,Z.jsx)(we,{children:g({user:t})}),(0,Z.jsx)(V,{children:S()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?C():E()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:O()}):d.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:j()}):[...f.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:o}){let s=M(a.agents.assignAgent),c=M(a.agents.removeAgent),l=M(a.agents.setDefaultAgent),u=R();if(!e)return null;async function d(n,r){try{r?await c({profileId:e,instanceName:t,agentId:n}):await s({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(x(),e)}}async function f(n){try{await l({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(b(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(I,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),a=o===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":T({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)(K,{variant:`outline`,className:`oc-access__gone`,children:y()}):null,e.outOfPool?(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:k()}):null,r?a?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":D(),title:D(),children:(0,Z.jsx)(H,{size:14,fill:`currentColor`})}):(0,Z.jsx)(N,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":_(),title:_(),disabled:c,onClick:()=>void f(e.agentId),children:(0,Z.jsx)(H,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return h();case`user`:return s();case`admin`:return m();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)(Ae,{children:[(0,Z.jsx)(Ee,{asChild:!0,children:(0,Z.jsx)(N,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?A():w({count:r})})}),(0,Z.jsxs)(Te,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(Se,{children:v()}),G.map(e=>{let r=U[e];return(0,Z.jsxs)(ke,{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:B[e]()})]},e)})]})]})}function Le(){let e=ye({from:`/settings/users`}),t=Oe({from:`/settings/users`}),n=e.q??``,s=e.role??Q,m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),h=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),g=p(a.admin.listUsers,{filter:{q:n||void 0,role:s===Q?void 0:s},withAgents:!0}),_=p(a.me.getMe,{host:xe}),v=M(a.admin.setRole),y=M(a.admin.setUserPermissions),b=M(a.admin.startImpersonation),x=M(a.admin.deleteUser),S=M(a.admin.setUserName),C=F(),w=be(),T=R(),[E,D]=(0,X.useState)(null),O=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of g??[])e.add(t.role);return[...e]},[g]),k=n!==``||s!==Q;function A(){t({search:{},replace:!0})}async function j(e){try{await v(e)}catch(e){T.error(ge(),e)}}async function N(e){try{await y(e)}catch(e){T.error(pe(),e)}}async function B(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await C({title:r(),description:ee({user:t}),confirmWord:se(),confirmLabel:ae(),destructive:!0}))try{await x({profileId:e._id}),T.success(u({user:t}))}catch(e){T.error(oe(),e)}}async function V(e){let t=e.email||e.name||e.userId.slice(0,8),n=await w({title:d(),label:o({user:t}),placeholder:ie(),defaultValue:e.name??``,confirmLabel:ce()});if(n!==null)try{await S({profileId:e._id,name:n}),T.success(ne())}catch(e){T.error(c(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{q:n,onQChange:m,searchPlaceholder:le(),onReset:A,canReset:k,children:(0,Z.jsxs)(z,{value:s,onValueChange:h,children:[(0,Z.jsx)(P,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(L,{value:Q,children:de()}),O.map(e=>(0,Z.jsx)(L,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:he(),rows:g,emptyHint:fe(),rowActions:e=>{let t=[{label:l(),onSelect:()=>D({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:me(),onSelect:()=>void V(e)}];return e.userId!==_?.userId&&t.push({label:_e(),onSelect:()=>void b({profileId:e._id})},{label:ue(),variant:`destructive`,onSelect:()=>void B(e)}),t},columns:[{header:re(),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:i(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(z,{value:e.role,onValueChange:t=>void j({profileId:e._id,role:t}),children:[(0,Z.jsx)(P,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(L,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(L,{value:`user`,children:$(`user`)}),(0,Z.jsx)(L,{value:`admin`,children:$(`admin`)})]})]})},{header:ve(),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:te()}):(0,Z.jsx)(Ie,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),N({profileId:e._id,permissions:[...n]})}})},{header:f(),cell:e=>(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(I,{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{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,At as i,Ct as a,D as o,Dt as s,E as c,Et as l,Fs as ee,Ft as u,H as d,J as f,K as p,Mt as m,Ns as h,Nt as g,Ot as _,Pt as v,Q as y,Sj as b,St as x,Tt as te,U as ne,V as re,W as S,Y as C,_t as ie,bt as ae,dt as oe,et as se,ft as ce,gt as w,hj as T,ht as E,jt as le,k as ue,kt as D,mt as O,nt as de,pj as fe,pt as pe,q as me,tl as k,tt as A,ut as j,vt as M,wt as N,xj as P,xt as F,yj as I,yt as L}from"./dist-C2CRpdq8.js";import{i as R,n as z,r as he,t as B}from"./tabs-1TpabOuW.js";import{t as V}from"./button-B39xibrh.js";import{B as ge,C as H,F as _e,I as ve,It as ye,Jt as be,L as xe,Ot as Se,P as Ce,R as U,S as W,b as G,bt as we,p as K,qt as Te,st as q,w as J,x as Y,z as X}from"./index-BygEdn-c.js";/* empty css */var Ee=o(`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=t(e(),1),Q=n(),De=[[`auto`,()=>_()],[`fr-FR`,()=>de()],[`en-US`,()=>A()],[`en-GB`,()=>se()],[`de-DE`,()=>r()],[`es-ES`,()=>y()]],Oe=[[`0.75`,()=>l()],[`1`,()=>te()],[`1.25`,()=>N()],[`1.5`,()=>a()]],$=0;function ke({instance:e}){let t=P(c.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},[a,o]=(0,Z.useState)(r),[l,u]=(0,Z.useState)(`idle`),[f,p]=(0,Z.useState)(!1),[m,g]=(0,Z.useState)(!1),_=I(c.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}),u(`idle`)},[e._id]);let v=a.enabled!==r.enabled||a.engine!==r.engine||a.lang!==r.lang||a.rate!==r.rate||a.autoRead!==r.autoRead;async function y(){u(`saving`);try{let n={...e.config??{}};n.voiceEnabled=a.enabled,a.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,a.lang===`auto`?delete n.voiceLang:n.voiceLang=a.lang;let r=Number.parseFloat(a.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,a.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),u(`idle`)}catch{u(`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)(K,{checked:a.enabled,onCheckedChange:e=>o({...a,enabled:e===!0}),"aria-label":i()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,Q.jsxs)(G,{value:a.engine,onValueChange:e=>o({...a,engine:e}),disabled:!a.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":S(),children:(0,Q.jsx)(J,{})}),(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(W,{value:`browser`,children:ne()}),e.kind===`hermes`?null:(0,Q.jsx)(W,{value:`gateway`,children:d()})]})]})]}),a.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:re()}):null,a.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,Q.jsxs)(G,{value:a.lang,onValueChange:e=>o({...a,lang:e}),disabled:!a.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":D(),children:(0,Q.jsx)(J,{})}),(0,Q.jsx)(Y,{children:De.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,Q.jsxs)(G,{value:a.rate,onValueChange:e=>o({...a,rate:e}),disabled:!a.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":s(),children:(0,Q.jsx)(J,{})}),(0,Q.jsx)(Y,{children:Oe.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),a.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(K,{checked:a.autoRead,onCheckedChange:e=>o({...a,autoRead:e===!0}),disabled:!a.enabled,"aria-label":x()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:F()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(V,{size:`sm`,disabled:!v||l===`saving`,onClick:()=>void y(),children:l===`saving`?k():ee()}),(0,Q.jsx)(V,{variant:`outline`,size:`sm`,disabled:!a.enabled||f,onClick:()=>{let t=Number.parseFloat(a.rate)||1,n=++$;if(g(!1),X(),U(),a.engine!==`gateway`){xe(M(),{lang:ve(a.lang,T()),rate:t});return}p(!0),_({instanceName:e.name,text:M()}).then(({mime:e,audioBase64:r})=>{n===$&&_e(r,e,{rate:t})}).catch(()=>{n===$&&g(!0)}).finally(()=>p(!1))},children:f?k():ae()}),(0,Q.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>{$++,p(!1),X(),U()},children:L()})]}),l===`error`||m?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m?ue():h()}):null]})}function Ae({stt:e}){let t=b(c.me.getMe,{host:we}),n=P(c.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=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:w()}),(0,Q.jsx)(q,{variant:e?`secondary`:`outline`,children:e?oe():j()}),(0,Q.jsx)(q,{variant:r?`secondary`:`destructive`,children:r?f():me()})]}),i?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(K,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":C()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:C()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:E()})]})}function je(){let e=b(c.admin.listInstances,{}),t=(0,Z.useMemo)(()=>ge(),[]),n=(0,Z.useMemo)(()=>Ce(),[]),{section:r}=be({from:`/settings/voice`}),i=Te({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(q,{variant:t?`secondary`:`destructive`,children:t?v():g()}),(0,Q.jsx)(q,{variant:n?`secondary`:`destructive`,children:n?m():le()})]}),(0,Q.jsxs)(B,{value:r,onValueChange:e=>void i({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)(Se,{size:13,"aria-hidden":!0}),p()]}),(0,Q.jsxs)(R,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(ye,{size:13,"aria-hidden":!0}),w()]}),(0,Q.jsxs)(R,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ee,{size:13,"aria-hidden":!0}),O()]})]}),(0,Q.jsx)(z,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):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:O()}),(0,Q.jsx)(q,{variant:`outline`,children:pe()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ce()})]})})]})]})}export{je as VoiceTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,At as i,Ct as a,D as o,Dt as s,E as c,Et as l,Fs as ee,Ft as u,H as d,J as f,K as p,Mt as m,Ns as h,Nt as g,Ot as _,Pt as v,Q as y,Sj as b,St as x,Tt as te,U as ne,V as re,W as S,Y as C,_t as ie,bt as ae,dt as oe,et as se,ft as ce,gt as w,hj as T,ht as E,jt as le,k as ue,kt as D,mt as O,nt as de,pj as fe,pt as pe,q as me,tl as k,tt as A,ut as j,vt as M,wt as N,xj as P,xt as F,yj as I,yt as L}from"./dist-C2CRpdq8.js";import{i as R,n as z,r as he,t as B}from"./tabs-DYLGMjrm.js";import{t as V}from"./button-B39xibrh.js";import{B as ge,C as H,F as _e,I as ve,It as ye,Jt as be,L as xe,Ot as Se,P as Ce,R as U,S as W,b as G,bt as we,p as K,qt as Te,st as q,w as J,x as Y,z as X}from"./index-Cw1UFCV-.js";/* empty css */var Ee=o(`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=t(e(),1),Q=n(),De=[[`auto`,()=>_()],[`fr-FR`,()=>de()],[`en-US`,()=>A()],[`en-GB`,()=>se()],[`de-DE`,()=>r()],[`es-ES`,()=>y()]],Oe=[[`0.75`,()=>l()],[`1`,()=>te()],[`1.25`,()=>N()],[`1.5`,()=>a()]],$=0;function ke({instance:e}){let t=P(c.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},[a,o]=(0,Z.useState)(r),[l,u]=(0,Z.useState)(`idle`),[f,p]=(0,Z.useState)(!1),[m,g]=(0,Z.useState)(!1),_=I(c.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}),u(`idle`)},[e._id]);let v=a.enabled!==r.enabled||a.engine!==r.engine||a.lang!==r.lang||a.rate!==r.rate||a.autoRead!==r.autoRead;async function y(){u(`saving`);try{let n={...e.config??{}};n.voiceEnabled=a.enabled,a.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,a.lang===`auto`?delete n.voiceLang:n.voiceLang=a.lang;let r=Number.parseFloat(a.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,a.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),u(`idle`)}catch{u(`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)(K,{checked:a.enabled,onCheckedChange:e=>o({...a,enabled:e===!0}),"aria-label":i()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,Q.jsxs)(G,{value:a.engine,onValueChange:e=>o({...a,engine:e}),disabled:!a.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":S(),children:(0,Q.jsx)(J,{})}),(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(W,{value:`browser`,children:ne()}),e.kind===`hermes`?null:(0,Q.jsx)(W,{value:`gateway`,children:d()})]})]})]}),a.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:re()}):null,a.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,Q.jsxs)(G,{value:a.lang,onValueChange:e=>o({...a,lang:e}),disabled:!a.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":D(),children:(0,Q.jsx)(J,{})}),(0,Q.jsx)(Y,{children:De.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,Q.jsxs)(G,{value:a.rate,onValueChange:e=>o({...a,rate:e}),disabled:!a.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":s(),children:(0,Q.jsx)(J,{})}),(0,Q.jsx)(Y,{children:Oe.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),a.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(K,{checked:a.autoRead,onCheckedChange:e=>o({...a,autoRead:e===!0}),disabled:!a.enabled,"aria-label":x()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:F()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(V,{size:`sm`,disabled:!v||l===`saving`,onClick:()=>void y(),children:l===`saving`?k():ee()}),(0,Q.jsx)(V,{variant:`outline`,size:`sm`,disabled:!a.enabled||f,onClick:()=>{let t=Number.parseFloat(a.rate)||1,n=++$;if(g(!1),X(),U(),a.engine!==`gateway`){xe(M(),{lang:ve(a.lang,T()),rate:t});return}p(!0),_({instanceName:e.name,text:M()}).then(({mime:e,audioBase64:r})=>{n===$&&_e(r,e,{rate:t})}).catch(()=>{n===$&&g(!0)}).finally(()=>p(!1))},children:f?k():ae()}),(0,Q.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>{$++,p(!1),X(),U()},children:L()})]}),l===`error`||m?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m?ue():h()}):null]})}function Ae({stt:e}){let t=b(c.me.getMe,{host:we}),n=P(c.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=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:w()}),(0,Q.jsx)(q,{variant:e?`secondary`:`outline`,children:e?oe():j()}),(0,Q.jsx)(q,{variant:r?`secondary`:`destructive`,children:r?f():me()})]}),i?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(K,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":C()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:C()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:E()})]})}function je(){let e=b(c.admin.listInstances,{}),t=(0,Z.useMemo)(()=>ge(),[]),n=(0,Z.useMemo)(()=>Ce(),[]),{section:r}=be({from:`/settings/voice`}),i=Te({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(q,{variant:t?`secondary`:`destructive`,children:t?v():g()}),(0,Q.jsx)(q,{variant:n?`secondary`:`destructive`,children:n?m():le()})]}),(0,Q.jsxs)(B,{value:r,onValueChange:e=>void i({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)(Se,{size:13,"aria-hidden":!0}),p()]}),(0,Q.jsxs)(R,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(ye,{size:13,"aria-hidden":!0}),w()]}),(0,Q.jsxs)(R,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ee,{size:13,"aria-hidden":!0}),O()]})]}),(0,Q.jsx)(z,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):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:O()}),(0,Q.jsx)(q,{variant:`outline`,children:pe()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ce()})]})})]})]})}export{je as VoiceTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{D as r,E as i,T as a}from"./index-BygEdn-c.js";var o=t(e(),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};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{D as r,E as i,T as a}from"./index-Cw1UFCV-.js";var o=t(e(),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};