@lacneu/atrium 0.19.3 → 0.20.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 (75) hide show
  1. package/dist/assets/AccessTab-DnmomQlW.js +1 -0
  2. package/dist/assets/{AdvancedFilter-GcKYGafW.js → AdvancedFilter-DX4JYkKu.js} +1 -1
  3. package/dist/assets/AgentFilesTab-M_jwk-Vm.js +3 -0
  4. package/dist/assets/AnomaliesTab-D_kmQ26T.js +1 -0
  5. package/dist/assets/AuditTab-BU2nYddz.js +1 -0
  6. package/dist/assets/BridgeTab-B4QV2N_w.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-DkX706Gz.js +1 -0
  8. package/dist/assets/{DataTableShell-CXnilHFx.js → DataTableShell-DBktq6d-.js} +1 -1
  9. package/dist/assets/{DetailChips-DwhF4wyT.js → DetailChips-DH3IDw6I.js} +1 -1
  10. package/dist/assets/FeedbacksTab-DNz3elBZ.js +1 -0
  11. package/dist/assets/FieldLabel-DEMPCo5Y.js +15 -0
  12. package/dist/assets/FilesTab-vGGdsYrR.js +1 -0
  13. package/dist/assets/{FilterBar-DZweUsOp.js → FilterBar-Cu1qlC3G.js} +1 -1
  14. package/dist/assets/GroupsTab-CiI1owjp.js +1 -0
  15. package/dist/assets/InstancesTab-DX1Hwp_V.js +1 -0
  16. package/dist/assets/IntegrationsTab-DNz616Lx.js +1 -0
  17. package/dist/assets/KpiTab-CmRckoHb.js +1 -0
  18. package/dist/assets/PreferencesTab-CtvFvgix.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-URJKYApx.js +3 -0
  20. package/dist/assets/RolesTab-Byzw-5Kl.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-mRDj-XeX.js +1 -0
  22. package/dist/assets/SubAgentReportsTab-BbTKsOCj.js +1 -0
  23. package/dist/assets/ThemeShowroom-v-RsWLjv.js +1 -0
  24. package/dist/assets/{TimeRangePicker-DatsuATN.js → TimeRangePicker-BiV08HXf.js} +1 -1
  25. package/dist/assets/TracesTab-Cj4eWBiv.js +1 -0
  26. package/dist/assets/UsersTab-D4Stcb0l.js +1 -0
  27. package/dist/assets/button-BaP2jczn.js +1 -0
  28. package/dist/assets/{card-DtbnXpuR.js → card-CU7PsoYg.js} +1 -1
  29. package/dist/assets/chevrons-up-down-BdNhbQVr.js +1 -0
  30. package/dist/assets/{compatView-Be0h8KSS.js → compatView-BHlLzBN_.js} +1 -1
  31. package/dist/assets/dispatchErrorInfo-Cl5q_ZXy.js +1 -0
  32. package/dist/assets/dist-8unVbLZb.js +5 -0
  33. package/dist/assets/{dist-C4sB9wBS.js → dist-BKPj1yrt.js} +1 -1
  34. package/dist/assets/{dist-CSHwMvoK.js → dist-DbxuL-_t.js} +1 -1
  35. package/dist/assets/dist-Dql2za7I.js +1 -0
  36. package/dist/assets/{highlighted-body-OFNGDK62-CJvkRtvs.js → highlighted-body-OFNGDK62-BjMnUUGa.js} +1 -1
  37. package/dist/assets/{index-B9tfYPkk.css → index-FvrgGsz9.css} +1 -1
  38. package/dist/assets/index-cf0xP0kN.js +227 -0
  39. package/dist/assets/mermaid-GHXKKRXX-DtvDzc6u.js +1 -0
  40. package/dist/assets/roleDescriptions-lVphvx8L.js +1 -0
  41. package/dist/assets/{table-Cr9ARpxr.js → table-C5Ypy4Nm.js} +1 -1
  42. package/dist/assets/{tabs-CSXMDWZx.js → tabs-CIgCijas.js} +1 -1
  43. package/dist/assets/x-BpWCNC8c.js +1 -0
  44. package/dist/index.html +8 -8
  45. package/package.json +1 -1
  46. package/dist/assets/AccessTab-DlXLRwUN.js +0 -1
  47. package/dist/assets/AgentFilesTab-ClqrQ6FL.js +0 -3
  48. package/dist/assets/AnomaliesTab-B817-fvy.js +0 -1
  49. package/dist/assets/AuditTab-BuIOG3Jy.js +0 -1
  50. package/dist/assets/BridgeTab-BrpHY1vH.js +0 -1
  51. package/dist/assets/ChatDefaultsTab-BiJe_6Kb.js +0 -1
  52. package/dist/assets/FeedbacksTab-Xo97w2yq.js +0 -1
  53. package/dist/assets/FieldLabel-DszF6BCc.js +0 -4
  54. package/dist/assets/FilesTab-fin_A9Kl.js +0 -1
  55. package/dist/assets/GroupsTab-wn-dxXIg.js +0 -1
  56. package/dist/assets/InstancesTab-BfgriPCp.js +0 -1
  57. package/dist/assets/IntegrationsTab-CknAQ8o3.js +0 -1
  58. package/dist/assets/KpiTab-_sVoFsUQ.js +0 -1
  59. package/dist/assets/PreferencesTab-CrFE2Xny.js +0 -1
  60. package/dist/assets/PromptInjectionsTab-BOdO-Zqo.js +0 -2
  61. package/dist/assets/RolesTab-D4pjVazK.js +0 -1
  62. package/dist/assets/ServiceAccountsTab-DAXUZYQJ.js +0 -1
  63. package/dist/assets/SubAgentReportsTab-BwoSqlZ2.js +0 -1
  64. package/dist/assets/ThemeShowroom-BIP8Pxk3.js +0 -1
  65. package/dist/assets/TracesTab-BhjH9l6x.js +0 -1
  66. package/dist/assets/UsersTab-B0_VG_cI.js +0 -1
  67. package/dist/assets/button-Do9b0Kl0.js +0 -1
  68. package/dist/assets/chevrons-up-down-BNHrpyID.js +0 -1
  69. package/dist/assets/dispatchErrorInfo-CNHPv3Dl.js +0 -1
  70. package/dist/assets/dist-DbJm5w2u.js +0 -5
  71. package/dist/assets/dist-DyqGXOsj.js +0 -1
  72. package/dist/assets/index-Djd_7VwF.js +0 -227
  73. package/dist/assets/mermaid-GHXKKRXX-DmtRrsIr.js +0 -1
  74. package/dist/assets/roleDescriptions-Me-Y5Y5f.js +0 -1
  75. package/dist/assets/x-DxTaDbZb.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ao as r,Bo as i,Do as a,Fo as o,Io as s,Lo as c,Mo as l,No as u,Oo as d,Po as f,Ro as p,Vo as m,ZD as h,iO as g,jo as _,ko as v,wD as y,zo as b}from"./dist-DbxuL-_t.js";import{C as x,S,X as C,b as w,x as T,y as E}from"./index-cf0xP0kN.js";var D=t(e(),1);function O(e){return e===`user`?_():e===`all`?r():v({group:e.group})}function k(e){return e===`common`?d():e===`owner`?a():v({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=g(h.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=g(h.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":i(),children:(0,A.jsx)(x,{placeholder:i()})}),(0,A.jsx)(w,{children:(e??[]).map(e=>(0,A.jsx)(T,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):r===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:p()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:r.user.label}),(0,A.jsx)(C,{variant:`secondary`,children:r.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.groups.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:s()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(C,{variant:`default`,children:l()}):null,(0,A.jsx)(C,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(C,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:o()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(C,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:f()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_c as r,gc as i,hc as a,mc as o,pc as s,vc as c,yc as l}from"./dist-CSHwMvoK.js";import{i as u}from"./dist-DyqGXOsj.js";import{t as d}from"./x-DxTaDbZb.js";import{t as f}from"./button-Do9b0Kl0.js";import{C as p,S as m,Z as h,b as g,bt as _,x as v,y}from"./index-Djd_7VwF.js";import{r as b}from"./TimeRangePicker-DatsuATN.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:l()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let l=(0,x.useRef)(t),w=!!(l.current&&l.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(l.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),c(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(y,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:i()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(y,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(h,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:a()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(_,{}),s()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Jc as r,Kc as i,Qc as a,Xc as o,Yc as s,Zc as c,qc as l}from"./dist-DbxuL-_t.js";import{i as u}from"./dist-Dql2za7I.js";import{t as d}from"./x-BpWCNC8c.js";import{t as f}from"./button-BaP2jczn.js";import{C as p,S as m,Z as h,b as g,bt as _,x as v,y}from"./index-cf0xP0kN.js";import{r as b}from"./TimeRangePicker-BiV08HXf.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:a()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let a=(0,x.useRef)(t),w=!!(a.current&&a.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(a.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),c(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(y,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:s()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(y,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(h,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:r()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(_,{}),i()]})]}):null]})}export{D as t};
@@ -0,0 +1,3 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$r as r,ED as i,Jr as a,Qr as o,Si as s,Xr as c,Yr as l,ZD as u,Zr as d,_i as ee,aa as f,ai as p,bi as te,ci as m,di as h,ei as g,fi as ne,gi as re,hS as _,hi as v,iO as y,ii as b,li as x,mi as ie,ni as S,oi as ae,pi as C,qr as w,ra as oe,ri as T,si as E,tO as D,ti as se,ui as O,vi as k,wD as A,xi as ce,yi as j}from"./dist-DbxuL-_t.js";import{t as M}from"./button-BaP2jczn.js";import{$ as N,A as P,B as F,C as I,F as le,I as ue,L as de,N as fe,P as pe,Q as me,R as he,S as L,X as R,b as z,et as ge,mt as B,nt as _e,ot as V,rt as ve,v as H,x as U,y as W,z as ye}from"./index-cf0xP0kN.js";import{i as G}from"./compatView-BHlLzBN_.js";/* empty css */var K=t(e(),1),q=2e4,J=6e4;function Y(e){return typeof e!=`number`||e<=0?0:Math.round(e/q*100)}function X(e){return e<=0?0:Math.round(e/J*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function be(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var xe=3;function Se(e,t){let n=new Map;for(let t of e.split(`
2
+ `))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
3
+ `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<xe&&a.push(e)):t>0&&(i+=t,o.length<xe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function Ce(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function we(){let e=y(u.me.getMe,{host:V}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=y(u.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!r||r.length===0||(!a||!r.some(e=>e.name===a))&&o(r[0].name)},[t,r,a]);let c=y(u.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),l=y(u.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),d=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return a===null||c===void 0?r!==void 0&&r.length===0?[]:void 0:c.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,c,r,l]),[f,p]=(0,K.useState)(null);(0,K.useEffect)(()=>{!d||d.length===0||(!f||!d.some(e=>$(e)===f))&&p($(d[0]))},[d,f]);let m=d?.find(e=>$(e)===f)??null,g=D(u.agentFiles.listAgentFiles),[_,b]=(0,K.useState)({status:`idle`}),x=m?.instanceName??null,S=m?.agentId??null,ae=y(u.compat.forInstance,n&&x!==null?{instanceName:x}:`skip`),w=n&&x!==null?H(ae,`agentFiles`):null,T=w===null?!1:w===`loading`?null:w.blocked,E=(0,K.useCallback)(async()=>{if(!(x===null||S===null)){b({status:`loading`});try{b({status:`done`,files:(await g({instanceName:x,agentId:S})).files})}catch{b({status:`error`})}}},[g,x,S]);(0,K.useEffect)(()=>{T===!1&&E()},[E,T]);let[se,N]=(0,K.useState)(null),P=i(),F=(0,K.useMemo)(()=>new Intl.NumberFormat(P,{maximumFractionDigits:0}),[P]);return e===void 0||d===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(W,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":ce(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:(r??[]).map(e=>(0,Q.jsx)(U,{value:e.name,children:e.name},e.name))})]}):null,d.length>0?(0,Q.jsxs)(W,{value:f??``,onValueChange:e=>p(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":te(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:d.map(e=>(0,Q.jsx)(U,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()})]}),m===null?null:w===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):w!==null&&w.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(B,{size:14,"aria-hidden":!0}),` `,G(w.gatewayVersion)]}):_.status===`loading`||_.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):_.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ee(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:oe()})]}):_.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:_.files.map(e=>{let n=Y(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(R,{variant:`outline`,children:re()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:v({size:Z(e.size,P)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:ie({pct:F.format(n)})}),r?(0,Q.jsx)(B,{size:14,className:`oc-afiles__warn`,"aria-label":C()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(M,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>N(e),children:t?h():O()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ne({used:Z(be(_.files),P),total:Z(J,P),pct:F.format(X(be(_.files)))})})]}),se&&m?(0,Q.jsx)(Te,{instanceName:m.instanceName,agentId:m.agentId,name:se.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void E()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:s,onClose:ee,onSaved:te}){let h=D(u.agentFiles.getAgentFile),ne=D(u.agentFiles.setAgentFile),re=P(),[v,y]=(0,K.useState)(null),[ie,C]=(0,K.useState)(!1),[O,k]=(0,K.useState)(``),[ce,j]=(0,K.useState)(!1),[I,L]=(0,K.useState)(!1),[R,z]=(0,K.useState)(!1),[B,V]=(0,K.useState)(!1),H=(0,K.useCallback)(async r=>{C(!1);try{let i=await h({instanceName:e,agentId:t,name:n});y({content:i.content,updatedAtMs:i.updatedAtMs}),r||k(i.content),z(!1)}catch{C(!0)}},[h,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(v!==null){L(!0),V(!1);try{await ne({instanceName:e,agentId:t,name:n,content:O,baseUpdatedAtMs:v.updatedAtMs??void 0}),re.success(T({name:n})),te(),await H(!1)}catch(e){Ce(e)?z(!0):V(!0)}finally{L(!1)}}}let W=v!==null&&O!==v.content,G=(0,K.useMemo)(()=>v===null?null:Se(v.content,O),[v,O]),J=O.length>q,Y=i(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(me,{open:!0,onOpenChange:e=>!e&&ee(),children:(0,Q.jsxs)(N,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(ve,{children:x({name:n})}),(0,Q.jsxs)(ge,{children:[m({agent:t,instance:e}),s?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,E()]})]})]}),ie?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[se(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:oe()})]}):v===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:O,readOnly:!s,spellCheck:!1,onChange:e=>k(e.target.value),"aria-label":x({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ae()}),R?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[g(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:r()})]}):null,B?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:S()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:p({count:X.format(O.length),max:X.format(q)})}),s?(0,Q.jsx)(M,{size:`sm`,disabled:!W||I||R,onClick:()=>j(!0),children:I?f():b()}):null]})]}),(0,Q.jsx)(fe,{open:ce,onOpenChange:j,children:(0,Q.jsxs)(ue,{children:[(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(F,{children:o({name:n})}),(0,Q.jsx)(de,{children:d({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:c({added:G.added,removed:G.removed})}),G.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:l()}),G.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,G.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:a()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(he,{children:[(0,Q.jsx)(le,{children:_()}),(0,Q.jsx)(pe,{onClick:()=>void U(),children:w()})]})]})})]})})}export{we as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Am as i,Cm as a,Dm as o,Em as ee,Gp as s,Hp as c,Jp as te,Kp as ne,Om as l,Qp as re,Sm as u,Tm as d,Up as f,Wp as p,Xp as m,Yp as ie,ZD as h,Zp as ae,_m as oe,am as g,bm as se,cm as ce,dm as le,em as ue,fm as de,gm as fe,hm as pe,iO as _,im as me,km as v,lm as he,mm as ge,nm as y,om as b,pm as x,qp as S,rO as C,rm as w,sm as T,tm as E,um as D,vm as O,wm as k,xm as A,ym as j}from"./dist-DbxuL-_t.js";import{A as M,C as N,Mt as P,S as F,X as I,a as L,b as R,j as _e,jt as z,ot as ve,r as ye,x as B,y as V}from"./index-cf0xP0kN.js";import{n as be}from"./TimeRangePicker-BiV08HXf.js";import{t as xe}from"./FilterBar-Cu1qlC3G.js";import{t as Se}from"./DataTableShell-DBktq6d-.js";import{t as H}from"./dispatchErrorInfo-Cl5q_ZXy.js";var U=t(e(),1),W=n(),G=`__all__`,Ce=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function we(e){return e===`open`?i():e===`acknowledged`?v():l()}var Te=[`info`,`warn`,`critical`],Ee=[`detector`,`agent`,`user`],De={kind:`relative`,from:`now-30d`,to:`now`},Oe=200,K=`all`;function q(){let e=P({from:`/settings/anomalies`}),t=z({from:`/settings/anomalies`}),n=e.q??``,i=e.status===K?G:e.status,s=e.severity??G,c=e.kind??G,[l,f]=(0,U.useState)(G),p=ye(e.from,e.to),{from:v,to:H}=be(p),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,status:e===G?K:e})}),Y=e=>void t({search:t=>({...t,severity:e===G?void 0:e})}),Ne=e=>void t({search:t=>({...t,kind:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,...L(e)})}),Pe=_e(),Z=M(),Q=C(h.anomalies.resolveAnomaly),Fe=(_(h.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=_(h.anomalies.listAnomalies,{limit:Oe,filter:{q:n||void 0,from:v,to:H,anomalyStatus:i===G?void 0:i,severity:s===G?void 0:s,source:l===G?void 0:l,kind:c===G?void 0:c}}),Ie=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||i!==`open`||s!==G||l!==G||c!==G||p.kind!==`relative`||p.from!==De.from;function Re(){f(G),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:o(),description:(0,W.jsxs)(W.Fragment,{children:[ee(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,d(),` `,(0,W.jsx)(`strong`,{children:k()}),`.`,` `,a()]}),confirmLabel:u()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(A(),e.kind)}catch(e){Z.error(se(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(j(),e.kind)}catch(e){Z.error(O(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[oe(),` `,(0,W.jsx)(`strong`,{children:fe()}),` `,pe(),` `,(0,W.jsx)(`strong`,{children:ge()}),` `,x(),` `,(0,W.jsx)(`strong`,{children:de()}),` `,le(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:D()})]}),(0,W.jsxs)(xe,{q:n,onQChange:q,searchPlaceholder:he(),timeRange:p,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,W.jsxs)(V,{value:i,onValueChange:J,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:ce()}),Ce.map(e=>(0,W.jsx)(B,{value:e.value,children:we(e.value)},e.value))]})]}),(0,W.jsxs)(V,{value:s,onValueChange:Y,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:T()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:b()}),Te.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:l,onValueChange:f,children:[(0,W.jsx)(F,{size:`sm`,className:`w-32`,children:(0,W.jsx)(N,{placeholder:g()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:me()}),Ee.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:c,onValueChange:Ne,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:w()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:y()}),Ie.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Se,{title:E(),rows:$,emptyHint:i===`open`?ue():r(),rowActions:e=>Fe&&e.status===`open`?[{label:re(),onSelect:()=>void ze(e)},{label:ae(),onSelect:()=>void Be(e)}]:[],columns:[{header:m(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:w(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:T(),cell:e=>(0,W.jsx)(Ae,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ie(),cell:e=>(0,W.jsx)(je,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:g(),cell:e=>(0,W.jsx)(I,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:te(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:S(),cell:e=>(0,W.jsx)(ke,{row:e}),sort:e=>e.evidence??null},{header:ne(),cell:e=>e.correlationId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:Me(e.correlationId)}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function J(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Y(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function ke({row:e}){let t=z();if(e.kind===`subagent.failure`){let n=Y(e);return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,s()]}):null]})}let n=J(e);if(!n.dominantCode)return(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=H(n.dominantCode),i=n.sampleCorrelationId;return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,W.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,W.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,s()]}):null]})}function Ae({severity:e}){return(0,W.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function je({status:e}){return e===`open`?(0,W.jsx)(I,{variant:`destructive`,children:p()}):e===`acknowledged`?(0,W.jsx)(I,{variant:`secondary`,children:f()}):(0,W.jsx)(I,{variant:`outline`,children:c()})}function Me(e){return e.length>8?e.slice(0,8):e}export{q as AnomaliesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,Ch as i,Dh as a,Eh as o,Fh as s,Mh as c,Nh as l,Oh as u,Ph as ee,Sh as d,Th as f,ZD as p,iO as m,jh as h,kh as g,wh as _,xh as v}from"./dist-DbxuL-_t.js";import{C as y,Mt as b,S as x,a as S,b as C,i as w,jt as T,o as E,r as D,t as O,x as k,y as A}from"./index-cf0xP0kN.js";import{n as j}from"./TimeRangePicker-BiV08HXf.js";import{t as M}from"./FilterBar-Cu1qlC3G.js";import{t as N}from"./AdvancedFilter-DX4JYkKu.js";import{t as P}from"./DataTableShell-DBktq6d-.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:O,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=b({from:`/settings/audit`}),t=T({from:`/settings/audit`}),n=e.q??``,O=e.action??R,B=e.impersonated??R,V=e.resource??R,H=D(e.from,e.to),U=(0,F.useMemo)(()=>E(e.adv),[e.adv]),{from:W,to:G}=j(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...S(e)})}),Z=e=>void t({search:t=>({...t,adv:w(e)}),replace:!0}),Q=m(p.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:O===R?void 0:O,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||O!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:ee()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:l(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(A,{value:O,onValueChange:q,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:c()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:h()}),$.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]}),(0,I.jsxs)(A,{value:B,onValueChange:J,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:r()}),(0,I.jsx)(k,{value:`yes`,children:g()}),(0,I.jsx)(k,{value:`no`,children:u()})]})]}),(0,I.jsxs)(A,{value:V,onValueChange:Y,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:a()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:o()}),te.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:f(),rows:Q,emptyHint:_(),columns:[{header:i(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:c(),cell:e=>e.action,sort:e=>e.action},{header:d(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:v(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:a(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,Ad as i,Ar as a,Au as o,Bd as s,Bu as c,Cr as l,Cu as u,Dr as d,Du as f,Er as p,Eu as m,Fd as h,Fu as g,Gu as _,Hd as v,Hu as y,Id as ee,Iu as te,Ju as ne,Ku as b,Ld as re,Lu as ie,Mr as ae,Mu as oe,Nd as se,Nu as x,Or as ce,Ou as le,Pd as ue,Pu as de,QD as S,Qu as fe,Rd as pe,Ru as me,Sr as he,Su as ge,Tr as _e,Tu as ve,Ud as ye,Uu as be,Vu as xe,Wu as Se,Xu as Ce,Yu as we,ZD as C,Zu as Te,ad as Ee,br as De,bu as w,ed as Oe,hr as ke,iO as T,id as Ae,jr as je,ju as Me,kd as Ne,kr as Pe,ku as Fe,nd as Ie,od as Le,qu as Re,rO as ze,rd as Be,sd as Ve,tO as He,td as Ue,wr as We,wu as Ge,xr as Ke,xu as E,yr as qe,yu as D,zd as Je,zu as Ye}from"./dist-DbxuL-_t.js";import{i as O,r as Xe}from"./dist-Dql2za7I.js";import{t as Ze}from"./chevrons-up-down-BdNhbQVr.js";import{i as Qe,n as k,o as $e,r as et,s as tt}from"./FieldLabel-DEMPCo5Y.js";import{t as nt}from"./button-BaP2jczn.js";import{$ as rt,A as it,At as at,C as A,H as ot,Q as st,S as j,St as ct,U as lt,V as ut,X as M,Z as N,_ as dt,_t as ft,b as P,et as pt,jt as mt,kt as F,mt as I,nt as ht,ot as gt,rt as _t,x as L,y as R}from"./index-cf0xP0kN.js";import{a as vt,i as z,n as yt,o as B,r as V,t as bt}from"./table-C5Ypy4Nm.js";import{t as xt}from"./FilterBar-Cu1qlC3G.js";import{a as H,n as St,o as U,r as W,s as Ct,t as wt}from"./compatView-BHlLzBN_.js";import{t as G}from"./dispatchErrorInfo-Cl5q_ZXy.js";var Tt=S(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Et=S(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=t(e(),1);function q(e){return e.filter(e=>e.state===`error`)}function Dt(e){return e.reachable&&q(e.targets).length===0}function Ot(e){return e.state===`error`&&e.lastErrorCode!==null}function kt(e){return!!e.lastDownstreamRejectCode}function J(e){return e.kind??`openclaw`}function At(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function jt(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,J(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(J(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return At(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>J(e)===r)}))}function Mt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,Nt={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function Pt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Ft(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function It(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Lt(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return U(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function Rt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=It(t.key,e),a=It(t.key,r);return i&&a?0:i?1:a?-1:n*Lt(t.key,e,r)})}function zt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function Bt(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function Vt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>U(e,t)??Z(e,t))}var Q=n();function Ht({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(Nt),[i,a]=(0,K.useState)(null),s=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),c=(0,K.useMemo)(()=>zt(s),[s]),l=(0,K.useMemo)(()=>Bt(s),[s]),d=(0,K.useMemo)(()=>Vt(s),[s]),p=(0,K.useMemo)(()=>Rt(Ft(s,n),i),[s,n,i]);function h(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(xt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:de(),onReset:()=>r(Nt),canReset:Pt(n),children:[(0,Q.jsxs)(R,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(A,{placeholder:oe()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(L,{value:Y,children:x()}),c.map(e=>(0,Q.jsx)(L,{value:e,children:Wt(e)},e))]})]}),(0,Q.jsxs)(R,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(A,{placeholder:Me()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(L,{value:Y,children:x()}),l.map(e=>(0,Q.jsx)(L,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(R,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(A,{placeholder:o()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(L,{value:Y,children:x()}),d.map(e=>(0,Q.jsx)(L,{value:e,children:e},e))]})]})]}),p.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):(0,Q.jsxs)(bt,{className:`oc-conn__table`,children:[(0,Q.jsx)(vt,{children:(0,Q.jsxs)(B,{children:[(0,Q.jsx)($,{label:le(),sortKey:`target`,sort:i,onSort:h}),(0,Q.jsx)($,{label:f(),sortKey:`state`,sort:i,onSort:h}),(0,Q.jsx)($,{label:m(),sortKey:`instance`,sort:i,onSort:h}),(0,Q.jsx)($,{label:ve(),sortKey:`host`,sort:i,onSort:h}),(0,Q.jsx)($,{label:Ge(),sortKey:`version`,sort:i,onSort:h}),(0,Q.jsx)(z,{children:u()}),(0,Q.jsx)($,{label:ge(),sortKey:`lastOk`,sort:i,onSort:h})]})}),(0,Q.jsx)(yt,{children:p.map(e=>(0,Q.jsx)(Ut,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(z,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(Xe,{size:13,"aria-hidden":!0}):(0,Q.jsx)(O,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Ut({r:e}){let t=Ot(e)?G(e.lastErrorCode):null,n=kt(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(B,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(V,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(V,{children:(0,Q.jsx)(Gt,{state:e.state})}),(0,Q.jsx)(V,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(V,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(V,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(V,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:te({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(V,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(B,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(V,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[g({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Wt(e){return e===`connected`?E():e===`error`?w():D()}function Gt({state:e}){return e===`connected`?(0,Q.jsx)(M,{variant:`secondary`,children:E()}):e===`error`?(0,Q.jsx)(M,{variant:`destructive`,children:w()}):(0,Q.jsx)(M,{variant:`outline`,children:D()})}function Kt(){return T(C.bridgeHealth.getBridgeHealth,{})}function qt(){let e=Kt(),t=T(C.compat.getBridgeCompat,{}),n=T(C.me.getMe,{host:gt})?.role===`admin`,r=T(C.admin.listInstances,n?{}:`skip`),i=mt(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=jt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&St(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Jt,{health:e,compat:t,onSeeAnomalies:a}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Re()}),o.map(e=>(0,Q.jsx)(Yt,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0},e.key)),l?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}):null]})}function Jt({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:a(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,Pe({build:t.buildVersion??`?`})]}):null,` · `,ce(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?d():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:_()});let s=q(e.targets),l=!e.reachable,u=Dt(e),f=u?`ok`:`error`,p=new Date(e.checkedAt).toLocaleString(`fr-FR`),m=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${f}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u?(0,Q.jsx)(F,{size:22}):l?(0,Q.jsx)(Et,{size:22}):(0,Q.jsx)(I,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:u?Se():l?be():y({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Tt,{size:12,"aria-hidden":!0}),` `,xe({time:p})]}),m?(0,Q.jsx)(`span`,{children:c({time:m})}):null,o]}),l?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ye()})]})}function Yt({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a}){let o=r?Ct(r,e):null,s=new Map;for(let e of n)s.set(e.name,e.displayName??e.name);let c=[],l=new Set;for(let n of t){if(!n.instanceName||l.has(n.instanceName))continue;l.add(n.instanceName);let t=n.gatewayVersion??null;c.push({instanceName:n.instanceName,displayName:s.get(n.instanceName)??n.instanceName,version:t,state:wt(t,e,r)})}let u=c.map(e=>e.state),d=u.includes(`beyond`)?`beyond`:u.length>0&&u.every(e=>e===`supported`)?`supported`:null,[f,p]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(ft,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Mt(e)}),d?(0,Q.jsx)(M,{variant:d===`beyond`?`destructive`:`secondary`,children:W(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ae()}),(0,Q.jsx)(Xt,{support:o,compatStatus:i,compatReachable:a,manifest:r,instanceRows:c}),(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(O,{size:13,"aria-hidden":!0}):(0,Q.jsx)(at,{size:13,"aria-hidden":!0}),me({count:t.length})]}),f?(0,Q.jsx)(Ht,{connections:t,displayByInstance:s}):null]})}function Xt({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:je()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:We()}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:l({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:d()}),e?(0,Q.jsx)(en,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(e.version)}),(0,Q.jsx)(M,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:W(e.state)})]},e.instanceName))})]})}function Zt({instance:e,onClose:t}){return(0,Q.jsx)(st,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(rt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(ht,{children:[(0,Q.jsx)(_t,{children:ye({instance:e.displayName??e.name})}),(0,Q.jsx)(pt,{children:v()})]}),(0,Q.jsx)($t,{instance:e,onClose:t})]})})}function Qt({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(F,{"aria-hidden":!0}):(0,Q.jsx)(I,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Te():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Ce()]}):null}function $t({instance:e,onClose:t}){let n=ze(C.admin.upsertInstanceConfig),a=He(C.bridge.validateMediaPaths),o=it(),[c,l]=(0,K.useState)(()=>Qe(e.config??{})),[u,d]=(0,K.useState)(!1),[f,p]=(0,K.useState)(!1),[m,g]=(0,K.useState)(null),_=c.inboundMediaMode===`shared-fs`,v=c.mediaMode===`shared-fs`,y=_||v;async function te(){p(!0),g(null);try{g(await a({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){o.error(Ue(),e)}finally{p(!1)}}async function b(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:et(c,r)}),t()}catch(e){o.error(h(),e)}finally{d(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:s(),help:ue()}),(0,Q.jsxs)(R,{value:c.mediaMode,onValueChange:e=>l({...c,mediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(A,{})}),(0,Q.jsx)(P,{children:tt.map(e=>(0,Q.jsx)(L,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:Je(),help:se()}),(0,Q.jsxs)(R,{value:c.inboundMediaMode,onValueChange:e=>l({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(A,{})}),(0,Q.jsx)(P,{children:$e.map(e=>(0,Q.jsx)(L,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:pe(),help:i()}),(0,Q.jsx)(N,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>l({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:Ve(),help:Le()}),(0,Q.jsx)(N,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>l({...c,inboundAgentMount:e.target.value})})]}),v&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:Ee(),help:Ae()}),(0,Q.jsx)(N,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>l({...c,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(dt,{checked:c.rehydration,onCheckedChange:e=>l({...c,rehydration:e===!0})}),(0,Q.jsx)(k,{label:re(),help:Ne()})]}),y&&m!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(I,{"aria-hidden":!0}),ne({reason:m.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Qt,{label:r(),result:m.inbound}),(0,Q.jsx)(Qt,{label:fe(),result:m.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(I,{"aria-hidden":!0}),we()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Q.jsxs)(nt,{variant:`outline`,size:`sm`,onClick:()=>void te(),disabled:f,children:[f?(0,Q.jsx)(ct,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?Ie():Be()]}),(0,Q.jsx)(nt,{size:`sm`,onClick:()=>void b(),disabled:u,children:ee()})]})]})})}function en({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(ut,{children:[(0,Q.jsx)(lt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?he():Ke({count:e.length}),(0,Q.jsx)(O,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(ot,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:De()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(M,{variant:`secondary`,children:e},e))})]})]})}export{qt as BridgeTab,Zt as InstanceConfigDialog};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,Br as i,Fr as a,Gr as o,Hr as s,Ir as c,Lr as l,Nr as u,Pr as d,Qi as f,Rr as p,Ur as ee,Vd as m,Vr as te,Wr as ne,ZD as h,aa as g,h as _,hS as re,iO as v,m as y,p as b,rO as x,ra as ie,tO as S,wD as C,xi as w,zr as T}from"./dist-DbxuL-_t.js";import{t as E}from"./button-BaP2jczn.js";import{A as ae,B as oe,C as D,F as se,I as ce,L as le,N as ue,P as de,R as fe,S as pe,Z as O,b as me,g as he,h as k,mt as A,v as j,x as M,y as N,z as P}from"./index-cf0xP0kN.js";import{i as F}from"./compatView-BHlLzBN_.js";/* empty css */var I=t(e(),1),L=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function ge(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var R=n();function _e({instance:e}){let t=x(h.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,I.useState)(n===null?``:String(n)),[a,o]=(0,I.useState)(`idle`);(0,I.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),c=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,u=c===null||Number.isInteger(c)&&c>=1e3&&c<=2e5,d=(c??null)!==n;async function f(){o(`saving`);try{let n={...e.config??{}};c===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=c,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,R.jsx)(O,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!u}),(0,R.jsx)(E,{size:`sm`,disabled:!d||!u||a===`saving`,onClick:()=>void f(),children:a===`saving`?g():T()})]}),u?null:(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:b()}),a===`done`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:p()}):null,a===`error`?(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}):null,(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]})}function z(){let e=S(h.agentFiles.getChatDefaults),t=S(h.agentFiles.setChatDefaults),n=ae(),[_,y]=(0,I.useState)({status:`loading`}),[b,x]=(0,I.useState)({thinkingDefault:null,fastModeDefault:null}),[O,z]=(0,I.useState)(!1),[B,V]=(0,I.useState)(!1),H=v(h.admin.listInstances,{}),[U,W]=(0,I.useState)(null);(0,I.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,ve=H!==void 0&&H.length===0,ye=v(h.compat.forInstance,U?{instanceName:U}:`skip`),K=U?j(ye,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,I.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,I.useRef)(0),X=(0,I.useCallback)(async()=>{let t=++Y.current;y({status:`loading`});try{let n=ge(await e(J));if(Y.current!==t)return;y({status:`done`,current:n}),x(n)}catch{if(Y.current!==t)return;y({status:`error`})}},[e,J]);(0,I.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=_.status===`done`?_.current:null,Q=Z!==null&&b.thinkingDefault!==null&&b.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&b.fastModeDefault!==null&&b.fastModeDefault!==Z.fastModeDefault,be=Q||$;async function xe(){V(!0);try{await t({...J,...Q?{thinkingDefault:b.thinkingDefault}:{},...$?{fastModeDefault:b.fastModeDefault}:{}}),n.success(p()),await X()}catch(e){n.error(l(),e)}finally{V(!1)}}let Se=(0,I.useMemo)(()=>L.map(e=>({id:e,label:he(e)})),[]),Ce=(0,I.useMemo)(()=>[{id:`fast`,label:r()},{id:`standard`,label:f()}],[]);return(0,R.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),G&&U?(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:w()}),(0,R.jsxs)(N,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,R.jsx)(pe,{size:`sm`,"aria-label":w(),children:(0,R.jsx)(D,{})}),(0,R.jsx)(me,{children:(H??[]).map(e=>(0,R.jsx)(M,{value:e.name,children:e.name},e.name))})]})]}):null,ve?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:m()}):K===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):K.blocked?(0,R.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,R.jsx)(A,{size:14,"aria-hidden":!0}),` `,F(K.gatewayVersion)]}):_.status===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):_.status===`error`?(0,R.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[i(),` `,(0,R.jsx)(E,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:ie()})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:ne()}),(0,R.jsx)(k,{options:Se,value:b.thinkingDefault,onChange:e=>x({...b,thinkingDefault:e}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:ee()})]}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,R.jsx)(k,{options:Ce,value:b.fastModeDefault===null?null:b.fastModeDefault?`fast`:`standard`,onChange:e=>x({...b,fastModeDefault:e===`fast`}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:te()})]}),(0,R.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,R.jsx)(E,{size:`sm`,disabled:!be||B,onClick:()=>z(!0),children:B?g():T()})}),(0,R.jsx)(`p`,{className:`oc-cdefaults__note`,children:c()})]}),(()=>{let e=H?.find(e=>e.name===(U??H[0]?.name));return e?(0,R.jsx)(_e,{instance:e}):null})(),(0,R.jsx)(ue,{open:O,onOpenChange:z,children:(0,R.jsxs)(ce,{children:[(0,R.jsxs)(P,{children:[(0,R.jsx)(oe,{children:a()}),(0,R.jsx)(le,{children:d()})]}),(0,R.jsxs)(fe,{children:[(0,R.jsx)(se,{children:re()}),(0,R.jsx)(de,{onClick:()=>void xe(),children:u()})]})]})})]})}export{z as ChatDefaultsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{As as r,Ds as i,Es as a,Os as o,Ts as s,js as c,ks as l}from"./dist-CSHwMvoK.js";import{i as u,r as d}from"./dist-DyqGXOsj.js";import{t as f}from"./chevrons-up-down-BNHrpyID.js";import{t as p}from"./button-Do9b0Kl0.js";import{G as m,J as h,K as g,Tt as _,W as v,Y as y,_ as b,bt as x,ht as S}from"./index-Djd_7VwF.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-Cr9ARpxr.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=c(),bulkActions:F,emptyHint:I=r(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(S,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(b,{"aria-label":o(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":s({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(b,{"aria-label":i(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(y,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(_,{})})}),(0,M.jsx)(m,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{ac as r,cc as i,ic as a,lc as o,oc as s,sc as c,uc as l}from"./dist-DbxuL-_t.js";import{i as u,r as d}from"./dist-Dql2za7I.js";import{t as f}from"./chevrons-up-down-BdNhbQVr.js";import{t as p}from"./button-BaP2jczn.js";import{G as m,J as h,K as g,Tt as _,W as v,Y as y,_ as b,bt as x,ht as S}from"./index-cf0xP0kN.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-C5Ypy4Nm.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=l(),bulkActions:F,emptyHint:I=o(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(S,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(b,{"aria-label":c(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":a({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],i=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(b,{"aria-label":s(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(y,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":r(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(_,{})})}),(0,M.jsx)(m,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),i&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{X as t}from"./index-Djd_7VwF.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{X as t}from"./index-cf0xP0kN.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,Av as i,Bv as a,Cv as o,Dv as s,Ev as c,Fv as l,Gv as u,Hv as d,Iv as f,Jv as p,Kv as m,Lv as ee,Mv as h,Nv as g,Ov as _,Pv as v,Q_ as y,Rv as te,Sv as ne,Tv as re,Uv as b,Vv as ie,Wv as x,X_ as S,Xv as C,Yv as w,ZD as T,Z_ as E,Zv as D,_v as O,av as k,bv as A,cv as j,dv as M,ev as N,fv as P,gv as F,hv as I,iO as L,iv as R,jv as z,kv as B,lv as ae,mv as V,nv as H,ov as U,pv as W,qv as G,rO as K,rv as q,sv as J,tv as oe,uv as se,vv as ce,wv as le,xv as ue,yv as de,zv as fe}from"./dist-DbxuL-_t.js";import{t as pe}from"./button-BaP2jczn.js";import{j as me}from"./index-cf0xP0kN.js";import{t as he}from"./DataTableShell-DBktq6d-.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>D(),incorrect:()=>C(),incoherence:()=>w(),formatting:()=>p(),latency:()=>G(),api_error:()=>m(),other:()=>u()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:b()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:d()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:x()})}function ge({data:e,closeReason:t}){let n=e.snapshot,r=K(T.feedback.respondToFeedback),[u,d]=(0,Y.useState)(e.thread),[p,m]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(!1);async function x(){let t=p.trim();if(!(!t||y)){b(!0);try{await r({feedbackId:e._id,text:t}),d(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),m(``)}finally{b(!1)}}}let S=[];try{S=n.contextJson?JSON.parse(n.contextJson):[]}catch{S=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${ie()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),u.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:u.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,X.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?te():ee()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:f()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:l(),value:p,maxLength:2e3,rows:3,onChange:e=>m(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(pe,{size:`sm`,onClick:()=>void x(),disabled:!p.trim()||y,children:y?v():g()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:h()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||z()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:i()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||z()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:B()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,S.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_({count:n.contextCount??S.length,truncated:n.contextTruncated?s():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:S.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:c()}),(0,X.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?o({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[ne(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,ue()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=L(T.feedback.listForAdmin,{}),t=K(T.feedback.readSnapshot),n=K(T.feedback.deleteFeedback),i=me(),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)({});async function l(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});c(t=>({...t,[e._id]:n}))}o(e._id)}async function u(e){await i({title:y(),description:E(),confirmLabel:S(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&o(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[A(),` `,(0,X.jsx)(`strong`,{children:de()}),` `,ce()]}),(0,X.jsx)(he,{title:O(),rows:e,emptyHint:F(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,X.jsx)(ge,{data:s[e._id],closeReason:e.userCloseReason}):null,columns:[{header:I(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:V(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:W(),cell:e=>e.messageRole===`user`?P():M(),sort:e=>e.messageRole},{header:se(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${ae({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:j(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:J(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:U(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:k()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:R()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:q()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:a===e._id?oe():N(),onSelect:()=>void l(e)},{label:r(),onSelect:()=>void u(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
@@ -0,0 +1,15 @@
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{QD as t,dO as n}from"./dist-DbxuL-_t.js";import{c as r,l as i,s as a,u as o}from"./index-cf0xP0kN.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:`[LIVRAISON]
2
+ Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
3
+ {references}`,disabledTemplate:`{references}`},inbound_files:{key:`inbound_files`,appliedIn:`bridge`,togglable:!0,placeholders:[`files`],defaultTemplate:`[FICHIERS REÇUS]
4
+ {files}`},history_summary:{key:`history_summary`,appliedIn:`convex`,togglable:!0,placeholders:[`previous_summary`,`new_messages`,`max_chars`],defaultTemplate:`[SYNTHÈSE DE CONVERSATION]
5
+ Tu maintiens le résumé cumulatif d'une conversation entre un utilisateur et un assistant. Mets à jour le résumé existant en y intégrant les nouveaux messages. Conserve : décisions, faits, chiffres, engagements, préférences exprimées, questions ouvertes. Style : factuel, compact, même langue que la conversation. Réponds UNIQUEMENT avec le résumé mis à jour, sans commentaire, en {max_chars} caractères au maximum.
6
+
7
+ [RÉSUMÉ EXISTANT]
8
+ {previous_summary}
9
+
10
+ [NOUVEAUX MESSAGES]
11
+ {new_messages}`,disabledTemplate:`[RÉSUMÉ EXISTANT]
12
+ {previous_summary}
13
+
14
+ [NOUVEAUX MESSAGES]
15
+ {new_messages}`}},l=Object.keys(c);function u(e,t){return t.enabled?t.template:c[e].disabledTemplate??``}function d(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:r})}var f=[`gateway-http`,`shared-fs`,`off`],p=[`inline`,`shared-fs`],m=[`reactive`,`sse`],h=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),summarizeThresholdChars:n.optional(n.number()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var g={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function _(e){let t={};for(let n of l){let r=e?.[n];t[n]={enabled:r?.enabled??!0,template:typeof r?.template==`string`&&r.template.length>0?r.template:c[n].defaultTemplate}}return t}function v(e){let t={};for(let n of l){let r=c[n],i=e[n];if(!i)continue;let a={};r.togglable&&i.enabled===!1&&(a.enabled=!1);let o=i.template.trim();o.length>0&&o!==r.defaultTemplate&&(a.template=o),(a.enabled!==void 0||a.template!==void 0)&&(t[n]=a)}return t}function y(e){return{mediaMode:e.mediaMode??g.mediaMode,inboundMediaMode:e.inboundMediaMode??g.inboundMediaMode,rehydration:e.rehydration??g.rehydration,mediaMaxMb:e.mediaMaxMb??g.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??g.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??g.outboundAgentMount,promptInjections:_(e.promptInjections)}}var b=[`summarizeThresholdChars`];function x(e,t){let n={},r=r=>{(e[r]!==g[r]||t[r]!==void 0)&&(n[r]=e[r])};r(`mediaMode`),r(`inboundMediaMode`),r(`rehydration`),r(`mediaMaxMb`),r(`inboundAgentMount`),r(`outboundAgentMount`);let i=v(e.promptInjections);Object.keys(i).length>0&&(n.promptInjections=i);let a=t;for(let e of b)typeof a[e]==`number`&&(n[e]=a[e]);return n}var S=e();function C({text:e}){return(0,S.jsx)(i,{delayDuration:150,children:(0,S.jsxs)(a,{children:[(0,S.jsx)(o,{asChild:!0,children:(0,S.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,S.jsx)(s,{"aria-hidden":!0})})}),(0,S.jsx)(r,{className:`max-w-xs text-pretty`,children:e})]})})}function w({label:e,help:t}){return(0,S.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,S.jsx)(C,{text:t})]})}export{h as a,m as c,u as d,d as f,y as i,c as l,w as n,p as o,x as r,f as s,C as t,l as u};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,AE as ee,BE as i,CE as te,DE as ne,ED as re,EE as ie,FE as ae,GE as a,HE as o,IE as s,JE as c,KE as l,LE as u,ME as d,NE as oe,OE as se,PE as ce,QE as f,RE as le,SE as ue,TE as de,UE as p,VE as m,WE as h,XE as fe,YE as pe,ZD as g,ZE as me,eD as he,hS as ge,iO as _e,jE as ve,kE as _,nD as v,qE as y,rO as b,tD as x,wD as S,wE as C,xE as w,zE as T}from"./dist-DbxuL-_t.js";import{t as E}from"./button-BaP2jczn.js";import{A as D,B as O,C as k,Et as A,F as j,G as M,I as N,K as P,L as F,N as ye,P as be,R as xe,S as I,Tt as Se,W as Ce,X as we,Y as Te,b as L,ht as Ee,x as R,y as z,yt as De,z as Oe}from"./index-cf0xP0kN.js";import{a as ke,i as B,n as Ae,o as V,r as H,t as je}from"./table-C5Ypy4Nm.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return a();case`audio`:return h();case`video`:return p();case`pdf`:return o();case`document`:return m();case`archive`:return i();default:return T()}}function q(){let[e,t]=(0,U.useState)(G),[n,i]=(0,U.useState)(G),[a,o]=(0,U.useState)(G),[p,m]=(0,U.useState)(G),[h,T]=(0,U.useState)(null),q=b(g.files.softDelete),J=D();function Me(){t(G),i(G),o(G),m(G)}async function Ne(){let e=h;if(T(null),e)try{await q({fileId:e.id}),J.success(se())}catch(e){J.error(ne(),e)}}let Y=_e(g.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:a===G?void 0:a,category:p===G?void 0:p}),X=(0,U.useMemo)(()=>new Intl.DateTimeFormat(re(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(Y===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:S()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=Y,$=e!==G||n!==G||a!==G||p!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(z,{value:e,onValueChange:t,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":x(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:he()}),(0,W.jsx)(R,{value:`inbound`,children:r()}),(0,W.jsx)(R,{value:`outbound`,children:f()})]})]}),(0,W.jsxs)(z,{value:n,onValueChange:i,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":me(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:fe()}),Q.chats.map(e=>(0,W.jsx)(R,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(z,{value:a,onValueChange:o,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":pe(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:c()}),Q.instances.map(e=>(0,W.jsx)(R,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(z,{value:p,onValueChange:m,children:[(0,W.jsx)(I,{size:`sm`,"aria-label":y(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:l()}),Q.categories.map(e=>(0,W.jsx)(R,{value:e,children:K(e)},e))]})]}),$?(0,W.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Me,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(De,{size:14,"aria-hidden":!0}),ve()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?ue():te()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(je,{children:[(0,W.jsx)(ke,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:le()}),(0,W.jsx)(B,{children:u()}),(0,W.jsx)(B,{children:s()}),(0,W.jsx)(B,{children:ae()}),(0,W.jsx)(B,{children:ce()}),(0,W.jsx)(B,{className:`text-right`,children:oe()})]})}),(0,W.jsx)(Ae,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsx)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(we,{variant:`secondary`,children:e.direction===`inbound`?r():f()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:X.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Ce,{children:[(0,W.jsx)(Te,{asChild:!0,children:(0,W.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":ee(),children:(0,W.jsx)(Se,{size:16})})}),(0,W.jsxs)(M,{align:`end`,children:[e.url?(0,W.jsx)(P,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(A,{size:14}),d()]})}):(0,W.jsxs)(P,{disabled:!0,children:[(0,W.jsx)(A,{size:14}),C()]}),(0,W.jsxs)(P,{variant:`destructive`,onSelect:()=>T({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Ee,{size:14}),_()]})]})]})})]},e._id))})]}),Pe?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:w({cap:Fe})}):null]}),(0,W.jsx)(ye,{open:h!==null,onOpenChange:e=>!e&&T(null),children:(0,W.jsxs)(N,{children:[(0,W.jsxs)(Oe,{children:[(0,W.jsx)(O,{children:ie()}),(0,W.jsx)(F,{children:de()})]}),(0,W.jsxs)(xe,{children:[(0,W.jsx)(j,{children:ge()}),(0,W.jsx)(be,{onClick:()=>void Ne(),children:_()})]})]})})]})}export{q as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ms as r,Ns as i}from"./dist-CSHwMvoK.js";import{t as a}from"./button-Do9b0Kl0.js";import{Z as o,vt as s,yt as c}from"./index-Djd_7VwF.js";import{t as l}from"./TimeRangePicker-DatsuATN.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(o,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(c,{}),r()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{dc as r,fc as i}from"./dist-DbxuL-_t.js";import{t as a}from"./button-BaP2jczn.js";import{Z as o,vt as s,yt as c}from"./index-cf0xP0kN.js";import{t as l}from"./TimeRangePicker-BiV08HXf.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(o,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(c,{}),r()]})]})}export{p as t};
@@ -0,0 +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,Co as s,Da as c,Ea as l,Eo 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,Oa as b,Pa as x,QD as S,Qa as ee,Ra as te,Sa as ne,So as C,Ta as re,To as w,Ua as T,Va as E,Wa as ie,Xa as D,Ya as ae,ZD as O,Za as k,_a as A,_o as j,ao as M,ba as oe,bo as se,co as N,do as ce,eo as le,fo as P,go as F,ho as ue,iO as I,io as de,ja as fe,ka as pe,lo as me,mo as he,no as ge,oo as _e,po as ve,qa as ye,rO as L,ro as be,so as xe,to as Se,uo as Ce,va as we,vo as Te,wa as Ee,wo as De,xa as R,xo as Oe,ya as ke,yo as Ae,za as je}from"./dist-DbxuL-_t.js";import{t as Me}from"./x-BpWCNC8c.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-CIgCijas.js";import{t as V}from"./button-BaP2jczn.js";import{$ as Fe,A as H,At as Ie,C as Le,Q as Re,S as ze,X as U,Z as W,_ as G,_t as K,b as Be,et as Ve,gt as q,j as He,m as Ue,nt as We,ot as Ge,rt as Ke,x as qe,y as Je}from"./index-cf0xP0kN.js";import{t as Ye}from"./FilterBar-Cu1qlC3G.js";import{t as Xe}from"./DataTableShell-DBktq6d-.js";import{t as J}from"./DetailChips-DH3IDw6I.js";var Ze=S(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Qe=S(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Y=S(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),$e=S(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),X=t(e(),1);function et(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function tt(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function nt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function rt(e){switch(e){case`admin`:return ye();case`user`:return g();case`pending`:return f();default:return e}}function Z(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=I(O.groups.listGroups,{}),t=I(O.me.getMe,{host:Ge})?.role===`admin`,n=L(O.groups.createGroup),r=L(O.groups.updateGroup),i=L(O.groups.deleteGroup),a=He(),o=H(),[c,l]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)($),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(``),y=(0,X.useMemo)(()=>{if(!e)return e;let t=_.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,_]);function b(){f(null),m($),l(!0)}function x(e){f(e),m({name:e.name,description:e.description??``}),l(!0)}async function S(){try{d?await r({groupId:d._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),m($),f(null),l(!1)}catch(e){o.error(oe(),e)}}async function ee(e){if(await a({title:xe({name:e.name}),description:_e(),confirmWord:e.name,confirmLabel:M(),cancelLabel:ve(),destructive:!0}))try{await i({groupId:e._id})}catch(e){o.error(ke(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,Q.jsx)(Ye,{q:_,onQChange:v,onReset:()=>v(``),canReset:_!==``,searchPlaceholder:Te()}),(0,Q.jsx)(Xe,{title:u(),rows:y,addLabel:De(),onAdd:t?b:void 0,emptyHint:s(),columns:[{header:C(),cell:e=>e.name,sort:e=>e.name},{header:Oe(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)($e,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(Y,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:se(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:Ae(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(q,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:j(),onSelect:()=>g({groupId:e._id,name:e.name})},...t?[{label:F(),onSelect:()=>x(e)},{label:ue(),variant:`destructive`,onSelect:()=>void ee(e)}]:[]]}),(0,Q.jsx)(Ue,{open:c,onOpenChange:l,title:d?ce():P(),description:Ce(),canSubmit:!!p.name.trim(),onSubmit:S,submitLabel:he(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:me()}),(0,Q.jsx)(W,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:N()}),(0,Q.jsx)(W,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:h?.groupId??null,groupName:h?.name??``,open:h!==null,onOpenChange:e=>{e||g(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Ze,{size:14,"aria-hidden":!0}),D()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":h({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ae(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let s=I(O.groups.getGroup,n&&e?{groupId:e}:`skip`),c=I(O.groups.listAssignableInstances,n?{}:`skip`),l=I(O.groups.listAssignableUsers,n?{}:`skip`),u=L(O.groups.addMember),d=L(O.groups.removeMember),f=L(O.groups.bulkSetMembers),m=L(O.groups.setGroupManager),h=H(),[g,_]=(0,X.useState)(``),[v,b]=(0,X.useState)(``),[x,S]=(0,X.useState)(`members`),[te,C]=(0,X.useState)(1),[w,T]=(0,X.useState)(new Set),E=(0,X.useRef)(null),D=(0,X.useMemo)(()=>new Set((s?.members??[]).map(e=>e.userId)),[s]),ae=(0,X.useMemo)(()=>new Set((s?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[s]),A=s?.viewerIsAdmin===!0,j=(0,X.useMemo)(()=>new Set((s?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[s]);(0,X.useEffect)(()=>{_(``),b(``),S(`members`),C(1),E.current=null},[n,e]),(0,X.useEffect)(()=>{C(1)},[g]),(0,X.useEffect)(()=>{n&&s&&e&&E.current!==e&&(E.current=e,T(new Set((s.members??[]).map(e=>e.userId))))},[n,s,e]);let M=(0,X.useMemo)(()=>l?et(l,g,w):[],[l,g,w]);async function oe(t,n){if(e)try{n?await d({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){h.error(we(),e)}}async function se(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){h.error(ne(),e)}}let N=Z(M,e=>D.has(e.userId)),ce=M.filter(e=>D.has(e.userId)).length,P=it(M,te,ot);async function F(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:N!==`all`})}catch(e){h.error(we(),e)}}return(0,Q.jsx)(Re,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Fe,{className:`oc-access`,children:[(0,Q.jsxs)(We,{children:[(0,Q.jsx)(Ke,{children:de({name:t})}),(0,Q.jsx)(Ve,{children:be()})]}),(0,Q.jsxs)(Pe,{value:x,onValueChange:S,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)($e,{size:13,"aria-hidden":!0}),ge(),s?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:D.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),le(),s?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),y(),s?(0,Q.jsx)(U,{variant:`secondary`,className:`oc-access__tabcount`,children:s.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:l===void 0||s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{value:g,onChange:e=>_(e.target.value),placeholder:Se(),className:`oc-access__search`}),M.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ee()}):(0,Q.jsxs)(Q.Fragment,{children:[M.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(G,{checked:N===`all`?!0:N===`some`?`indeterminate`:!1,onCheckedChange:()=>void F(),"aria-label":k()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:k()}),(0,Q.jsxs)(U,{variant:`outline`,className:`oc-access__count`,children:[ce,` / `,M.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:P.pageItems.map(e=>{let t=D.has(e.userId),n=nt(e),r=ae.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(G,{checked:t,onCheckedChange:()=>void oe(e.userId,t),"aria-label":ie({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__role`,children:rt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&A?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?o():Ee(),title:r?o():Ee(),onClick:()=>void se(e.userId,r),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":re(),title:re(),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:P.page,pageCount:P.pageCount,onPage:C})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:c===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:je()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{value:v,onChange:e=>b(e.target.value),placeholder:r(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:j,query:v},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=I(O.groups.listAssignableAgents,{instanceName:t}),o=L(O.groups.assignAgentToGroup),s=L(O.groups.removeAgentFromGroup),c=L(O.groups.bulkSetGroupAgents),l=H(),[u,f]=(0,X.useState)(1);if((0,X.useEffect)(()=>{f(1)},[i]),!e)return null;let p=tt(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let g=p.filter(e=>e.presentInLastOk!==!1),v=Z(g,e=>r.has(`${t}/${e.agentId}`)),y=it(p,u,ot);async function b(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(A(),e)}}async function S(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){l.error(A(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__stale`,children:m()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:E()}):p.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h?_():te()}):(0,Q.jsxs)(Q.Fragment,{children:[g.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(G,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void S(),"aria-label":k()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:k()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(G,{checked:i,disabled:a&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":T({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":x(),title:x(),children:(0,Q.jsx)(q,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(U,{variant:`outline`,className:`oc-access__gone`,children:d()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:f})]})]})}function ut({groupId:e}){let t=I(O.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=L(O.charts.assignChartToGroup),r=L(O.charts.removeChartFromGroup),a=L(O.charts.setGroupDefaultChart),o=L(O.charts.addChartToGroupPool),s=L(O.charts.removeChartFromGroupPool),u=H();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()});let{pool:d,addable:f,canManagePool:m}=t;if(d.length===0&&!m)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:v()});async function h(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){u.error(R(),e)}}async function g(t){try{await a({groupId:e,chartKey:t})}catch(e){u.error(R(),e)}}async function _(t){try{await o({groupId:e,chartKey:t})}catch(e){u.error(R(),e)}}async function y(t){try{await s({groupId:e,chartKey:t})}catch(e){u.error(R(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:d.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(G,{checked:e.selected,onCheckedChange:()=>void h(e.chartKey,e.selected),"aria-label":b({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":c(),title:c(),children:(0,Q.jsx)(q,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:l()}):null,m?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":pe({name:e.name}),title:pe({name:e.name}),onClick:()=>void y(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),m?f.length>0?(0,Q.jsxs)(Je,{value:``,onValueChange:e=>void _(e),children:[(0,Q.jsx)(ze,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Le,{placeholder:i()})}),(0,Q.jsx)(Be,{children:f.map(e=>(0,Q.jsx)(qe,{value:e.chartKey,children:e.name},e.chartKey))})]}):d.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):null:null]})}export{at as GroupsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,$h as i,A as a,Ag as o,Bg as s,Bh as c,Cg as l,Dg as u,Eg as d,Fg as f,Gg as p,Gh as m,Hg as h,Hh as g,Ig as _,Ih as v,Jg as y,Jh as b,Kg as x,Kh as S,Lg as ee,Lh as C,Md as w,Mg as T,Ng as te,Og as E,Pg as ne,Qg as D,Qh as O,Rg as k,Rh as A,S_ as j,Sg as M,Tg as re,Ug as ie,Uh as ae,Vg as oe,Vh as se,Wg as ce,Wh as le,Xg as ue,Xh as de,Yg as fe,Yh as pe,ZD as N,Zg as me,Zh as he,__ as ge,_g as _e,aC as ve,a_ as ye,ag as be,b_ as xe,bg as Se,c_ as Ce,cg as we,d_ as Te,dg as Ee,e_ as De,eg as Oe,f_ as ke,fg as Ae,g_ as je,gg as Me,h_ as Ne,hg as Pe,iC as Fe,iO as P,i_ as Ie,ig as Le,j as Re,jd as ze,jg as Be,kg as Ve,l_ as He,lg as Ue,m_ as We,mg as Ge,n_ as Ke,ng as qe,o_ as Je,og as F,p_ as Ye,pg as Xe,qg as Ze,qh as Qe,rO as I,r_ as $e,rg as L,s_ as et,sg as tt,tO as R,t_ as nt,tg as rt,u_ as it,ug as at,v_ as ot,vg as st,wg as ct,x_ as lt,xg as ut,y_ as dt,yg as ft,zg as z,zh as pt}from"./dist-DbxuL-_t.js";import{a as mt,c as ht}from"./FieldLabel-DEMPCo5Y.js";import{t as B}from"./button-BaP2jczn.js";import{$ as V,A as H,C as U,H as gt,Q as W,S as G,U as _t,V as vt,X as K,Z as q,_ as yt,b as bt,et as xt,j as St,m as Ct,nt as wt,rt as Tt,x as J,y as Et}from"./index-cf0xP0kN.js";import{t as Dt}from"./DataTableShell-DBktq6d-.js";import{InstanceConfigDialog as Ot}from"./BridgeTab-B4QV2N_w.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`],kt=new Set(X),At=`conversational`;function jt(e){let t=new Set((e??[]).filter(e=>kt.has(e)));return t.size===0?[At]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:mt},Mt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Pt(){let e=P(N.admin.listInstances,{}),t=P(N.agents.listAllInstanceAgents,{}),n=I(N.admin.upsertInstance),i=I(N.admin.deleteInstance),a=H(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(Q),[u,d]=(0,Y.useState)(null),[f,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null);async function b(){try{await n({instanceId:_??void 0,name:c.name,gatewayUrl:c.gatewayUrl,bridgeUrl:c.bridgeUrl||void 0,displayName:c.displayName||void 0,kind:c.kind,gatewayVersion:c.gatewayVersion||void 0,gatewayHttpUrl:c.gatewayHttpUrl||void 0,streamTransport:c.streamTransport}),l(Q),v(null),s(!1)}catch(e){a.error(xe(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[dt(),(0,Z.jsx)(`strong`,{children:ot()}),ge()]}),(0,Z.jsx)(Dt,{title:je(),rows:e,addLabel:Ne(),onAdd:()=>{v(null),l(Q),s(!0)},emptyHint:We(),columns:[{header:Ye(),cell:e=>e.name,sort:e=>e.name},{header:ke(),cell:e=>(0,Z.jsx)(K,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Te(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:it(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:j(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(K,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?C():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Je(),onSelect:()=>{v(e._id),l(Nt(e)),s(!0)}},{label:lt(),onSelect:()=>d(e.name)},{label:p(),onSelect:()=>g(e)},{label:He(),onSelect:()=>m(e)},{label:Ce(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:Ce(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(Ct,{open:o,onOpenChange:s,title:_?ye():et(),description:$e(),canSubmit:!!(c.name&&c.gatewayUrl),onSubmit:b,submitLabel:Ke(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:nt(),children:[(0,Z.jsx)(q,{value:c.name,disabled:_!==null,onChange:e=>l({...c,name:e.target.value})}),_?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ie()}):null]}),(0,Z.jsx)($,{label:De(),children:(0,Z.jsxs)(Et,{value:c.kind,onValueChange:e=>l({...c,kind:e}),children:[(0,Z.jsx)(G,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(bt,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:r(),children:(0,Z.jsx)(q,{value:c.gatewayUrl,onChange:e=>l({...c,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:D(),children:(0,Z.jsx)(q,{value:c.bridgeUrl,placeholder:me(),onChange:e=>l({...c,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:ue(),children:(0,Z.jsx)(q,{value:c.displayName,onChange:e=>l({...c,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:w(),children:[(0,Z.jsxs)(Et,{value:c.streamTransport,onValueChange:e=>l({...c,streamTransport:e}),children:[(0,Z.jsx)(G,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(U,{})}),(0,Z.jsx)(bt,{children:ht.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ze()})]}),(0,Z.jsx)($,{label:fe(),children:(0,Z.jsx)(q,{value:c.gatewayVersion,placeholder:y(),onChange:e=>l({...c,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Ze(),children:(0,Z.jsx)(q,{value:c.gatewayHttpUrl,placeholder:x(),onChange:e=>l({...c,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wt,{instanceName:u,open:u!==null,onOpenChange:e=>{e||d(null)}}),f?(0,Z.jsx)(Ot,{instance:f,onClose:()=>m(null)},f._id):null,h?(0,Z.jsx)(Ft,{instance:h,onClose:()=>g(null)},h._id):null]})}function Ft({instance:e,onClose:t}){let n=P(N.instanceSecrets.listInstanceSecretStatus,{}),r=Mt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(W,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(V,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Tt,{children:ce({instance:e.displayName??e.name})}),(0,Z.jsx)(xt,{children:ie()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Rt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Lt,{instance:e})}),(0,Z.jsx)(It,{instance:e})]})})}function It({instance:e}){let t=R(N.instanceSync.forceInstanceSync),n=H(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(l());break;case`no_agents`:n.success(ut());break;case`no_bridge_url`:n.error(Se());break;case`deploy_misconfigured`:n.error(ft());break;case`unauthorized`:n.error(_e());break;case`not_served`:n.error(Me());break;default:n.error(st());break}}catch(e){n.error(M(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(B,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?ct():re()})})]})}function Lt({instance:e}){let t=P(N.bridgeAuth.listBridgeAuthStatus,{}),n=R(N.bridgeAuth.mintBridgeSecret),r=I(N.bridgeAuth.revokeBridgeSecret),i=H(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(we(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(Ue())}catch(e){i.error(we(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:Ge(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(K,{variant:f?`outline`:`secondary`,children:f?`${z()} · ${d.prefix}…${d.lastFour}`:k()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(B,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?Ee():Ae()}),f?(0,Z.jsx)(B,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:at()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:tt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?ve():Fe()})]}),(0,Z.jsx)(B,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:F()})]}):null]})}function Rt({instanceId:e,field:t,updatedAt:n}){let r=R(N.instanceSecrets.setInstanceSecret),i=I(N.instanceSecrets.clearInstanceSecret),a=R(N.deviceIdentity.generateDeviceIdentity),c=H(),[l,p]=(0,Y.useState)(``),[m,g]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(!1),S=n!==null,C=t===`deviceIdentity`,w=t===`token`?h():t===`deviceIdentity`?oe():s();async function D(){if(!(!l.trim()||m)){g(!0);try{await r({instanceId:e,field:t,plaintext:l}),p(``),y(null),x(!1),c.success(te())}catch(e){c.error(T(),e)}finally{g(!1)}}}async function O(){if(!m){g(!0);try{await i({instanceId:e,field:t}),y(null),x(!1),c.success(Be())}catch(e){c.error(T(),e)}finally{g(!1)}}}async function A(){if(!m){g(!0);try{y(await a({instanceId:e})),x(!1),c.success(E())}catch(e){c.error(d(),e)}finally{g(!1)}}}let j=v?`openclaw devices approve ${v.id}`:``;async function M(){if(j)try{await navigator.clipboard.writeText(j),x(!0)}catch{}}return(0,Z.jsxs)($,{label:w,children:[C?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(K,{variant:S?`outline`:`secondary`,children:S?z():k()}),(0,Z.jsx)(q,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:S?_():ee(),onChange:e=>p(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(B,{size:`sm`,onClick:()=>void D(),disabled:m||l.trim().length===0,children:f()}),C?(0,Z.jsx)(B,{size:`sm`,variant:`outline`,onClick:()=>void A(),disabled:m,children:o()}):null,S?(0,Z.jsx)(B,{size:`sm`,variant:`destructive`,onClick:()=>void O(),disabled:m,children:ne()}):null]})]}),v?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:E()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:j}),(0,Z.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>void M(),children:b?ve():Fe()})]}),(0,Z.jsx)(B,{size:`sm`,variant:`ghost`,onClick:()=>{y(null),x(!1)},children:F()})]}):null]})}var zt={conversational:O,documentary:de,summarizer:Re},Bt={conversational:he,documentary:pe,summarizer:a},Vt=e=>(zt[e]??(()=>e))(),Ht=e=>(Bt[e]??(()=>``))();function Ut({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:qe()}),t.map(e=>(0,Z.jsx)(K,{variant:`secondary`,className:`oc-agenttype__chip`,title:Ht(e),children:Vt(e)},e)),(0,Z.jsxs)(vt,{children:[(0,Z.jsx)(_t,{asChild:!0,children:(0,Z.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:rt()})}),(0,Z.jsxs)(gt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Oe()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:i()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(yt,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Vt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Ht(r)})]})]},r)})})]})]})]})}function Wt({instanceName:e,open:t,onOpenChange:n}){let r=P(N.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=I(N.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=I(N.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=I(N.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jt(r);e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=I(N.agents.removeInstanceAgent),l=St(),u=H();async function d(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(L(),e)}}async function f(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){u.error(L(),e)}}async function p(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){u.error(L(),e)}}async function h(t,n){if(e&&await l({title:S({name:n}),description:m(),confirmLabel:le(),destructive:!0}))try{await s({instanceName:e,agentId:t}),u.success(ae())}catch(e){u.error(L(),e)}}return(0,Z.jsx)(W,{open:t,onOpenChange:n,children:(0,Z.jsxs)(V,{className:`oc-access`,children:[(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Tt,{children:be({name:e??``})}),(0,Z.jsx)(xt,{children:Le()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:g()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?se():r.discovery.lastPollOk?c():pt({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:A()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(yt,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void d(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:v()}),(0,Z.jsx)(B,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(e.agentId,i),children:Qe()})]}):n?(0,Z.jsx)(K,{variant:`default`,children:C()}):(0,Z.jsx)(B,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void f(e.agentId),children:b()})]}),e.enabled?(0,Z.jsx)(Ut,{agentId:e.agentId,types:a,onToggle:t=>void p(e.agentId,t,a)}):null]},e.agentId)})})]})]})})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Pt as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Ay as i,By as a,Cy as o,Dy as s,Ey as c,Fy as l,Gt as u,Hy as d,Iy as f,Jt as p,Kt as m,Ly as h,My as ee,Ny as te,Oy as g,Py as _,Qt as ne,Qv as re,Ry as v,Sy as ie,Ty as ae,Uy as oe,Vy as se,Wt as y,Wy as ce,Xt as le,Yt as ue,ZD as b,Zt as x,_y as S,ay as C,by as w,cy as T,dy as E,ey as D,fy as O,gy as k,hy as A,iO as j,iy as M,jy as N,ky as P,ly as F,my as I,ny as L,oy as R,py as z,qt as B,rO as V,ry as H,sy as de,tO as fe,ty as pe,uy as me,vy as he,wy as ge,xy as _e,yy as U,zy as W}from"./dist-DbxuL-_t.js";import{t as G}from"./button-BaP2jczn.js";import{C as ve,S as ye,X as K,Z as q,_ as be,b as xe,x as Se,y as Ce}from"./index-cf0xP0kN.js";import{t as we}from"./DataTableShell-DBktq6d-.js";var J=t(e(),1),Y=n();function Te(){let e=j(b.integrations.status.status,{}),t=V(b.admin.setIntegrationConfig),[n,u]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&u(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ce()});let p=n,m=(e,t,n)=>u({...p,[e]:{...p[e],[t]:n}}),y=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[oe(),` `,(0,Y.jsx)(`strong`,{children:d()}),` `,se()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:a()}):(0,Y.jsx)(K,{variant:`outline`,children:W()}):(0,Y.jsx)(K,{variant:`outline`,children:v()}),note:f(),children:[(0,Y.jsx)(Z,{label:_(),children:(0,Y.jsx)(q,{value:p.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>m(`langfuse`,`host`,e.target.value),onBlur:()=>y(`langfuse`,{host:p.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:i(),checked:p.langfuse.enabled??!0,onChange:e=>{m(`langfuse`,`enabled`,e),y(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:a()}):(0,Y.jsx)(K,{variant:`outline`,children:W()}):(0,Y.jsx)(K,{variant:`outline`,children:v()}),note:l(),children:[(0,Y.jsx)(Z,{label:te(),children:(0,Y.jsx)(q,{value:p.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>m(`opik`,`baseUrl`,e.target.value),onBlur:()=>y(`opik`,{baseUrl:p.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:ee(),children:(0,Y.jsx)(q,{value:p.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||N(),onChange:e=>m(`opik`,`workspace`,e.target.value),onBlur:()=>y(`opik`,{workspace:p.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:i(),checked:p.opik.enabled??!0,onChange:e=>{m(`opik`,`enabled`,e),y(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:a()}):(0,Y.jsx)(K,{variant:`outline`,children:W()}):(0,Y.jsx)(K,{variant:`outline`,children:ne()}),note:x(),children:[(0,Y.jsx)(Z,{label:le(),children:(0,Y.jsx)(q,{value:p.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>m(`otlp`,`endpoint`,e.target.value),onBlur:()=>y(`otlp`,{endpoint:p.otlp.endpoint??``})})}),(0,Y.jsx)(Ee,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:i(),checked:p.otlp.enabled??!0,onChange:e=>{m(`otlp`,`enabled`,e),y(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:P(),status:(0,Y.jsx)(K,{variant:`outline`,children:h()}),note:g(),children:[(0,Y.jsx)(Z,{label:s(),children:(0,Y.jsx)($,{value:p.tts.auto??`off`,options:[[`off`,c()],[`always`,ae()],[`inbound`,ge()],[`tagged`,o()]],onChange:e=>{m(`tts`,`auto`,e),y(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:ie(),children:(0,Y.jsx)($,{value:p.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,_e()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{m(`tts`,`provider`,e),y(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:w(),children:(0,Y.jsx)(q,{value:p.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>m(`tts`,`model`,e.target.value),onBlur:()=>y(`tts`,{model:p.tts.model??``})})}),(0,Y.jsx)(Z,{label:U(),children:(0,Y.jsx)(q,{value:p.tts.voice??``,placeholder:he(),onChange:e=>m(`tts`,`voice`,e.target.value),onBlur:()=>y(`tts`,{voice:p.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:S(),status:(0,Y.jsx)(K,{variant:`outline`,children:h()}),note:e.secrets.openai?k():A(),children:[(0,Y.jsx)(Q,{label:I(),checked:p.talk.enabled??!1,onChange:e=>{m(`talk`,`enabled`,e),y(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:z(),children:(0,Y.jsx)($,{value:p.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{m(`talk`,`realtimeProvider`,e),y(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:O(),children:(0,Y.jsx)(q,{value:p.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>m(`talk`,`realtimeModel`,e.target.value),onBlur:()=>y(`talk`,{realtimeModel:p.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:U(),children:(0,Y.jsx)(q,{value:p.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>m(`talk`,`voice`,e.target.value),onBlur:()=>y(`talk`,{voice:p.talk.voice??``})})}),(0,Y.jsx)(Z,{label:E(),children:(0,Y.jsx)($,{value:p.talk.transport??`webrtc`,options:[[`webrtc`,me()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{m(`talk`,`transport`,e),y(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:F(),children:(0,Y.jsx)(q,{value:p.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>m(`talk`,`speechLocale`,e.target.value),onBlur:()=>y(`talk`,{speechLocale:p.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:T(),checked:p.talk.interruptOnSpeech??!0,onChange:e=>{m(`talk`,`interruptOnSpeech`,e),y(`talk`,{interruptOnSpeech:e})}})]}),(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:de()}),(0,Y.jsx)(K,{variant:`outline`,children:R()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[C(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(we,{title:M(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:H(),columns:[{header:L(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:pe(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:D(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:r(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:re(),cell:e=>e.lastError??`—`,sort:e=>e.lastError??null}]})]})}function X({title:e,status:t,note:n,children:r}){return(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,Y.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`label`,{className:`oc-int__field`,children:[(0,Y.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function Q({label:e,checked:t,onChange:n}){return(0,Y.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,Y.jsx)(be,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(Ce,{value:e,onValueChange:n,children:[(0,Y.jsx)(ye,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(ve,{})}),(0,Y.jsx)(xe,{children:t.map(([e,t])=>(0,Y.jsx)(Se,{value:e,children:t},e))})]})}function Ee({headersSet:e}){let t=fe(b.integrations.otlpSecret.setOtlpHeaders),n=V(b.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1),l=async()=>{c(!0),o(null);try{await t({headersJson:r}),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{c(!1)}};return(0,Y.jsxs)(Z,{label:ue(),children:[(0,Y.jsx)(q,{value:r,placeholder:e?p():B(),onChange:e=>i(e.target.value)}),(0,Y.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:s||r.trim().length===0,onClick:()=>void l(),children:m()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:s,onClick:()=>void n({}),children:u()}):null]}),a?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:y()})]})}export{Te as IntegrationsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,Cb as i,Jl as a,Kl as o,Ql as s,Sb as c,Tb as l,Xb as u,Xl as d,Yl as f,ZD as p,Zl as m,au as h,eu as g,hb as _,iO as v,iu as y,mb as b,nu as x,ql as S,ru as C,tu as w,wb as T}from"./dist-DbxuL-_t.js";import{Mt as E,a as D,jt as ee,n as te,ot as ne,r as re}from"./index-cf0xP0kN.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-CU7PsoYg.js";import{n as N,t as P}from"./TimeRangePicker-BiV08HXf.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=v(p.me.getMe,{host:ne})?.permissions?.includes(`traces.read`)??!1,t=v(p.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:u()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:l()}),(0,I.jsx)(j,{children:i()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[b(),` p50 `,R(s.cP50),` `,T()]}),(0,I.jsxs)(`span`,{children:[_(),` p50 `,R(s.aP50),` `,T()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":l(),children:[(0,I.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:h(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:y(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:C(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:x(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:w(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:g(),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,te,`now`),i=e=>void t({search:t=>({...t,...D(e)})}),{from:a,to:o}=N(n),{rowLimit:c,buckets:l}=K(a,o),u=v(p.kpi.listKpis,{limit:c,filter:{from:a,to:o}}),f=(0,F.useMemo)(()=>{let e=new Map;for(let t of u??[]){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>l&&e.set(t,n.slice(n.length-l));return e},[u,l]),h=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[r(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:s()})]}),(0,I.jsx)(J,{value:n,onChange:i})]});return u===void 0?(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]}):u.length===0?(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:d()})]}):(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=>(f.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:f.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:f({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:a()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:S({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":o({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};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Aw as r,Bw as i,Cw as a,Dw as o,Ew as s,Fw as c,Gw as l,Hw as u,Iw as d,Jw as f,Kw as ee,Lw as p,Mw as m,Nw as h,Ow as g,Pw as te,Rw as ne,Sw as re,Tw as ie,Uw as ae,Vw as oe,Ww as se,Xw as ce,Yw as le,ZD as _,_w as ue,aD as de,bw as v,cD as y,dD as b,fD as x,gD as S,hD as C,iD as w,iO as T,jw as E,kw as D,lD as O,mD as k,n_ as A,oD as j,pD as M,qw as N,rO as P,sD as F,uD as I,vw as L,wD as R,ww as z,xw as B,yD as V,yw as fe,zw as pe}from"./dist-DbxuL-_t.js";import{t as H}from"./button-BaP2jczn.js";import{A as me,C as he,O as ge,S as _e,Z as U,_ as W,b as ve,ot as G,x as K,y as ye}from"./index-cf0xP0kN.js";var q=t(e(),1),J=[{id:`messages`,label:()=>ce()},{id:`composer`,label:()=>le()},{id:`sidebar`,label:()=>f()},{id:`other`,label:()=>N()}],Y={showSource:{category:`messages`,label:()=>ee(),help:()=>l()},showReport:{category:`messages`,label:()=>se(),help:()=>ae()},copyAssistant:{category:`messages`,label:()=>u()},copyUser:{category:`messages`,label:()=>oe()},showDelete:{category:`messages`,label:()=>i()},showTools:{category:`messages`,label:()=>pe(),help:()=>ne()},voiceInput:{category:`composer`,label:()=>p(),help:()=>d()},showChatAge:{category:`sidebar`,label:()=>c(),help:()=>te()},showChatProvider:{category:`sidebar`,label:()=>h(),help:()=>m()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function be(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],Se={voiceInput:`voiceInput`};function Ce(e){return xe.includes(e)}function Z(e){return e===`admin`}function we(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Q(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Ce(e)?Se[e]:void 0}var $=n(),Ee={voiceInput:()=>B()};function De({prefKey:e,ui:t}){let n=P(_.admin.setUiPrefDefault),r=P(_.admin.setFeatureEnabled),i=Te(e),a=i?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ie()}),(0,$.jsxs)(ye,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(_e,{size:`sm`,className:`w-36`,children:(0,$.jsx)(he,{})}),(0,$.jsxs)(ve,{children:[(0,$.jsx)(K,{value:`on`,children:fe()}),(0,$.jsx)(K,{value:`off`,children:L()}),(0,$.jsx)(K,{value:`inherit`,children:ue()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(W,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":z()}),z()]}):null]}),a?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,i]=(0,q.useState)(!1),c=T(_.me.getMe,{host:G}),l=c?.ui,u=Z(c?.role)&&n,d=P(_.me.setUiPref).withOptimisticUpdate(ge),f=(0,q.useMemo)(()=>l?be(Object.keys(l.effective),e):[],[l,e]);return l?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(c?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>i(e===!0),"aria-label":s()}),s()]}):null,u?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:a()}),(0,$.jsx)(`p`,{children:re()}),(0,$.jsx)(`p`,{children:v()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:E(),"aria-label":E(),className:`mb-2`}),f.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:r()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:f.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=l.locked[e],a=l.effective[e],s=l.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${s&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:D()}):s?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:g()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&s?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void d({key:e,value:null}),children:o()}):null,(0,$.jsx)(W,{checked:a,disabled:i,onCheckedChange:t=>void d({key:e,value:t===!0}),"aria-label":n})]}),u?(0,$.jsx)(De,{prefKey:e,ui:l}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:R()})}function ke(){let e=T(_.me.getMe,{host:G}),t=P(_.me.setLocale),n=P(_.me.setMyName),r=me(),i=e?.locale??`default`,a=e?.name??``,[o,s]=(0,q.useState)(null),c=o??a,l=c.trim()!==a.trim();async function u(){try{await n({name:c}),s(null),r.success(x())}catch(e){r.error(b(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:S()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:C()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{className:`max-w-xs`,value:c,maxLength:120,placeholder:k(),onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l&&(e.preventDefault(),u())}}),(0,$.jsx)(H,{size:`sm`,disabled:!l,onClick:()=>void u(),children:A()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:M()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:I()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:O()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:i===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?de():e===`en`?w():V()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:F()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:j()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
@@ -0,0 +1,3 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cd as r,Dd as i,Ed as a,F as o,Fd as s,I as c,Id as l,M as u,N as d,Od as f,P as p,Sd as ee,Td as m,ZD as h,_d as g,bd as _,dd as v,fd as y,gd as b,hd as x,iO as S,ld as C,md as w,pd as T,rO as E,ud as D,vd as O,wd as k,xd as A,yd as j}from"./dist-DbxuL-_t.js";import{d as M,f as N,i as P,l as F,n as I,r as L,t as R,u as z}from"./FieldLabel-DEMPCo5Y.js";import{t as B}from"./button-BaP2jczn.js";import{A as V,C as H,S as U,_ as W,b as G,x as K,y as q}from"./index-cf0xP0kN.js";/* empty css */var J=t(e(),1),Y=n(),X={media_delivery:{label:r,help:ee},documentary_fetch:{label:A,help:_},inbound_files:{label:j,help:O},history_summary:{label:c,help:o}},Z={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
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
+ Assistant : Comparaison en cours.`,max_chars:`6000`},Q={outboundDir:v,references:D,files:C,previous_summary:p,new_messages:d,max_chars:u};function $(){let e=S(h.admin.listInstances,{}),[t,n]=(0,J.useState)(null);if(e===void 0)return(0,Y.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,Y.jsx)(`div`,{className:`oc-injtab`,children:(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:b()})});let r=e.find(e=>e._id===t)??e[0];return(0,Y.jsxs)(`div`,{className:`oc-injtab`,children:[(0,Y.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,Y.jsx)(I,{label:f(),help:i()}),(0,Y.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Y.jsx)(`span`,{children:g()}),(0,Y.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,Y.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(G,{children:e.map(e=>(0,Y.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,Y.jsx)(te,{instance:r},r._id)]})}function te({instance:e}){let t=E(h.admin.upsertInstanceConfig),n=V(),r=e.config??{},[i,a]=(0,J.useState)(()=>P(r)),[o,c]=(0,J.useState)(!1),u=i.promptInjections,d=(e,t)=>a({...i,promptInjections:{...u,[e]:{...u[e],...t}}});async function f(){c(!0);try{await t({instanceId:e._id,config:L(i,r)})}catch(e){n.error(s(),e)}finally{c(!1)}}return(0,Y.jsxs)(`div`,{className:`oc-injtab__body`,children:[z.map(e=>(0,Y.jsx)(ne,{injKey:e,def:F[e],i18n:X[e],row:u[e]??{enabled:!0,template:F[e].defaultTemplate},onChange:t=>d(e,t)},e)),(0,Y.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,Y.jsx)(B,{size:`sm`,onClick:()=>void f(),disabled:o,children:l()})})]})}function ne({injKey:e,def:t,i18n:n,row:r,onChange:i}){let[o,s]=(0,J.useState)(!1),c=r.template.trim()!==t.defaultTemplate,l=t.togglable&&!r.enabled,u=Object.fromEntries(t.placeholders.map(e=>[e,Z[e]??`{${e}}`])),d=M(e,r),f=d?N(d,u):``;return(0,Y.jsxs)(`section`,{className:`oc-injcard`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,Y.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Y.jsx)(W,{checked:r.enabled,onCheckedChange:e=>i({enabled:e===!0})}),(0,Y.jsx)(I,{label:n.label(),help:n.help()})]}):(0,Y.jsx)(I,{label:n.label(),help:n.help()}),c&&(0,Y.jsx)(`span`,{className:`oc-injection__badge`,children:m()})]}),(0,Y.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:l,rows:8,spellCheck:!1,onChange:e=>i({template:e.target.value})}),(0,Y.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:k()}),t.placeholders.map(e=>(0,Y.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Y.jsx)(`code`,{children:`{${e}}`}),(0,Y.jsx)(R,{text:(Q[e]??(()=>e))()})]},e))]}),(0,Y.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?w():x()}),c&&(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>i({template:t.defaultTemplate}),children:a()})]})]}),o&&(0,Y.jsx)(`div`,{className:`oc-injcard__preview`,children:f?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:f}),(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:T()})]}):(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:y()})})]})}export{$ as PromptInjectionsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,Fm as i,Gm as a,Im as o,Jm as s,Km as ee,Lm as te,Mm as ne,Nm as re,Pm as c,Qm as l,Rm as u,Xm as d,Ym as f,ZD as p,Zm as m,_h as h,ah as g,bh as _,ch as v,dh as y,eh as ie,fh as b,gh as x,hh as S,iO as ae,ih as C,jm as w,lh as T,mh as E,nh as D,oh as O,ph as k,qm as A,rO as j,rh as M,sh as N,th as P,uh as F,vh as I,yh as L,zm as R}from"./dist-DbxuL-_t.js";import{t as z}from"./button-BaP2jczn.js";import{A as B,X as V,Z as H,_ as U,j as W,m as G,xt as K}from"./index-cf0xP0kN.js";import{t as q}from"./roleDescriptions-lVphvx8L.js";var J=t(e(),1),Y=n(),X=[{group:()=>_(),keys:[{key:`traces.read`,label:()=>S()},{key:`traces.read.content`,label:()=>E(),phi:!0},{key:`traces.write`,label:()=>k()}]},{group:()=>L(),keys:[{key:`kpi.read`,label:()=>S()},{key:`kpi.write`,label:()=>k()}]},{group:()=>I(),keys:[{key:`openclaw.query`,label:()=>b()},{key:`anomalies.read`,label:()=>y()},{key:`anomalies.report`,label:()=>F()}]},{group:()=>h(),keys:[{key:`chats.read`,label:()=>S()},{key:`selfheal`,label:()=>v()}]},{group:()=>x(),keys:[{key:`admin.manage`,label:()=>T()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=ae(p.apiKeys.listRoles,{}),t=j(p.apiKeys.createRole),n=j(p.apiKeys.ensureRolesSeeded),h=j(p.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(p.apiKeys.listRoles,{});r&&e.setQuery(p.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),_=W(),v=B(),[y,b]=(0,J.useState)(!1),[x,S]=(0,J.useState)(Q),[T,E]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{v.error(O(),e)})},[n,v]);let k=e??[];async function F(e,t){if(Z(e.permissions)||T.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await _({title:g({name:e.name}),description:C(),confirmLabel:M()}))){E(t=>new Set(t).add(e._id));try{await h({roleId:e._id,permissions:n})}catch(e){v.error(D(),e)}finally{E(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function I(){try{await t({key:x.key,name:x.name,description:x.description||void 0,permissions:[]}),S(Q),b(!1)}catch(e){v.error(P(),e)}}let L=e===void 0,$=!L&&k.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[ie(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,r(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,l()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:m()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{S(Q),b(!0)},children:d()})})]}),L?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:A()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?N({key:e.key}):e.key,children:[e.label(),e.phi?(0,Y.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,Y.jsx)(`tbody`,{children:k.map(e=>{let t=Z(e.permissions),n=T.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(V,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,ee()]}):(0,Y.jsx)(V,{variant:`secondary`,children:a()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(r=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(U,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?R():n?u():r,onCheckedChange:()=>void F(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:y,onOpenChange:b,title:te(),description:o(),canSubmit:!!(x.key&&x.name),onSubmit:I,submitLabel:i(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:c()}),(0,Y.jsx)(H,{value:x.key,placeholder:re(),onChange:e=>S({...x,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:ne()}),(0,Y.jsx)(H,{value:x.name,onChange:e=>S({...x,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:w()}),(0,Y.jsx)(H,{value:x.description,onChange:e=>S({...x,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,$S as i,AC as ee,BC as te,CC as ne,DC as re,EC as ie,FC as ae,GC as oe,HC as se,IC as ce,JC as le,KC as ue,LC as de,MC as fe,NC as pe,OC as me,PC as he,QC as ge,QS as a,RC as _e,SC as ve,TC as ye,UC as be,VC as xe,WC as Se,XC as Ce,XS as o,YC as we,ZC as Te,ZD as s,ZS as c,_C as l,aC as u,aw as Ee,bC as De,cC as d,cw as Oe,dC as f,dw as p,eC as m,ew as ke,fC as h,fw as Ae,gC as g,gw as je,hC as Me,hw as Ne,iC as Pe,iO as _,iw as Fe,jC as Ie,kC as Le,lC as v,lw as Re,mC as y,mw as ze,nC as b,nw as Be,oC as x,ow as Ve,pC as S,pw as He,qC as Ue,rC as C,rO as w,rw as We,sC as T,sw as Ge,tC as E,tO as Ke,tw as qe,uC as D,uw as O,vC as k,wC as Je,xC as Ye,yC as A,zC as Xe}from"./dist-DbxuL-_t.js";import{n as j}from"./dist-BKPj1yrt.js";import{i as Ze}from"./dist-Dql2za7I.js";import{t as M}from"./button-BaP2jczn.js";import{$ as N,A as Qe,At as $e,C as P,Dt as F,Mt as et,Q as I,S as L,X as R,Z as z,b as B,et as V,j as tt,jt as nt,m as rt,nt as H,rt as U,tt as it,x as W,y as G}from"./index-cf0xP0kN.js";import{t as at}from"./FilterBar-Cu1qlC3G.js";import{t as ot}from"./DataTableShell-DBktq6d-.js";import{t as st}from"./roleDescriptions-lVphvx8L.js";var K=t(e(),1),q=n(),ct=[{value:`never`,label:()=>b(),days:null},{value:`30`,label:()=>E(),days:30},{value:`90`,label:()=>m(),days:90}],lt=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=et({from:`/settings/serviceAccounts`}),t=nt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??J,[a,o]=(0,K.useState)(J),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),u=_(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===J?void 0:a,disabled:i===J?void 0:i===`disabled`}}),d=_(s.apiKeys.listKeys,{}),f=_(s.apiKeys.listRoles,{}),m=w(s.apiKeys.createServiceAccount),h=w(s.apiKeys.updateServiceAccount),g=w(s.apiKeys.deleteServiceAccount),Me=Ke(s.apiKeys.mintApiKey),Pe=w(s.apiKeys.revokeApiKey),v=tt(),y=Qe(),b=n!==``||a!==J||i!==J;function x(){o(J),t({search:{},replace:!0})}let[S,C]=(0,K.useState)(!1),[T,E]=(0,K.useState)(Y),[D,k]=(0,K.useState)(null),[A,j]=(0,K.useState)(new Set),[N,F]=(0,K.useState)(null),I=(0,K.useRef)(!1),[V,H]=(0,K.useState)(new Set),[U,it]=(0,K.useState)({}),[lt,X]=(0,K.useState)(null),Z=(0,K.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function Q(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await h({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),y.success(he())):await m({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Y),k(null),C(!1)}catch(e){y.error(D?ae():ce(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),C(!0)}async function $(e){if(I.current)return;I.current=!0;let t=U[e._id]??`never`,n=ct.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 Me({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(pe(),e)}finally{I.current=!1,F(null)}}async function mt(e){if(await v({title:fe(),description:(0,q.jsxs)(q.Fragment,{children:[Ie(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,ee(),` `,(0,q.jsx)(`strong`,{children:Le()}),` `,me()]}),confirmWord:e.name,confirmLabel:re(),destructive:!0}))try{await g({serviceAccountId:e._id}),y.success(ie(),e.name)}catch(e){y.error(ye(),e)}}async function ht(e){if(await v({title:Je(),description:(0,q.jsxs)(q.Fragment,{children:[ne(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ve()]}),confirmLabel:Ye(),destructive:!0})&&!V.has(e._id)){H(t=>new Set(t).add(e._id));try{await Pe({keyId:e._id})}catch(e){y.error(De(),e)}finally{H(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:je()}),(0,q.jsxs)(at,{q:n,onQChange:c,searchPlaceholder:Ne(),onReset:x,canReset:b,children:[(0,q.jsxs)(G,{value:a,onValueChange:o,children:[(0,q.jsx)(L,{size:`sm`,className:`w-40`,children:(0,q.jsx)(P,{placeholder:ze()})}),(0,q.jsxs)(B,{children:[(0,q.jsx)(W,{value:J,children:He()}),(f??[]).map(e=>(0,q.jsx)(W,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(G,{value:i,onValueChange:l,children:[(0,q.jsx)(L,{size:`sm`,className:`w-36`,children:(0,q.jsx)(P,{})}),(0,q.jsxs)(B,{children:[(0,q.jsx)(W,{value:J,children:Ae()}),(0,q.jsx)(W,{value:`active`,children:p()}),(0,q.jsx)(W,{value:`disabled`,children:O()})]})]})]}),(0,q.jsx)(ot,{title:Re(),rows:u,addLabel:Oe(),onAdd:()=>{E(Y),k(null),C(!0)},emptyHint:Ge(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:V}),rowActions:e=>[{label:We(),onSelect:()=>pt(e)},{label:Ve(),onSelect:()=>void $(e)},{label:A.has(e._id)?Ee():Fe(),onSelect:()=>Q(e._id)},{label:Be(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?qe():ke(),onClick:()=>Q(e._id),children:A.has(e._id)?(0,q.jsx)(Ze,{}):(0,q.jsx)($e,{})})},{header:r(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:ge(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(R,{variant:`secondary`,children:e.roleKey})},{header:Te(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(R,{variant:`destructive`,children:O()}):(0,q.jsx)(R,{variant:`outline`,children:p()})},{header:Ce(),cell:e=>(0,q.jsxs)(G,{value:U[e._id]??`never`,onValueChange:t=>it(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(L,{size:`sm`,className:`w-32`,children:(0,q.jsx)(P,{})}),(0,q.jsx)(B,{children:ct.map(e=>(0,q.jsx)(W,{value:e.value,children:e.label()},e.value))})]})},{header:we(),sort:e=>(Z.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Z.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?le():Ue({count:t})})}}]}),(0,q.jsx)(rt,{open:S,onOpenChange:e=>{C(e),e||k(null)},title:D?ue():be(),description:D?oe():se(),canSubmit:!!(T.name&&T.roleKey),onSubmit:ft,submitLabel:D?Se():xe(),children:(0,q.jsxs)(`div`,{className:`oc-form`,children:[(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,q.jsx)(z,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Xe()}),(0,q.jsxs)(G,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,q.jsx)(L,{className:`w-full`,children:(0,q.jsx)(P,{placeholder:_e()})}),(0,q.jsx)(B,{children:(f??[]).map(e=>(0,q.jsxs)(W,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===T.roleKey),t=e?st(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:de()}),(0,q.jsx)(z,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:lt,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[A(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:l()}),(0,q.jsx)(`th`,{children:g()}),(0,q.jsx)(`th`,{children:Me()}),(0,q.jsx)(`th`,{children:y()}),(0,q.jsx)(`th`,{children:S()}),(0,q.jsx)(`th`,{children:h()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(R,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:Z(t.createdAt)}),(0,q.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:pt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,q.jsx)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?f():D()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(I,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(N,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(H,{children:[(0,q.jsx)(U,{children:v()}),(0,q.jsx)(V,{children:d({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:T()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":x(),children:[n?(0,q.jsx)(j,{}):(0,q.jsx)(F,{}),n?u():Pe()]})]}),(0,q.jsx)(it,{children:(0,q.jsx)(M,{onClick:()=>{r(!1),t()},children:C()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>lt}function ft(e){return e===null?i():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,q.jsx)(R,{variant:`destructive`,children:a()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(R,{variant:`outline`,children:c()}):(0,q.jsx)(R,{variant:`outline`,children:o()})}export{X as ServiceAccountsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,Ct as i,G as a,H as o,J as s,K as c,Q as l,St as u,Tt as d,U as f,V as p,W as m,X as h,Y as g,Z as _,ZD as v,_t as y,at as b,bt as x,ct as S,dt as C,et as w,ft as T,gt as E,ht as D,iO as O,it as k,lt as A,mt as j,nt as M,ot as N,pt as P,q as F,rO as I,rt as L,st as R,tt as z,ut as B,vt as V,wt as H,xt as U,yt as W}from"./dist-DbxuL-_t.js";import{t as G}from"./button-BaP2jczn.js";import{j as K}from"./index-cf0xP0kN.js";import{t as q}from"./DataTableShell-DBktq6d-.js";var J=t(e(),1),Y=n(),X={hung:()=>S(),wrong_result:()=>R(),error:()=>N(),other:()=>b()},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=I(v.subAgentReports.respondToReport),[i,o]=(0,J.useState)(e.thread),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(!1);async function y(){let t=u.trim();if(!(!t||f)){p(!0);try{await n({reportId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),d(``)}finally{p(!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),` · `,k({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:L()}),(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()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?z():w()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:r()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:l(),value:u,maxLength:2e3,rows:3,onChange:e=>d(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(G,{size:`sm`,onClick:()=>void y(),disabled:!u.trim()||f,children:f?h():_()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[g({count:t.children.length}),t.childrenTruncated?` ${s()}`:``,t.textTruncated?` ${F()}`:``]}),(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?` · ${c()}`:``]}),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:a()}),(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:m()}),(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 ee(){let e=O(v.subAgentReports.listForAdmin,{}),t=I(v.subAgentReports.readReport),n=I(v.subAgentReports.deleteReport),r=K(),[a,s]=(0,J.useState)(null),[c,l]=(0,J.useState)({});async function m(e){if(a===e._id){s(null);return}if(!c[e._id]){let n=await t({reportId:e._id});l(t=>({...t,[e._id]:n}))}s(e._id)}async function h(e){await r({title:f(),description:o(),confirmLabel:p(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&s(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[i(),` `,(0,Y.jsx)(`strong`,{children:u()}),` `,U()]}),(0,Y.jsx)(q,{title:d(),rows:e,emptyHint:H(),isExpanded:e=>a===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Y.jsx)($,{data:c[e._id]}):null,columns:[{header:x(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:W(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:V(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:y(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${j({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:E(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:D(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:P()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:T()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?B():C(),onSelect:()=>void m(e)},{label:A(),onSelect:()=>void h(e),variant:`destructive`}]})]})}export{ee as SubAgentReportsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$T as r,$w as i,AT as a,B as o,BT as s,CT as c,DT as l,ET as u,FT as d,GT as f,HT as p,IT as m,JT as h,KT as g,L as ee,LT as _,MT as v,NT as y,OT as te,PT as ne,QD as re,QT as ie,Qw as ae,R as oe,RT as se,SD as ce,ST as le,TT as ue,UT as de,VT as fe,WT as pe,XT as me,YT as he,ZD as b,ZT as ge,Zw as _e,_E as ve,_T as x,aD as ye,aE as be,aT as S,bD as xe,bT as Se,cE as Ce,cT as we,dE as Te,dT as Ee,eE as De,eT as Oe,fE as ke,fT as Ae,gE as je,gT as Me,hE as Ne,hT as Pe,iD as Fe,iE as Ie,iO as C,iT as Le,jT as Re,kT as ze,lE as w,lT as Be,mE as Ve,mT as He,n as Ue,nE as We,nT as Ge,oE as Ke,oT as qe,pE as Je,pT as Ye,qT as Xe,rE as Ze,rO as T,rT as Qe,sE as $e,sT as et,tE as tt,tO as nt,tT as E,uE as rt,uT as it,vE as at,vT as ot,wT as st,xD as ct,xT as lt,yE as ut,yT as dt,z as ft,zT as pt}from"./dist-DbxuL-_t.js";import{n as D}from"./dist-BKPj1yrt.js";import{t as O}from"./x-BpWCNC8c.js";import{t as k}from"./button-BaP2jczn.js";import{C as A,Et as mt,G as ht,J as j,K as M,S as N,Tt as P,W as gt,X as F,Y as _t,Z as I,_ as L,at as vt,b as R,it as yt,ot as z,q as bt,x as B,y as V}from"./index-cf0xP0kN.js";import{a as xt,i as St,n as Ct,o as wt,r as Tt,t as Et}from"./card-CU7PsoYg.js";import{a as Dt,i as H,n as Ot,o as U,r as W,t as kt}from"./table-C5Ypy4Nm.js";import{t as At}from"./TimeRangePicker-BiV08HXf.js";import{t as jt}from"./FilterBar-Cu1qlC3G.js";import{t as Mt}from"./AdvancedFilter-DX4JYkKu.js";var G=re(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),K=t(e(),1),Nt=.1,Pt=[248,248,248],Ft=[24,24,24];function It(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 Lt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function q(e,t,n){return Lt(e,t,n)>=Nt}function Rt(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 zt(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 Bt=12*1024*1024,Vt=480,Ht=160,Ut=.92;async function Wt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(Se());if(e.size>Bt)throw Error(dt());let{source:n,width:r,height:i,cleanup:a}=await Gt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Vt/r,Ht/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(x());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=It(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(x());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);q(e.data,d.width,d.height)?Rt(e.data,t.variantFor===`dark`?Pt:Ft):zt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Ut)??await Y(f,`image/png`);if(!h)throw Error(Me());return{blob:h,hasAlpha:m}}finally{a()}}async function Gt(e){if(e.type===`image/svg+xml`)return J(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return J(e)}async function J(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(ot())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Kt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Q={kind:`relative`,from:`now-24h`,to:`now`},qt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Jt(e){return e===`light`?ce():e===`dark`?ct():xe()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Zt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:s}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Ue(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(D,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Xt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),s?(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:s,"aria-label":o(),title:o(),children:(0,X.jsx)(mt,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=C(b.charts.listMyCharts),r=T(b.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:rt()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:w(),subtitle:Ce(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?$e():n.via===`owner`?Ke():be({group:n.via.group});return(0,X.jsx)(Zt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Kt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ie()}):null]})}function $t(){let e=T(b.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[a,o]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,f]=(0,K.useState)(!1);async function h(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),l(!1);try{i(await t.text())}catch{o(m())}}}async function g(){if(o(null),l(!1),t.trim()===``){o(ne());return}let a;try{a=JSON.parse(r)}catch{o(m());return}f(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{f(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:p()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:fe(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:s()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:pt(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),se(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void h(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:u,onClick:()=>void g(),children:_()})]}),a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:d()}):null]})]})}function en({chart:e}){let t=nt(b.charts.setChartLogo),n=T(b.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function d(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Wt(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 d(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=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await d(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=s(e),n=s(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?l():u()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?st():ue(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void f(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void m(e),children:le()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void p(e),children:c()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:te()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(h,{mode:`light`}),(0,X.jsx)(h,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:lt()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=C(b.me.getMe,{host:z}),n=T(b.charts.addChartDomain),r=T(b.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){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 f(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Pe()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ee()}):u.map(e=>(0,X.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":it({domain:e}),onClick:()=>void f(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{value:i,onChange:e=>a(e.target.value),placeholder:Ye(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:Ae()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:He()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function nn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function rn({chart:e}){let t=T(b.charts.updateChart),n=T(b.charts.deleteChart),[r,i]=(0,K.useState)(!1),[o,s]=(0,K.useState)(e.name),[c,l]=(0,K.useState)(()=>nn(e.tokens)),[u,d]=(0,K.useState)(e.tokens.bpm??0),[f,p]=(0,K.useState)(null),[h,g]=(0,K.useState)(!1);function _(){s(e.name),l(nn(e.tokens)),d(e.tokens.bpm??0),p(null),i(!0)}async function v(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(c)}catch{p(m());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:o.trim(),tokens:n}),i(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function y(){if(e.chartId!==void 0&&window.confirm(S()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:_,children:a()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void y(),children:ze()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:et()}),(0,X.jsx)(I,{value:o,onChange:e=>s(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ft()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>d(Number(e.target.value)),"aria-label":ft()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?oe():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ee()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:qe()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:h,onClick:()=>void v(),children:Be()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:we()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function an(){let e=C(b.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:y()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:v()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(rn,{chart:e},e.key))})]})}function on({chart:e,groups:t}){let n=T(b.charts.addChartToGroupPool),r=T(b.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,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(F,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?me():e.kind===`custom`&&e.scope===`personal`?E():ge()}),e.isGlobalDefault?(0,X.jsx)(F,{variant:`default`,children:he()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Xe()}),(a??[]).map(e=>(0,X.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":f({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(V,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(N,{size:`sm`,className:`w-56`,children:(0,X.jsx)(A,{placeholder:g()})}),(0,X.jsx)(R,{children:s.map(e=>(0,X.jsx)(B,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:h()}):null]})]})}function sn({chart:e}){let t=T(b.charts.promoteChartToCommon),n=T(b.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(S()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(F,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Oe():E()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ge({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:i()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void a(),children:ae()})]})]})}function cn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let i=T(b.admin.setDefaultThemeMode),a=T(b.admin.setDefaultLocale),o=T(b.charts.setDefaultChart),s=C(b.charts.listChartsAdmin),c=C(b.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Je()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ke()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:We()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:w()}),vt.map(e=>(0,X.jsx)(k,{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,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:tt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:De()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(on,{chart:e,groups:c??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:r()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(tn,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Le()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Qe()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_e()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(sn,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ut()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:at()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void i({mode:e}),children:Jt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:je()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,X.jsx)(k,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e}),children:e===`fr`?ye():Fe()},e))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]})]})}function ln(){let e=C(b.me.getMe,{host:z}),t=yt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)($t,{}),(0,X.jsx)(an,{}),e?.role===`admin`?(0,X.jsx)(cn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function un(){let[e,t]=(0,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.useState)(Q),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Q)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(ln,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:Ve()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(P,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)($,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(F,{children:`Default`}),(0,X.jsx)(F,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(F,{variant:`outline`,children:`Outline`}),(0,X.jsx)(F,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)($,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(I,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(V,{value:n,onValueChange:r,children:[(0,X.jsx)(N,{className:`w-56`,children:(0,X.jsx)(A,{placeholder:`Select…`})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(B,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(L,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(jt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(V,{value:o,onValueChange:s,children:[(0,X.jsx)(N,{size:`sm`,children:(0,X.jsx)(A,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:Z,children:`Toutes directions`}),(0,X.jsx)(B,{value:`inbound`,children:`inbound`}),(0,X.jsx)(B,{value:`outbound`,children:`outbound`}),(0,X.jsx)(B,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(V,{value:c,onValueChange:l,children:[(0,X.jsx)(N,{size:`sm`,children:(0,X.jsx)(A,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(B,{value:`info`,children:`info`}),(0,X.jsx)(B,{value:`warn`,children:`warn`}),(0,X.jsx)(B,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(Mt,{fields:qt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(At,{value:u,onChange:d})]})]})}),(0,X.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(gt,{children:[(0,X.jsx)(_t,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(P,{})})}),(0,X.jsxs)(ht,{align:`start`,children:[(0,X.jsx)(bt,{children:`Actions`}),(0,X.jsx)(j,{}),(0,X.jsx)(M,{children:`Edit`}),(0,X.jsx)(M,{children:`Duplicate`}),(0,X.jsx)(j,{}),(0,X.jsx)(M,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Et,{className:`w-80`,children:[(0,X.jsxs)(xt,{children:[(0,X.jsx)(wt,{children:`Instance`}),(0,X.jsx)(Tt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(Ct,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(St,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(kt,{children:[(0,X.jsx)(Dt,{children:(0,X.jsxs)(U,{children:[(0,X.jsx)(H,{className:`w-8`,children:(0,X.jsx)(L,{"aria-label":`select all`})}),(0,X.jsx)(H,{children:`Name`}),(0,X.jsx)(H,{children:`Mode`}),(0,X.jsx)(H,{className:`text-right`,children:`Status`}),(0,X.jsx)(H,{className:`w-8`})]})}),(0,X.jsx)(Ot,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{children:(0,X.jsx)(L,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(F,{variant:`secondary`,children:e.m})}),(0,X.jsx)(W,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(D,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(P,{})})})]},e.n))})]})}),(0,X.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{un as ThemeShowroom};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Al as r,Dl as i,Fl as a,Il as o,Ll as s,Ml as c,Nl as l,Ol as u,Pl as d,Rl as f,jl as p,kl as m,zl as h}from"./dist-CSHwMvoK.js";import{t as g}from"./button-Do9b0Kl0.js";import{Ot as _,Z as v,ct as y,lt as b,st as x,ut as S,vt as C}from"./index-Djd_7VwF.js";var w=t(e(),1),T={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function E(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=T[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function D(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:E(e.from,t)??t-T.h,to:E(e.to,t)??t}}var O=[{label:h(),from:`now-5m`},{label:f(),from:`now-15m`},{label:s(),from:`now-30m`},{label:o(),from:`now-1h`},{label:a(),from:`now-3h`},{label:d(),from:`now-6h`},{label:l(),from:`now-12h`},{label:c(),from:`now-24h`},{label:p(),from:`now-2d`},{label:r(),from:`now-7d`},{label:m(),from:`now-30d`},{label:u(),from:`now-90d`},{label:i(),from:`now-520w`}];function k(e){return new Date(e).toLocaleString(`fr-FR`,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function A(e){if(e.kind===`relative`){let t=O.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${k(e.from)} → ${k(e.to)}`}function j(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 M(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function N(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var P=n();function F(e){let[t,n]=(0,w.useState)(0);return(0,w.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,w.useMemo)(()=>{let{from:t,to:n}=D(e);return e.kind===`absolute`?{from:t,to:n}:{from:I(t),to:I(n)}},[e,t])}function I(e){return Math.floor(e/6e4)*6e4}function L({value:e,onChange:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(``),o=D(e),[s,c]=(0,w.useState)(()=>j(o.from)),[l,u]=(0,w.useState)(()=>j(o.to));function d(t){if(t){let t=D(e);c(j(t.from)),u(j(t.to)),a(``)}r(t)}function f(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function p(){let e=M(s),n=M(l);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let m=(0,w.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?O:O.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),h=M(s)!==null&&M(l)!==null;return(0,P.jsxs)(b,{open:n,onOpenChange:d,children:[(0,P.jsx)(S,{asChild:!0,children:(0,P.jsxs)(g,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,P.jsx)(_,{}),A(e)]})}),(0,P.jsx)(y,{children:(0,P.jsx)(x,{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,P.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,P.jsx)(`div`,{className:`oc-timerange__section-title`,children:`Plage absolue`}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`De`}),(0,P.jsx)(v,{type:`datetime-local`,value:s,onChange:e=>c(e.target.value)})]}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`À`}),(0,P.jsx)(v,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,P.jsx)(g,{size:`sm`,className:`oc-timerange__apply`,disabled:!h,onClick:p,children:`Appliquer`})]}),(0,P.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,P.jsx)(C,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,P.jsx)(v,{value:i,onChange:e=>a(e.target.value),placeholder:`Rechercher une plage`,"aria-label":`Rechercher une plage relative`})]}),(0,P.jsx)(`ul`,{className:`oc-timerange__list`,children:m.length===0?(0,P.jsx)(`li`,{className:`oc-timerange__empty`,children:`Aucune plage.`}):m.map(t=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>f(t.from),children:t.label})},t.from))})]})]})})})]})}export{F as n,N as r,L as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_u as r,cu as i,du as a,fu as o,gu as s,hu as c,lu as l,mu as u,ou as d,pu as f,su as p,uu as m,vu as h}from"./dist-DbxuL-_t.js";import{t as g}from"./button-BaP2jczn.js";import{Ot as _,Z as v,ct as y,lt as b,st as x,ut as S,vt as C}from"./index-cf0xP0kN.js";var w=t(e(),1),T={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function E(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=T[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function D(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:E(e.from,t)??t-T.h,to:E(e.to,t)??t}}var O=[{label:h(),from:`now-5m`},{label:r(),from:`now-15m`},{label:s(),from:`now-30m`},{label:c(),from:`now-1h`},{label:u(),from:`now-3h`},{label:f(),from:`now-6h`},{label:o(),from:`now-12h`},{label:a(),from:`now-24h`},{label:m(),from:`now-2d`},{label:l(),from:`now-7d`},{label:i(),from:`now-30d`},{label:p(),from:`now-90d`},{label:d(),from:`now-520w`}];function k(e){return new Date(e).toLocaleString(`fr-FR`,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function A(e){if(e.kind===`relative`){let t=O.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${k(e.from)} → ${k(e.to)}`}function j(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 M(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function N(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var P=n();function F(e){let[t,n]=(0,w.useState)(0);return(0,w.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,w.useMemo)(()=>{let{from:t,to:n}=D(e);return e.kind===`absolute`?{from:t,to:n}:{from:I(t),to:I(n)}},[e,t])}function I(e){return Math.floor(e/6e4)*6e4}function L({value:e,onChange:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(``),o=D(e),[s,c]=(0,w.useState)(()=>j(o.from)),[l,u]=(0,w.useState)(()=>j(o.to));function d(t){if(t){let t=D(e);c(j(t.from)),u(j(t.to)),a(``)}r(t)}function f(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function p(){let e=M(s),n=M(l);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let m=(0,w.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?O:O.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),h=M(s)!==null&&M(l)!==null;return(0,P.jsxs)(b,{open:n,onOpenChange:d,children:[(0,P.jsx)(S,{asChild:!0,children:(0,P.jsxs)(g,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,P.jsx)(_,{}),A(e)]})}),(0,P.jsx)(y,{children:(0,P.jsx)(x,{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,P.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,P.jsx)(`div`,{className:`oc-timerange__section-title`,children:`Plage absolue`}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`De`}),(0,P.jsx)(v,{type:`datetime-local`,value:s,onChange:e=>c(e.target.value)})]}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`À`}),(0,P.jsx)(v,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,P.jsx)(g,{size:`sm`,className:`oc-timerange__apply`,disabled:!h,onClick:p,children:`Appliquer`})]}),(0,P.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,P.jsx)(C,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,P.jsx)(v,{value:i,onChange:e=>a(e.target.value),placeholder:`Rechercher une plage`,"aria-label":`Rechercher une plage relative`})]}),(0,P.jsx)(`ul`,{className:`oc-timerange__list`,children:m.length===0?(0,P.jsx)(`li`,{className:`oc-timerange__empty`,children:`Aucune plage.`}):m.map(t=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>f(t.from),children:t.label})},t.from))})]})]})})})]})}export{F as n,N as r,L as t};