@lacneu/atrium 0.51.0 → 0.52.0

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 (37) hide show
  1. package/dist/assets/{AccessTab-BTTUfIwc.js → AccessTab-CTW_nnWZ.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-BQlL-4N9.js → AdvancedFilter-CKwZSjrh.js} +1 -1
  3. package/dist/assets/{AgentFilesTab-By3Jzopm.js → AgentFilesTab-q9XSjz3-.js} +1 -1
  4. package/dist/assets/{AnomaliesTab-Cs6vlfDv.js → AnomaliesTab-DRfDR0J5.js} +1 -1
  5. package/dist/assets/{AuditTab-BOu6pgTB.js → AuditTab-Dy6MHYXk.js} +1 -1
  6. package/dist/assets/{BridgeTab-DFpunFsv.js → BridgeTab-BYuXlyxy.js} +1 -1
  7. package/dist/assets/{ChatDefaultsTab-DkHZTknY.js → ChatDefaultsTab-Dcfzk7xu.js} +1 -1
  8. package/dist/assets/{DataTableShell-KGrtOG5M.js → DataTableShell-DtJr2ebT.js} +1 -1
  9. package/dist/assets/{DetailChips-C2LFFpNg.js → DetailChips-CXG_QPSx.js} +1 -1
  10. package/dist/assets/{FeedbacksTab-D34MEu6C.js → FeedbacksTab-WlCA0v5O.js} +1 -1
  11. package/dist/assets/{FieldLabel-CKVYl95W.js → FieldLabel-DOYQdxs6.js} +1 -1
  12. package/dist/assets/{FilesTab-ByKXXey8.js → FilesTab-DQ9pHjeQ.js} +1 -1
  13. package/dist/assets/{FilterBar-BVVVO1_O.js → FilterBar-Csl1r1c5.js} +1 -1
  14. package/dist/assets/{GroupsTab-CJUI6gQ9.js → GroupsTab-i_p1qxDl.js} +1 -1
  15. package/dist/assets/{InstancesTab-Cb_2msXj.js → InstancesTab-C2vgcYdE.js} +1 -1
  16. package/dist/assets/{IntegrationsTab-B9Nkc7-l.js → IntegrationsTab-U_Dml2lf.js} +1 -1
  17. package/dist/assets/{KpiTab-B6SqslSj.js → KpiTab-D8BAnPiK.js} +1 -1
  18. package/dist/assets/{PreferencesTab-BdvOFp2E.js → PreferencesTab-BktDAi8P.js} +1 -1
  19. package/dist/assets/{PromptInjectionsTab-CgAFhOn5.js → PromptInjectionsTab-Bk59PWzu.js} +1 -1
  20. package/dist/assets/{RolesTab-CtV113pW.js → RolesTab-DVdsW49x.js} +1 -1
  21. package/dist/assets/{ServiceAccountsTab-Bu_j0kUL.js → ServiceAccountsTab-ZsiwQmeJ.js} +1 -1
  22. package/dist/assets/{SubAgentReportsTab-G_s4_aPf.js → SubAgentReportsTab-Ce0Y_sVn.js} +1 -1
  23. package/dist/assets/{ThemeShowroom-CbU-xJra.js → ThemeShowroom-BRl6NHy2.js} +1 -1
  24. package/dist/assets/{TimeRangePicker-NSOkx3C0.js → TimeRangePicker-BeZLlC4Y.js} +1 -1
  25. package/dist/assets/{TracesTab-Wo-rxO1v.js → TracesTab-CBN2vo1w.js} +1 -1
  26. package/dist/assets/{UsersTab-DO7Wa8iJ.js → UsersTab-C_K650wH.js} +1 -1
  27. package/dist/assets/{VoiceTab-ilUT53Ds.js → VoiceTab-b4ZPVB2F.js} +1 -1
  28. package/dist/assets/compatView-CONPJXEW.js +1 -0
  29. package/dist/assets/{highlighted-body-OFNGDK62-BOjjbbd6.js → highlighted-body-OFNGDK62-CJz5HJX2.js} +1 -1
  30. package/dist/assets/{index-DBQ43N4_.js → index-4Peu865E.js} +5 -5
  31. package/dist/assets/mermaid-GHXKKRXX-B47aXknL.js +1 -0
  32. package/dist/assets/{pdf-D7AA0FY6.js → pdf-C1wt9cpf.js} +1 -1
  33. package/dist/assets/{tabs-BJyz65LR.js → tabs-0f19le6d.js} +1 -1
  34. package/dist/index.html +1 -1
  35. package/package.json +1 -1
  36. package/dist/assets/compatView-S4X8HKXY.js +0 -1
  37. package/dist/assets/mermaid-GHXKKRXX-CXCdU_oF.js +0 -1
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ao as r,DM as i,Do as a,E as o,Eo as s,Mo as c,OM as l,Oo as u,TM as d,To as f,aw as p,cw as m,dw as h,fw as g,gw as _,hw as v,iw as y,jo as b,ko as x,lw as S,mw as C,ow as w,pw as T,rw as E,sw as D,uw as O,wo as k}from"./dist-HBBi9Y25.js";import{t as A}from"./button-b04wLuGq.js";import{ct as j,lt as M,p as N}from"./index-DBQ43N4_.js";var P=t(e(),1),F=n();function I(){let e=l(o.integrations.status.status,{}),t=i(o.admin.setIntegrationConfig),[n,a]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&a(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:_()});let s=n,u=(e,t,n)=>a({...s,[e]:{...s[e],[t]:n}}),d=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,F.jsx)(`strong`,{children:C()}),` `,T()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:h()}):(0,F.jsx)(j,{variant:`outline`,children:O()}),note:S(),children:[(0,F.jsx)(R,{label:D(),children:(0,F.jsx)(M,{value:s.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>u(`langfuse`,`host`,e.target.value),onBlur:()=>d(`langfuse`,{host:s.langfuse.host??``})})}),(0,F.jsx)(z,{label:E(),checked:s.langfuse.enabled??!0,onChange:e=>{u(`langfuse`,`enabled`,e),d(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:h()}):(0,F.jsx)(j,{variant:`outline`,children:O()}),note:m(),children:[(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(M,{value:s.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>u(`opik`,`baseUrl`,e.target.value),onBlur:()=>d(`opik`,{baseUrl:s.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:p(),children:(0,F.jsx)(M,{value:s.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||y(),onChange:e=>u(`opik`,`workspace`,e.target.value),onBlur:()=>d(`opik`,{workspace:s.opik.workspace??``})})}),(0,F.jsx)(z,{label:E(),checked:s.opik.enabled??!0,onChange:e=>{u(`opik`,`enabled`,e),d(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:h()}):(0,F.jsx)(j,{variant:`outline`,children:c()}),note:b(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(M,{value:s.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>u(`otlp`,`endpoint`,e.target.value),onBlur:()=>d(`otlp`,{endpoint:s.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:E(),checked:s.otlp.enabled??!0,onChange:e=>{u(`otlp`,`enabled`,e),d(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=d(o.integrations.otlpSecret.setOtlpHeaders),n=i(o.integrations.otlpSecret.clearOtlpHeaders),[r,c]=(0,P.useState)(``),[l,p]=(0,P.useState)(null),[m,h]=(0,P.useState)(!1),g=async()=>{h(!0),p(null);try{await t({headersJson:r}),c(``)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}};return(0,F.jsxs)(R,{label:x(),children:[(0,F.jsx)(M,{value:r,placeholder:e?u():a(),onChange:e=>c(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:m||r.trim().length===0,onClick:()=>void g(),children:s()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:m,onClick:()=>void n({}),children:f()}):null]}),l?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:l}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:k()})]})}export{I as IntegrationsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ao as r,DM as i,Do as a,E as o,Eo as s,Mo as c,OM as l,Oo as u,TM as d,To as f,aw as p,cw as m,dw as h,fw as g,gw as _,hw as v,iw as y,jo as b,ko as x,lw as S,mw as C,ow as w,pw as T,rw as E,sw as D,uw as O,wo as k}from"./dist-HBBi9Y25.js";import{t as A}from"./button-b04wLuGq.js";import{ct as j,lt as M,p as N}from"./index-4Peu865E.js";var P=t(e(),1),F=n();function I(){let e=l(o.integrations.status.status,{}),t=i(o.admin.setIntegrationConfig),[n,a]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&a(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:_()});let s=n,u=(e,t,n)=>a({...s,[e]:{...s[e],[t]:n}}),d=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,F.jsx)(`strong`,{children:C()}),` `,T()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:h()}):(0,F.jsx)(j,{variant:`outline`,children:O()}),note:S(),children:[(0,F.jsx)(R,{label:D(),children:(0,F.jsx)(M,{value:s.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>u(`langfuse`,`host`,e.target.value),onBlur:()=>d(`langfuse`,{host:s.langfuse.host??``})})}),(0,F.jsx)(z,{label:E(),checked:s.langfuse.enabled??!0,onChange:e=>{u(`langfuse`,`enabled`,e),d(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:h()}):(0,F.jsx)(j,{variant:`outline`,children:O()}),note:m(),children:[(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(M,{value:s.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>u(`opik`,`baseUrl`,e.target.value),onBlur:()=>d(`opik`,{baseUrl:s.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:p(),children:(0,F.jsx)(M,{value:s.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||y(),onChange:e=>u(`opik`,`workspace`,e.target.value),onBlur:()=>d(`opik`,{workspace:s.opik.workspace??``})})}),(0,F.jsx)(z,{label:E(),checked:s.opik.enabled??!0,onChange:e=>{u(`opik`,`enabled`,e),d(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:h()}):(0,F.jsx)(j,{variant:`outline`,children:c()}),note:b(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(M,{value:s.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>u(`otlp`,`endpoint`,e.target.value),onBlur:()=>d(`otlp`,{endpoint:s.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:E(),checked:s.otlp.enabled??!0,onChange:e=>{u(`otlp`,`enabled`,e),d(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=d(o.integrations.otlpSecret.setOtlpHeaders),n=i(o.integrations.otlpSecret.clearOtlpHeaders),[r,c]=(0,P.useState)(``),[l,p]=(0,P.useState)(null),[m,h]=(0,P.useState)(!1),g=async()=>{h(!0),p(null);try{await t({headersJson:r}),c(``)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}};return(0,F.jsxs)(R,{label:x(),children:[(0,F.jsx)(M,{value:r,placeholder:e?u():a(),onChange:e=>c(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:m||r.trim().length===0,onClick:()=>void g(),children:s()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:m,onClick:()=>void n({}),children:f()}):null]}),l?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:l}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:k()})]})}export{I as IntegrationsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Bm as i,E as a,Gm as o,Hm as s,Hw as c,Jm as l,Km as u,OM as d,Qw as f,Rm as p,Um as m,Uw as h,Vm as g,Wm as _,Xm as v,Xw as y,Ym as b,Zm as x,Zw as S,qm as C,wT as w,zm as T}from"./dist-HBBi9Y25.js";import{Xt as E,Yt as ee,a as te,n as ne,r as re,xt as D}from"./index-DBQ43N4_.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-DdBF2ct9.js";import{n as N,t as P}from"./TimeRangePicker-NSOkx3C0.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=d(a.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=d(a.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:w()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:r()}),(0,I.jsx)(j,{children:S()})]}),(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),o=e=>74-e*68/i,s=e=>e.map((e,t)=>`${t===0?`M`:`L`}${a(t).toFixed(1)},${o(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:[c(),` p50 `,R(l.cP50),` `,f()]}),(0,I.jsxs)(`span`,{children:[h(),` p50 `,R(l.aP50),` `,f()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":r(),children:[(0,I.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:x(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:v(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:b(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:l(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:C(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:u(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=E({from:`/settings/kpi`}),t=ee({from:`/settings/kpi`}),n=re(e.from,e.to,ne,`now`),r=e=>void t({search:t=>({...t,...te(e)})}),{from:i,to:c}=N(n),{rowLimit:l,buckets:u}=K(i,c),f=d(a.kpi.listKpis,{limit:l,filter:{from:i,to:c}}),p=(0,F.useMemo)(()=>{let e=new Map;for(let t of f??[]){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},[f,u]),h=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[o(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:_()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return f===void 0?(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]}):f.length===0?(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}):(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(p.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:p.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:g({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:i()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:T({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":p({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{$w as r,Bm as i,E as a,Gm as o,Hm as s,Hw as c,Jm as l,Km as u,OM as d,Qw as f,Rm as p,Um as m,Uw as h,Vm as g,Wm as _,Xm as v,Xw as y,Ym as b,Zm as x,Zw as S,qm as C,wT as w,zm as T}from"./dist-HBBi9Y25.js";import{Xt as E,Yt as ee,a as te,n as ne,r as re,xt as D}from"./index-4Peu865E.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-DdBF2ct9.js";import{n as N,t as P}from"./TimeRangePicker-BeZLlC4Y.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=d(a.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=d(a.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:w()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:r()}),(0,I.jsx)(j,{children:S()})]}),(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),o=e=>74-e*68/i,s=e=>e.map((e,t)=>`${t===0?`M`:`L`}${a(t).toFixed(1)},${o(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:[c(),` p50 `,R(l.cP50),` `,f()]}),(0,I.jsxs)(`span`,{children:[h(),` p50 `,R(l.aP50),` `,f()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":r(),children:[(0,I.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:x(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:v(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:b(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:l(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:C(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:u(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=E({from:`/settings/kpi`}),t=ee({from:`/settings/kpi`}),n=re(e.from,e.to,ne,`now`),r=e=>void t({search:t=>({...t,...te(e)})}),{from:i,to:c}=N(n),{rowLimit:l,buckets:u}=K(i,c),f=d(a.kpi.listKpis,{limit:l,filter:{from:i,to:c}}),p=(0,F.useMemo)(()=>{let e=new Map;for(let t of f??[]){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},[f,u]),h=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[o(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:_()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return f===void 0?(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]}):f.length===0?(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}):(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(p.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:p.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:g({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:i()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:T({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":p({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,Ak as i,Bk as a,Ck as o,DM as s,Dk as c,E as l,Ek as u,F as d,Fk as f,G as ee,Gk as te,Hk as ne,I as re,Ik as ie,Kk as ae,L as oe,Lk as se,M as ce,Mk as le,N as p,Nk as ue,OM as m,Ok as de,P as fe,Pk as pe,Rk as me,Sk as he,Tk as ge,Uk as h,Vk as g,Wk as _,X as v,Z as y,_k as b,aM as x,bk as S,cM as C,ck as w,dM as T,dk as E,fk as D,gk as O,hk as k,iM as A,j,jk as M,kk as N,lM as P,lk as F,mM as I,mk as L,n as R,nM as _e,oM as ve,ok as ye,pk as z,qk as be,rM as xe,sM as Se,sS as Ce,sk as we,tM as Te,uM as Ee,uk as De,vk as B,wk as Oe,xk as ke,yM as Ae,yk as V,zk as je}from"./dist-HBBi9Y25.js";import{t as H}from"./button-b04wLuGq.js";import{A as Me,C as Ne,S as U,b as Pe,bt as Fe,ct as W,lt as G,p as K,vt as Ie,w as Le,x as Re,xt as q,yt as ze,z as Be}from"./index-DBQ43N4_.js";import{t as Ve}from"./localePickerView-C2RmOS86.js";var J=t(e(),1),Y=n();function He({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:()=>be()},{id:`composer`,label:()=>ae()},{id:`sidebar`,label:()=>te()},{id:`notifications`,label:()=>u()},{id:`other`,label:()=>_()}],Z={showSource:{category:`messages`,label:()=>h(),help:()=>ne()},showReport:{category:`messages`,label:()=>g(),help:()=>a()},copyAssistant:{category:`messages`,label:()=>je()},copyUser:{category:`messages`,label:()=>me()},showDelete:{category:`messages`,label:()=>se()},showTools:{category:`messages`,label:()=>ie(),help:()=>f()},voiceInput:{category:`composer`,label:()=>pe(),help:()=>ue()},showUsage:{category:`composer`,label:()=>le(),help:()=>M()},autoReadAloud:{category:`composer`,label:()=>y(),help:()=>v()},showChatAge:{category:`sidebar`,label:()=>i(),help:()=>N()},showChatProvider:{category:`sidebar`,label:()=>de(),help:()=>c()},notifSound:{category:`notifications`,label:()=>ge(),help:()=>Oe()},notifSystem:{category:`notifications`,label:()=>o(),help:()=>he()},replySound:{category:`notifications`,label:()=>ke(),help:()=>S()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ue(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 We=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],Ge={voiceInput:`voiceInput`};function Ke(e){return We.includes(e)}function $(e){return e===`admin`}function qe(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Je(e){return e===`on`?!0:e===`off`?!1:null}function Ye(e){return Ke(e)?Ge[e]:void 0}var Xe={voiceInput:()=>De()};function Ze({prefKey:e,ui:t}){let n=s(l.admin.setUiPrefDefault),r=s(l.admin.setFeatureEnabled),i=Ye(e),a=i?Xe[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:L()}),(0,Y.jsxs)(Pe,{value:qe(t.defaults[e]),onValueChange:t=>void n({key:e,value:Je(t)}),children:[(0,Y.jsx)(Ne,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(Le,{})}),(0,Y.jsxs)(Re,{children:[(0,Y.jsx)(U,{value:`on`,children:w()}),(0,Y.jsx)(U,{value:`off`,children:we()}),(0,Y.jsx)(U,{value:`inherit`,children:ye()})]})]}),i?(0,Y.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,Y.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":z()}),z()]}):null]}),a?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Qe({current:e,enabled:t}){let n=s(l.me.setDictationShortcut),[i,a]=(0,J.useState)(!1),[o,c]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!i)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=ze(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(c(!0),window.setTimeout(()=>c(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[i,n]),(0,Y.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[oe(),e?(0,Y.jsx)(W,{variant:`secondary`,children:Fe(e,Ie())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:o?fe():i?d():re()})]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!i?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:r()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":i,onClick:()=>a(e=>!e),children:i?j():e?ce():p()})]})]})}function $e(){let[e,t]=(0,J.useState)(``),[n,r]=(0,J.useState)(!1),i=m(l.me.getMe,{host:q}),a=i?.ui,o=$(i?.role)&&n,c=s(l.me.setUiPref).withOptimisticUpdate(Me),u=(0,J.useMemo)(()=>a?Ue(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":k()}),k()]}):null,o?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:D()}),(0,Y.jsx)(`p`,{children:E()}),(0,Y.jsx)(`p`,{children:F()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:V(),"aria-label":V(),className:`mb-2`}),u.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:B()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:u.map(e=>(0,Y.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,Y.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Z[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],s=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)(W,{variant:`outline`,children:b()}):l?(0,Y.jsx)(W,{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 c({key:e,value:null}),children:O()}):null,(0,Y.jsx)(He,{checked:s,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),o?(0,Y.jsx)(Ze,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,Y.jsx)(Qe,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:Ae()})}function et(){let e=m(l.me.getMe,{host:q}),t=s(l.me.setLocale),n=s(l.me.setMyName),r=Be(),i=e?.locale??`default`,a=e?.name??``,[o,c]=(0,J.useState)(null),u=o??a,d=u.trim()!==a.trim();async function f(){try{await n({name:u}),c(null),r.success(Se())}catch(e){r.error(ve(),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:T()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:u,maxLength:120,placeholder:P(),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:Ce()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:C()})]}),(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:x()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:A()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[Ve().map(e=>(0,Y.jsx)(H,{variant:i===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(H,{variant:i==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:I()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]}),(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:_e()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Te()})]}),(0,Y.jsx)($e,{})]})]})}export{et as PreferencesTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,Ak as i,Bk as a,Ck as o,DM as s,Dk as c,E as l,Ek as u,F as d,Fk as f,G as ee,Gk as te,Hk as ne,I as re,Ik as ie,Kk as ae,L as oe,Lk as se,M as ce,Mk as le,N as p,Nk as ue,OM as m,Ok as de,P as fe,Pk as pe,Rk as me,Sk as he,Tk as ge,Uk as h,Vk as g,Wk as _,X as v,Z as y,_k as b,aM as x,bk as S,cM as C,ck as w,dM as T,dk as E,fk as D,gk as O,hk as k,iM as A,j,jk as M,kk as N,lM as P,lk as F,mM as I,mk as L,n as R,nM as _e,oM as ve,ok as ye,pk as z,qk as be,rM as xe,sM as Se,sS as Ce,sk as we,tM as Te,uM as Ee,uk as De,vk as B,wk as Oe,xk as ke,yM as Ae,yk as V,zk as je}from"./dist-HBBi9Y25.js";import{t as H}from"./button-b04wLuGq.js";import{A as Me,C as Ne,S as U,b as Pe,bt as Fe,ct as W,lt as G,p as K,vt as Ie,w as Le,x as Re,xt as q,yt as ze,z as Be}from"./index-4Peu865E.js";import{t as Ve}from"./localePickerView-C2RmOS86.js";var J=t(e(),1),Y=n();function He({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:()=>be()},{id:`composer`,label:()=>ae()},{id:`sidebar`,label:()=>te()},{id:`notifications`,label:()=>u()},{id:`other`,label:()=>_()}],Z={showSource:{category:`messages`,label:()=>h(),help:()=>ne()},showReport:{category:`messages`,label:()=>g(),help:()=>a()},copyAssistant:{category:`messages`,label:()=>je()},copyUser:{category:`messages`,label:()=>me()},showDelete:{category:`messages`,label:()=>se()},showTools:{category:`messages`,label:()=>ie(),help:()=>f()},voiceInput:{category:`composer`,label:()=>pe(),help:()=>ue()},showUsage:{category:`composer`,label:()=>le(),help:()=>M()},autoReadAloud:{category:`composer`,label:()=>y(),help:()=>v()},showChatAge:{category:`sidebar`,label:()=>i(),help:()=>N()},showChatProvider:{category:`sidebar`,label:()=>de(),help:()=>c()},notifSound:{category:`notifications`,label:()=>ge(),help:()=>Oe()},notifSystem:{category:`notifications`,label:()=>o(),help:()=>he()},replySound:{category:`notifications`,label:()=>ke(),help:()=>S()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ue(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 We=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],Ge={voiceInput:`voiceInput`};function Ke(e){return We.includes(e)}function $(e){return e===`admin`}function qe(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Je(e){return e===`on`?!0:e===`off`?!1:null}function Ye(e){return Ke(e)?Ge[e]:void 0}var Xe={voiceInput:()=>De()};function Ze({prefKey:e,ui:t}){let n=s(l.admin.setUiPrefDefault),r=s(l.admin.setFeatureEnabled),i=Ye(e),a=i?Xe[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:L()}),(0,Y.jsxs)(Pe,{value:qe(t.defaults[e]),onValueChange:t=>void n({key:e,value:Je(t)}),children:[(0,Y.jsx)(Ne,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(Le,{})}),(0,Y.jsxs)(Re,{children:[(0,Y.jsx)(U,{value:`on`,children:w()}),(0,Y.jsx)(U,{value:`off`,children:we()}),(0,Y.jsx)(U,{value:`inherit`,children:ye()})]})]}),i?(0,Y.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,Y.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":z()}),z()]}):null]}),a?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Qe({current:e,enabled:t}){let n=s(l.me.setDictationShortcut),[i,a]=(0,J.useState)(!1),[o,c]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!i)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=ze(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(c(!0),window.setTimeout(()=>c(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[i,n]),(0,Y.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[oe(),e?(0,Y.jsx)(W,{variant:`secondary`,children:Fe(e,Ie())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:o?fe():i?d():re()})]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!i?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:r()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":i,onClick:()=>a(e=>!e),children:i?j():e?ce():p()})]})]})}function $e(){let[e,t]=(0,J.useState)(``),[n,r]=(0,J.useState)(!1),i=m(l.me.getMe,{host:q}),a=i?.ui,o=$(i?.role)&&n,c=s(l.me.setUiPref).withOptimisticUpdate(Me),u=(0,J.useMemo)(()=>a?Ue(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":k()}),k()]}):null,o?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:D()}),(0,Y.jsx)(`p`,{children:E()}),(0,Y.jsx)(`p`,{children:F()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:V(),"aria-label":V(),className:`mb-2`}),u.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:B()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:u.map(e=>(0,Y.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,Y.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Z[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],s=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)(W,{variant:`outline`,children:b()}):l?(0,Y.jsx)(W,{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 c({key:e,value:null}),children:O()}):null,(0,Y.jsx)(He,{checked:s,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),o?(0,Y.jsx)(Ze,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,Y.jsx)(Qe,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:Ae()})}function et(){let e=m(l.me.getMe,{host:q}),t=s(l.me.setLocale),n=s(l.me.setMyName),r=Be(),i=e?.locale??`default`,a=e?.name??``,[o,c]=(0,J.useState)(null),u=o??a,d=u.trim()!==a.trim();async function f(){try{await n({name:u}),c(null),r.success(Se())}catch(e){r.error(ve(),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:T()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:u,maxLength:120,placeholder:P(),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:Ce()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:C()})]}),(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:x()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:A()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[Ve().map(e=>(0,Y.jsx)(H,{variant:i===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(H,{variant:i==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:I()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]}),(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:_e()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Te()})]}),(0,Y.jsx)($e,{})]})]})}export{et as PreferencesTab};
@@ -1,4 +1,4 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$t as r,Ar as i,Cg as a,DM as o,Dg as s,Dr as c,E as l,Eg as u,Ig as d,Lg as f,Mr as p,OM as m,Og as h,Or as g,Qt as _,Sg as v,Tg as y,Zt as ee,_g as b,bg as x,dg as S,fa as C,fg as w,ga as T,gg as te,ha as E,hg as D,jr as ne,kg as re,kr as ie,ma as ae,mg as O,pa as k,pg as A,ug as j,vg as M,wg as N,xg as P,yg as F}from"./dist-HBBi9Y25.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as H,u as U}from"./FieldLabel-CKVYl95W.js";import{t as W}from"./button-b04wLuGq.js";import{C as G,S as K,b as q,p as J,w as Y,x as X,xt as oe,z as se}from"./index-DBQ43N4_.js";import{r as Z,t as ce}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:N,help:a},documentary_fetch:{label:v,help:P},inbound_files:{label:x,help:F},history_summary:{label:T,help:E},file_curation:{label:p,help:ne}},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{$t as r,Ar as i,Cg as a,DM as o,Dg as s,Dr as c,E as l,Eg as u,Ig as d,Lg as f,Mr as p,OM as m,Og as h,Or as g,Qt as _,Sg as v,Tg as y,Zt as ee,_g as b,bg as x,dg as S,fa as C,fg as w,ga as T,gg as te,ha as E,hg as D,jr as ne,kg as re,kr as ie,ma as ae,mg as O,pa as k,pg as A,ug as j,vg as M,wg as N,xg as P,yg as F}from"./dist-HBBi9Y25.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as H,u as U}from"./FieldLabel-DOYQdxs6.js";import{t as W}from"./button-b04wLuGq.js";import{C as G,S as K,b as q,p as J,w as Y,x as X,xt as oe,z as se}from"./index-4Peu865E.js";import{r as Z,t as ce}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:N,help:a},documentary_fetch:{label:v,help:P},inbound_files:{label:x,help:F},history_summary:{label:T,help:E},file_curation:{label:p,help:ne}},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:w,references:S,files:j,previous_summary:ae,new_messages:k,max_chars:C,file_name:i,budget_chars:ie,feedback:g,content:c};function pe(){let e=m(l.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:b()})});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:re(),help:h()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:M()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsx)(X,{children:e.map(e=>(0,$.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=o(l.admin.upsertInstanceConfig),n=se(),i=m(l.me.getMe,{host:oe}),a=e.config??{},s=Z(e.config?.contentLocale,i?.defaultLocale??void 0),[c,u]=(0,Q.useState)(()=>R(a,s));(0,Q.useEffect)(()=>{u(R(a,s))},[s,e._id]);let[p,h]=(0,Q.useState)(!1),g=c.promptInjections,v=(e,t)=>u({...c,promptInjections:{...g,[e]:{...g[e],...t}}});async function y(){h(!0);try{await t({instanceId:e._id,config:V(c,a,s)})}catch(e){n.error(d(),e)}finally{h(!1)}}async function b(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(d(),e)}}let x=e.config?.contentLocale??`default`,S=ce[Z(void 0,i?.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:r()}),(0,$.jsxs)(q,{value:x,onValueChange:e=>void b(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{value:`default`,children:ee({locale:S})}),le().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:_()})]}),U.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:g[e]??{enabled:!0,template:z[e].defaultTemplate[s]},contentLocale:s,onChange:t=>v(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void y(),disabled:p,children:f()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[i],d=t.togglable&&!r.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),p=I(e,r,i),m=p?L(p,f):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(J,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:u()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:d,rows:8,spellCheck:!1,onChange:e=>a({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:y()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:o?D():te()}),l&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:s()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:O()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:A()})})]})}export{pe as PromptInjectionsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,By as i,Cb as a,DM as o,E as s,Hy as c,Iy as l,Ly as u,OM as d,Qy as ee,Ry as te,Sb as f,Tb as p,Uy as m,Vy as h,Wy as g,Xy as _,Zy as v,_b as y,ab as b,bb as x,cb as S,db as ne,eb as re,fb as ie,gb as C,hb as w,ib as T,lb as E,mb as D,nb as O,ni as k,ob as A,pb as j,rb as M,sb as N,tb as P,ub as F,vb as I,wb as L,xb as R,yb as z,zy as ae}from"./dist-HBBi9Y25.js";import{t as B}from"./button-b04wLuGq.js";import{B as V,Rt as H,ct as U,lt as W,p as G,u as K,z as q}from"./index-DBQ43N4_.js";import{t as J}from"./roleDescriptions-onSlZ7A3.js";var Y=t(e(),1),X=n(),Z=[{group:()=>p(),keys:[{key:`traces.read`,label:()=>x()},{key:`traces.read.content`,label:()=>z(),phi:!0},{key:`traces.write`,label:()=>I()}]},{group:()=>L(),keys:[{key:`kpi.read`,label:()=>x()},{key:`kpi.write`,label:()=>I()}]},{group:()=>a(),keys:[{key:`openclaw.query`,label:()=>y()},{key:`anomalies.read`,label:()=>C()},{key:`anomalies.report`,label:()=>w()}]},{group:()=>f(),keys:[{key:`chats.read`,label:()=>x()},{key:`selfheal`,label:()=>j()},{key:`feedback.respond`,label:()=>k()}]},{group:()=>R(),keys:[{key:`admin.manage`,label:()=>D()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=d(s.apiKeys.listRoles,{}),t=o(s.apiKeys.createRole),n=o(s.apiKeys.ensureRolesSeeded),a=o(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))}),f=V(),p=q(),[y,x]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)($),[D,k]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{p.error(ne(),e)})},[n,p]);let j=e??[];async function I(e,t){if(Q(e.permissions)||D.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await f({title:F({name:e.name}),description:E(),confirmLabel:S()}))){k(t=>new Set(t).add(e._id));try{await a({roleId:e._id,permissions:n})}catch(e){p.error(N(),e)}finally{k(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function L(){try{await t({key:C.key,name:C.name,description:C.description||void 0,permissions:[]}),w($),x(!1)}catch(e){p.error(A(),e)}}let R=e===void 0,z=!R&&j.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[b(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,T(),` `,(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:O()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{w($),x(!0)},children:P()})})]}),R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(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:ee()}),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?ie({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:j.map(e=>{let t=Q(e.permissions),n=D.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,v()]}):(0,X.jsx)(U,{variant:`secondary`,children:_()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?g():n?m():r,onCheckedChange:()=>void I(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(K,{open:y,onOpenChange:x,title:c(),description:h(),canSubmit:!!(C.key&&C.name),onSubmit:L,submitLabel:i(),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:ae()}),(0,X.jsx)(W,{value:C.key,placeholder:te(),onChange:e=>w({...C,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:u()}),(0,X.jsx)(W,{value:C.name,onChange:e=>w({...C,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:l()}),(0,X.jsx)(W,{value:C.description,onChange:e=>w({...C,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{$y as r,By as i,Cb as a,DM as o,E as s,Hy as c,Iy as l,Ly as u,OM as d,Qy as ee,Ry as te,Sb as f,Tb as p,Uy as m,Vy as h,Wy as g,Xy as _,Zy as v,_b as y,ab as b,bb as x,cb as S,db as ne,eb as re,fb as ie,gb as C,hb as w,ib as T,lb as E,mb as D,nb as O,ni as k,ob as A,pb as j,rb as M,sb as N,tb as P,ub as F,vb as I,wb as L,xb as R,yb as z,zy as ae}from"./dist-HBBi9Y25.js";import{t as B}from"./button-b04wLuGq.js";import{B as V,Rt as H,ct as U,lt as W,p as G,u as K,z as q}from"./index-4Peu865E.js";import{t as J}from"./roleDescriptions-onSlZ7A3.js";var Y=t(e(),1),X=n(),Z=[{group:()=>p(),keys:[{key:`traces.read`,label:()=>x()},{key:`traces.read.content`,label:()=>z(),phi:!0},{key:`traces.write`,label:()=>I()}]},{group:()=>L(),keys:[{key:`kpi.read`,label:()=>x()},{key:`kpi.write`,label:()=>I()}]},{group:()=>a(),keys:[{key:`openclaw.query`,label:()=>y()},{key:`anomalies.read`,label:()=>C()},{key:`anomalies.report`,label:()=>w()}]},{group:()=>f(),keys:[{key:`chats.read`,label:()=>x()},{key:`selfheal`,label:()=>j()},{key:`feedback.respond`,label:()=>k()}]},{group:()=>R(),keys:[{key:`admin.manage`,label:()=>D()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=d(s.apiKeys.listRoles,{}),t=o(s.apiKeys.createRole),n=o(s.apiKeys.ensureRolesSeeded),a=o(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))}),f=V(),p=q(),[y,x]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)($),[D,k]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{p.error(ne(),e)})},[n,p]);let j=e??[];async function I(e,t){if(Q(e.permissions)||D.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await f({title:F({name:e.name}),description:E(),confirmLabel:S()}))){k(t=>new Set(t).add(e._id));try{await a({roleId:e._id,permissions:n})}catch(e){p.error(N(),e)}finally{k(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function L(){try{await t({key:C.key,name:C.name,description:C.description||void 0,permissions:[]}),w($),x(!1)}catch(e){p.error(A(),e)}}let R=e===void 0,z=!R&&j.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[b(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,T(),` `,(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:O()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{w($),x(!0)},children:P()})})]}),R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(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:ee()}),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?ie({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:j.map(e=>{let t=Q(e.permissions),n=D.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,v()]}):(0,X.jsx)(U,{variant:`secondary`,children:_()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?g():n?m():r,onCheckedChange:()=>void I(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(K,{open:y,onOpenChange:x,title:c(),description:h(),canSubmit:!!(C.key&&C.name),onSubmit:L,submitLabel:i(),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:ae()}),(0,X.jsx)(W,{value:C.key,placeholder:te(),onChange:e=>w({...C,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:u()}),(0,X.jsx)(W,{value:C.name,onChange:e=>w({...C,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:l()}),(0,X.jsx)(W,{value:C.description,onChange:e=>w({...C,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,$O as i,AO as ee,BD as a,BO as te,CO as ne,DM as o,DO as re,E as s,EO as ie,FO as ae,GD as c,GO as oe,HD as l,HO as se,IO as ce,JD as u,JO as le,KD as d,KO as ue,LO as de,MO as fe,NO as pe,OM as f,OO as me,PO as he,QD as p,QO as ge,RO as _e,SO as ve,TM as ye,TO as be,UD as m,UO as xe,VD as Se,VO as Ce,WD as we,WO as Te,XD as h,XO as Ee,YD as g,YO as De,ZD as _,ZO as Oe,_O as ke,aO as v,ak as Ae,bO as je,cO as y,dO as Me,eO as b,ek as x,fO as Ne,gO as Pe,hO as Fe,iO as S,ik as Ie,jO as Le,kO as Re,lO as ze,mO as Be,nO as C,nk as Ve,oO as w,pO as He,qD as T,qO as Ue,rO as E,rk as We,sO as D,tO as O,tk as Ge,uO as Ke,vO as qe,wO as Je,xO as Ye,yO as Xe,zD as k,zO as Ze}from"./dist-HBBi9Y25.js";import{n as A}from"./dist-6oi7FQ0i.js";import{i as Qe}from"./dist-DBet7oNc.js";import{t as j}from"./button-b04wLuGq.js";import{$ as M,B as $e,C as N,S as P,Wt as F,Xt as et,Yt as tt,b as I,ct as L,dt as R,et as z,ft as B,ht as V,lt as H,mt as U,pt as nt,qt as rt,u as it,ut as W,w as G,x as K,z as at}from"./index-DBQ43N4_.js";import{t as ot}from"./FilterBar-BVVVO1_O.js";import{t as st}from"./DataTableShell-KGrtOG5M.js";import{t as ct}from"./roleDescriptions-onSlZ7A3.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>c(),days:null},{value:`30`,label:()=>we(),days:30},{value:`90`,label:()=>m(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=et({from:`/settings/serviceAccounts`}),t=tt({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??Z,[a,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=f(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:r===Z?void 0:r===`disabled`}}),p=f(s.apiKeys.listKeys,{}),m=f(s.apiKeys.listRoles,{}),Se=o(s.apiKeys.createServiceAccount),we=o(s.apiKeys.updateServiceAccount),h=o(s.apiKeys.deleteServiceAccount),g=ye(s.apiKeys.mintApiKey),_=o(s.apiKeys.revokeApiKey),v=$e(),y=at(),b=n!==``||a!==Z||r!==Z;function S(){c(Z),t({search:{},replace:!0})}let[C,w]=(0,q.useState)(!1),[T,E]=(0,q.useState)(Q),[D,O]=(0,q.useState)(null),[k,A]=(0,q.useState)(new Set),[M,F]=(0,q.useState)(null),R=(0,q.useRef)(!1),[z,B]=(0,q.useState)(new Set),[V,U]=(0,q.useState)({}),[nt,W]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of p??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[p]);function $(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{D?(await we({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),y.success(ne())):await Se({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Q),O(null),w(!1)}catch(e){y.error(D?Je():be(),e)}}function ft(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),w(!0)}async function pt(e){if(R.current)return;R.current=!0;let t=V[e._id]??`never`,n=Y.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await g({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(ve(),e)}finally{R.current=!1,F(null)}}async function mt(e){if(await v({title:Ye(),description:(0,J.jsxs)(J.Fragment,{children:[je(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Xe(),` `,(0,J.jsx)(`strong`,{children:qe()}),` `,ke()]}),confirmWord:e.name,confirmLabel:Pe(),destructive:!0}))try{await h({serviceAccountId:e._id}),y.success(Fe(),e.name)}catch(e){y.error(Be(),e)}}async function ht(e){if(await v({title:He(),description:(0,J.jsxs)(J.Fragment,{children:[Ne(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Me()]}),confirmLabel:Ke(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){y.error(ze(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}),(0,J.jsxs)(ot,{q:n,onQChange:l,searchPlaceholder:Ie(),onReset:S,canReset:b,children:[(0,J.jsxs)(I,{value:a,onValueChange:c,children:[(0,J.jsx)(N,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:We()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:Ve()}),(m??[]).map(e=>(0,J.jsx)(P,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(I,{value:r,onValueChange:u,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:Ge()}),(0,J.jsx)(P,{value:`active`,children:x()}),(0,J.jsx)(P,{value:`disabled`,children:i()})]})]})]}),(0,J.jsx)(st,{title:ge(),rows:d,addLabel:Oe(),onAdd:()=>{E(Q),O(null),w(!0)},emptyHint:Ee(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:ue(),onSelect:()=>ft(e)},{label:De(),onSelect:()=>void pt(e)},{label:k.has(e._id)?le():Ue(),onSelect:()=>$(e._id)},{label:oe(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Te():xe(),onClick:()=>$(e._id),children:k.has(e._id)?(0,J.jsx)(Qe,{}):(0,J.jsx)(rt,{})})},{header:se(),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:Ce(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:te(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:i()}):(0,J.jsx)(L,{variant:`outline`,children:x()})},{header:Ze(),cell:e=>(0,J.jsxs)(I,{value:V[e._id]??`never`,onValueChange:t=>U(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(N,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:Y.map(e=>(0,J.jsx)(P,{value:e.value,children:e.label()},e.value))})]})},{header:_e(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?de():ce({count:t})})}}]}),(0,J.jsx)(it,{open:C,onOpenChange:e=>{w(e),e||O(null)},title:D?ae():fe(),description:D?he():Le(),canSubmit:!!(T.name&&T.roleKey),onSubmit:dt,submitLabel:D?pe():ee(),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:Re()}),(0,J.jsx)(H,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:me()}),(0,J.jsxs)(I,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,J.jsx)(N,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:re()})}),(0,J.jsx)(K,{children:(m??[]).map(e=>(0,J.jsxs)(P,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(m??[]).find(e=>e.key===T.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:ie()}),(0,J.jsx)(H,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:nt,onClose:()=>W(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:i}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[y(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:w()}),(0,J.jsx)(`th`,{children:v()}),(0,J.jsx)(`th`,{children:S()}),(0,J.jsx)(`th`,{children:E()}),(0,J.jsx)(`th`,{children:C()}),(0,J.jsx)(`th`,{children:O()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:z(t.createdAt)}),(0,J.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:pt(t.expiresAt)}),(0,J.jsx)(`td`,{children:mt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(j,{variant:`destructive`,size:`sm`,disabled:i.has(t._id),onClick:()=>n(t),children:i.has(t._id)?b():r()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(W,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(R,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(U,{children:[(0,J.jsx)(V,{children:p()}),(0,J.jsx)(B,{children:_({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:h()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":g(),children:[n?(0,J.jsx)(A,{}):(0,J.jsx)(F,{}),n?u():T()]})]}),(0,J.jsx)(nt,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:d()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?l():z(e)}function pt(e){return e===null?`—`:M(e)}function mt(e){return e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:Se()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(L,{variant:`outline`,children:a()}):(0,J.jsx)(L,{variant:`outline`,children:k()})}export{$ as ServiceAccountsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,$O as i,AO as ee,BD as a,BO as te,CO as ne,DM as o,DO as re,E as s,EO as ie,FO as ae,GD as c,GO as oe,HD as l,HO as se,IO as ce,JD as u,JO as le,KD as d,KO as ue,LO as de,MO as fe,NO as pe,OM as f,OO as me,PO as he,QD as p,QO as ge,RO as _e,SO as ve,TM as ye,TO as be,UD as m,UO as xe,VD as Se,VO as Ce,WD as we,WO as Te,XD as h,XO as Ee,YD as g,YO as De,ZD as _,ZO as Oe,_O as ke,aO as v,ak as Ae,bO as je,cO as y,dO as Me,eO as b,ek as x,fO as Ne,gO as Pe,hO as Fe,iO as S,ik as Ie,jO as Le,kO as Re,lO as ze,mO as Be,nO as C,nk as Ve,oO as w,pO as He,qD as T,qO as Ue,rO as E,rk as We,sO as D,tO as O,tk as Ge,uO as Ke,vO as qe,wO as Je,xO as Ye,yO as Xe,zD as k,zO as Ze}from"./dist-HBBi9Y25.js";import{n as A}from"./dist-6oi7FQ0i.js";import{i as Qe}from"./dist-DBet7oNc.js";import{t as j}from"./button-b04wLuGq.js";import{$ as M,B as $e,C as N,S as P,Wt as F,Xt as et,Yt as tt,b as I,ct as L,dt as R,et as z,ft as B,ht as V,lt as H,mt as U,pt as nt,qt as rt,u as it,ut as W,w as G,x as K,z as at}from"./index-4Peu865E.js";import{t as ot}from"./FilterBar-Csl1r1c5.js";import{t as st}from"./DataTableShell-DtJr2ebT.js";import{t as ct}from"./roleDescriptions-onSlZ7A3.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>c(),days:null},{value:`30`,label:()=>we(),days:30},{value:`90`,label:()=>m(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=et({from:`/settings/serviceAccounts`}),t=tt({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??Z,[a,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=f(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:r===Z?void 0:r===`disabled`}}),p=f(s.apiKeys.listKeys,{}),m=f(s.apiKeys.listRoles,{}),Se=o(s.apiKeys.createServiceAccount),we=o(s.apiKeys.updateServiceAccount),h=o(s.apiKeys.deleteServiceAccount),g=ye(s.apiKeys.mintApiKey),_=o(s.apiKeys.revokeApiKey),v=$e(),y=at(),b=n!==``||a!==Z||r!==Z;function S(){c(Z),t({search:{},replace:!0})}let[C,w]=(0,q.useState)(!1),[T,E]=(0,q.useState)(Q),[D,O]=(0,q.useState)(null),[k,A]=(0,q.useState)(new Set),[M,F]=(0,q.useState)(null),R=(0,q.useRef)(!1),[z,B]=(0,q.useState)(new Set),[V,U]=(0,q.useState)({}),[nt,W]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of p??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[p]);function $(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{D?(await we({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),y.success(ne())):await Se({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Q),O(null),w(!1)}catch(e){y.error(D?Je():be(),e)}}function ft(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),w(!0)}async function pt(e){if(R.current)return;R.current=!0;let t=V[e._id]??`never`,n=Y.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await g({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(ve(),e)}finally{R.current=!1,F(null)}}async function mt(e){if(await v({title:Ye(),description:(0,J.jsxs)(J.Fragment,{children:[je(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Xe(),` `,(0,J.jsx)(`strong`,{children:qe()}),` `,ke()]}),confirmWord:e.name,confirmLabel:Pe(),destructive:!0}))try{await h({serviceAccountId:e._id}),y.success(Fe(),e.name)}catch(e){y.error(Be(),e)}}async function ht(e){if(await v({title:He(),description:(0,J.jsxs)(J.Fragment,{children:[Ne(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Me()]}),confirmLabel:Ke(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){y.error(ze(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}),(0,J.jsxs)(ot,{q:n,onQChange:l,searchPlaceholder:Ie(),onReset:S,canReset:b,children:[(0,J.jsxs)(I,{value:a,onValueChange:c,children:[(0,J.jsx)(N,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:We()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:Ve()}),(m??[]).map(e=>(0,J.jsx)(P,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(I,{value:r,onValueChange:u,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:Ge()}),(0,J.jsx)(P,{value:`active`,children:x()}),(0,J.jsx)(P,{value:`disabled`,children:i()})]})]})]}),(0,J.jsx)(st,{title:ge(),rows:d,addLabel:Oe(),onAdd:()=>{E(Q),O(null),w(!0)},emptyHint:Ee(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:ue(),onSelect:()=>ft(e)},{label:De(),onSelect:()=>void pt(e)},{label:k.has(e._id)?le():Ue(),onSelect:()=>$(e._id)},{label:oe(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Te():xe(),onClick:()=>$(e._id),children:k.has(e._id)?(0,J.jsx)(Qe,{}):(0,J.jsx)(rt,{})})},{header:se(),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:Ce(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:te(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:i()}):(0,J.jsx)(L,{variant:`outline`,children:x()})},{header:Ze(),cell:e=>(0,J.jsxs)(I,{value:V[e._id]??`never`,onValueChange:t=>U(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(N,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:Y.map(e=>(0,J.jsx)(P,{value:e.value,children:e.label()},e.value))})]})},{header:_e(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?de():ce({count:t})})}}]}),(0,J.jsx)(it,{open:C,onOpenChange:e=>{w(e),e||O(null)},title:D?ae():fe(),description:D?he():Le(),canSubmit:!!(T.name&&T.roleKey),onSubmit:dt,submitLabel:D?pe():ee(),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:Re()}),(0,J.jsx)(H,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:me()}),(0,J.jsxs)(I,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,J.jsx)(N,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:re()})}),(0,J.jsx)(K,{children:(m??[]).map(e=>(0,J.jsxs)(P,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(m??[]).find(e=>e.key===T.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:ie()}),(0,J.jsx)(H,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:nt,onClose:()=>W(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:i}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[y(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:w()}),(0,J.jsx)(`th`,{children:v()}),(0,J.jsx)(`th`,{children:S()}),(0,J.jsx)(`th`,{children:E()}),(0,J.jsx)(`th`,{children:C()}),(0,J.jsx)(`th`,{children:O()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:z(t.createdAt)}),(0,J.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:pt(t.expiresAt)}),(0,J.jsx)(`td`,{children:mt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(j,{variant:`destructive`,size:`sm`,disabled:i.has(t._id),onClick:()=>n(t),children:i.has(t._id)?b():r()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(W,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(R,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(U,{children:[(0,J.jsx)(V,{children:p()}),(0,J.jsx)(B,{children:_({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:h()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":g(),children:[n?(0,J.jsx)(A,{}):(0,J.jsx)(F,{}),n?u():T()]})]}),(0,J.jsx)(nt,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:d()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?l():z(e)}function pt(e){return e===null?`—`:M(e)}function mt(e){return e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:Se()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(L,{variant:`outline`,children:a()}):(0,J.jsx)(L,{variant:`outline`,children:k()})}export{$ as ServiceAccountsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,Aa as i,Ba as a,Ca as o,DM as s,Da as c,E as l,Ea as u,Fa as d,Ga as f,Ha as p,Ia as m,Ja as h,Ka as g,La as _,Ma as v,Na as y,OM as b,Oa as x,Pa as S,Qa as C,Ra as w,Sa as T,Ta as E,Ua as D,Va as O,Wa as k,Xa as A,Ya as j,Za as M,ao as N,eo as P,io as F,ja as I,ka as ee,no as L,qa as R,ro as z,to as B,wa as V,xa as H,za as U}from"./dist-HBBi9Y25.js";import{t as W}from"./button-b04wLuGq.js";import{B as G,et as K}from"./index-DBQ43N4_.js";import{t as q}from"./DataTableShell-KGrtOG5M.js";var J=t(e(),1),Y=n(),X={hung:()=>p(),wrong_result:()=>O(),error:()=>a(),other:()=>U()},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=s(l.subAgentReports.respondToReport),[r,a]=(0,J.useState)(e.thread),[o,f]=(0,J.useState)(``),[p,h]=(0,J.useState)(!1);async function g(){let t=o.trim();if(!(!t||p)){h(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{h(!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),` · `,w({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:_()}),(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:m()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?d():S()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:y()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:v(),value:o,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 g(),disabled:!o.trim()||p,children:p?i():I()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[ee({count:t.children.length}),t.childrenTruncated?` ${x()}`:``,t.textTruncated?` ${c()}`:``]}),(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?` · ${u()}`:``]}),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:E()}),(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:V()}),(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=b(l.subAgentReports.listForAdmin,{}),t=s(l.subAgentReports.readReport),n=s(l.subAgentReports.deleteReport),i=G(),[a,c]=(0,J.useState)(null),[u,d]=(0,J.useState)({});async function p(e){if(a===e._id){c(null);return}if(!u[e._id]){let n=await t({reportId:e._id});d(t=>({...t,[e._id]:n}))}c(e._id)}async function m(e){await i({title:o(),description:T(),confirmLabel:H(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&c(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[z(),` `,(0,Y.jsx)(`strong`,{children:L()}),` `,B()]}),(0,Y.jsx)(q,{title:N(),rows:e,emptyHint:F(),isExpanded:e=>a===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Y.jsx)($,{data:u[e._id]}):null,columns:[{header:P(),cell:e=>K(e.at),sort:e=>e.at},{header:r(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:C(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:M(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${h({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:A(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:j(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:R()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:g()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?k():f(),onSelect:()=>void p(e)},{label:D(),onSelect:()=>void m(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,Aa as i,Ba as a,Ca as o,DM as s,Da as c,E as l,Ea as u,Fa as d,Ga as f,Ha as p,Ia as m,Ja as h,Ka as g,La as _,Ma as v,Na as y,OM as b,Oa as x,Pa as S,Qa as C,Ra as w,Sa as T,Ta as E,Ua as D,Va as O,Wa as k,Xa as A,Ya as j,Za as M,ao as N,eo as P,io as F,ja as I,ka as ee,no as L,qa as R,ro as z,to as B,wa as V,xa as H,za as U}from"./dist-HBBi9Y25.js";import{t as W}from"./button-b04wLuGq.js";import{B as G,et as K}from"./index-4Peu865E.js";import{t as q}from"./DataTableShell-DtJr2ebT.js";var J=t(e(),1),Y=n(),X={hung:()=>p(),wrong_result:()=>O(),error:()=>a(),other:()=>U()},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=s(l.subAgentReports.respondToReport),[r,a]=(0,J.useState)(e.thread),[o,f]=(0,J.useState)(``),[p,h]=(0,J.useState)(!1);async function g(){let t=o.trim();if(!(!t||p)){h(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{h(!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),` · `,w({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:_()}),(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:m()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?d():S()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:y()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:v(),value:o,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 g(),disabled:!o.trim()||p,children:p?i():I()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[ee({count:t.children.length}),t.childrenTruncated?` ${x()}`:``,t.textTruncated?` ${c()}`:``]}),(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?` · ${u()}`:``]}),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:E()}),(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:V()}),(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=b(l.subAgentReports.listForAdmin,{}),t=s(l.subAgentReports.readReport),n=s(l.subAgentReports.deleteReport),i=G(),[a,c]=(0,J.useState)(null),[u,d]=(0,J.useState)({});async function p(e){if(a===e._id){c(null);return}if(!u[e._id]){let n=await t({reportId:e._id});d(t=>({...t,[e._id]:n}))}c(e._id)}async function m(e){await i({title:o(),description:T(),confirmLabel:H(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&c(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[z(),` `,(0,Y.jsx)(`strong`,{children:L()}),` `,B()]}),(0,Y.jsx)(q,{title:N(),rows:e,emptyHint:F(),isExpanded:e=>a===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Y.jsx)($,{data:u[e._id]}):null,columns:[{header:P(),cell:e=>K(e.at),sort:e=>e.at},{header:r(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:C(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:M(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${h({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:A(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:j(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:R()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:g()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?k():f(),onSelect:()=>void p(e)},{label:D(),onSelect:()=>void m(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{$A as r,$k as i,AA as a,BA as o,CA as s,D as c,DA as l,DM as u,E as d,EA as f,FA as p,GA as m,HA as h,IA as g,JA as _,Jk as v,KA as y,LA as b,MA as x,NA as S,OA as ee,OM as C,PA as te,QA as ne,Qk as w,RA as re,SA as ie,TA as ae,TM as oe,UA as se,VA as ce,WA as le,XA as ue,Xk as de,YA as fe,Yk as pe,ZA as me,Zk as he,_A as ge,_M as _e,_a as ve,aA as ye,aj as be,bA as xe,ba as T,cA as Se,cj as Ce,dA as we,dj as Te,eA as Ee,ej as De,fA as Oe,fj as ke,gA as Ae,gM as je,gj as Me,hA as Ne,hM as Pe,hj as Fe,iA as Ie,ij as Le,jA as Re,kA as ze,lA as Be,lj as Ve,mA as E,mj as He,n as Ue,nA as We,nj as Ge,oA as Ke,oj as qe,pA as Je,pj as Ye,qA as Xe,rA as Ze,rj as Qe,sA as $e,sj as et,tA as tt,tj as nt,uA as rt,uj as it,vA as at,va as ot,wA as st,xA as ct,yA as lt,ya as D,zA as ut}from"./dist-HBBi9Y25.js";import{n as O}from"./dist-6oi7FQ0i.js";import{t as k}from"./x-DBKGK4o_.js";import{t as A}from"./button-b04wLuGq.js";import{C as j,Ht as M,S as N,Ut as dt,_t as ft,at as pt,b as P,ct as F,gt as mt,it as I,lt as L,nt as ht,ot as R,p as z,rt as gt,st as _t,w as B,x as V,xt as H}from"./index-DBQ43N4_.js";import{t as vt}from"./localePickerView-C2RmOS86.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-DdBF2ct9.js";import{a as Tt,i as U,n as Et,o as W,r as G,t as Dt}from"./table-CtNwimV_.js";import{t as Ot}from"./TimeRangePicker-NSOkx3C0.js";import{t as kt}from"./FilterBar-BVVVO1_O.js";import{t as At}from"./AdvancedFilter-BQlL-4N9.js";var K=c(`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`}]]),q=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(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 Ft(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 J(e,t,n){return Ft(e,t,n)>=jt}function It(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 Lt(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 Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ge());if(e.size>Rt)throw Error(Ae());let{source:n,width:r,height:i,cleanup:a}=await Ut(e);try{let a=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(E());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Pt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(E());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);J(e.data,d.width,d.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),p.putImageData(e,0,0)}let m=J(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await X(f,`image/webp`,Vt)??await X(f,`image/png`);if(!h)throw Error(Je());return{blob:h,hasAlpha:m}}finally{a()}}async function Ut(e){if(e.type===`image/svg+xml`)return Y(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 Y(e)}async function Y(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(Ne())),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 X(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Z=n();function Wt(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 Q=`__all__`,Gt={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,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?_e():e===`dark`?je():Pe()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,Z.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,Z.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,Z.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:Ue(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Z.jsx)(O,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Z.jsx)(Yt,{tokens:r,mode:i}):(0,Z.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Z.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Z.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":T(),title:T(),children:(0,Z.jsx)(dt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=C(d.charts.listMyCharts),r=u(d.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Ce()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:et()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Z.jsx)(Xt,{selected:e===null,title:qe(),subtitle:be(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?Le():n.via===`owner`?Qe():Ge({group:n.via.group});return(0,Z.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Wt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:nt()}):null]})}function Qt(){let e=u(d.charts.importChart),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[a,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1),[f,m]=(0,q.useState)(!1);async function h(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(S())}}}async function _(){if(s(null),l(!1),t.trim()===``){s(Re());return}let a;try{a=JSON.parse(r)}catch{s(S());return}m(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{m(!1)}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:ce()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:ut()}),(0,Z.jsx)(L,{value:t,onChange:e=>n(e.target.value),placeholder:re(),maxLength:60})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:b()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:g(),rows:8,spellCheck:!1})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(K,{className:`size-4`}),p(),(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void h(e)})]})}),(0,Z.jsx)(A,{size:`sm`,disabled:f,onClick:()=>void _(),children:te()})]}),a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,c?(0,Z.jsx)(`p`,{className:`oc-chart-import__ok`,children:x()}):null]})]})}function $t({chart:e}){let t=oe(d.charts.setChartLogo),n=u(d.charts.removeChartLogo),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ht(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 f(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function p(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 m(e){let t=c(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function h({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?st():s()}),(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Z.jsx)(`img`,{src:t,alt:``}):null}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(K,{className:`size-4`}),t?ct():ie(),(0,Z.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void f(e,t)})]})}),!t&&n?(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void m(e),children:lt()}):null,t?(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void p(e),children:xe()}):null]})}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ae()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Z.jsx)(h,{mode:`light`}),(0,Z.jsx)(h,{mode:`dark`})]}),r?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:at()}):null,a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=C(d.me.getMe,{host:H}),n=u(d.charts.addChartDomain),r=u(d.charts.removeChartDomain),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1);if(t?.role!==`admin`)return null;let f=e.domains??[];async function p(){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 m(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Oe()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__groups`,children:f.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Se()}):f.map(e=>(0,Z.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":$e({domain:e}),onClick:()=>void m(e),children:(0,Z.jsx)(k,{className:`size-3`})})]},e))}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(L,{value:i,onChange:e=>a(e.target.value),placeholder:rt(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void p(),children:Be()})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:we()}),o?(0,Z.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=u(d.charts.updateChart),n=u(d.charts.deleteChart),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.name),[s,c]=(0,q.useState)(()=>tn(e.tokens)),[p,m]=(0,q.useState)(e.tokens.bpm??0),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(!1);function y(){o(e.name),c(tn(e.tokens)),m(e.tokens.bpm??0),g(null),i(!0)}async function b(){if(e.chartId===void 0)return;g(null);let n;try{n=JSON.parse(s)}catch{g(S());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:a.trim(),tokens:n}),i(!1)}catch(e){g(e instanceof Error?e.message:String(e))}finally{v(!1)}}async function x(){if(e.chartId!==void 0&&window.confirm(We()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(A,{variant:`outline`,size:`sm`,onClick:y,children:l()}),(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void x(),children:f()})]})})]}),r?(0,Z.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ie()}),(0,Z.jsx)(L,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:D()}),(0,Z.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Z.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":D()}),(0,Z.jsx)(`span`,{className:`oc-chart-bpm__value`,children:p===0?ot():`${p} BPM`})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:ve()})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ze()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),h?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:h}):null,(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{size:`sm`,disabled:_,onClick:()=>void b(),children:Ke()}),(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:ye()})]})]}):null,(0,Z.jsx)($t,{chart:e}),(0,Z.jsx)(en,{chart:e})]})}function rn(){let e=C(d.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:a()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ze()})]}),e!==void 0&&t.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ee()}):(0,Z.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Z.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=u(d.charts.addChartToGroupPool),r=u(d.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(F,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Xe():e.kind===`custom`&&e.scope===`personal`?w():_()}),e.isGlobalDefault?(0,Z.jsx)(F,{variant:`default`,children:y()}):null]}),(0,Z.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:le()}),(a??[]).map(e=>(0,Z.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":h({group:e.name}),onClick:()=>void l(e.groupId),children:(0,Z.jsx)(k,{className:`size-3`})})]},e.groupId)),s.length>0?(0,Z.jsxs)(P,{value:``,onValueChange:e=>void c(e),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(B,{placeholder:se()})}),(0,Z.jsx)(V,{children:s.map(e=>(0,Z.jsx)(N,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:m()}):null]})]})}function on({chart:e}){let t=u(d.charts.promoteChartToCommon),n=u(d.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function a(){if(e.chartId!==void 0&&window.confirm(We()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(F,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?he():w()}),e.ownerLabel?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:i({owner:e.ownerLabel})}):null]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Z.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:de()}):null,(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void a(),children:pe()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let i=u(d.admin.setDefaultThemeMode),a=u(d.admin.setDefaultLocale),o=u(d.charts.setDefaultChart),s=C(d.charts.listChartsAdmin),c=C(d.groups.listGroups,{}),l=e??`system`,f=t??`fr`;return(0,Z.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:it()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ve()})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:De()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:r()})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:qe()}),ft.map(e=>(0,Z.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Z.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:ne()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Z.jsx)(an,{chart:e,groups:c??[]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:ue()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Z.jsx)(en,{chart:e})]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:tt()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:v()}):(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Z.jsx)(on,{chart:e},e.key))})})()]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:Me()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Fe()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Z.jsx)(A,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void i({mode:e}),children:qt(e)},e))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:He()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ye()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:vt().map(e=>(0,Z.jsx)(A,{variant:f===e.value?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e.value}),children:e.label},e.value))}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ke()})]})]})}function cn(){let e=C(d.me.getMe,{host:H}),t=mt(e?.resolvedThemeMode);return(0,Z.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Z.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Z.jsx)(Qt,{}),(0,Z.jsx)(rn,{}),e?.role===`admin`?(0,Z.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,q.useState)(!0),[n,r]=(0,q.useState)(`per-user`),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(Q),[c,l]=(0,q.useState)(Q),[u,d]=(0,q.useState)(Gt),f=i!==``||o!==Q||c!==Q;function p(){a(``),s(Q),l(Q),d(Gt)}return(0,Z.jsxs)(`div`,{className:`oc-show`,children:[(0,Z.jsx)(cn,{}),(0,Z.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Z.jsx)(`summary`,{className:`oc-show__title`,children:Te()}),(0,Z.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{children:`Default`}),(0,Z.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(A,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(A,{variant:`ghost`,children:`Ghost`}),(0,Z.jsx)(A,{variant:`destructive`,children:`Destructive`}),(0,Z.jsx)(A,{variant:`link`,children:`Link`})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{size:`sm`,children:`Small`}),(0,Z.jsx)(A,{children:`Default`}),(0,Z.jsx)(A,{size:`lg`,children:`Large`}),(0,Z.jsx)(A,{size:`icon`,"aria-label":`more`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(A,{disabled:!0,children:`Disabled`})]})]}),(0,Z.jsx)($,{title:`Badges`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(F,{children:`Default`}),(0,Z.jsx)(F,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(F,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(F,{variant:`destructive`,children:`Destructive`})]})}),(0,Z.jsx)($,{title:`Inputs & selection`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(L,{placeholder:`Text input…`}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsxs)(P,{value:n,onValueChange:r,children:[(0,Z.jsx)(j,{className:`w-56`,children:(0,Z.jsx)(B,{placeholder:`Select…`})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(N,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Z.jsx)(N,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Z.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Z.jsx)(z,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Z.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,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsxs)(kt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Z.jsxs)(P,{value:o,onValueChange:s,children:[(0,Z.jsx)(j,{size:`sm`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(N,{value:Q,children:`Toutes directions`}),(0,Z.jsx)(N,{value:`inbound`,children:`inbound`}),(0,Z.jsx)(N,{value:`outbound`,children:`outbound`}),(0,Z.jsx)(N,{value:`internal`,children:`internal`})]})]}),(0,Z.jsxs)(P,{value:c,onValueChange:l,children:[(0,Z.jsx)(j,{size:`sm`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(N,{value:Q,children:`Toutes sévérités`}),(0,Z.jsx)(N,{value:`info`,children:`info`}),(0,Z.jsx)(N,{value:`warn`,children:`warn`}),(0,Z.jsx)(N,{value:`critical`,children:`critical`})]})]})]}),(0,Z.jsx)(At,{fields:Kt,onChange:()=>{}}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Z.jsx)(Ot,{value:u,onChange:d})]})]})}),(0,Z.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Z.jsxs)(ht,{children:[(0,Z.jsx)(_t,{asChild:!0,children:(0,Z.jsx)(A,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Z.jsx)(M,{})})}),(0,Z.jsxs)(gt,{align:`start`,children:[(0,Z.jsx)(pt,{children:`Actions`}),(0,Z.jsx)(R,{}),(0,Z.jsx)(I,{children:`Edit`}),(0,Z.jsx)(I,{children:`Duplicate`}),(0,Z.jsx)(R,{}),(0,Z.jsx)(I,{variant:`destructive`,children:`Delete`})]})]})}),(0,Z.jsx)($,{title:`Card`,children:(0,Z.jsxs)(wt,{className:`w-80`,children:[(0,Z.jsxs)(yt,{children:[(0,Z.jsx)(St,{children:`Instance`}),(0,Z.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,Z.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Z.jsxs)(bt,{className:`gap-2`,children:[(0,Z.jsx)(A,{size:`sm`,children:`Save`}),(0,Z.jsx)(A,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Z.jsx)($,{title:`Table`,children:(0,Z.jsxs)(Dt,{children:[(0,Z.jsx)(Tt,{children:(0,Z.jsxs)(W,{children:[(0,Z.jsx)(U,{className:`w-8`,children:(0,Z.jsx)(z,{"aria-label":`select all`})}),(0,Z.jsx)(U,{children:`Name`}),(0,Z.jsx)(U,{children:`Mode`}),(0,Z.jsx)(U,{className:`text-right`,children:`Status`}),(0,Z.jsx)(U,{className:`w-8`})]})}),(0,Z.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Z.jsxs)(W,{children:[(0,Z.jsx)(G,{children:(0,Z.jsx)(z,{"aria-label":`select ${e.n}`})}),(0,Z.jsx)(G,{className:`font-medium`,children:e.n}),(0,Z.jsx)(G,{children:(0,Z.jsx)(F,{variant:`secondary`,children:e.m})}),(0,Z.jsx)(G,{className:`text-right`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Z.jsx)(O,{className:`size-3.5`}),` `,e.s]})}),(0,Z.jsx)(G,{children:(0,Z.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Z.jsx)(M,{})})})]},e.n))})]})}),(0,Z.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Z.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Z.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Z.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Z.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Z.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Z.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Z.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Z.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Z.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{$A as r,$k as i,AA as a,BA as o,CA as s,D as c,DA as l,DM as u,E as d,EA as f,FA as p,GA as m,HA as h,IA as g,JA as _,Jk as v,KA as y,LA as b,MA as x,NA as S,OA as ee,OM as C,PA as te,QA as ne,Qk as w,RA as re,SA as ie,TA as ae,TM as oe,UA as se,VA as ce,WA as le,XA as ue,Xk as de,YA as fe,Yk as pe,ZA as me,Zk as he,_A as ge,_M as _e,_a as ve,aA as ye,aj as be,bA as xe,ba as T,cA as Se,cj as Ce,dA as we,dj as Te,eA as Ee,ej as De,fA as Oe,fj as ke,gA as Ae,gM as je,gj as Me,hA as Ne,hM as Pe,hj as Fe,iA as Ie,ij as Le,jA as Re,kA as ze,lA as Be,lj as Ve,mA as E,mj as He,n as Ue,nA as We,nj as Ge,oA as Ke,oj as qe,pA as Je,pj as Ye,qA as Xe,rA as Ze,rj as Qe,sA as $e,sj as et,tA as tt,tj as nt,uA as rt,uj as it,vA as at,va as ot,wA as st,xA as ct,yA as lt,ya as D,zA as ut}from"./dist-HBBi9Y25.js";import{n as O}from"./dist-6oi7FQ0i.js";import{t as k}from"./x-DBKGK4o_.js";import{t as A}from"./button-b04wLuGq.js";import{C as j,Ht as M,S as N,Ut as dt,_t as ft,at as pt,b as P,ct as F,gt as mt,it as I,lt as L,nt as ht,ot as R,p as z,rt as gt,st as _t,w as B,x as V,xt as H}from"./index-4Peu865E.js";import{t as vt}from"./localePickerView-C2RmOS86.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-DdBF2ct9.js";import{a as Tt,i as U,n as Et,o as W,r as G,t as Dt}from"./table-CtNwimV_.js";import{t as Ot}from"./TimeRangePicker-BeZLlC4Y.js";import{t as kt}from"./FilterBar-Csl1r1c5.js";import{t as At}from"./AdvancedFilter-CKwZSjrh.js";var K=c(`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`}]]),q=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(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 Ft(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 J(e,t,n){return Ft(e,t,n)>=jt}function It(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 Lt(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 Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ge());if(e.size>Rt)throw Error(Ae());let{source:n,width:r,height:i,cleanup:a}=await Ut(e);try{let a=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(E());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Pt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(E());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);J(e.data,d.width,d.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),p.putImageData(e,0,0)}let m=J(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await X(f,`image/webp`,Vt)??await X(f,`image/png`);if(!h)throw Error(Je());return{blob:h,hasAlpha:m}}finally{a()}}async function Ut(e){if(e.type===`image/svg+xml`)return Y(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 Y(e)}async function Y(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(Ne())),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 X(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Z=n();function Wt(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 Q=`__all__`,Gt={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,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?_e():e===`dark`?je():Pe()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,Z.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,Z.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,Z.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:Ue(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Z.jsx)(O,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Z.jsx)(Yt,{tokens:r,mode:i}):(0,Z.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Z.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Z.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":T(),title:T(),children:(0,Z.jsx)(dt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=C(d.charts.listMyCharts),r=u(d.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Ce()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:et()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Z.jsx)(Xt,{selected:e===null,title:qe(),subtitle:be(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?Le():n.via===`owner`?Qe():Ge({group:n.via.group});return(0,Z.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Wt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:nt()}):null]})}function Qt(){let e=u(d.charts.importChart),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[a,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1),[f,m]=(0,q.useState)(!1);async function h(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(S())}}}async function _(){if(s(null),l(!1),t.trim()===``){s(Re());return}let a;try{a=JSON.parse(r)}catch{s(S());return}m(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{m(!1)}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:ce()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:ut()}),(0,Z.jsx)(L,{value:t,onChange:e=>n(e.target.value),placeholder:re(),maxLength:60})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:b()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:g(),rows:8,spellCheck:!1})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(K,{className:`size-4`}),p(),(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void h(e)})]})}),(0,Z.jsx)(A,{size:`sm`,disabled:f,onClick:()=>void _(),children:te()})]}),a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,c?(0,Z.jsx)(`p`,{className:`oc-chart-import__ok`,children:x()}):null]})]})}function $t({chart:e}){let t=oe(d.charts.setChartLogo),n=u(d.charts.removeChartLogo),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ht(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 f(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function p(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 m(e){let t=c(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function h({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?st():s()}),(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Z.jsx)(`img`,{src:t,alt:``}):null}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(K,{className:`size-4`}),t?ct():ie(),(0,Z.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void f(e,t)})]})}),!t&&n?(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void m(e),children:lt()}):null,t?(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void p(e),children:xe()}):null]})}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ae()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Z.jsx)(h,{mode:`light`}),(0,Z.jsx)(h,{mode:`dark`})]}),r?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:at()}):null,a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=C(d.me.getMe,{host:H}),n=u(d.charts.addChartDomain),r=u(d.charts.removeChartDomain),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1);if(t?.role!==`admin`)return null;let f=e.domains??[];async function p(){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 m(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Oe()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__groups`,children:f.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Se()}):f.map(e=>(0,Z.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":$e({domain:e}),onClick:()=>void m(e),children:(0,Z.jsx)(k,{className:`size-3`})})]},e))}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(L,{value:i,onChange:e=>a(e.target.value),placeholder:rt(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,Z.jsx)(A,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void p(),children:Be()})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:we()}),o?(0,Z.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=u(d.charts.updateChart),n=u(d.charts.deleteChart),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.name),[s,c]=(0,q.useState)(()=>tn(e.tokens)),[p,m]=(0,q.useState)(e.tokens.bpm??0),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(!1);function y(){o(e.name),c(tn(e.tokens)),m(e.tokens.bpm??0),g(null),i(!0)}async function b(){if(e.chartId===void 0)return;g(null);let n;try{n=JSON.parse(s)}catch{g(S());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:a.trim(),tokens:n}),i(!1)}catch(e){g(e instanceof Error?e.message:String(e))}finally{v(!1)}}async function x(){if(e.chartId!==void 0&&window.confirm(We()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(A,{variant:`outline`,size:`sm`,onClick:y,children:l()}),(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void x(),children:f()})]})})]}),r?(0,Z.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ie()}),(0,Z.jsx)(L,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:D()}),(0,Z.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Z.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":D()}),(0,Z.jsx)(`span`,{className:`oc-chart-bpm__value`,children:p===0?ot():`${p} BPM`})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:ve()})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ze()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),h?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:h}):null,(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{size:`sm`,disabled:_,onClick:()=>void b(),children:Ke()}),(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:ye()})]})]}):null,(0,Z.jsx)($t,{chart:e}),(0,Z.jsx)(en,{chart:e})]})}function rn(){let e=C(d.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:a()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ze()})]}),e!==void 0&&t.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ee()}):(0,Z.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Z.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=u(d.charts.addChartToGroupPool),r=u(d.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(F,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Xe():e.kind===`custom`&&e.scope===`personal`?w():_()}),e.isGlobalDefault?(0,Z.jsx)(F,{variant:`default`,children:y()}):null]}),(0,Z.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:le()}),(a??[]).map(e=>(0,Z.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":h({group:e.name}),onClick:()=>void l(e.groupId),children:(0,Z.jsx)(k,{className:`size-3`})})]},e.groupId)),s.length>0?(0,Z.jsxs)(P,{value:``,onValueChange:e=>void c(e),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(B,{placeholder:se()})}),(0,Z.jsx)(V,{children:s.map(e=>(0,Z.jsx)(N,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:m()}):null]})]})}function on({chart:e}){let t=u(d.charts.promoteChartToCommon),n=u(d.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function a(){if(e.chartId!==void 0&&window.confirm(We()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(F,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?he():w()}),e.ownerLabel?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:i({owner:e.ownerLabel})}):null]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Z.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:de()}):null,(0,Z.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void a(),children:pe()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let i=u(d.admin.setDefaultThemeMode),a=u(d.admin.setDefaultLocale),o=u(d.charts.setDefaultChart),s=C(d.charts.listChartsAdmin),c=C(d.groups.listGroups,{}),l=e??`system`,f=t??`fr`;return(0,Z.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:it()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ve()})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:De()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:r()})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:qe()}),ft.map(e=>(0,Z.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Z.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:ne()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Z.jsx)(an,{chart:e,groups:c??[]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:ue()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Z.jsx)(en,{chart:e})]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:tt()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:v()}):(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Z.jsx)(on,{chart:e},e.key))})})()]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:Me()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Fe()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Z.jsx)(A,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void i({mode:e}),children:qt(e)},e))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:He()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ye()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:vt().map(e=>(0,Z.jsx)(A,{variant:f===e.value?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e.value}),children:e.label},e.value))}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ke()})]})]})}function cn(){let e=C(d.me.getMe,{host:H}),t=mt(e?.resolvedThemeMode);return(0,Z.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Z.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Z.jsx)(Qt,{}),(0,Z.jsx)(rn,{}),e?.role===`admin`?(0,Z.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,q.useState)(!0),[n,r]=(0,q.useState)(`per-user`),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(Q),[c,l]=(0,q.useState)(Q),[u,d]=(0,q.useState)(Gt),f=i!==``||o!==Q||c!==Q;function p(){a(``),s(Q),l(Q),d(Gt)}return(0,Z.jsxs)(`div`,{className:`oc-show`,children:[(0,Z.jsx)(cn,{}),(0,Z.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Z.jsx)(`summary`,{className:`oc-show__title`,children:Te()}),(0,Z.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{children:`Default`}),(0,Z.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(A,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(A,{variant:`ghost`,children:`Ghost`}),(0,Z.jsx)(A,{variant:`destructive`,children:`Destructive`}),(0,Z.jsx)(A,{variant:`link`,children:`Link`})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(A,{size:`sm`,children:`Small`}),(0,Z.jsx)(A,{children:`Default`}),(0,Z.jsx)(A,{size:`lg`,children:`Large`}),(0,Z.jsx)(A,{size:`icon`,"aria-label":`more`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(A,{disabled:!0,children:`Disabled`})]})]}),(0,Z.jsx)($,{title:`Badges`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(F,{children:`Default`}),(0,Z.jsx)(F,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(F,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(F,{variant:`destructive`,children:`Destructive`})]})}),(0,Z.jsx)($,{title:`Inputs & selection`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(L,{placeholder:`Text input…`}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsxs)(P,{value:n,onValueChange:r,children:[(0,Z.jsx)(j,{className:`w-56`,children:(0,Z.jsx)(B,{placeholder:`Select…`})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(N,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Z.jsx)(N,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Z.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Z.jsx)(z,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Z.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,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsxs)(kt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Z.jsxs)(P,{value:o,onValueChange:s,children:[(0,Z.jsx)(j,{size:`sm`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(N,{value:Q,children:`Toutes directions`}),(0,Z.jsx)(N,{value:`inbound`,children:`inbound`}),(0,Z.jsx)(N,{value:`outbound`,children:`outbound`}),(0,Z.jsx)(N,{value:`internal`,children:`internal`})]})]}),(0,Z.jsxs)(P,{value:c,onValueChange:l,children:[(0,Z.jsx)(j,{size:`sm`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(N,{value:Q,children:`Toutes sévérités`}),(0,Z.jsx)(N,{value:`info`,children:`info`}),(0,Z.jsx)(N,{value:`warn`,children:`warn`}),(0,Z.jsx)(N,{value:`critical`,children:`critical`})]})]})]}),(0,Z.jsx)(At,{fields:Kt,onChange:()=>{}}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Z.jsx)(Ot,{value:u,onChange:d})]})]})}),(0,Z.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Z.jsxs)(ht,{children:[(0,Z.jsx)(_t,{asChild:!0,children:(0,Z.jsx)(A,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Z.jsx)(M,{})})}),(0,Z.jsxs)(gt,{align:`start`,children:[(0,Z.jsx)(pt,{children:`Actions`}),(0,Z.jsx)(R,{}),(0,Z.jsx)(I,{children:`Edit`}),(0,Z.jsx)(I,{children:`Duplicate`}),(0,Z.jsx)(R,{}),(0,Z.jsx)(I,{variant:`destructive`,children:`Delete`})]})]})}),(0,Z.jsx)($,{title:`Card`,children:(0,Z.jsxs)(wt,{className:`w-80`,children:[(0,Z.jsxs)(yt,{children:[(0,Z.jsx)(St,{children:`Instance`}),(0,Z.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,Z.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Z.jsxs)(bt,{className:`gap-2`,children:[(0,Z.jsx)(A,{size:`sm`,children:`Save`}),(0,Z.jsx)(A,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Z.jsx)($,{title:`Table`,children:(0,Z.jsxs)(Dt,{children:[(0,Z.jsx)(Tt,{children:(0,Z.jsxs)(W,{children:[(0,Z.jsx)(U,{className:`w-8`,children:(0,Z.jsx)(z,{"aria-label":`select all`})}),(0,Z.jsx)(U,{children:`Name`}),(0,Z.jsx)(U,{children:`Mode`}),(0,Z.jsx)(U,{className:`text-right`,children:`Status`}),(0,Z.jsx)(U,{className:`w-8`})]})}),(0,Z.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Z.jsxs)(W,{children:[(0,Z.jsx)(G,{children:(0,Z.jsx)(z,{"aria-label":`select ${e.n}`})}),(0,Z.jsx)(G,{className:`font-medium`,children:e.n}),(0,Z.jsx)(G,{children:(0,Z.jsx)(F,{variant:`secondary`,children:e.m})}),(0,Z.jsx)(G,{className:`text-right`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Z.jsx)(O,{className:`size-3.5`}),` `,e.s]})}),(0,Z.jsx)(G,{children:(0,Z.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Z.jsx)(M,{})})})]},e.n))})]})}),(0,Z.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Z.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Z.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Z.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Z.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Z.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Z.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Z.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Z.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Z.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{$m as r,Qm as i,_r as a,ah as o,ch as s,eh as c,gr as l,hr as u,ih as d,lh as f,mr as p,nh as m,oh as h,pr as g,rh as _,sh as v,th as y,uh as b,vr as x,yr as S}from"./dist-HBBi9Y25.js";import{t as C}from"./button-b04wLuGq.js";import{Ct as w,Gt as T,Pt as E,St as D,Tt as O,et as k,lt as A,wt as j}from"./index-DBQ43N4_.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:b(),from:`now-5m`},{label:f(),from:`now-15m`},{label:s(),from:`now-30m`},{label:v(),from:`now-1h`},{label:h(),from:`now-3h`},{label:o(),from:`now-6h`},{label:d(),from:`now-12h`},{label:_(),from:`now-24h`},{label:m(),from:`now-2d`},{label:y(),from:`now-7d`},{label:c(),from:`now-30d`},{label:r(),from:`now-90d`},{label:i(),from:`now-520w`}];function L(e){return k(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,r]=(0,M.useState)(!1),[i,o]=(0,M.useState)(``),s=F(e),[c,d]=(0,M.useState)(()=>z(s.from)),[f,m]=(0,M.useState)(()=>z(s.to));function h(t){if(t){let t=F(e);d(z(t.from)),m(z(t.to)),o(``)}r(t)}function _(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function v(){let e=B(c),n=B(f);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let y=(0,M.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),b=B(c)!==null&&B(f)!==null;return(0,H.jsxs)(j,{open:n,onOpenChange:h,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(T,{}),R(e)]})}),(0,H.jsx)(w,{children:(0,H.jsx)(D,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:S()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,H.jsx)(A,{type:`datetime-local`,value:c,onChange:e=>d(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,H.jsx)(A,{type:`datetime-local`,value:f,onChange:e=>m(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!b,onClick:v,children:l()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(E,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(A,{value:i,onChange:e=>o(e.target.value),placeholder:u(),"aria-label":p()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:y.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:g()}):y.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:()=>_(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{$m as r,Qm as i,_r as a,ah as o,ch as s,eh as c,gr as l,hr as u,ih as d,lh as f,mr as p,nh as m,oh as h,pr as g,rh as _,sh as v,th as y,uh as b,vr as x,yr as S}from"./dist-HBBi9Y25.js";import{t as C}from"./button-b04wLuGq.js";import{Ct as w,Gt as T,Pt as E,St as D,Tt as O,et as k,lt as A,wt as j}from"./index-4Peu865E.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:b(),from:`now-5m`},{label:f(),from:`now-15m`},{label:s(),from:`now-30m`},{label:v(),from:`now-1h`},{label:h(),from:`now-3h`},{label:o(),from:`now-6h`},{label:d(),from:`now-12h`},{label:_(),from:`now-24h`},{label:m(),from:`now-2d`},{label:y(),from:`now-7d`},{label:c(),from:`now-30d`},{label:r(),from:`now-90d`},{label:i(),from:`now-520w`}];function L(e){return k(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,r]=(0,M.useState)(!1),[i,o]=(0,M.useState)(``),s=F(e),[c,d]=(0,M.useState)(()=>z(s.from)),[f,m]=(0,M.useState)(()=>z(s.to));function h(t){if(t){let t=F(e);d(z(t.from)),m(z(t.to)),o(``)}r(t)}function _(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function v(){let e=B(c),n=B(f);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let y=(0,M.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),b=B(c)!==null&&B(f)!==null;return(0,H.jsxs)(j,{open:n,onOpenChange:h,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(T,{}),R(e)]})}),(0,H.jsx)(w,{children:(0,H.jsx)(D,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:S()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,H.jsx)(A,{type:`datetime-local`,value:c,onChange:e=>d(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,H.jsx)(A,{type:`datetime-local`,value:f,onChange:e=>m(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!b,onClick:v,children:l()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(E,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(A,{value:i,onChange:e=>o(e.target.value),placeholder:u(),"aria-label":p()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:y.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:g()}):y.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:()=>_(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{$_ as r,B_ as i,Bw as a,CT as o,D as s,DM as c,E as l,F_ as u,Fw as d,G_ as f,Gw as p,H_ as m,Hw as h,I_ as g,Iw as _,J_ as ee,Jw as v,K_ as y,Kw as b,L_ as te,Lw as ne,M_ as x,N_ as S,OM as C,P_ as re,Q_ as ie,R_ as ae,Rw as w,ST as T,U_ as oe,Uw as E,V_ as se,Vw as D,W_ as ce,Ww as le,X_ as ue,Y_ as de,Yw as fe,Z_ as pe,_T as me,aT as he,av as ge,bT as _e,cT as ve,cv as ye,dT as O,dv as be,eT as xe,ev as Se,fT as k,fv as Ce,gT as we,gn as Te,hT as A,hn as j,hv as Ee,iT as M,iv as De,j_ as N,lT as P,lv as Oe,mT as F,mn as ke,mv as Ae,nT as je,nv as Me,oT as Ne,ov as Pe,pT as Fe,pv as Ie,q_ as Le,qw as Re,rT as ze,rv as Be,sT as Ve,sv as He,tT as I,tv as Ue,uT as We,uv as Ge,vT as Ke,wT as qe,xT as Je,yT as Ye,z_ as Xe,zw as Ze}from"./dist-HBBi9Y25.js";import{n as Qe}from"./dist-6oi7FQ0i.js";import{t as $e}from"./x-DBKGK4o_.js";import{i as L,n as R,r as et,t as tt}from"./tabs-BJyz65LR.js";import{t as z}from"./button-b04wLuGq.js";import{Bt as nt,C as B,S as V,Vt as rt,Wt as it,Xt as at,Yt as ot,a as st,b as H,ct as U,dt as ct,et as W,ft as lt,ht as ut,i as dt,j as ft,mt as pt,o as mt,r as ht,tt as gt,ut as _t,w as G,x as K,xt as vt}from"./index-DBQ43N4_.js";import{n as yt}from"./TimeRangePicker-NSOkx3C0.js";import{t as bt}from"./FilterBar-BVVVO1_O.js";import{t as xt}from"./AdvancedFilter-BQlL-4N9.js";import{t as St}from"./DataTableShell-KGrtOG5M.js";var Ct=s(`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`}]]),wt=s(`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`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function Tt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?he():n===`agent`?`${M()} - ${r}`:e}function Et(){let e=C(l.me.getMe,{host:vt})?.role===`admin`,t=C(l.deliveryTiming.getDeliveryStatus,{}),n=c(l.deliveryTiming.startDeliveryRecord),r=c(l.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[s,u]=(0,q.useState)(!1),d=t?.recording??!1,f=async()=>{u(!0);try{d?await r({}):await n({})}finally{u(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:qe()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}),e?(0,J.jsx)(z,{variant:d?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void f(),children:d?Je():T()}):null]}),d?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(U,{variant:`secondary`,children:_e()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:Ye({time:gt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?we():me()})}),i?(0,J.jsx)(Dt,{isAdmin:e}):null]})}function Dt({isAdmin:e}){let t=C(l.deliveryTiming.listDeliverySessions,{}),n=c(l.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(`all`),[s,u]=(0,q.useState)(Y),[d,f]=(0,q.useState)(null),{from:p,to:m}=yt(s),h=s.to===`now`?1/0:m,g=r.trim()!==``||a!==`all`||s!==Y,ee=()=>{i(``),o(`all`),u(Y)},v=(0,q.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]),y=e=>{let t=new Set((v??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),d!==null&&r.includes(d)&&f(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:i,searchPlaceholder:F(),timeRange:s,onTimeRangeChange:u,onReset:ee,canReset:g,children:(0,J.jsxs)(H,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:`all`,children:Fe()}),(0,J.jsx)(V,{value:`active`,children:k()}),(0,J.jsx)(V,{value:`stopped`,children:O()})]})]})}),(0,J.jsx)(St,{title:A(),rows:v,emptyHint:_(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":d===e.sessionId?je():ze(),onClick:()=>f(t=>t===e.sessionId?null:e.sessionId),children:d===e.sessionId?(0,J.jsx)(Ct,{size:15,"aria-hidden":!0}):(0,J.jsx)(rt,{size:15,"aria-hidden":!0})})},{header:We(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:W(e.startedAt)})},{header:P(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:W(e.stoppedAt)})},{header:ve(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:Ve(),sort:e=>e.startedBy,cell:e=>Tt(e.startedBy)},{header:Ne(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(U,{variant:`secondary`,children:k()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:O()})}],rowActions:e?e=>[{label:I(),variant:`destructive`,onSelect:()=>y([e.sessionId])}]:void 0,bulkActions:e?[{label:I(),variant:`destructive`,onSelect:e=>y(e)}]:void 0,isExpanded:e=>e.sessionId===d,renderExpanded:e=>(0,J.jsx)(Ot,{sessionId:e.sessionId})})]})}function Ot({sessionId:e}){let t=C(l.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(kt,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(ft(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function kt({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:xe()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,d()]}),(0,J.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(Qe,{size:13,"aria-hidden":!0}):(0,J.jsx)(it,{size:13,"aria-hidden":!0}),t?ne():w()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:Re()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:b()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:p()})]})}),(0,J.jsxs)(`tbody`,{children:[i(le(),r.bridge),i(E(),r.A),i(h(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:D()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]})}var At=[50,100,200,500],Z=`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:Te()},{value:`principalType`,label:j()},{value:`direction`,label:`direction`},{value:`roleKey`,label:ke()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=at({from:`/settings/traces`}),t=ot({from:`/settings/traces`}),n=e.limit,a=e.kind,o=e.statusClass??Q,s=e.principalType??Q,c=e.direction??Q,d=e.roleKey??Q,p=e.q??``,h=ht(e.from,e.to),_=(0,q.useMemo)(()=>mt(e.adv),[e.adv]),{from:b,to:ne}=yt(h),[x,S]=(0,q.useState)(null),[w,T]=(0,q.useState)(null),E=e=>void t({search:t=>({...t,limit:e})}),D=e=>void t({search:t=>({...t,kind:e})}),le=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),me=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),he=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),_e=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),ve=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),O=e=>void t({search:t=>({...t,...st(e)})}),xe=e=>void t({search:t=>({...t,adv:dt(e)}),replace:!0}),k=C(l.observability.listEvents,{limit:n}),we=C(l.observability.listEvents,{limit:n,kind:a===Z?void 0:a,filter:{q:p||void 0,from:b,to:ne,statusClass:o===Q?void 0:o,principalType:s===Q?void 0:s,direction:c===Q?void 0:c,roleKey:d===Q?void 0:d,advanced:_.length>0?_:void 0}}),Te=(0,q.useMemo)(()=>{let e=new Set;for(let t of k??[])e.add(t.kind);return[...e].sort()},[k]),A=(0,q.useMemo)(()=>{let e=new Set;for(let t of k??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[k]),j=p!==``||o!==Q||s!==Q||c!==Q||d!==Q||_.length>0||h.kind!==`relative`||h.from!==Pt.from;function M(){t({search:{limit:100,kind:`all`},replace:!0})}let N=x?k?.filter(e=>e.correlationId===x):we,P=e.section,F=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(tt,{value:P,onValueChange:e=>F(e),children:[(0,J.jsxs)(et,{className:`w-full`,children:[(0,J.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(nt,{size:13,"aria-hidden":!0}),fe()]}),(0,J.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(wt,{size:13,"aria-hidden":!0}),v()]})]}),(0,J.jsx)(R,{value:`latency`,children:(0,J.jsx)(Et,{})}),(0,J.jsxs)(R,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ee(),(0,J.jsx)(`strong`,{children:Ae()}),Ie(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:Ce()})]}),(0,J.jsxs)(bt,{q:p,onQChange:le,searchPlaceholder:be(),timeRange:h,onTimeRangeChange:O,onReset:M,canReset:j,children:[(0,J.jsxs)(H,{value:o,onValueChange:me,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{placeholder:Ge()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:Q,children:Oe()}),jt.map(e=>(0,J.jsx)(V,{value:e,children:e},e))]})]}),(0,J.jsxs)(H,{value:s,onValueChange:he,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{placeholder:ye()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:Q,children:He()}),Mt.map(e=>(0,J.jsx)(V,{value:e,children:e},e))]})]}),(0,J.jsxs)(H,{value:c,onValueChange:_e,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{placeholder:Pe()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:Q,children:ge()}),Nt.map(e=>(0,J.jsx)(V,{value:e,children:e},e))]})]}),(0,J.jsxs)(H,{value:d,onValueChange:ve,children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{placeholder:De()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:Q,children:Be()}),A.map(e=>(0,J.jsx)(V,{value:e,children:e},e))]})]}),(0,J.jsxs)(H,{value:a,onValueChange:D,children:[(0,J.jsx)(B,{size:`sm`,className:`w-44`,children:(0,J.jsx)(G,{placeholder:Me()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:Z,children:Ue()}),Te.map(e=>(0,J.jsx)(V,{value:e,children:e},e))]})]}),(0,J.jsxs)(H,{value:String(n),onValueChange:e=>E(Number(e)),children:[(0,J.jsx)(B,{size:`sm`,className:`w-28`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:At.map(e=>(0,J.jsx)(V,{value:String(e),children:Se({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Ft,seed:_,onChange:xe}),x?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>S(null),title:r(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ie(),(0,J.jsx)(`code`,{children:$(x)})]}),(0,J.jsx)($e,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:pe()})]})}):null,(0,J.jsx)(St,{title:ue(),rows:N,emptyHint:x?de():ee(),columns:[{header:Le(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:W(e.at)})},{header:y(),sort:e=>e.kind,cell:e=>(0,J.jsx)(U,{variant:`secondary`,children:e.kind})},{header:f(),sort:e=>Rt(e)??null,cell:e=>{let t=Rt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":ce(),children:`✓`})}},{header:oe(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(U,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:m(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(U,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:se(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(U,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:i(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Xe(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${Lt(e.status)}`,children:e.status})},{header:ae(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:te(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:g(),onClick:()=>S(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:u(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>T(e),children:re()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(zt,{row:w,onClose:()=>T(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,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(_t,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(ct,{className:`max-w-lg`,children:[(0,J.jsxs)(pt,{children:[(0,J.jsxs)(ut,{className:`oc-traces__meta-title`,children:[S(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(U,{variant:`outline`,children:x()})]}),(0,J.jsx)(lt,{children:N()})]}),(0,J.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{$_ as r,B_ as i,Bw as a,CT as o,D as s,DM as c,E as l,F_ as u,Fw as d,G_ as f,Gw as p,H_ as m,Hw as h,I_ as g,Iw as _,J_ as ee,Jw as v,K_ as y,Kw as b,L_ as te,Lw as ne,M_ as x,N_ as S,OM as C,P_ as re,Q_ as ie,R_ as ae,Rw as w,ST as T,U_ as oe,Uw as E,V_ as se,Vw as D,W_ as ce,Ww as le,X_ as ue,Y_ as de,Yw as fe,Z_ as pe,_T as me,aT as he,av as ge,bT as _e,cT as ve,cv as ye,dT as O,dv as be,eT as xe,ev as Se,fT as k,fv as Ce,gT as we,gn as Te,hT as A,hn as j,hv as Ee,iT as M,iv as De,j_ as N,lT as P,lv as Oe,mT as F,mn as ke,mv as Ae,nT as je,nv as Me,oT as Ne,ov as Pe,pT as Fe,pv as Ie,q_ as Le,qw as Re,rT as ze,rv as Be,sT as Ve,sv as He,tT as I,tv as Ue,uT as We,uv as Ge,vT as Ke,wT as qe,xT as Je,yT as Ye,z_ as Xe,zw as Ze}from"./dist-HBBi9Y25.js";import{n as Qe}from"./dist-6oi7FQ0i.js";import{t as $e}from"./x-DBKGK4o_.js";import{i as L,n as R,r as et,t as tt}from"./tabs-0f19le6d.js";import{t as z}from"./button-b04wLuGq.js";import{Bt as nt,C as B,S as V,Vt as rt,Wt as it,Xt as at,Yt as ot,a as st,b as H,ct as U,dt as ct,et as W,ft as lt,ht as ut,i as dt,j as ft,mt as pt,o as mt,r as ht,tt as gt,ut as _t,w as G,x as K,xt as vt}from"./index-4Peu865E.js";import{n as yt}from"./TimeRangePicker-BeZLlC4Y.js";import{t as bt}from"./FilterBar-Csl1r1c5.js";import{t as xt}from"./AdvancedFilter-CKwZSjrh.js";import{t as St}from"./DataTableShell-DtJr2ebT.js";var Ct=s(`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`}]]),wt=s(`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`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function Tt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?he():n===`agent`?`${M()} - ${r}`:e}function Et(){let e=C(l.me.getMe,{host:vt})?.role===`admin`,t=C(l.deliveryTiming.getDeliveryStatus,{}),n=c(l.deliveryTiming.startDeliveryRecord),r=c(l.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[s,u]=(0,q.useState)(!1),d=t?.recording??!1,f=async()=>{u(!0);try{d?await r({}):await n({})}finally{u(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:qe()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}),e?(0,J.jsx)(z,{variant:d?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void f(),children:d?Je():T()}):null]}),d?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(U,{variant:`secondary`,children:_e()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:Ye({time:gt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?we():me()})}),i?(0,J.jsx)(Dt,{isAdmin:e}):null]})}function Dt({isAdmin:e}){let t=C(l.deliveryTiming.listDeliverySessions,{}),n=c(l.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(`all`),[s,u]=(0,q.useState)(Y),[d,f]=(0,q.useState)(null),{from:p,to:m}=yt(s),h=s.to===`now`?1/0:m,g=r.trim()!==``||a!==`all`||s!==Y,ee=()=>{i(``),o(`all`),u(Y)},v=(0,q.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]),y=e=>{let t=new Set((v??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),d!==null&&r.includes(d)&&f(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:i,searchPlaceholder:F(),timeRange:s,onTimeRangeChange:u,onReset:ee,canReset:g,children:(0,J.jsxs)(H,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:`all`,children:Fe()}),(0,J.jsx)(V,{value:`active`,children:k()}),(0,J.jsx)(V,{value:`stopped`,children:O()})]})]})}),(0,J.jsx)(St,{title:A(),rows:v,emptyHint:_(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":d===e.sessionId?je():ze(),onClick:()=>f(t=>t===e.sessionId?null:e.sessionId),children:d===e.sessionId?(0,J.jsx)(Ct,{size:15,"aria-hidden":!0}):(0,J.jsx)(rt,{size:15,"aria-hidden":!0})})},{header:We(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:W(e.startedAt)})},{header:P(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:W(e.stoppedAt)})},{header:ve(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:Ve(),sort:e=>e.startedBy,cell:e=>Tt(e.startedBy)},{header:Ne(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(U,{variant:`secondary`,children:k()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:O()})}],rowActions:e?e=>[{label:I(),variant:`destructive`,onSelect:()=>y([e.sessionId])}]:void 0,bulkActions:e?[{label:I(),variant:`destructive`,onSelect:e=>y(e)}]:void 0,isExpanded:e=>e.sessionId===d,renderExpanded:e=>(0,J.jsx)(Ot,{sessionId:e.sessionId})})]})}function Ot({sessionId:e}){let t=C(l.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(kt,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(ft(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function kt({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:xe()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,d()]}),(0,J.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(Qe,{size:13,"aria-hidden":!0}):(0,J.jsx)(it,{size:13,"aria-hidden":!0}),t?ne():w()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:Re()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:b()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:p()})]})}),(0,J.jsxs)(`tbody`,{children:[i(le(),r.bridge),i(E(),r.A),i(h(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:D()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]})}var At=[50,100,200,500],Z=`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:Te()},{value:`principalType`,label:j()},{value:`direction`,label:`direction`},{value:`roleKey`,label:ke()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=at({from:`/settings/traces`}),t=ot({from:`/settings/traces`}),n=e.limit,a=e.kind,o=e.statusClass??Q,s=e.principalType??Q,c=e.direction??Q,d=e.roleKey??Q,p=e.q??``,h=ht(e.from,e.to),_=(0,q.useMemo)(()=>mt(e.adv),[e.adv]),{from:b,to:ne}=yt(h),[x,S]=(0,q.useState)(null),[w,T]=(0,q.useState)(null),E=e=>void t({search:t=>({...t,limit:e})}),D=e=>void t({search:t=>({...t,kind:e})}),le=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),me=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),he=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),_e=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),ve=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),O=e=>void t({search:t=>({...t,...st(e)})}),xe=e=>void t({search:t=>({...t,adv:dt(e)}),replace:!0}),k=C(l.observability.listEvents,{limit:n}),we=C(l.observability.listEvents,{limit:n,kind:a===Z?void 0:a,filter:{q:p||void 0,from:b,to:ne,statusClass:o===Q?void 0:o,principalType:s===Q?void 0:s,direction:c===Q?void 0:c,roleKey:d===Q?void 0:d,advanced:_.length>0?_:void 0}}),Te=(0,q.useMemo)(()=>{let e=new Set;for(let t of k??[])e.add(t.kind);return[...e].sort()},[k]),A=(0,q.useMemo)(()=>{let e=new Set;for(let t of k??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[k]),j=p!==``||o!==Q||s!==Q||c!==Q||d!==Q||_.length>0||h.kind!==`relative`||h.from!==Pt.from;function M(){t({search:{limit:100,kind:`all`},replace:!0})}let N=x?k?.filter(e=>e.correlationId===x):we,P=e.section,F=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(tt,{value:P,onValueChange:e=>F(e),children:[(0,J.jsxs)(et,{className:`w-full`,children:[(0,J.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(nt,{size:13,"aria-hidden":!0}),fe()]}),(0,J.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(wt,{size:13,"aria-hidden":!0}),v()]})]}),(0,J.jsx)(R,{value:`latency`,children:(0,J.jsx)(Et,{})}),(0,J.jsxs)(R,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ee(),(0,J.jsx)(`strong`,{children:Ae()}),Ie(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:Ce()})]}),(0,J.jsxs)(bt,{q:p,onQChange:le,searchPlaceholder:be(),timeRange:h,onTimeRangeChange:O,onReset:M,canReset:j,children:[(0,J.jsxs)(H,{value:o,onValueChange:me,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{placeholder:Ge()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:Q,children:Oe()}),jt.map(e=>(0,J.jsx)(V,{value:e,children:e},e))]})]}),(0,J.jsxs)(H,{value:s,onValueChange:he,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{placeholder:ye()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:Q,children:He()}),Mt.map(e=>(0,J.jsx)(V,{value:e,children:e},e))]})]}),(0,J.jsxs)(H,{value:c,onValueChange:_e,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{placeholder:Pe()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:Q,children:ge()}),Nt.map(e=>(0,J.jsx)(V,{value:e,children:e},e))]})]}),(0,J.jsxs)(H,{value:d,onValueChange:ve,children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{placeholder:De()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:Q,children:Be()}),A.map(e=>(0,J.jsx)(V,{value:e,children:e},e))]})]}),(0,J.jsxs)(H,{value:a,onValueChange:D,children:[(0,J.jsx)(B,{size:`sm`,className:`w-44`,children:(0,J.jsx)(G,{placeholder:Me()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(V,{value:Z,children:Ue()}),Te.map(e=>(0,J.jsx)(V,{value:e,children:e},e))]})]}),(0,J.jsxs)(H,{value:String(n),onValueChange:e=>E(Number(e)),children:[(0,J.jsx)(B,{size:`sm`,className:`w-28`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:At.map(e=>(0,J.jsx)(V,{value:String(e),children:Se({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Ft,seed:_,onChange:xe}),x?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>S(null),title:r(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ie(),(0,J.jsx)(`code`,{children:$(x)})]}),(0,J.jsx)($e,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:pe()})]})}):null,(0,J.jsx)(St,{title:ue(),rows:N,emptyHint:x?de():ee(),columns:[{header:Le(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:W(e.at)})},{header:y(),sort:e=>e.kind,cell:e=>(0,J.jsx)(U,{variant:`secondary`,children:e.kind})},{header:f(),sort:e=>Rt(e)??null,cell:e=>{let t=Rt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":ce(),children:`✓`})}},{header:oe(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(U,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:m(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(U,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:se(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(U,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:i(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Xe(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${Lt(e.status)}`,children:e.status})},{header:ae(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:te(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:g(),onClick:()=>S(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:u(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>T(e),children:re()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(zt,{row:w,onClose:()=>T(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,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(_t,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(ct,{className:`max-w-lg`,children:[(0,J.jsxs)(pt,{children:[(0,J.jsxs)(ut,{className:`oc-traces__meta-title`,children:[S(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(U,{variant:`outline`,children:x()})]}),(0,J.jsx)(lt,{children:N()})]}),(0,J.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{$S as r,$g as i,AS as a,BS as o,Cu as s,DM as c,DS as l,E as u,ES as d,FS as f,GS as p,Gg as m,HS as h,IS as ee,JS as te,Jg as g,KS as ne,Kg as _,LS as re,MS as ie,NS as ae,OM as v,OS as oe,PS as se,QS as y,Qg as b,RS as ce,Su as x,US as le,VS as ue,WS as S,XS as de,Xg as C,YS as fe,Yg as w,ZS as pe,Zg as T,eC as E,e_ as D,jS as me,kS as he,n_ as O,qS as ge,qg as k,r_ as A,sS as _e,t_ as j,xu as M,zS as N}from"./dist-HBBi9Y25.js";import{t as P}from"./button-b04wLuGq.js";import{B as F,C as I,Mt as L,Nt as R,S as z,V as ve,Xt as ye,Yt as be,at as B,b as V,c as xe,ct as H,dt as Se,ft as Ce,ht as we,it as Te,l as U,mt as Ee,nt as De,p as W,rt as Oe,s as G,st as ke,ut as Ae,w as K,x as q,xt as je,z as J}from"./index-DBQ43N4_.js";import{t as Me}from"./FilterBar-BVVVO1_O.js";import{t as Ne}from"./DataTableShell-KGrtOG5M.js";import{t as Pe}from"./DetailChips-C2LFFpNg.js";var Y=t(e(),1),X=n();function Fe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let a=v(u.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=v(u.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,d=new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),f=[...(a?.agents??[]).map(e=>({...e,outOfPool:!1})),...(o??[]).filter(e=>!d.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,enabled:e.enabled,state:e.state,outOfPool:!0}))],p=new Map;for(let e of f){let t=p.get(e.instanceName)??[];t.push(e),p.set(e.instanceName,t)}return(0,X.jsx)(Ae,{open:n,onOpenChange:r,children:(0,X.jsxs)(Se,{className:`oc-access`,children:[(0,X.jsxs)(Ee,{children:[(0,X.jsx)(we,{children:A({user:t})}),(0,X.jsx)(Ce,{children:O()})]}),a?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:a.inGroup?j():D()}):null,(0,X.jsx)(`div`,{className:`oc-access__list`,children:a===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:i()}):f.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:C()}):[...p.entries()].map(([t,n])=>(0,X.jsx)(Ie,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:l},t))})]})})}function Ie({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=c(u.agents.assignAgent),s=c(u.agents.removeAgent),l=c(u.agents.setDefaultAgent),d=J();if(!e)return null;async function f(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){d.error(b(),e)}}async function p(n){try{await l({profileId:e,instanceName:t,agentId:n})}catch(e){d.error(T(),e)}}return(0,X.jsxs)(`div`,{className:`oc-access__group`,children:[(0,X.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,X.jsx)(R,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:t}),(0,X.jsx)(H,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),o=a===n,s=e.state===`deleted`,c=!e.enabled;return(0,X.jsxs)(`div`,{className:`oc-access__row${c?` is-disabled`:``}`,children:[(0,X.jsx)(W,{checked:r,disabled:(s||c)&&!r,onCheckedChange:()=>void f(e.agentId,r),"aria-label":w({name:e.displayName??e.agentId})}),(0,X.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,s?(0,X.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:g()}):null,e.outOfPool?(0,X.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:k()}):null,r?o?(0,X.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":_(),title:_(),children:(0,X.jsx)(L,{size:14,fill:`currentColor`})}):(0,X.jsx)(P,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":m(),title:m(),disabled:c,onClick:()=>void p(e.agentId),children:(0,X.jsx)(L,{size:14})}):null]},e.agentId)})]})}var Z=`__all__`;function Q(e){switch(e){case`pending`:return M();case`user`:return x();case`admin`:return s();default:return e}}function Le({granted:e,onToggle:t}){let n=new Set(e),i=G.filter(e=>n.has(U[e])).length;return(0,X.jsxs)(De,{children:[(0,X.jsx)(ke,{asChild:!0,children:(0,X.jsx)(P,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:i===0?E():r({count:i})})}),(0,X.jsxs)(Oe,{align:`start`,className:`w-52`,children:[(0,X.jsx)(B,{children:y()}),G.map(e=>{let r=U[e];return(0,X.jsxs)(Te,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,X.jsx)(W,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,X.jsx)(`span`,{children:xe[e]()})]},e)})]})]})}function $(){let e=ye({from:`/settings/users`}),t=be({from:`/settings/users`}),n=e.q??``,r=e.role??Z,i=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),s=e=>void t({search:t=>({...t,role:e===Z?void 0:e})}),m=v(u.admin.listUsers,{filter:{q:n||void 0,role:r===Z?void 0:r},withAgents:!0}),g=v(u.me.getMe,{host:je}),_=c(u.admin.setRole),y=c(u.admin.setUserPermissions),b=c(u.admin.startImpersonation),x=c(u.admin.deleteUser),C=c(u.admin.setUserName),w=F(),T=ve(),E=J(),[D,O]=(0,Y.useState)(null),k=(0,Y.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of m??[])e.add(t.role);return[...e]},[m]),A=n!==``||r!==Z;function j(){t({search:{},replace:!0})}async function M(e){try{await _(e)}catch(e){E.error(pe(),e)}}async function P(e){try{await y(e)}catch(e){E.error(de(),e)}}async function L(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await w({title:le(),description:h({user:t}),confirmWord:ue(),confirmLabel:o(),destructive:!0}))try{await x({profileId:e._id}),E.success(ce({user:t}))}catch(e){E.error(N(),e)}}async function B(e){let t=e.email||e.name||e.userId.slice(0,8),n=await T({title:ee(),label:f({user:t}),placeholder:se(),defaultValue:e.name??``,confirmLabel:_e()});if(n!==null)try{await C({profileId:e._id,name:n}),E.success(ae())}catch(e){E.error(ie(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Me,{q:n,onQChange:i,searchPlaceholder:fe(),onReset:j,canReset:A,children:(0,X.jsxs)(V,{value:r,onValueChange:s,children:[(0,X.jsx)(I,{size:`sm`,className:`w-36`,children:(0,X.jsx)(K,{})}),(0,X.jsxs)(q,{children:[(0,X.jsx)(z,{value:Z,children:te()}),k.map(e=>(0,X.jsx)(z,{value:e,children:Q(e)},e))]})]})}),(0,X.jsx)(Ne,{title:ge(),rows:m,emptyHint:ne(),rowActions:e=>{let t=[{label:d(),onSelect:()=>O({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:re(),onSelect:()=>void B(e)}];return e.userId!==g?.userId&&t.push({label:p(),onSelect:()=>void b({profileId:e._id})},{label:S(),variant:`destructive`,onSelect:()=>void L(e)}),t},columns:[{header:me(),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,X.jsxs)(`div`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{children:t}),n?(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:a(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,X.jsxs)(V,{value:e.role,onValueChange:t=>void M({profileId:e._id,role:t}),children:[(0,X.jsx)(I,{size:`sm`,className:`w-28`,children:(0,X.jsx)(K,{})}),(0,X.jsxs)(q,{children:[(0,X.jsx)(z,{value:`pending`,children:Q(`pending`)}),(0,X.jsx)(z,{value:`user`,children:Q(`user`)}),(0,X.jsx)(z,{value:`admin`,children:Q(`admin`)})]})]})},{header:he(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:oe()}):(0,X.jsx)(Le,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),P({profileId:e._id,permissions:[...n]})}})},{header:l(),cell:e=>(0,X.jsx)(Pe,{icon:(0,X.jsx)(R,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,X.jsx)(Fe,{profileId:D?.profileId??null,userLabel:D?.label??``,open:D!==null,onOpenChange:e=>{e||O(null)}})]})}export{$ as UsersTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,$g as i,AS as a,BS as o,Cu as s,DM as c,DS as l,E as u,ES as d,FS as f,GS as p,Gg as m,HS as h,IS as ee,JS as te,Jg as g,KS as ne,Kg as _,LS as re,MS as ie,NS as ae,OM as v,OS as oe,PS as se,QS as y,Qg as b,RS as ce,Su as x,US as le,VS as ue,WS as S,XS as de,Xg as C,YS as fe,Yg as w,ZS as pe,Zg as T,eC as E,e_ as D,jS as me,kS as he,n_ as O,qS as ge,qg as k,r_ as A,sS as _e,t_ as j,xu as M,zS as N}from"./dist-HBBi9Y25.js";import{t as P}from"./button-b04wLuGq.js";import{B as F,C as I,Mt as L,Nt as R,S as z,V as ve,Xt as ye,Yt as be,at as B,b as V,c as xe,ct as H,dt as Se,ft as Ce,ht as we,it as Te,l as U,mt as Ee,nt as De,p as W,rt as Oe,s as G,st as ke,ut as Ae,w as K,x as q,xt as je,z as J}from"./index-4Peu865E.js";import{t as Me}from"./FilterBar-Csl1r1c5.js";import{t as Ne}from"./DataTableShell-DtJr2ebT.js";import{t as Pe}from"./DetailChips-CXG_QPSx.js";var Y=t(e(),1),X=n();function Fe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let a=v(u.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=v(u.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,d=new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),f=[...(a?.agents??[]).map(e=>({...e,outOfPool:!1})),...(o??[]).filter(e=>!d.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,enabled:e.enabled,state:e.state,outOfPool:!0}))],p=new Map;for(let e of f){let t=p.get(e.instanceName)??[];t.push(e),p.set(e.instanceName,t)}return(0,X.jsx)(Ae,{open:n,onOpenChange:r,children:(0,X.jsxs)(Se,{className:`oc-access`,children:[(0,X.jsxs)(Ee,{children:[(0,X.jsx)(we,{children:A({user:t})}),(0,X.jsx)(Ce,{children:O()})]}),a?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:a.inGroup?j():D()}):null,(0,X.jsx)(`div`,{className:`oc-access__list`,children:a===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:i()}):f.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:C()}):[...p.entries()].map(([t,n])=>(0,X.jsx)(Ie,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:l},t))})]})})}function Ie({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=c(u.agents.assignAgent),s=c(u.agents.removeAgent),l=c(u.agents.setDefaultAgent),d=J();if(!e)return null;async function f(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){d.error(b(),e)}}async function p(n){try{await l({profileId:e,instanceName:t,agentId:n})}catch(e){d.error(T(),e)}}return(0,X.jsxs)(`div`,{className:`oc-access__group`,children:[(0,X.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,X.jsx)(R,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:t}),(0,X.jsx)(H,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),o=a===n,s=e.state===`deleted`,c=!e.enabled;return(0,X.jsxs)(`div`,{className:`oc-access__row${c?` is-disabled`:``}`,children:[(0,X.jsx)(W,{checked:r,disabled:(s||c)&&!r,onCheckedChange:()=>void f(e.agentId,r),"aria-label":w({name:e.displayName??e.agentId})}),(0,X.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,s?(0,X.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:g()}):null,e.outOfPool?(0,X.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:k()}):null,r?o?(0,X.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":_(),title:_(),children:(0,X.jsx)(L,{size:14,fill:`currentColor`})}):(0,X.jsx)(P,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":m(),title:m(),disabled:c,onClick:()=>void p(e.agentId),children:(0,X.jsx)(L,{size:14})}):null]},e.agentId)})]})}var Z=`__all__`;function Q(e){switch(e){case`pending`:return M();case`user`:return x();case`admin`:return s();default:return e}}function Le({granted:e,onToggle:t}){let n=new Set(e),i=G.filter(e=>n.has(U[e])).length;return(0,X.jsxs)(De,{children:[(0,X.jsx)(ke,{asChild:!0,children:(0,X.jsx)(P,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:i===0?E():r({count:i})})}),(0,X.jsxs)(Oe,{align:`start`,className:`w-52`,children:[(0,X.jsx)(B,{children:y()}),G.map(e=>{let r=U[e];return(0,X.jsxs)(Te,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,X.jsx)(W,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,X.jsx)(`span`,{children:xe[e]()})]},e)})]})]})}function $(){let e=ye({from:`/settings/users`}),t=be({from:`/settings/users`}),n=e.q??``,r=e.role??Z,i=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),s=e=>void t({search:t=>({...t,role:e===Z?void 0:e})}),m=v(u.admin.listUsers,{filter:{q:n||void 0,role:r===Z?void 0:r},withAgents:!0}),g=v(u.me.getMe,{host:je}),_=c(u.admin.setRole),y=c(u.admin.setUserPermissions),b=c(u.admin.startImpersonation),x=c(u.admin.deleteUser),C=c(u.admin.setUserName),w=F(),T=ve(),E=J(),[D,O]=(0,Y.useState)(null),k=(0,Y.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of m??[])e.add(t.role);return[...e]},[m]),A=n!==``||r!==Z;function j(){t({search:{},replace:!0})}async function M(e){try{await _(e)}catch(e){E.error(pe(),e)}}async function P(e){try{await y(e)}catch(e){E.error(de(),e)}}async function L(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await w({title:le(),description:h({user:t}),confirmWord:ue(),confirmLabel:o(),destructive:!0}))try{await x({profileId:e._id}),E.success(ce({user:t}))}catch(e){E.error(N(),e)}}async function B(e){let t=e.email||e.name||e.userId.slice(0,8),n=await T({title:ee(),label:f({user:t}),placeholder:se(),defaultValue:e.name??``,confirmLabel:_e()});if(n!==null)try{await C({profileId:e._id,name:n}),E.success(ae())}catch(e){E.error(ie(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Me,{q:n,onQChange:i,searchPlaceholder:fe(),onReset:j,canReset:A,children:(0,X.jsxs)(V,{value:r,onValueChange:s,children:[(0,X.jsx)(I,{size:`sm`,className:`w-36`,children:(0,X.jsx)(K,{})}),(0,X.jsxs)(q,{children:[(0,X.jsx)(z,{value:Z,children:te()}),k.map(e=>(0,X.jsx)(z,{value:e,children:Q(e)},e))]})]})}),(0,X.jsx)(Ne,{title:ge(),rows:m,emptyHint:ne(),rowActions:e=>{let t=[{label:d(),onSelect:()=>O({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:re(),onSelect:()=>void B(e)}];return e.userId!==g?.userId&&t.push({label:p(),onSelect:()=>void b({profileId:e._id})},{label:S(),variant:`destructive`,onSelect:()=>void L(e)}),t},columns:[{header:me(),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,X.jsxs)(`div`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{children:t}),n?(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:a(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,X.jsxs)(V,{value:e.role,onValueChange:t=>void M({profileId:e._id,role:t}),children:[(0,X.jsx)(I,{size:`sm`,className:`w-28`,children:(0,X.jsx)(K,{})}),(0,X.jsxs)(q,{children:[(0,X.jsx)(z,{value:`pending`,children:Q(`pending`)}),(0,X.jsx)(z,{value:`user`,children:Q(`user`)}),(0,X.jsx)(z,{value:`admin`,children:Q(`admin`)})]})]})},{header:he(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:oe()}):(0,X.jsx)(Le,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),P({profileId:e._id,permissions:[...n]})}})},{header:l(),cell:e=>(0,X.jsx)(Pe,{icon:(0,X.jsx)(R,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,X.jsx)(Fe,{profileId:D?.profileId??null,userLabel:D?.label??``,open:D!==null,onOpenChange:e=>{e||O(null)}})]})}export{$ 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,DM as s,Dt as c,E as l,Et as u,Fl as d,Ft as f,H as ee,J as p,K as m,Mt as h,Nt as g,OM as _,Ot as v,Pt as y,Q as b,St as x,TM as S,Tt as te,U as ne,V as re,W as C,Y as w,_t as T,bt as ie,dt as ae,et as oe,ft as se,gt as E,hc as ce,ht as le,jt as ue,k as de,kt as D,mt as O,nt as fe,pc as pe,pt as me,q as k,tt as A,ut as j,vt as M,wt as N,xM as P,xt as F,yM as I,yt as L}from"./dist-HBBi9Y25.js";import{i as R,n as z,r as he,t as B}from"./tabs-BJyz65LR.js";import{t as V}from"./button-b04wLuGq.js";import{C as H,F as ge,I as U,L as W,Lt as _e,M as ve,N as ye,P as be,R as xe,S as G,Xt as Se,Yt as Ce,b as K,ct as q,kt as we,p as J,w as Y,x as X,xt as Te}from"./index-DBQ43N4_.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`,()=>v()],[`fr-FR`,()=>fe()],[`en-US`,()=>A()],[`en-GB`,()=>oe()],[`de-DE`,()=>r()],[`es-ES`,()=>b()]],Oe=[[`0.75`,()=>u()],[`1`,()=>te()],[`1.25`,()=>N()],[`1.5`,()=>a()]],$=0;function ke({instance:e}){let t=s(l.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),[u,f]=(0,Z.useState)(`idle`),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(!1),_=S(l.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}),f(`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(){f(`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}),f(`idle`)}catch{f(`error`)}}return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(q,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(J,{checked: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:C()}),(0,Q.jsxs)(K,{value:a.engine,onValueChange:e=>o({...a,engine:e}),disabled:!a.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":C(),children:(0,Q.jsx)(Y,{})}),(0,Q.jsxs)(X,{children:[(0,Q.jsx)(G,{value:`browser`,children:ne()}),e.kind===`hermes`?null:(0,Q.jsx)(G,{value:`gateway`,children:ee()})]})]})]}),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)(K,{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)(Y,{})}),(0,Q.jsx)(X,{children:De.map(([e,t])=>(0,Q.jsx)(G,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:c()}),(0,Q.jsxs)(K,{value:a.rate,onValueChange:e=>o({...a,rate:e}),disabled:!a.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":c(),children:(0,Q.jsx)(Y,{})}),(0,Q.jsx)(X,{children:Oe.map(([e,t])=>(0,Q.jsx)(G,{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)(J,{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||u===`saving`,onClick:()=>void y(),children:u===`saving`?d():ce()}),(0,Q.jsx)(V,{variant:`outline`,size:`sm`,disabled:!a.enabled||p,onClick:()=>{let t=Number.parseFloat(a.rate)||1,n=++$;if(g(!1),W(),U(),a.engine!==`gateway`){ge(M(),{lang:be(a.lang,P()),rate:t});return}m(!0),_({instanceName:e.name,text:M()}).then(({mime:e,audioBase64:r})=>{n===$&&ye(r,e,{rate:t})}).catch(()=>{n===$&&g(!0)}).finally(()=>m(!1))},children:p?d():ie()}),(0,Q.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>{$++,m(!1),W(),U()},children:L()})]}),u===`error`||h?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h?de():pe()}):null]})}function Ae({stt:e}){let t=_(l.me.getMe,{host:Te}),n=s(l.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:E()}),(0,Q.jsx)(q,{variant:e?`secondary`:`outline`,children:e?ae():j()}),(0,Q.jsx)(q,{variant:r?`secondary`:`destructive`,children:r?p():k()})]}),i?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(J,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":w()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:w()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:le()})]})}function je(){let e=_(l.admin.listInstances,{}),t=(0,Z.useMemo)(()=>xe(),[]),n=(0,Z.useMemo)(()=>ve(),[]),{section:r}=Se({from:`/settings/voice`}),i=Ce({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(q,{variant:t?`secondary`:`destructive`,children:t?y():g()}),(0,Q.jsx)(q,{variant:n?`secondary`:`destructive`,children:n?h():ue()})]}),(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)(we,{size:13,"aria-hidden":!0}),m()]}),(0,Q.jsxs)(R,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(_e,{size:13,"aria-hidden":!0}),E()]}),(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:I()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):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:me()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:se()})]})})]})]})}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,DM as s,Dt as c,E as l,Et as u,Fl as d,Ft as f,H as ee,J as p,K as m,Mt as h,Nt as g,OM as _,Ot as v,Pt as y,Q as b,St as x,TM as S,Tt as te,U as ne,V as re,W as C,Y as w,_t as T,bt as ie,dt as ae,et as oe,ft as se,gt as E,hc as ce,ht as le,jt as ue,k as de,kt as D,mt as O,nt as fe,pc as pe,pt as me,q as k,tt as A,ut as j,vt as M,wt as N,xM as P,xt as F,yM as I,yt as L}from"./dist-HBBi9Y25.js";import{i as R,n as z,r as he,t as B}from"./tabs-0f19le6d.js";import{t as V}from"./button-b04wLuGq.js";import{C as H,F as ge,I as U,L as W,Lt as _e,M as ve,N as ye,P as be,R as xe,S as G,Xt as Se,Yt as Ce,b as K,ct as q,kt as we,p as J,w as Y,x as X,xt as Te}from"./index-4Peu865E.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`,()=>v()],[`fr-FR`,()=>fe()],[`en-US`,()=>A()],[`en-GB`,()=>oe()],[`de-DE`,()=>r()],[`es-ES`,()=>b()]],Oe=[[`0.75`,()=>u()],[`1`,()=>te()],[`1.25`,()=>N()],[`1.5`,()=>a()]],$=0;function ke({instance:e}){let t=s(l.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),[u,f]=(0,Z.useState)(`idle`),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(!1),_=S(l.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}),f(`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(){f(`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}),f(`idle`)}catch{f(`error`)}}return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(q,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(J,{checked: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:C()}),(0,Q.jsxs)(K,{value:a.engine,onValueChange:e=>o({...a,engine:e}),disabled:!a.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":C(),children:(0,Q.jsx)(Y,{})}),(0,Q.jsxs)(X,{children:[(0,Q.jsx)(G,{value:`browser`,children:ne()}),e.kind===`hermes`?null:(0,Q.jsx)(G,{value:`gateway`,children:ee()})]})]})]}),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)(K,{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)(Y,{})}),(0,Q.jsx)(X,{children:De.map(([e,t])=>(0,Q.jsx)(G,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:c()}),(0,Q.jsxs)(K,{value:a.rate,onValueChange:e=>o({...a,rate:e}),disabled:!a.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":c(),children:(0,Q.jsx)(Y,{})}),(0,Q.jsx)(X,{children:Oe.map(([e,t])=>(0,Q.jsx)(G,{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)(J,{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||u===`saving`,onClick:()=>void y(),children:u===`saving`?d():ce()}),(0,Q.jsx)(V,{variant:`outline`,size:`sm`,disabled:!a.enabled||p,onClick:()=>{let t=Number.parseFloat(a.rate)||1,n=++$;if(g(!1),W(),U(),a.engine!==`gateway`){ge(M(),{lang:be(a.lang,P()),rate:t});return}m(!0),_({instanceName:e.name,text:M()}).then(({mime:e,audioBase64:r})=>{n===$&&ye(r,e,{rate:t})}).catch(()=>{n===$&&g(!0)}).finally(()=>m(!1))},children:p?d():ie()}),(0,Q.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>{$++,m(!1),W(),U()},children:L()})]}),u===`error`||h?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h?de():pe()}):null]})}function Ae({stt:e}){let t=_(l.me.getMe,{host:Te}),n=s(l.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:E()}),(0,Q.jsx)(q,{variant:e?`secondary`:`outline`,children:e?ae():j()}),(0,Q.jsx)(q,{variant:r?`secondary`:`destructive`,children:r?p():k()})]}),i?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(J,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":w()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:w()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:le()})]})}function je(){let e=_(l.admin.listInstances,{}),t=(0,Z.useMemo)(()=>xe(),[]),n=(0,Z.useMemo)(()=>ve(),[]),{section:r}=Se({from:`/settings/voice`}),i=Ce({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(q,{variant:t?`secondary`:`destructive`,children:t?y():g()}),(0,Q.jsx)(q,{variant:n?`secondary`:`destructive`,children:n?h():ue()})]}),(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)(we,{size:13,"aria-hidden":!0}),m()]}),(0,Q.jsxs)(R,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(_e,{size:13,"aria-hidden":!0}),E()]}),(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:I()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):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:me()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:se()})]})})]})]})}export{je as VoiceTab};
@@ -0,0 +1 @@
1
+ import{$s as e,Js as t,Qs as n,Ys as r,Zs as i,qt as a,sc as o}from"./dist-HBBi9Y25.js";var s=e=>typeof e==`string`?e:null;function c(e){let t=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/.exec(e);return t?{nums:[t[1],t[2],t[3]].map(e=>Number.parseInt(e,10)),pre:t[4]??null}:null}function l(e,t){let n=e.split(`.`),r=t.split(`.`);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e],i=r[e];if(t===void 0)return-1;if(i===void 0)return 1;let a=/^\d+$/.test(t)?Number.parseInt(t,10):null,o=/^\d+$/.test(i)?Number.parseInt(i,10):null;if(a!==null&&o!==null){if(a!==o)return a-o}else if(a!==null)return-1;else if(o!==null)return 1;else{let e=t<i?-1:+(t>i);if(e!==0)return e}}return 0}function u(e,t){let n=c(e),r=c(t);if(n===null||r===null)return null;for(let e=0;e<3;e++){let t=n.nums[e]-r.nums[e];if(t!==0)return t}return n.pre===null&&r.pre===null?0:n.pre===null?1:r.pre===null?-1:l(n.pre,r.pre)}function d(e,t){if(e===null||t===null)return!1;let n=u(t,e.min);return n!==null&&n>=0}function f(e,t){let n={range:null,validatedVersions:[]};if(typeof e!=`object`||!e)return n;let r=e.providers;if(typeof r!=`object`||!r)return n;let i=r[t];if(typeof i!=`object`||!i)return n;let a=i,o=null;if(typeof a.supportedRange==`object`&&a.supportedRange!==null){let e=a.supportedRange,t=s(e.min),n=s(e.maxValidated);t!==null&&n!==null&&(o={min:t,maxValidated:n})}let c=Array.isArray(a.validatedVersions)?a.validatedVersions.filter(e=>typeof e==`string`):[];return{range:o,validatedVersions:c}}function p(e,t,n){if(e===null)return`unknown`;let{range:r}=f(n,t);return d(r,e)?r!==null&&(u(e,r.maxValidated)??0)>0?`beyond`:`supported`:`unknown`}function m(t){return t===`supported`?e():t===`beyond`?n():i()}function h(e){return e??o()}function g(e,n){return n&&n!==`openclaw`?a({provider:n}):e===null?t():r({version:e})}function _(e,t){if(typeof e!=`object`||!e)return!1;let n=e.providers;return typeof n!=`object`||!n?!1:t in n}export{h as a,g as i,_ as n,u as o,m as r,f as s,p as t};
@@ -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-DBQ43N4_.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-4Peu865E.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};