@lacneu/atrium 0.43.0 → 0.43.2

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 (72) hide show
  1. package/dist/assets/AccessTab-94MtF5lT.js +1 -0
  2. package/dist/assets/{AdvancedFilter-UZD1c3U9.js → AdvancedFilter-BnA7f0yX.js} +1 -1
  3. package/dist/assets/AgentFilesTab-sjdoEmO4.js +3 -0
  4. package/dist/assets/AnomaliesTab-DbH8S6fZ.js +1 -0
  5. package/dist/assets/AuditTab-B4enDRkk.js +1 -0
  6. package/dist/assets/BridgeTab-DqV2JfAL.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-VjBCgiMX.js +1 -0
  8. package/dist/assets/DataTableShell-BwOKMopJ.js +1 -0
  9. package/dist/assets/{DetailChips-J-KcpPRO.js → DetailChips-B7PRsQ8X.js} +1 -1
  10. package/dist/assets/FeedbacksTab-WbanMd0X.js +1 -0
  11. package/dist/assets/{FieldLabel-DYhOcc_e.js → FieldLabel-D6e92lXR.js} +1 -1
  12. package/dist/assets/FilesTab-BRT-LD5j.js +1 -0
  13. package/dist/assets/{FilterBar-CzpwZuGf.js → FilterBar-Z4TZZeJs.js} +1 -1
  14. package/dist/assets/GroupsTab-BDmYIdOy.js +1 -0
  15. package/dist/assets/InstancesTab-Bion8hoW.js +1 -0
  16. package/dist/assets/IntegrationsTab-C1rqnuOD.js +1 -0
  17. package/dist/assets/KpiTab-DXJRXni-.js +1 -0
  18. package/dist/assets/PreferencesTab-U9LNPEoY.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-Qkodd11k.js +4 -0
  20. package/dist/assets/RolesTab-B9DClwCJ.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-CZnWRSm3.js +1 -0
  22. package/dist/assets/SubAgentReportsTab-Dk4U8jt3.js +1 -0
  23. package/dist/assets/ThemeShowroom-C5FSV0-b.js +1 -0
  24. package/dist/assets/{TimeRangePicker-XUfGR5S2.js → TimeRangePicker-CcUEMoXD.js} +1 -1
  25. package/dist/assets/TracesTab-9U3IirNk.js +1 -0
  26. package/dist/assets/UsersTab-AzjFhn2N.js +1 -0
  27. package/dist/assets/VoiceTab-BYE2xI7l.js +1 -0
  28. package/dist/assets/{button-CvJAYeHx.js → button-B9CsHmrJ.js} +1 -1
  29. package/dist/assets/{card-1aYDgnwU.js → card-CMDVfuXr.js} +1 -1
  30. package/dist/assets/chevrons-up-down-C13y3ij3.js +1 -0
  31. package/dist/assets/{compatView-BHy79k8P.js → compatView-BU4Wp3dH.js} +1 -1
  32. package/dist/assets/dispatchErrorInfo-dqUyKO3V.js +1 -0
  33. package/dist/assets/{dist-Bcr-KIFN.js → dist-B7IaMcdm.js} +5 -5
  34. package/dist/assets/{dist-CEDhHgbc.js → dist-CulxjFIv.js} +1 -1
  35. package/dist/assets/{dist-BvTSSv91.js → dist-D87j9TcT.js} +1 -1
  36. package/dist/assets/{dist-CX03UY-q.js → dist-UNwILdG2.js} +1 -1
  37. package/dist/assets/{highlighted-body-OFNGDK62-EleSp1r2.js → highlighted-body-OFNGDK62-VCSqL6Ck.js} +1 -1
  38. package/dist/assets/{index--Drh_B6c.js → index-DYfClpT4.js} +25 -25
  39. package/dist/assets/mermaid-GHXKKRXX-BVRnJa6t.js +1 -0
  40. package/dist/assets/roleDescriptions-ow1wfNQF.js +1 -0
  41. package/dist/assets/{table-CrooMP5e.js → table-r4XuUszk.js} +1 -1
  42. package/dist/assets/{tabs-DMDS7i26.js → tabs-K6MF5os_.js} +1 -1
  43. package/dist/assets/x-CJSI-sn5.js +1 -0
  44. package/dist/index.html +7 -7
  45. package/package.json +1 -1
  46. package/dist/assets/AccessTab-BmNF0xWT.js +0 -1
  47. package/dist/assets/AgentFilesTab-Iqk_KofY.js +0 -3
  48. package/dist/assets/AnomaliesTab-xDgaxiGt.js +0 -1
  49. package/dist/assets/AuditTab-C1YqkRR1.js +0 -1
  50. package/dist/assets/BridgeTab-mLReg09f.js +0 -1
  51. package/dist/assets/ChatDefaultsTab-DJu8Eoyy.js +0 -1
  52. package/dist/assets/DataTableShell-c6bvewGu.js +0 -1
  53. package/dist/assets/FeedbacksTab-CzAvDpW2.js +0 -1
  54. package/dist/assets/FilesTab-BnodMPSK.js +0 -1
  55. package/dist/assets/GroupsTab-C9Sz4tdf.js +0 -1
  56. package/dist/assets/InstancesTab-OTDf7MYw.js +0 -1
  57. package/dist/assets/IntegrationsTab-DC9WLLvC.js +0 -1
  58. package/dist/assets/KpiTab-DIdsAXH_.js +0 -1
  59. package/dist/assets/PreferencesTab-Yy4nWGBM.js +0 -1
  60. package/dist/assets/PromptInjectionsTab-CILSRtdl.js +0 -4
  61. package/dist/assets/RolesTab-BQNU-vsJ.js +0 -1
  62. package/dist/assets/ServiceAccountsTab-De0P-S_F.js +0 -1
  63. package/dist/assets/SubAgentReportsTab-GFSfR2RF.js +0 -1
  64. package/dist/assets/ThemeShowroom-sg8sZwIW.js +0 -1
  65. package/dist/assets/TracesTab-DE3TeHRG.js +0 -1
  66. package/dist/assets/UsersTab-CwAl49kr.js +0 -1
  67. package/dist/assets/VoiceTab-Djb19TZI.js +0 -1
  68. package/dist/assets/chevrons-up-down-BEdda7QD.js +0 -1
  69. package/dist/assets/dispatchErrorInfo-AjCvuCVv.js +0 -1
  70. package/dist/assets/mermaid-GHXKKRXX-kZO9jf6G.js +0 -1
  71. package/dist/assets/roleDescriptions-DBwd5h4i.js +0 -1
  72. package/dist/assets/x-BVy5P5am.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Au as r,Cu as i,Du as a,E as o,Eu as s,Fu as c,Iu as l,Mu as u,Nu as d,Ou as f,Pu as p,Su as m,Tu as h,fj as g,ju as _,ku as v,wu as y,xj as b}from"./dist-B7IaMcdm.js";import{C as x,S,b as C,st as w,w as T,x as E}from"./index-DYfClpT4.js";var D=t(e(),1);function O(e){return e===`user`?s():e===`all`?h():y({group:e.group})}function k(e){return e===`common`?i():e===`owner`?m():y({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=b(o.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=b(o.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}),(0,A.jsxs)(C,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":c(),children:(0,A.jsx)(T,{placeholder:c()})}),(0,A.jsx)(E,{children:(e??[]).map(e=>(0,A.jsx)(S,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(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:d()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:u()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(w,{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:_()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.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)(w,{variant:`default`,children:a()}):null,(0,A.jsx)(w,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(w,{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:r()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.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)(w,{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:v()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(w,{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{Bf as r,Gf as i,Hf as a,Kf as o,Uf as s,Vf as c,Wf as l}from"./dist-Bcr-KIFN.js";import{i as u}from"./dist-BvTSSv91.js";import{t as d}from"./x-BVy5P5am.js";import{t as f}from"./button-CvJAYeHx.js";import{C as p,Nt as m,S as h,b as g,ot as _,w as v,x as y}from"./index--Drh_B6c.js";import{r as b}from"./TimeRangePicker-XUfGR5S2.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:o()},{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 o=(0,x.useRef)(t),w=!!(o.current&&o.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(o.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}),i(),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:l()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(g,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-40`,children:(0,S.jsx)(v,{placeholder:s()})}),(0,S.jsx)(y,{children:e.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(g,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-28`,children:(0,S.jsx)(v,{})}),(0,S.jsx)(y,{children:C.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(_,{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":c(),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)(m,{}),r()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gf as r,Hf as i,Kf as a,Uf as o,Vf as s,Wf as c,qf as l}from"./dist-B7IaMcdm.js";import{i as u}from"./dist-D87j9TcT.js";import{t as d}from"./x-CJSI-sn5.js";import{t as f}from"./button-B9CsHmrJ.js";import{C as p,Ft as m,S as h,b as g,ct as _,w as v,x as y}from"./index-DYfClpT4.js";import{r as b}from"./TimeRangePicker-CcUEMoXD.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}),a(),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)(g,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-40`,children:(0,S.jsx)(v,{placeholder:c()})}),(0,S.jsx)(y,{children:e.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(g,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-28`,children:(0,S.jsx)(v,{})}),(0,S.jsx)(y,{children:C.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(_,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:o()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":i(),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)(m,{}),s()]})]}):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{$s as r,E as i,Gn as a,Gs as o,Hs as s,Jn as c,Js as l,Kn as u,Ks as d,Qc as f,Qs as p,Sr as m,Un as h,Us as g,Wn as _,Ws as v,Xs as y,Yn as b,Ys as x,Zs as S,_c as C,_r as w,ac as T,ar as E,bj as D,br as O,cc as k,cr as A,dc as j,dr as M,ec as ee,el as N,fc as te,fj as P,fr as F,gc as I,gr as L,hc as ne,hr as R,ic as re,ir as z,lc as ie,lr as B,mc as V,mj as H,mr as U,nc as ae,nr as oe,oc as se,or as ce,pc as le,pr as ue,qn as de,qs as fe,rc as pe,rr as me,sc as he,sr as ge,tE as _e,tc as ve,uc as ye,ur as be,vj as W,vr as xe,xj as G,xr as Se,yr as Ce}from"./dist-B7IaMcdm.js";import{t as K}from"./button-B9CsHmrJ.js";import{C as we,G as Te,J as Ee,K as De,S as Oe,V as q,W as ke,X as Ae,Y as je,Z as Me,b as Ne,bt as Pe,dt as Fe,kt as J,lt as Ie,mt as Le,pt as Re,q as ze,st as Be,ut as Ve,w as He,x as Ue,y as We}from"./index-DYfClpT4.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-BU4Wp3dH.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*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 Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(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<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=G(i.me.getMe,{host:Pe}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=G(i.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!a||!r.some(e=>e.name===a))&&o(r[0].name)},[t,r,a]);let s=G(i.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),c=G(i.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return a===null||s===void 0?r!==void 0&&r.length===0?[]:void 0:s.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,s,r,c]),[u,d]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!l||l.length===0||(!u||!l.some(e=>$(e)===u))&&d($(l[0]))},[l,u]);let p=l?.find(e=>$(e)===u)??null,m=W(i.agentFiles.listAgentFiles),[h,g]=(0,Y.useState)({status:`idle`}),_=p?.instanceName??null,v=p?.agentId??null,y=G(i.compat.forInstance,n&&_!==null?{instanceName:_}:`skip`),b=n&&_!==null?We(y,`agentFiles`):null,x=b===null?!1:b===`loading`?null:b.blocked,S=(0,Y.useCallback)(async()=>{if(!(_===null||v===null)){g({status:`loading`});try{g({status:`done`,files:(await m({instanceName:_,agentId:v})).files})}catch{g({status:`error`})}}},[m,_,v]);(0,Y.useEffect)(()=>{x===!1&&S()},[S,x]);let[E,D]=(0,Y.useState)(null),O=G(i.agentFileCuration.listCurations,t&&_!==null&&v!==null?{instanceName:_,agentId:v}:`skip`),A=G(i.agentFileCuration.curationSettings,t&&_!==null?{instanceName:_}:`skip`),M=W(i.agentFileCuration.requestCuration),[ee,N]=(0,Y.useState)(null),[F,L]=(0,Y.useState)(null),{toast:R}=q(),re=(0,Y.useMemo)(()=>{let e=new Map;for(let t of O??[])e.has(t.name)||e.set(t.name,t);return e},[O]),z=(0,Y.useCallback)(async e=>{if(!(_===null||v===null)){N(e);try{let t=await M({instanceName:_,agentId:v,name:e,trigger:`manual`});t.ok?R({title:Ce(),variant:`success`}):R({title:xe({reason:t.reason??`unknown`}),variant:`error`})}catch{R({title:w(),variant:`error`})}finally{N(null)}}},[M,_,v,R]),B=H(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(B,{maximumFractionDigits:0}),[B]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ne,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":I(),children:(0,Q.jsx)(He,{})}),(0,Q.jsx)(Ue,{children:(r??[]).map(e=>(0,Q.jsx)(Oe,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(Ne,{value:u??``,onValueChange:e=>d(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":ne(),children:(0,Q.jsx)(He,{})}),(0,Q.jsx)(Ue,{children:l.map(e=>(0,Q.jsx)(Oe,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()})]}),p===null?null:b===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):b!==null&&b.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,qe(b.gatewayVersion,b.provider)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[te(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void S(),children:f()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:le()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Ye(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)(Be,{variant:`outline`,children:j()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ye({size:Z(e.size,B)})}),(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:U.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":k()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>D(e),children:t?se():T()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:A?.budgetChars??null,enabled:A?.enabled??!1,curation:re.get(e.name)??null,inFlight:ee===e.name,onCurate:()=>void z(e.name),onReview:e=>L(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:he({used:Z(Ze(h.files),B),total:Z(Je,B),pct:U.format(Xe(Ze(h.files)))})})]}),E&&p?(0,Q.jsx)(rt,{instanceName:p.instanceName,agentId:p.agentId,name:E.name,isAdmin:t,onClose:()=>D(null),onSaved:()=>void S()}):null,F?(0,Q.jsx)(it,{curationId:F,onClose:()=>L(null),onApplied:()=>{L(null),S()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:Se()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Be,{variant:`outline`,className:`oc-afiles__curate-status`,children:O()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:m()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:a,onClose:c,onSaved:u}){let m=W(i.agentFiles.getAgentFile),h=W(i.agentFiles.setAgentFile),_=q(),[b,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(!1),[E,D]=(0,Y.useState)(``),[O,k]=(0,Y.useState)(!1),[A,j]=(0,Y.useState)(!1),[M,te]=(0,Y.useState)(!1),[F,I]=(0,Y.useState)(!1),L=(0,Y.useCallback)(async r=>{T(!1);try{let i=await m({instanceName:e,agentId:t,name:n});C({content:i.content,updatedAtMs:i.updatedAtMs}),r||D(i.content),te(!1)}catch{T(!0)}},[m,e,t,n]);(0,Y.useEffect)(()=>{L(!1)},[L]);async function ne(){if(b!==null){j(!0),I(!1);try{await h({instanceName:e,agentId:t,name:n,content:E,baseUpdatedAtMs:b.updatedAtMs??void 0}),_.success(p({name:n})),u(),await L(!1)}catch(e){et(e)?te(!0):I(!0)}finally{j(!1)}}}let R=b!==null&&E!==b.content,z=(0,Y.useMemo)(()=>b===null?null:$e(b.content,E),[b,E]),ie=E.length>X,B=H(),V=(0,Y.useMemo)(()=>new Intl.NumberFormat(B),[B]);return(0,Q.jsx)(Ie,{open:!0,onOpenChange:e=>!e&&c(),children:(0,Q.jsxs)(Ve,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:re({name:n})}),(0,Q.jsxs)(Fe,{children:[pe({agent:t,instance:e}),a?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,ae()]})]})]}),w?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[y(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void L(!1),children:f()})]}):b===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:E,readOnly:!a,spellCheck:!1,onChange:e=>D(e.target.value),"aria-label":re({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ve()}),M?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[x(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void L(!0),children:l()})]}):null,F?(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${ie?` is-over`:``}`,children:ee({count:V.format(E.length),max:V.format(X)})}),a?(0,Q.jsx)(K,{size:`sm`,disabled:!R||A||M,onClick:()=>k(!0),children:A?N():r()}):null]})]}),(0,Q.jsx)(ke,{open:O,onOpenChange:k,children:(0,Q.jsxs)(ze,{children:[(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(Me,{children:fe({name:n})}),(0,Q.jsx)(Ee,{children:d({agent:t})})]}),z?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:o({added:z.added,removed:z.removed})}),z.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:v()}),z.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,z.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:g()}),z.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(je,{children:[(0,Q.jsx)(De,{children:_e()}),(0,Q.jsx)(Te,{onClick:()=>void ne(),children:s()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=G(i.agentFileCuration.getProposal,{curationId:e}),o=W(i.agentFileCuration.approveCuration),s=D(i.agentFileCuration.rejectCuration),{toast:l}=q(),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(!1),[g,v]=(0,Y.useState)(``),y=H(),x=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function S(){f(`approve`);try{let t=await o({curationId:e});t.ok?(l({title:L(),variant:`success`}),n()):l({title:t.reason===`conflict`?U():ue({reason:t.reason??`unknown`}),variant:`error`})}catch{l({title:w(),variant:`error`})}finally{f(null)}}async function C(n){f(`reject`);try{let r=g.trim();(await s({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?l({title:n?_():R(),variant:`success`}):l({title:be(),variant:`error`}),t()}catch{l({title:w(),variant:`error`})}finally{f(null)}}return(0,Q.jsx)(Ie,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Ve,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:r?F({name:r.name}):P()}),(0,Q.jsx)(Fe,{children:M()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[B({before:Z(r.beforeSize,y),after:Z(r.proposedSize,y)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,A()]}):null]}),x?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:ge({added:x.added,removed:x.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:h({feedback:r.feedback})}):null,x&&x.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:oe()}),(0,Q.jsx)(`ul`,{children:x.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:me()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:ce()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),p?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:b()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:c(),value:g,onChange:e=>v(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>m(!1),disabled:d!==null,children:de()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void C(!1),disabled:d!==null,children:d===`reject`?N():u()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void C(!0),disabled:d!==null,children:d===`reject`?N():a()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>m(!0),disabled:d!==null||r==null,children:E()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void S(),disabled:d!==null||r==null,children:d===`approve`?N():z()})]})]})})}export{tt as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Av as r,Bv as i,Cv as ee,Dv as te,E as a,Ev as ne,Fv as re,Hv as o,Iv as ie,Lv as s,Mv as c,Nv as l,Ov as u,Pv as d,Rv as f,Sv as p,Tv as ae,Uv as m,Vv as oe,Wv as h,_v as g,av as _,bj as se,bv as ce,cv as le,dv as ue,fv as de,gv as fe,hv as pe,iv as v,jv as me,kv as he,lv as ge,mv as _e,nv as y,ov as b,pv as x,rv as S,sv as C,uv as w,vv as T,wv as E,xj as D,xv as O,yv as k,zv as A}from"./dist-B7IaMcdm.js";import{A as j,C as M,H as N,Jt as P,S as F,V as I,a as ve,b as L,bt as ye,qt as R,r as be,st as z,w as B,x as V}from"./index-DYfClpT4.js";import{n as xe}from"./TimeRangePicker-CcUEMoXD.js";import{t as Se}from"./FilterBar-Z4TZZeJs.js";import{t as Ce}from"./DataTableShell-BwOKMopJ.js";import{t as H}from"./dispatchErrorInfo-dqUyKO3V.js";var U=t(e(),1),W=n(),G=`__all__`,we=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Te(e){return e===`open`?h():e===`acknowledged`?m():o()}var Ee=[`info`,`warn`,`critical`],De=[`detector`,`agent`,`user`],Oe={kind:`relative`,from:`now-30d`,to:`now`},ke=200,K=`all`;function q(){let e=P({from:`/settings/anomalies`}),t=R({from:`/settings/anomalies`}),n=e.q??``,o=e.status===K?G:e.status,m=e.severity??G,h=e.kind??G,[_,v]=(0,U.useState)(G),y=be(e.from,e.to),{from:S,to:H}=xe(y),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})}),Pe=e=>void t({search:t=>({...t,kind:e===G?void 0:e})}),Fe=e=>void t({search:t=>({...t,...ve(e)})}),Ie=N(),X=I(),Z=se(a.anomalies.resolveAnomaly),Le=(D(a.me.getMe,{host:ye})?.permissions??[]).includes(`admin.manage`),Q=D(a.anomalies.listAnomalies,{limit:ke,filter:{q:n||void 0,from:S,to:H,anomalyStatus:o===G?void 0:o,severity:m===G?void 0:m,source:_===G?void 0:_,kind:h===G?void 0:h}}),$=(0,U.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.kind);return[...e].sort()},[Q]),Re=n!==``||o!==`open`||m!==G||_!==G||h!==G||y.kind!==`relative`||y.from!==Oe.from;function ze(){v(G),t({search:{status:`open`},replace:!0})}async function Be(e){if(await Ie({title:oe(),description:(0,W.jsxs)(W.Fragment,{children:[i(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,A(),` `,(0,W.jsx)(`strong`,{children:f()}),`.`,` `,s()]}),confirmLabel:ie()}))try{await Z({anomalyId:e._id,status:`resolved`}),X.success(re(),e.kind)}catch(e){X.error(d(),e)}}async function Ve(e){try{await Z({anomalyId:e._id,status:`acknowledged`}),X.success(l(),e.kind)}catch(e){X.error(c(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[me(),` `,(0,W.jsx)(`strong`,{children:r()}),` `,he(),` `,(0,W.jsx)(`strong`,{children:u()}),` `,te(),` `,(0,W.jsx)(`strong`,{children:ne()}),` `,ae(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:E()})]}),(0,W.jsxs)(Se,{q:n,onQChange:q,searchPlaceholder:ee(),timeRange:y,onTimeRangeChange:Fe,onReset:ze,canReset:Re,children:[(0,W.jsxs)(L,{value:o,onValueChange:J,children:[(0,W.jsx)(M,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(F,{value:G,children:p()}),we.map(e=>(0,W.jsx)(F,{value:e.value,children:Te(e.value)},e.value))]})]}),(0,W.jsxs)(L,{value:m,onValueChange:Y,children:[(0,W.jsx)(M,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:O()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(F,{value:G,children:ce()}),Ee.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]}),(0,W.jsxs)(L,{value:_,onValueChange:v,children:[(0,W.jsx)(M,{size:`sm`,className:`w-32`,children:(0,W.jsx)(B,{placeholder:k()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(F,{value:G,children:T()}),De.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]}),(0,W.jsxs)(L,{value:h,onValueChange:Pe,children:[(0,W.jsx)(M,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:g()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(F,{value:G,children:fe()}),$.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Ce,{title:pe(),rows:Q,emptyHint:o===`open`?_e():x(),rowActions:e=>Le&&e.status===`open`?[{label:de(),onSelect:()=>void Be(e)},{label:ue(),onSelect:()=>void Ve(e)}]:[],columns:[{header:w(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:j(e.at)}),sort:e=>e.at},{header:g(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:O(),cell:e=>(0,W.jsx)(je,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ge(),cell:e=>(0,W.jsx)(Me,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:k(),cell:e=>(0,W.jsx)(z,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:le(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:C(),cell:e=>(0,W.jsx)(Ae,{row:e}),sort:e=>e.evidence??null},{header:b(),cell:e=>e.correlationId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:Ne(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 Ae({row:e}){let t=R();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:[`↗ `,_()]}):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:[`↗ `,_()]}):null]})}function je({severity:e}){return(0,W.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Me({status:e}){return e===`open`?(0,W.jsx)(z,{variant:`destructive`,children:v()}):e===`acknowledged`?(0,W.jsx)(z,{variant:`secondary`,children:S()}):(0,W.jsx)(z,{variant:`outline`,children:y()})}function Ne(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{By as r,E as i,Fy as a,Gy as o,Hy as s,Iy as c,Jy as l,Ky as u,Ly as d,Ry as f,Uy as p,Vy as m,Wy as h,Yy as g,_n as _,bn as v,gn as y,qy as b,vn as x,xj as S,xn as C,yn as w,zy as T}from"./dist-B7IaMcdm.js";import{A as E,C as D,Jt as O,S as k,a as A,b as j,i as M,o as N,qt as P,r as F,t as I,w as L,x as R}from"./index-DYfClpT4.js";import{n as ee}from"./TimeRangePicker-CcUEMoXD.js";import{t as z}from"./FilterBar-Z4TZZeJs.js";import{t as B}from"./AdvancedFilter-BnA7f0yX.js";import{t as V}from"./DataTableShell-BwOKMopJ.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:C()},{value:`realLabel`,label:v()},{value:`targetLabel`,label:w()},{value:`impersonated`,label:x()},{value:`resource`,label:_()},{value:`resourceId`,label:y()}];function q(){let e=O({from:`/settings/audit`}),t=P({from:`/settings/audit`}),n=e.q??``,_=e.action??G,v=e.impersonated??G,y=e.resource??G,x=F(e.from,e.to),C=(0,H.useMemo)(()=>N(e.adv),[e.adv]),{from:w,to:I}=ee(x),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...A(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=S(i.admin.listAudit,{filter:{q:n||void 0,from:w,to:I,action:_===G?void 0:_,resource:y===G?void 0:y,impersonated:v===G?void 0:v===`yes`,advanced:C.length>0?C:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||_!==G||v!==G||y!==G||C.length>0||x.kind!==`relative`||x.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:l()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:b(),timeRange:x,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(j,{value:_,onValueChange:J,children:[(0,U.jsx)(D,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:u()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:o()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(j,{value:v,onValueChange:Y,children:[(0,U.jsx)(D,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:h()}),(0,U.jsx)(k,{value:`yes`,children:p()}),(0,U.jsx)(k,{value:`no`,children:s()})]})]}),(0,U.jsxs)(j,{value:y,onValueChange:X,children:[(0,U.jsx)(D,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:m()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:r()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:C,onChange:Q}),(0,U.jsx)(V,{title:T(),rows:$,emptyHint:f(),columns:[{header:d(),cell:e=>E(e.at),sort:e=>e.at},{header:u(),cell:e=>e.action,sort:e=>e.action},{header:c(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:a(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:m(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,$m as i,Am as a,As as o,Bm as s,Bt as c,Cs as l,D as u,Dm as d,Ds as f,E as p,Em as m,Es as h,Fm as g,Gm as _,Gt as v,Hm as y,Ht as ee,Im as te,Jh as ne,Jm as re,Km as ie,Lm as ae,Mm as oe,Nm as se,Om as ce,Os as le,Pm as ue,Qh as de,Qm as fe,Rm as pe,Rt as me,Ss as he,Ts as ge,Uh as _e,Um as ve,Vm as ye,Vt as be,Wh as xe,Wm as Se,Xh as Ce,Xm as we,Yh as Te,Ym as Ee,Zh as De,Zm as Oe,_h as ke,ah as Ae,bh as je,bj as Me,bs as Ne,ch as Pe,dh as Fe,eg as Ie,eh as Le,fh as Re,gh as ze,hh as Be,hs as Ve,ih as He,jm as Ue,js as We,km as Ge,ks as Ke,lh as qe,mh as Je,ng as Ye,nh as Xe,oh as Ze,ph as Qe,qh as $e,qm as et,rg as tt,rh as nt,sh as rt,th as it,uh as at,vh as ot,vj as st,ws as ct,xh as lt,xj as b,xs as ut,yh as dt,ys as ft,zm as pt,zt as mt}from"./dist-B7IaMcdm.js";import{i as x,r as ht}from"./dist-D87j9TcT.js";import{t as gt}from"./chevrons-up-down-C13y3ij3.js";import{i as _t,n as S,o as vt,r as yt,s as bt}from"./FieldLabel-D6e92lXR.js";import{i as xt,n as St,r as Ct,t as wt}from"./tabs-K6MF5os_.js";import{t as C}from"./button-B9CsHmrJ.js";import{$ as Tt,A as Et,C as w,Gt as T,Jt as Dt,Kt as E,Mt as Ot,Q as kt,Rt as At,S as D,V as jt,b as O,bt as Mt,ct as k,dt as Nt,et as Pt,j as A,kt as j,lt as Ft,m as It,mt as Lt,p as Rt,pt as zt,qt as M,st as N,ut as Bt,w as P,x as F}from"./index-DYfClpT4.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as I,i as L,n as R,o as z,r as B,t as V}from"./table-r4XuUszk.js";import{t as Ht}from"./FilterBar-Z4TZZeJs.js";import{a as H,n as Ut,o as U,r as W,s as Wt,t as Gt}from"./compatView-BU4Wp3dH.js";import{t as G}from"./dispatchErrorInfo-dqUyKO3V.js";var Kt=u(`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`}]]),qt=u(`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 Jt(e){return e.filter(e=>e.state===`error`)}function Yt(e){return e.reachable&&Jt(e.targets).length===0}function Xt(e){return e.state===`error`&&e.lastErrorCode!==null}function Zt(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function Qt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function $t(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,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Qt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,en={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function tn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function nn(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 rn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function an(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 on(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=rn(t.key,e),a=rn(t.key,r);return i&&a?0:i?1:a?-1:n*an(t.key,e,r)})}function sn(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 cn(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 ln(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 un({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(en),[i,o]=(0,K.useState)(null),c=(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]),l=(0,K.useMemo)(()=>sn(c),[c]),u=(0,K.useMemo)(()=>cn(c),[c]),d=(0,K.useMemo)(()=>ln(c),[c]),f=(0,K.useMemo)(()=>on(nn(c,n),i),[c,n,i]);function p(e){o(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:Se()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Ht,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:ye(),onReset:()=>r(en),canReset:tn(n),children:[(0,Q.jsxs)(O,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(w,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:pt()})}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(D,{value:Y,children:s()}),l.map(e=>(0,Q.jsx)(D,{value:e,children:fn(e)},e))]})]}),(0,Q.jsxs)(O,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(w,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(P,{placeholder:pe()})}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(D,{value:Y,children:s()}),u.map(e=>(0,Q.jsx)(D,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(O,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(w,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:ae()})}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(D,{value:Y,children:s()}),d.map(e=>(0,Q.jsx)(D,{value:e,children:e},e))]})]})]}),f.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,Q.jsxs)(V,{className:`oc-conn__table`,children:[(0,Q.jsx)(I,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:g(),sortKey:`target`,sort:i,onSort:p}),(0,Q.jsx)($,{label:ue(),sortKey:`state`,sort:i,onSort:p}),(0,Q.jsx)($,{label:se(),sortKey:`instance`,sort:i,onSort:p}),(0,Q.jsx)($,{label:oe(),sortKey:`host`,sort:i,onSort:p}),(0,Q.jsx)($,{label:Ue(),sortKey:`version`,sort:i,onSort:p}),(0,Q.jsx)(L,{children:a()}),(0,Q.jsx)($,{label:Ge(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(0,Q.jsx)(R,{children:f.map(e=>(0,Q.jsx)(dn,{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)(L,{"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)(ht,{size:13,"aria-hidden":!0}):(0,Q.jsx)(x,{size:13,"aria-hidden":!0}):(0,Q.jsx)(gt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function dn({r:e}){let t=Xt(e)?G(e.lastErrorCode):null,n=Zt(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(z,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(B,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(pn,{state:e.state})}),(0,Q.jsx)(B,{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)(B,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(B,{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)(B,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:ve({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(B,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:A(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(z,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(B,{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?` · ${A(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[y({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${A(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function fn(e){return e===`connected`?ce():e===`error`?d():m()}function pn({state:e}){return e===`connected`?(0,Q.jsx)(N,{variant:`secondary`,children:ce()}):e===`error`?(0,Q.jsx)(N,{variant:`destructive`,children:d()}):(0,Q.jsx)(N,{variant:`outline`,children:m()})}function mn(){return b(p.bridgeHealth.getBridgeHealth,{})}function hn(){let e=mn(),t=b(p.compat.getBridgeCompat,{}),n=b(p.me.getMe,{host:Mt})?.role===`admin`,r=b(p.admin.listInstances,n?{}:`skip`),i=b(p.agents.usageForInstances,n?{}:`skip`),a=M(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=$t(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=Dt({from:`/settings/bridge`}),u=M({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,m=d!==null&&Ut(d,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(gn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:rt()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Ze()}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(I,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)(L,{children:ee()}),(0,Q.jsx)(L,{children:be()}),(0,Q.jsx)(L,{children:c()}),(0,Q.jsx)(L,{children:mt()}),(0,Q.jsx)(L,{children:me()})]})}),(0,Q.jsx)(R,{children:i.flatMap(e=>{let t=It(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(z,{children:[(0,Q.jsx)(B,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(B,{children:t.provider}),(0,Q.jsx)(B,{children:t.label}),(0,Q.jsx)(B,{children:(0,Q.jsxs)(N,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(B,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(wt,{value:s.some(e=>e.key===l)?l:s[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Q.jsx)(Ct,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(xt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ot,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(St,{value:e.key,children:(0,Q.jsx)(_n,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):null]})}function gn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=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)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:Ke(),children:[`(`,a,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,le({build:t.buildVersion??`?`})]}):null,` · `,f(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?h():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:i()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:fe()});let s=Jt(e.targets),c=!e.reachable,l=Yt(e),u=l?`ok`:`error`,d=Et(e.checkedAt),p=e.startedAt==null?null:Et(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l?(0,Q.jsx)(T,{size:22}):c?(0,Q.jsx)(qt,{size:22}):(0,Q.jsx)(j,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l?Oe():c?we():Ee({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Kt,{size:12,"aria-hidden":!0}),` `,re({time:d})]}),p?(0,Q.jsx)(`span`,{children:et({time:p})}):null,o]}),c?(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:ie()})]})}function _n({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Wt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Gt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(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)(Ot,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),f?(0,Q.jsx)(N,{variant:f===`beyond`?`destructive`:`secondary`,children:W(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:We()}),(0,Q.jsx)(yn,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(vn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(x,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}),_({count:t.length})]}),p?(0,Q.jsx)(un,{connections:t,displayByInstance:c}):null]})}function vn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ae(),i.length>0?(0,Q.jsx)(N,{variant:`destructive`,children:nt({count:i.length})}):(0,Q.jsx)(N,{variant:`secondary`,children:He()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[Xe({version:e.vendoredVersion}),r?` · `+it({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(x,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}),Le({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function yn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:a,providerName:s}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ct()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:v({provider:s})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:l({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:h()}),e?(0,Q.jsx)(Cn,{versions:e.validatedVersions}):null]}),a.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ft()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:a.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)(N,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:W(e.state)})]},e.instanceName))})]})}function bn({instance:e,onClose:t}){return(0,Q.jsx)(Ft,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Bt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(zt,{children:[(0,Q.jsx)(Lt,{children:tt({instance:e.displayName??e.name})}),(0,Q.jsx)(Nt,{children:Ye()})]}),(0,Q.jsx)(Sn,{instance:e,onClose:t})]})})}function xn({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)(T,{"aria-hidden":!0}):(0,Q.jsx)(j,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Fe():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,at()]}):null}function Sn({instance:e,onClose:t}){let n=Me(p.admin.upsertInstanceConfig),i=st(p.bridge.validateMediaPaths),a=jt(),o=Vt(e.config?.contentLocale,void 0),[s,c]=(0,K.useState)(()=>_t(e.config??{},o)),[l,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(!1),[m,h]=(0,K.useState)(null),g=s.inboundMediaMode===`shared-fs`,_=s.mediaMode===`shared-fs`,v=g||_;async function y(){f(!0),h(null);try{h(await i({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){a.error(Be(),e)}finally{f(!1)}}async function ee(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:yt(s,r,o)}),t()}catch(e){a.error(Te(),e)}finally{u(!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)(S,{label:Ie(),help:ne()}),(0,Q.jsxs)(O,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Q.jsx)(w,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(F,{children:bt.map(e=>(0,Q.jsx)(D,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(S,{label:r(),help:$e()}),(0,Q.jsxs)(O,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Q.jsx)(w,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(F,{children:vt.map(e=>(0,Q.jsx)(D,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(S,{label:de(),help:xe()}),(0,Q.jsx)(k,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>c({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(S,{label:lt(),help:je()}),(0,Q.jsx)(k,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(S,{label:dt(),help:ot()}),(0,Q.jsx)(k,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>c({...s,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Rt,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Q.jsx)(S,{label:De(),help:_e()})]}),v&&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)(j,{"aria-hidden":!0}),Pe({reason:m.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xn,{label:Qe(),result:m.inbound}),(0,Q.jsx)(xn,{label:Re(),result:m.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Je()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(j,{"aria-hidden":!0}),qe()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Q.jsxs)(C,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:d,children:[d?(0,Q.jsx)(At,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?ze():ke()]}),(0,Q.jsx)(C,{size:`sm`,onClick:()=>void ee(),disabled:l,children:Ce()})]})]})})}function Cn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(kt,{children:[(0,Q.jsx)(Pt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?he():ut({count:e.length}),(0,Q.jsx)(x,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Tt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:Ne()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(N,{variant:`secondary`,children:e},e))})]})]})}export{hn as BridgeTab,bn as InstanceConfigDialog};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bs as r,E as i,Fs as a,Is as o,Jc as s,Ls as c,Ms as l,Ns as u,Ps as d,Qc as f,Rs as p,Wt as m,bj as h,ci as g,di as _,el as v,fi as y,fj as b,gc as x,li as S,pi as C,qc as w,si as T,tg as E,ui as D,vj as O,xj as k,zs as A}from"./dist-B7IaMcdm.js";import{t as j}from"./button-B9CsHmrJ.js";import{C as M,S as N,b as P,ct as F,d as I,f as L,kt as R,p as z,w as B,x as V,y as H}from"./index-DYfClpT4.js";import{i as U}from"./compatView-BU4Wp3dH.js";/* empty css */var W=t(e(),1),G=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function K(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 q=n();function J({instance:e}){let t=h(i.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,W.useState)(n),[s,c]=(0,W.useState)(r===null?``:String(r)),[f,p]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{o(n),c(r===null?``:String(r)),p(`idle`)},[e._id,n,r]);let m=s.trim(),y=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,b=!a||y===null||Number.isInteger(y)&&y>=4e3&&y<=6e4,x=a!==n||(y??null)!==r;async function C(){p(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||y===null||Number.isNaN(y)?delete n.curationBudgetChars:n.curationBudgetChars=y,await t({instanceId:e._id,config:n}),p(`done`)}catch{p(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,q.jsx)(z,{checked:a,onCheckedChange:e=>o(e===!0),"aria-label":_()}),(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(F,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>c(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!b,"aria-label":D(),disabled:!a}),(0,q.jsx)(j,{size:`sm`,disabled:!x||!b||f===`saving`,onClick:()=>void C(),children:f===`saving`?v():d()})]}),b?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:S()}),f===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,f===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:g()})]})}function Y({instance:e}){let t=h(i.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,a]=(0,W.useState)(n===null?``:String(n)),[o,s]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{a(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),f=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,p=f===null||Number.isInteger(f)&&f>=1e3&&f<=2e5,m=(f??null)!==n;async function g(){s(`saving`);try{let n={...e.config??{}};f===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=f,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:C()}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(F,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p}),(0,q.jsx)(j,{size:`sm`,disabled:!m||!p||o===`saving`,onClick:()=>void g(),children:o===`saving`?v():d()})]}),p?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:T()}),o===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,o===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]})}function X(){let e=O(i.agentFiles.getChatDefaults),[t,n]=(0,W.useState)({status:`loading`}),l=k(i.admin.listInstances,{}),[u,d]=(0,W.useState)(null);(0,W.useEffect)(()=>{!l||l.length===0||(!u||!l.some(e=>e.name===u))&&d(l[0].name)},[l,u]);let h=(l?.length??0)>1,g=l!==void 0&&l.length===0,_=k(i.compat.forInstance,u?{instanceName:u}:`skip`),v=u?H(_,`configDefaults`):`loading`,y=v===`loading`?null:v.blocked,S=(0,W.useMemo)(()=>h&&u?{instanceName:u}:{},[h,u]),C=(0,W.useRef)(0),T=(0,W.useCallback)(async()=>{let t=++C.current;n({status:`loading`});try{let r=K(await e(S));if(C.current!==t)return;n({status:`done`,current:r})}catch{if(C.current!==t)return;n({status:`error`})}},[e,S]);(0,W.useEffect)(()=>{y===!1&&(h&&!u||T())},[T,y,h,u]);let D=t.status===`done`?t.current:null,F=(0,W.useMemo)(()=>G.map(e=>({id:e,label:L(e)})),[]),z=(0,W.useMemo)(()=>[{id:`fast`,label:s()},{id:`standard`,label:w()}],[]);return(0,q.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}),h&&u?(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()}),(0,q.jsxs)(P,{value:u,onValueChange:e=>d(e),children:[(0,q.jsx)(M,{size:`sm`,"aria-label":x(),children:(0,q.jsx)(B,{})}),(0,q.jsx)(V,{children:(l??[]).map(e=>(0,q.jsx)(N,{value:e.name,children:e.name},e.name))})]})]}):null,g?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:E()}):v===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):v.blocked?(0,q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,q.jsx)(R,{size:14,"aria-hidden":!0}),` `,U(v.gatewayVersion,v.provider)]}):t.status===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):t.status===`error`?(0,q.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[a(),` `,(0,q.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void T(),children:f()})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()}),(0,q.jsx)(I,{options:F,value:D?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:p()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:c()}),(0,q.jsx)(I,{options:z,value:D===null||D.fastModeDefault===null?null:D.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:o()})]}),(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:m()})]}),(()=>{let e=l?.find(e=>e.name===(u??l[0]?.name));return e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Y,{instance:e}),(0,q.jsx)(J,{instance:e})]}):null})()]})}export{X as ChatDefaultsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,af as i,ef as a,if as o,nf as s,rf as c,tf as l}from"./dist-B7IaMcdm.js";import{i as u,r as d}from"./dist-D87j9TcT.js";import{t as f}from"./chevrons-up-down-C13y3ij3.js";import{t as p}from"./button-B9CsHmrJ.js";import{At as m,Ft as h,Vt as g,at as _,nt as v,ot as y,p as b,rt as x,tt as S}from"./index-DYfClpT4.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-r4XuUszk.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=i(),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)(m,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(h,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):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":s(),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":r({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":l(),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)(S,{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)(g,{})})}),(0,M.jsx)(v,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(_,{}):null,(0,M.jsx)(x,{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 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{at as t}from"./index--Drh_B6c.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{st as t}from"./index-DYfClpT4.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{$S as r,AS as i,BS as a,CS as o,DS as s,E as c,ES as l,Er as u,FS as d,GS as f,HS as p,IS as m,JS as h,KS as g,LS as ee,MS as _,NS as v,OS as y,Or as te,PS as b,QS as ne,RS as re,SS as ie,TS as x,US as S,VS as C,WS as w,XS as T,YS as E,ZS as D,_S as O,aC as k,bS as A,bj as j,cC as M,dC as N,dS as P,eC as F,fS as I,gS as L,hS as R,iC as z,jS as B,kS as V,lC as H,mS as U,nC as W,oC as ae,pS as G,qS as K,rC as q,sC as J,tC as oe,uC as se,uS as ce,vS as le,wS as ue,xS as de,xj as fe,yS as pe,zS as me}from"./dist-B7IaMcdm.js";import{t as he}from"./button-B9CsHmrJ.js";import{A as ge,H as _e}from"./index-DYfClpT4.js";import{t as Y}from"./DataTableShell-BwOKMopJ.js";var X=t(e(),1),Z=n(),ve={altered_words:()=>N(),incorrect:()=>se(),incoherence:()=>H(),formatting:()=>M(),latency:()=>J(),api_error:()=>ae(),other:()=>k()},Q=e=>ve[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:q()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:W()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:z()})}function ye({data:e,closeReason:t}){let n=e.snapshot,i=j(c.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[l,u]=(0,X.useState)(``),[_,v]=(0,X.useState)(!1);async function y(){let t=l.trim();if(!(!t||_)){v(!0);try{await i({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{v(!1)}}}let b=[];try{b=n.contextJson?JSON.parse(n.contextJson):[]}catch{b=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${oe()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:r()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?ne():e.authorRole===`agent`?e.authorLabel??te():D()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:T()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:E(),value:l,maxLength:2e3,rows:3,onChange:e=>u(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(he,{size:`sm`,onClick:()=>void y(),disabled:!l.trim()||_,children:_?h():K()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||f()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||f()})]}):null,n.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:S()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,b.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:p({count:n.contextCount??b.length,truncated:n.contextTruncated?C():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:b.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,Z.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,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:me()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?ee({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,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[m(),` `,n.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,d()]})]}):null,n.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function be(){let e=fe(c.feedback.listForAdmin,{}),t=j(c.feedback.readSnapshot),n=j(c.feedback.deleteFeedback),r=_e(),[a,d]=(0,X.useState)(null),[f,p]=(0,X.useState)({});async function m(e){if(a===e._id){d(null);return}if(!f[e._id]){let n=await t({feedbackId:e._id});p(t=>({...t,[e._id]:n}))}d(e._id)}async function h(e){await r({title:I(),description:P(),confirmLabel:ce(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&d(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[b(),` `,(0,Z.jsx)(`strong`,{children:v()}),` `,_()]}),(0,Z.jsx)(Y,{title:B(),rows:e,emptyHint:i(),isExpanded:e=>a===e._id&&!!f[e._id],renderExpanded:e=>f[e._id]?(0,Z.jsx)(ye,{data:f[e._id],closeReason:e.userCloseReason}):null,columns:[{header:V(),cell:e=>ge(e.at),sort:e=>e.at},{header:y(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:s(),cell:e=>e.messageRole===`user`?l():x(),sort:e=>e.messageRole},{header:ue(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${o({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:ie(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:de(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:A(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:pe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:le()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:u()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:O()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?R():U(),onSelect:()=>void m(e)},{label:G(),onSelect:()=>void h(e),variant:`destructive`}]})]})}export{be as FeedbacksTab};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,Dj as n}from"./dist-Bcr-KIFN.js";import{_ as r,g as i,h as a,v as o}from"./index--Drh_B6c.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.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:{fr:`[LIVRAISON]
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,Oj as n}from"./dist-B7IaMcdm.js";import{_ as r,g as i,h as a,v as o}from"./index-DYfClpT4.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.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:{fr:`[LIVRAISON]
2
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.`,en:`[DELIVERY]
3
3
  To make a file you generate downloadable by the user in this webchat: write it under {outboundDir}/ then add, in your final reply, a dedicated line EXACTLY in the format MEDIA:<absolute file path>. Do NOT use a markdown link to a local path — it would not be clickable.`}},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:{fr:`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 :
4
4
  {references}`,en:`Provide the downloadable source files matching EXACTLY these document references (one file per reference, named after the reference). Reply only with the files, no commentary:
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AA as r,BA as i,CA as a,DA as ee,E as o,EA as s,FA as c,GA as te,HA as l,IA as ne,KA as re,LA as u,MA as d,Mr as f,NA as p,OA as ie,PA as m,RA as ae,SA as oe,TA as se,UA as h,VA as ce,WA as le,_A as ue,bA as de,bj as fe,dA as pe,fA as me,fj as he,gA as ge,hA as _e,jA as g,jr as ve,kA as _,mA as ye,mj as be,pA as xe,tE as v,vA as y,wA as b,xA as x,xj as S,yA as C,zA as w}from"./dist-B7IaMcdm.js";import{t as T}from"./button-B9CsHmrJ.js";import{At as E,C as D,G as O,Ht as k,J as A,K as j,Pt as M,S as N,V as Se,Vt as Ce,W as we,X as Te,Y as Ee,Z as De,b as P,nt as Oe,ot as ke,p as Ae,q as je,rt as F,st as I,tt as Me,w as L,x as R}from"./index-DYfClpT4.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-r4XuUszk.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return c();case`audio`:return m();case`video`:return p();case`pdf`:return d();case`document`:return g();case`archive`:return r();default:return _()}}function K(){let[e,t]=(0,H.useState)(W),[n,r]=(0,H.useState)(W),[c,d]=(0,H.useState)(W),[p,m]=(0,H.useState)(W),[g,_]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=fe(o.files.softDelete),Y=Se();function Ie(){t(W),r(W),d(W),m(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(y())}catch(e){Y.error(ue(),e)}}let X=S(o.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:c===W?void 0:c,category:p===W?void 0:p,includeAutoGenerated:g||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(be(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:he()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||c!==W||p!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:re()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(P,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":te(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:le()}),(0,U.jsx)(N,{value:`inbound`,children:h()}),(0,U.jsx)(N,{value:`outbound`,children:l()})]})]}),(0,U.jsxs)(P,{value:n,onValueChange:r,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":ce(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:i()}),Q.chats.map(e=>(0,U.jsx)(N,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(P,{value:c,onValueChange:d,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":w(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:ae()}),Q.instances.map(e=>(0,U.jsx)(N,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(P,{value:p,onValueChange:m,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":u(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:ne()}),Q.categories.map(e=>(0,U.jsx)(N,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Ae,{checked:g,onCheckedChange:e=>_(e===!0),"aria-label":f()}),(0,U.jsx)(`span`,{children:f()})]}),$?(0,U.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(M,{size:14,"aria-hidden":!0}),x()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?me():xe()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:ie()}),(0,U.jsx)(z,{children:ee()}),(0,U.jsx)(z,{children:s()}),(0,U.jsx)(z,{children:se()}),(0,U.jsx)(z,{children:b()}),(0,U.jsx)(z,{className:`text-right`,children:a()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(I,{variant:`outline`,style:{marginLeft:6},children:ve()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(I,{variant:`secondary`,children:e.direction===`inbound`?h():l()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(Me,{children:[(0,U.jsx)(ke,{asChild:!0,children:(0,U.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":de(),children:(0,U.jsx)(Ce,{size:16})})}),(0,U.jsxs)(Oe,{align:`end`,children:[e.url?(0,U.jsx)(F,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(k,{size:14}),oe()]})}):(0,U.jsxs)(F,{disabled:!0,children:[(0,U.jsx)(k,{size:14}),ye()]}),(0,U.jsxs)(F,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(E,{size:14}),C()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:pe({cap:Be})}):null]}),(0,U.jsx)(we,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Te,{children:[(0,U.jsx)(De,{children:ge()}),(0,U.jsx)(A,{children:_e()})]}),(0,U.jsxs)(Ee,{children:[(0,U.jsx)(j,{children:v()}),(0,U.jsx)(O,{onClick:()=>void Le(),children:C()})]})]})})]})}export{K as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{af as r,of as i}from"./dist-Bcr-KIFN.js";import{t as a}from"./button-CvJAYeHx.js";import{Mt as o,jt as s,ot as c}from"./index--Drh_B6c.js";import{t as l}from"./TimeRangePicker-XUfGR5S2.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)(c,{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)(o,{}),r()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{of as r,sf as i}from"./dist-B7IaMcdm.js";import{t as a}from"./button-B9CsHmrJ.js";import{Nt as o,Pt as s,ct as c}from"./index-DYfClpT4.js";import{t as l}from"./TimeRangePicker-CcUEMoXD.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)(o,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(c,{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)(s,{}),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{$l as r,Al as i,Bl as a,Cl as o,D as s,Dl as c,E as l,El as u,Fl as d,Gl as f,Hl as p,Il as m,Jl as h,Kl as g,Ll as _,Ml as v,Nl as y,Ol as b,Pl as x,Ql as S,Rl as C,Sl as w,Tl as T,Ul as E,Vl as ee,Wl as D,Xl as te,Yl as ne,Zl as re,_l as ie,_u as O,au as ae,bj as k,bl as oe,bu as A,cu as j,du as se,eu as ce,fl as M,fu as N,gl as P,gu as F,hl as I,hu as le,iu as L,jl as R,kl as ue,lu as de,ml as fe,mu as pe,nu as me,ou as he,pl as ge,pu as _e,ql as ve,ru as ye,su as be,tu as xe,uu as Se,vl as Ce,vu as we,wl as Te,xj as z,xl as Ee,xu as De,yl as Oe,yu as ke,zl as Ae}from"./dist-B7IaMcdm.js";import{t as je}from"./x-CJSI-sn5.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-K6MF5os_.js";import{t as H}from"./button-B9CsHmrJ.js";import{C as Pe,H as Fe,Kt as Ie,Mt as U,S as Le,V as W,b as Re,bt as ze,ct as G,dt as Be,jt as K,lt as Ve,mt as He,p as q,pt as Ue,st as J,u as We,ut as Ge,w as Ke,x as qe}from"./index-DYfClpT4.js";import{t as Je}from"./FilterBar-Z4TZZeJs.js";import{t as Ye}from"./DataTableShell-BwOKMopJ.js";import{t as Y}from"./DetailChips-B7PRsQ8X.js";var Xe=s(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ze=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`}]]),X=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`}]]),Qe=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`}]]),Z=t(e(),1);function $e(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 et(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 tt(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 nt(e){switch(e){case`admin`:return p();case`user`:return ee();case`pending`:return a();default:return e}}function rt(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=z(l.groups.listGroups,{}),t=z(l.me.getMe,{host:ze})?.role===`admin`,n=k(l.groups.createGroup),r=k(l.groups.updateGroup),i=k(l.groups.deleteGroup),a=Fe(),o=W(),[s,c]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)($),[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(``),v=(0,Z.useMemo)(()=>{if(!e)return e;let t=g.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,g]);function y(){d(null),p($),c(!0)}function b(e){d(e),p({name:e.name,description:e.description??``}),c(!0)}async function x(){try{u?await r({groupId:u._id,name:f.name,description:f.description}):await n({name:f.name,description:f.description||void 0}),p($),d(null),c(!1)}catch(e){o.error(I(),e)}}async function S(e){if(await a({title:me({name:e.name}),description:xe(),confirmWord:e.name,confirmLabel:ce(),cancelLabel:j(),destructive:!0}))try{await i({groupId:e._id})}catch(e){o.error(fe(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:A()}),(0,Q.jsx)(Je,{q:g,onQChange:_,onReset:()=>_(``),canReset:g!==``,searchPlaceholder:_e()}),(0,Q.jsx)(Ye,{title:De(),rows:v,addLabel:ke(),onAdd:t?y:void 0,emptyHint:we(),columns:[{header:O(),cell:e=>e.name,sort:e=>e.name},{header:F(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:le(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(U,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:pe(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(K,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:N(),onSelect:()=>h({groupId:e._id,name:e.name})},...t?[{label:se(),onSelect:()=>b(e)},{label:Se(),variant:`destructive`,onSelect:()=>void S(e)}]:[]]}),(0,Q.jsx)(We,{open:s,onOpenChange:c,title:u?he():be(),description:ae(),canSubmit:!!f.name.trim(),onSubmit:x,submitLabel:de(),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:L()}),(0,Q.jsx)(G,{value:f.name,onChange:e=>p({...f,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ye()}),(0,Q.jsx)(G,{value:f.description,onChange:e=>p({...f,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:m?.groupId??null,groupName:m?.name??``,open:m!==null,onOpenChange:e=>{e||h(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)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Xe,{size:14,"aria-hidden":!0}),f()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":E({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[D(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let a=z(l.groups.getGroup,n&&e?{groupId:e}:`skip`),o=z(l.groups.listAssignableInstances,n?{}:`skip`),s=z(l.groups.listAssignableUsers,n?{}:`skip`),c=k(l.groups.addMember),u=k(l.groups.removeMember),f=k(l.groups.bulkSetMembers),p=k(l.groups.setGroupManager),m=W(),[v,y]=(0,Z.useState)(``),[C,w]=(0,Z.useState)(``),[T,E]=(0,Z.useState)(`members`),[ee,D]=(0,Z.useState)(1),[O,ae]=(0,Z.useState)(new Set),A=(0,Z.useRef)(null),j=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),se=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ce=a?.viewerIsAdmin===!0,M=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{y(``),w(``),E(`members`),D(1),A.current=null},[n,e]),(0,Z.useEffect)(()=>{D(1)},[v]),(0,Z.useEffect)(()=>{n&&a&&e&&A.current!==e&&(A.current=e,ae(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let N=(0,Z.useMemo)(()=>s?$e(s,v,O):[],[s,v,O]);async function P(t,n){if(e)try{n?await u({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){m.error(ge(),e)}}async function F(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){m.error(ie(),e)}}let I=rt(N,e=>j.has(e.userId)),le=N.filter(e=>j.has(e.userId)).length,L=it(N,ee,ot);async function R(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:I!==`all`})}catch(e){m.error(ge(),e)}}return(0,Q.jsx)(Ve,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Ge,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(He,{children:r({name:t})}),(0,Q.jsx)(Be,{children:S()})]}),(0,Q.jsxs)(Ne,{value:T,onValueChange:E,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),re(),a?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(U,{size:13,"aria-hidden":!0}),ne(),a?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),b(),a?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:s===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:d()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:v,onChange:e=>y(e.target.value),placeholder:te(),className:`oc-access__search`}),N.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ve()}):(0,Q.jsxs)(Q.Fragment,{children:[N.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void R(),"aria-label":g()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:g()}),(0,Q.jsxs)(J,{variant:`outline`,className:`oc-access__count`,children:[le,` / `,N.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=j.has(e.userId),n=tt(e),r=se.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void P(e.userId,t),"aria-label":Ae({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)(J,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ce?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?Ce():Oe(),title:r?Ce():Oe(),onClick:()=>void F(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":oe(),title:oe(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:L.page,pageCount:L.pageCount,onPage:D})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:x()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:C,onChange:e=>w(e.target.value),placeholder:h(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,query:C},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:a}){let o=z(l.groups.listAssignableAgents,{instanceName:t}),s=k(l.groups.assignAgentToGroup),c=k(l.groups.removeAgentFromGroup),u=k(l.groups.bulkSetGroupAgents),d=W(),[f,p]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{p(1)},[a]),!e)return null;let h=et(o?.agents??[],a),_=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&h.length===0)return null;let b=h.filter(e=>e.presentInLastOk!==!1),x=rt(b,e=>r.has(`${t}/${e.agentId}`)),S=it(h,f,ot);async function w(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(M(),e)}}async function T(){if(b.length===0)return;let n=b.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:x!==`all`})}catch(e){d.error(M(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(U,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__kind`,children:n}),_?(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__stale`,children:R()}):null]}),o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):h.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_?v():y()}):(0,Q.jsxs)(Q.Fragment,{children:[b.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:x===`all`?!0:x===`some`?`indeterminate`:!1,onCheckedChange:()=>void T(),"aria-label":g()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:g()})]}):null,S.pageItems.map(e=>{let n=`${t}/${e.agentId}`,a=r.has(n),o=e.presentInLastOk===!1;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:a,disabled:o&&!a,onCheckedChange:()=>void w(e.agentId,a),"aria-label":C({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":ue(),title:ue(),children:(0,Q.jsx)(K,{size:14,fill:`currentColor`})}):null,o?(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:i()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:S.page,pageCount:S.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=z(l.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=k(l.charts.assignChartToGroup),r=k(l.charts.removeChartFromGroup),i=k(l.charts.setGroupDefaultChart),a=k(l.charts.addChartToGroupPool),s=k(l.charts.removeChartFromGroupPool),d=W();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()});let{pool:f,addable:p,canManagePool:m}=t;if(f.length===0&&!m)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:c()});async function h(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){d.error(P(),e)}}async function g(t){try{await i({groupId:e,chartKey:t})}catch(e){d.error(P(),e)}}async function v(t){try{await a({groupId:e,chartKey:t})}catch(e){d.error(P(),e)}}async function y(t){try{await s({groupId:e,chartKey:t})}catch(e){d.error(P(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:f.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:e.selected,onCheckedChange:()=>void h(e.chartKey,e.selected),"aria-label":o({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":w(),title:w(),children:(0,Q.jsx)(K,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:Ee()}):null,m?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":Te({name:e.name}),title:Te({name:e.name}),onClick:()=>void y(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),m?p.length>0?(0,Q.jsxs)(Re,{value:``,onValueChange:e=>void v(e),children:[(0,Q.jsx)(Pe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ke,{placeholder:T()})}),(0,Q.jsx)(qe,{children:p.map(e=>(0,Q.jsx)(Le,{value:e.chartKey,children:e.name},e.chartKey))})]}):f.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:u()}):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{$b as r,$y as i,Ab as a,Ai as o,Ax as s,Bb as c,Cb as l,Cx as u,Db as d,Dx as f,E as p,Eb as m,Ex as h,Fb as g,Fx as _,Gb as v,Gh as y,Hb as b,Ib as x,Ix as ee,JE as S,Jb as C,Jt as w,Kb as T,Kh as E,Lb as D,Mb as O,Mx as te,Nb as ne,Nx as re,Ob as ie,Oi as ae,Ox as oe,Pb as se,Px as ce,Qb as le,Qy as ue,Rb as de,Sb as fe,Sx as pe,Tb as me,Tx as he,Ub as ge,Vb as _e,Wb as ve,Xb as ye,Xy as be,Yb as xe,Yt as Se,Zb as Ce,Zy as k,_b as A,_x as we,ab as Te,ax as Ee,bb as j,bj as M,bx as De,cb as Oe,cx as ke,db as Ae,dx as je,eb as Me,ex as Ne,fb as Pe,fx as Fe,gb as Ie,gx as Le,hb as Re,hx as ze,ib as Be,ix as Ve,jb as He,ji as Ue,jx as We,kb as Ge,ki as Ke,kx as qe,lb as Je,lx as Ye,mb as Xe,mx as Ze,nb as Qe,nx as $e,ob as et,ox as tt,pb as nt,px as rt,qE as N,qb as it,qt as at,rb as ot,rx as st,sb as ct,sx as lt,tb as ut,tx as dt,ub as ft,ux as pt,vb as mt,vj as P,vx as ht,wb as gt,wx as _t,xb as vt,xj as F,xx as yt,yb as bt,yx as xt,zb as St}from"./dist-B7IaMcdm.js";import{a as Ct,c as wt}from"./FieldLabel-D6e92lXR.js";import{t as I}from"./button-B9CsHmrJ.js";import{$ as Tt,C as L,H as Et,Q as Dt,S as R,V as z,b as B,ct as V,dt as H,et as Ot,lt as U,mt as W,p as G,pt as kt,st as K,u as At,ut as jt,w as q,x as J}from"./index-DYfClpT4.js";import{t as Mt}from"./DataTableShell-BwOKMopJ.js";import{InstanceConfigDialog as Nt}from"./BridgeTab-DqV2JfAL.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],Pt=new Set(X),Ft=`conversational`;function It(e){let t=new Set((e??[]).filter(e=>Pt.has(e)));return t.size===0?[Ft]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Ct},Lt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Rt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function zt(){let e=F(p.admin.listInstances,{}),t=F(p.agents.listAllInstanceAgents,{}),n=M(p.admin.upsertInstance),r=M(p.admin.deleteInstance),i=z(),[a,o]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(Q),[d,m]=(0,Y.useState)(null),[g,v]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(null);async function T(){try{await n({instanceId:S??void 0,name:c.name,gatewayUrl:c.gatewayUrl,bridgeUrl:c.bridgeUrl||void 0,displayName:c.displayName||void 0,kind:c.kind,transport:c.kind===`hermes`?c.transport:void 0,gatewayVersion:c.gatewayVersion||void 0,gatewayHttpUrl:c.gatewayHttpUrl||void 0,streamTransport:c.streamTransport}),l(Q),C(null),o(!1)}catch(e){i.error(ce(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[re(),(0,Z.jsx)(`strong`,{children:te()}),We()]}),(0,Z.jsx)(Mt,{title:s(),rows:e,addLabel:qe(),onAdd:()=>{C(null),l(Q),o(!0)},emptyHint:oe(),columns:[{header:f(),cell:e=>e.name,sort:e=>e.name},{header:h(),cell:e=>(0,Z.jsx)(K,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:he(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:_t(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:ee(),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)?k():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:De(),onSelect:()=>{C(e._id),l(Rt(e)),o(!0)}},{label:_(),onSelect:()=>m(e.name)},{label:Ee(),onSelect:()=>x(e)},{label:u(),onSelect:()=>v(e)},{label:pe(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:pe(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(At,{open:a,onOpenChange:o,title:S?xt():yt(),description:we(),canSubmit:!!(c.name&&c.gatewayUrl),onSubmit:T,submitLabel:Le(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:ze(),children:[(0,Z.jsx)(V,{value:c.name,disabled:S!==null,onChange:e=>l({...c,name:e.target.value})}),S?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ht()}):null]}),(0,Z.jsx)($,{label:Ze(),children:(0,Z.jsxs)(B,{value:c.kind,onValueChange:e=>l({...c,kind:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(R,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(R,{value:`hermes`,children:`Hermes`})]})]})}),c.kind===`hermes`?(0,Z.jsx)($,{label:Se(),children:(0,Z.jsxs)(B,{value:c.transport,onValueChange:e=>l({...c,transport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(R,{value:`ws`,children:w()}),(0,Z.jsx)(R,{value:`rest`,children:at()})]})]})}):null,(0,Z.jsx)($,{label:rt(),children:(0,Z.jsx)(V,{value:c.gatewayUrl,onChange:e=>l({...c,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Fe(),children:(0,Z.jsx)(V,{value:c.bridgeUrl,placeholder:je(),onChange:e=>l({...c,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:pt(),children:(0,Z.jsx)(V,{value:c.displayName,onChange:e=>l({...c,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:E(),children:[(0,Z.jsxs)(B,{value:c.streamTransport,onValueChange:e=>l({...c,streamTransport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsx)(J,{children:wt.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:y()})]}),(0,Z.jsx)($,{label:Ye(),children:(0,Z.jsx)(V,{value:c.gatewayVersion,placeholder:ke(),onChange:e=>l({...c,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:lt(),children:(0,Z.jsx)(V,{value:c.gatewayHttpUrl,placeholder:tt(),onChange:e=>l({...c,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Yt,{instanceName:d,open:d!==null,onOpenChange:e=>{e||m(null)}}),g?(0,Z.jsx)(Nt,{instance:g,onClose:()=>v(null)},g._id):null,b?(0,Z.jsx)(Bt,{instance:b,onClose:()=>x(null)},b._id):null]})}function Bt({instance:e,onClose:t}){let n=F(p.instanceSecrets.listInstanceSecretStatus,{}),r=Lt[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)(U,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(jt,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(W,{children:Ve({instance:e.displayName??e.name})}),(0,Z.jsx)(H,{children:st()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Ut,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ht,{instance:e})}),(0,Z.jsx)(Vt,{instance:e})]})})}function Vt({instance:e}){let t=P(p.instanceSync.forceInstanceSync),n=z(),[r,i]=(0,Y.useState)(!1);async function o(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(D());break;case`no_agents`:n.success(g());break;case`no_bridge_url`:n.error(se());break;case`deploy_misconfigured`:n.error(ne());break;case`unauthorized`:n.error(He());break;case`not_served`:n.error(a());break;default:n.error(O());break}}catch(e){n.error(x(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?de():St()})})]})}function Ht({instance:e}){let t=F(p.bridgeAuth.listBridgeAuthStatus,{}),n=P(p.bridgeAuth.mintBridgeSecret),i=M(p.bridgeAuth.revokeBridgeSecret),a=z(),[o,s]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)(null),[f,h]=(0,Y.useState)(!1),g=(t??[]).find(t=>t.instanceId===e._id),_=g!==void 0;async function v(){if(!o){s(!0);try{u((await n({instanceId:e._id})).plaintext),h(!1)}catch(e){a.error(fe(),e)}finally{s(!1)}}}async function y(){if(!o){s(!0);try{await i({instanceId:e._id}),u(null),a.success(l())}catch(e){a.error(fe(),e)}finally{s(!1)}}}async function b(){if(c)try{await navigator.clipboard.writeText(c),h(!0)}catch{}}return(0,Z.jsxs)($,{label:ie(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(K,{variant:_?`outline`:`secondary`,children:_?`${r()} · ${g.prefix}…${g.lastFour}`:le()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void v(),disabled:o,children:_?me():m()}),_?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void y(),disabled:o,children:gt()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:vt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:f?S():N()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{u(null),h(!1)},children:j()})]}):null]})}function Ut({instanceId:e,field:t,updatedAt:n}){let i=P(p.instanceSecrets.setInstanceSecret),a=M(p.instanceSecrets.clearInstanceSecret),o=P(p.deviceIdentity.generateDeviceIdentity),s=z(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),y=n!==null,x=t===`deviceIdentity`,ee=t===`token`?$e():t===`deviceIdentity`?dt():Ne();async function w(){if(!(!l.trim()||d)){f(!0);try{await i({instanceId:e,field:t,plaintext:l}),u(``),h(null),_(!1),s.success(it())}catch(e){s.error(T(),e)}finally{f(!1)}}}async function E(){if(!d){f(!0);try{await a({instanceId:e,field:t}),h(null),_(!1),s.success(v())}catch(e){s.error(T(),e)}finally{f(!1)}}}async function D(){if(!d){f(!0);try{h(await o({instanceId:e})),_(!1),s.success(b())}catch(e){s.error(c(),e)}finally{f(!1)}}}let O=m?`openclaw devices approve ${m.id}`:``;async function te(){if(O)try{await navigator.clipboard.writeText(O),_(!0)}catch{}}return(0,Z.jsxs)($,{label:ee,children:[x?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(K,{variant:y?`outline`:`secondary`,children:y?r():le()}),(0,Z.jsx)(V,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:y?ye():Ce(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void w(),disabled:d||l.trim().length===0,children:xe()}),x?(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void D(),disabled:d,children:ve()}):null,y?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void E(),disabled:d,children:C()}):null]})]}),m?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:b()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:O}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:g?S():N()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{h(null),_(!1)},children:j()})]}):null]})}var Wt={conversational:Pe,documentary:ft,summarizer:Ue,curator:Ke},Gt={conversational:Ae,documentary:Je,summarizer:o,curator:ae},Kt=e=>(Wt[e]??(()=>e))(),qt=e=>(Gt[e]??(()=>``))();function Jt({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:Ie()}),t.map(e=>(0,Z.jsx)(K,{variant:`secondary`,className:`oc-agenttype__chip`,title:qt(e),children:Kt(e)},e)),(0,Z.jsxs)(Dt,{children:[(0,Z.jsx)(Ot,{asChild:!0,children:(0,Z.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Re()})}),(0,Z.jsxs)(Tt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Xe()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:nt()}),(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)(G,{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:Kt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:qt(r)})]})]},r)})})]})]})]})}function Yt({instanceName:e,open:t,onOpenChange:n}){let r=F(p.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=M(p.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=M(p.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=M(p.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=It(r);e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=M(p.agents.removeInstanceAgent),l=Et(),u=z();async function d(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(A(),e)}}async function f(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){u.error(A(),e)}}async function m(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){u.error(A(),e)}}async function h(t,n){if(e&&await l({title:et({name:n}),description:Te(),confirmLabel:Be(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(ot())}catch(e){u.error(A(),e)}}return(0,Z.jsx)(U,{open:t,onOpenChange:n,children:(0,Z.jsxs)(jt,{className:`oc-access`,children:[(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(W,{children:bt({name:e??``})}),(0,Z.jsx)(H,{children:mt()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Qe()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ut():r.discovery.lastPollOk?Me():i({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ue()}):(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)(G,{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:be()}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(e.agentId,i),children:ct()})]}):n?(0,Z.jsx)(K,{variant:`default`,children:k()}):(0,Z.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void f(e.agentId),children:Oe()})]}),e.enabled?(0,Z.jsx)(Jt,{agentId:e.agentId,types:a,onToggle:t=>void m(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{zt as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CC as r,E as i,Ga as a,Ja as o,Ka as s,Qa as c,SC as l,TC as u,Wa as d,Xa as f,Ya as p,Za as m,_C as h,bC as g,bj as _,fC as v,gC as y,hC as b,mC as x,pC as S,qa as C,vC as w,vj as T,wC as E,xC as D,xj as O,yC as k}from"./dist-B7IaMcdm.js";import{t as A}from"./button-B9CsHmrJ.js";import{ct as j,p as M,st as N}from"./index-DYfClpT4.js";var P=t(e(),1),F=n();function I(){let e=O(i.integrations.status.status,{}),t=_(i.admin.setIntegrationConfig),[n,a]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&a(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:u()});let o=n,s=(e,t,n)=>a({...o,[e]:{...o[e],[t]:n}}),d=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,F.jsx)(`strong`,{children:r()}),` `,l()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:D()}):(0,F.jsx)(N,{variant:`outline`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:k()}),note:w(),children:[(0,F.jsx)(R,{label:y(),children:(0,F.jsx)(j,{value:o.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>s(`langfuse`,`host`,e.target.value),onBlur:()=>d(`langfuse`,{host:o.langfuse.host??``})})}),(0,F.jsx)(z,{label:v(),checked:o.langfuse.enabled??!0,onChange:e=>{s(`langfuse`,`enabled`,e),d(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:D()}):(0,F.jsx)(N,{variant:`outline`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:k()}),note:h(),children:[(0,F.jsx)(R,{label:b(),children:(0,F.jsx)(j,{value:o.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>s(`opik`,`baseUrl`,e.target.value),onBlur:()=>d(`opik`,{baseUrl:o.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:x(),children:(0,F.jsx)(j,{value:o.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||S(),onChange:e=>s(`opik`,`workspace`,e.target.value),onBlur:()=>d(`opik`,{workspace:o.opik.workspace??``})})}),(0,F.jsx)(z,{label:v(),checked:o.opik.enabled??!0,onChange:e=>{s(`opik`,`enabled`,e),d(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:D()}):(0,F.jsx)(N,{variant:`outline`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:c()}),note:m(),children:[(0,F.jsx)(R,{label:f(),children:(0,F.jsx)(j,{value:o.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>s(`otlp`,`endpoint`,e.target.value),onBlur:()=>d(`otlp`,{endpoint:o.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:v(),checked:o.otlp.enabled??!0,onChange:e=>{s(`otlp`,`enabled`,e),d(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(M,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=T(i.integrations.otlpSecret.setOtlpHeaders),n=_(i.integrations.otlpSecret.clearOtlpHeaders),[r,c]=(0,P.useState)(``),[l,u]=(0,P.useState)(null),[f,m]=(0,P.useState)(!1),h=async()=>{m(!0),u(null);try{await t({headersJson:r}),c(``)}catch(e){u(e instanceof Error?e.message:String(e))}finally{m(!1)}};return(0,F.jsxs)(R,{label:p(),children:[(0,F.jsx)(j,{value:r,placeholder:e?o():C(),onChange:e=>c(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:f||r.trim().length===0,onClick:()=>void h(),children:s()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:f,onClick:()=>void n({}),children:a()}):null]}),l?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:l}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:d()})]})}export{I as IntegrationsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,E as i,Nw as a,QC as o,ZC as s,am as c,aw as l,cm as u,cw as d,dm as f,em as p,fm as m,im as h,lm as g,nm as _,om as v,ow as y,rm as b,sm as x,sw as S,tm as C,um as w,xj as T}from"./dist-B7IaMcdm.js";import{Jt as E,a as ee,bt as te,n as ne,qt as re,r as D}from"./index-DYfClpT4.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-CMDVfuXr.js";import{n as N,t as P}from"./TimeRangePicker-CcUEMoXD.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=T(i.me.getMe,{host:te})?.permissions?.includes(`traces.read`)??!1,t=T(i.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:a()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:d()}),(0,I.jsx)(j,{children:y()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(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,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),l=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[s(),` p50 `,R(l.cP50),` `,S()]}),(0,I.jsxs)(`span`,{children:[o(),` p50 `,R(l.aP50),` `,S()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":d(),children:[(0,I.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:m(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:f(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:w(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:g(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:u(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:x(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=E({from:`/settings/kpi`}),t=re({from:`/settings/kpi`}),n=D(e.from,e.to,ne,`now`),r=e=>void t({search:t=>({...t,...ee(e)})}),{from:a,to:o}=N(n),{rowLimit:s,buckets:l}=K(a,o),u=T(i.kpi.listKpis,{limit:s,filter:{from:a,to:o}}),d=(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]),f=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:c()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return u===void 0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:h()})]}):u.length===0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:b()})]}):(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(d.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:d.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:_({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:C()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:p({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 i=e.reduce((e,t)=>t.value>e?t.value:e,0),a=X/e.length,o=Math.max(a-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":r({max:Q(i),unit:n}),children:e.map((e,r)=>{let s=i>0?e.value/i*(Z-1):0,c=r*a,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:o,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{$A as r,A as i,AO as a,BO as o,CO as s,DO as c,E as l,EO as u,F as d,FO as f,I as p,IO as ee,JA as te,LO as ne,M as re,MO as ie,N as ae,NO as oe,OO as se,P as ce,PO as m,QA as h,RO as le,SO as ue,TO as de,W as fe,X as pe,XA as me,Y as he,YA as ge,ZA as g,_O as _,bO as v,bj as y,cO as b,dO as x,ej as S,fO as C,fj as w,gO as T,gx as E,hO as D,ij as O,j as k,jO as A,k as j,kO as M,lO as N,mO as P,n as F,nj as I,oO as L,pO as R,rj as _e,sO as ve,sj as ye,tj as be,uO as xe,vO as Se,wO as Ce,xO as we,xj as z,yO as B,zO as Te}from"./dist-B7IaMcdm.js";import{t as V}from"./button-B9CsHmrJ.js";import{C as H,M as Ee,S as U,V as De,_t as Oe,b as ke,bt as W,ct as G,p as K,st as q,vt as Ae,w as je,x as Me,yt as Ne}from"./index-DYfClpT4.js";import{t as Pe}from"./localePickerView-C2RmOS86.js";var J=t(e(),1),Y=n();function Fe({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:F(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,Y.jsx)(`span`,{className:F(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var X=[{id:`messages`,label:()=>o()},{id:`composer`,label:()=>Te()},{id:`sidebar`,label:()=>le()},{id:`other`,label:()=>ne()}],Z={showSource:{category:`messages`,label:()=>ee(),help:()=>f()},showReport:{category:`messages`,label:()=>m(),help:()=>oe()},copyAssistant:{category:`messages`,label:()=>ie()},copyUser:{category:`messages`,label:()=>A()},showDelete:{category:`messages`,label:()=>a()},showTools:{category:`messages`,label:()=>M(),help:()=>se()},voiceInput:{category:`composer`,label:()=>c(),help:()=>u()},showUsage:{category:`composer`,label:()=>de(),help:()=>Ce()},autoReadAloud:{category:`composer`,label:()=>pe(),help:()=>he()},showChatAge:{category:`sidebar`,label:()=>s(),help:()=>ue()},showChatProvider:{category:`sidebar`,label:()=>we(),help:()=>v()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ie(e,t){let n=Q(t.trim()),r=new Map(X.map(e=>[e.id,e.label()])),i=new Map(X.map(e=>[e.id,[]]));for(let t of e){let e=Z[t],a=e?.category??`other`;n&&!Q(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return X.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var Le=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`,`showUsage`,`autoReadAloud`],Re={voiceInput:`voiceInput`};function ze(e){return Le.includes(e)}function $(e){return e===`admin`}function Be(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Ve(e){return e===`on`?!0:e===`off`?!1:null}function He(e){return ze(e)?Re[e]:void 0}var Ue={voiceInput:()=>xe()};function We({prefKey:e,ui:t}){let n=y(l.admin.setUiPrefDefault),r=y(l.admin.setFeatureEnabled),i=He(e),a=i?Ue[e]?.():void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,Y.jsx)(`span`,{className:`oc-prefs__gov-label`,children:P()}),(0,Y.jsxs)(ke,{value:Be(t.defaults[e]),onValueChange:t=>void n({key:e,value:Ve(t)}),children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(je,{})}),(0,Y.jsxs)(Me,{children:[(0,Y.jsx)(U,{value:`on`,children:b()}),(0,Y.jsx)(U,{value:`off`,children:ve()}),(0,Y.jsx)(U,{value:`inherit`,children:L()})]})]}),i?(0,Y.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,Y.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":R()}),R()]}):null]}),a?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Ge({current:e,enabled:t}){let n=y(l.me.setDictationShortcut),[r,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Ae(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,Y.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[p(),e?(0,Y.jsx)(q,{variant:`secondary`,children:Ne(e,Oe())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:o?ae():r?ce():d()})]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:j()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?i():e?k():re()})]})]})}function Ke(){let[e,t]=(0,J.useState)(``),[n,r]=(0,J.useState)(!1),i=z(l.me.getMe,{host:W}),a=i?.ui,o=$(i?.role)&&n,s=y(l.me.setUiPref).withOptimisticUpdate(Ee),c=(0,J.useMemo)(()=>a?Ie(Object.keys(a.effective),e):[],[a,e]);return a?(0,Y.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,Y.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,Y.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":D()}),D()]}):null,o?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:C()}),(0,Y.jsx)(`p`,{children:x()}),(0,Y.jsx)(`p`,{children:N()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:B(),"aria-label":B(),className:`mb-2`}),c.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:Se()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,Y.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,Y.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Z[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,Y.jsx)(q,{variant:`outline`,children:_()}):l?(0,Y.jsx)(q,{variant:`secondary`,children:fe()}):null]}),r?(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:T()}):null,(0,Y.jsx)(Fe,{checked:c,disabled:i,onCheckedChange:t=>void s({key:e,value:t}),"aria-label":n})]}),o?(0,Y.jsx)(We,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,Y.jsx)(Ge,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:w()})}function qe(){let e=z(l.me.getMe,{host:W}),t=y(l.me.setLocale),n=y(l.me.setMyName),i=De(),a=e?.locale??`default`,o=e?.name??``,[s,c]=(0,J.useState)(null),u=s??o,d=u.trim()!==o.trim();async function f(){try{await n({name:u}),c(null),i.success(S())}catch(e){i.error(r(),e)}}return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:O()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:u,maxLength:120,placeholder:I(),onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),f())}}),(0,Y.jsx)(V,{size:`sm`,disabled:!d,onClick:()=>void f(),children:E()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:be()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:h()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:g()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[Pe().map(e=>(0,Y.jsx)(V,{variant:a===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(V,{variant:a==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:ye()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:ge()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,Y.jsx)(Ke,{})]})]})}export{qe as PreferencesTab};
@@ -0,0 +1,4 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$n as r,Ah as i,Bh as a,Ch as o,Dh as s,E as c,Eh as l,Fh as u,Fi as d,Hh as f,Ih as p,Ii as m,Lh as h,Mh as g,Mi as ee,Nh as _,Ni as v,Oh as y,Ph as b,Pi as x,Qn as S,Qt as C,Rh as w,Th as te,Vh as ne,Xh as re,Xn as ie,Xt as ae,Yh as T,Zn as E,Zt as D,bj as O,er as k,jh as A,kh as j,tr as M,wh as N,xj as P,zh as F}from"./dist-B7IaMcdm.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as oe,u as H}from"./FieldLabel-D6e92lXR.js";import{t as U}from"./button-B9CsHmrJ.js";import{C as W,S as G,V as K,b as q,bt as se,p as ce,w as J,x as Y}from"./index-DYfClpT4.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:h,help:p},documentary_fetch:{label:u,help:b},inbound_files:{label:_,help:g},history_summary:{label:m,help:d},file_curation:{label:M,help:k}},de={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`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
+ - [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:te,references:N,files:o,previous_summary:x,new_messages:v,max_chars:ee,file_name:r,budget_chars:S,feedback:E,content:ie};function pe(){let e=P(c.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:i()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:f(),help:ne()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:A()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(J,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=O(c.admin.upsertInstanceConfig),n=K(),r=P(c.me.getMe,{host:se}),i=e.config??{},a=X(e.config?.contentLocale,r?.defaultLocale??void 0),[o,s]=(0,Q.useState)(()=>R(i,a));(0,Q.useEffect)(()=>{s(R(i,a))},[a,e._id]);let[l,u]=(0,Q.useState)(!1),d=o.promptInjections,f=(e,t)=>s({...o,promptInjections:{...d,[e]:{...d[e],...t}}});async function p(){u(!0);try{await t({instanceId:e._id,config:V(o,i,a)})}catch(e){n.error(T(),e)}finally{u(!1)}}async function m(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(T(),e)}}let h=e.config?.contentLocale??`default`,g=Z[X(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:C()}),(0,$.jsxs)(q,{value:h,onValueChange:e=>void m(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(J,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(G,{value:`default`,children:ae({locale:g})}),le().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:D()})]}),H.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:d[e]??{enabled:!0,template:z[e].defaultTemplate[a]},contentLocale:a,onChange:t=>f(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void p(),disabled:l,children:re()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:o}){let[c,u]=(0,Q.useState)(!1),d=r.template.trim()!==t.defaultTemplate[i],f=t.togglable&&!r.enabled,p=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),m=I(e,r,i),h=m?L(m,p):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(ce,{checked:r.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),d&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:F()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:f,rows:8,spellCheck:!1,onChange:e=>o({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:w()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(oe,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>u(e=>!e),children:c?y():j()}),d&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[i]}),children:a()})]})]}),c&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:s()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:l()})})]})}export{pe as PromptInjectionsTab};
@@ -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,Cy as a,Dy as o,E as s,Ey as c,Gv as l,Jv as u,Kv as d,My as f,Ny as p,Oy as m,Py as h,Qv as ee,Sy as g,Tr as _,Ty as v,Xv as y,Yv as b,Zv as x,_y as S,ay as te,bj as C,by as ne,cy as re,dy as ie,fy as w,gy as T,hy as E,jy as D,ky as O,ly as k,my as A,oy as j,py as M,qv as N,sy as P,uy as F,vy as I,wy as L,xj as R,xy as z,yy as ae}from"./dist-B7IaMcdm.js";import{t as B}from"./button-B9CsHmrJ.js";import{H as V,Lt as H,V as U,ct as W,p as G,st as K,u as q}from"./index-DYfClpT4.js";import{t as J}from"./roleDescriptions-ow1wfNQF.js";var Y=t(e(),1),X=n(),Z=[{group:()=>h(),keys:[{key:`traces.read`,label:()=>O()},{key:`traces.read.content`,label:()=>m(),phi:!0},{key:`traces.write`,label:()=>o()}]},{group:()=>p(),keys:[{key:`kpi.read`,label:()=>O()},{key:`kpi.write`,label:()=>o()}]},{group:()=>f(),keys:[{key:`openclaw.query`,label:()=>c()},{key:`anomalies.read`,label:()=>v()},{key:`anomalies.report`,label:()=>L()}]},{group:()=>D(),keys:[{key:`chats.read`,label:()=>O()},{key:`selfheal`,label:()=>g()},{key:`feedback.respond`,label:()=>_()}]},{group:()=>i(),keys:[{key:`admin.manage`,label:()=>a()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=R(s.apiKeys.listRoles,{}),t=C(s.apiKeys.createRole),n=C(s.apiKeys.ensureRolesSeeded),i=C(s.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(s.apiKeys.listRoles,{});r&&e.setQuery(s.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=V(),o=U(),[c,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)($),[h,g]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{o.error(ne(),e)})},[n,o]);let _=e??[];async function v(e,t){if(Q(e.permissions)||h.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await a({title:ae({name:e.name}),description:I(),confirmLabel:S()}))){g(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){o.error(T(),e)}finally{g(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function D(){try{await t({key:p.key,name:p.name,description:p.description||void 0,permissions:[]}),m($),f(!1)}catch(e){o.error(E(),e)}}let O=e===void 0,L=!O&&_.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[A(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,M(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,w()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:ie()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{m($),f(!0)},children:F()})})]}),O?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:P()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?z({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:_.map(e=>{let t=Q(e.permissions),n=h.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(K,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,j()]}):(0,X.jsx)(K,{variant:`secondary`,children:te()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(i=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(i),disabled:t||n,"aria-label":`${e.key} · ${i}`,title:t?r():n?ee():i,onCheckedChange:()=>void v(e,i)})},i))]},e.key)})})]})})]}),(0,X.jsx)(q,{open:c,onOpenChange:f,title:x(),description:y(),canSubmit:!!(p.key&&p.name),onSubmit:D,submitLabel:b(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:u()}),(0,X.jsx)(W,{value:p.key,placeholder:N(),onChange:e=>m({...p,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:d()}),(0,X.jsx)(W,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:l()}),(0,X.jsx)(W,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})})]})}export{se as RolesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,$E as i,AD as ee,BD as te,BE as a,CD as ne,DD as re,E as o,ED as ie,FD as ae,GD as oe,GE as s,HD as se,HE as c,ID as ce,JD as le,JE as l,KD as ue,KE as u,LD as de,MD as fe,ND as pe,OD as me,PD as he,QD as ge,QE as d,RD as _e,SD as ve,TD as ye,UD as be,UE as f,VD as xe,VE as p,WD as Se,WE as Ce,XD as we,XE as m,YD as Te,YE as h,ZD as Ee,ZE as g,_D as De,aD as _,aO as Oe,bD as ke,bj as v,cD as y,dD as Ae,eD as je,eO as b,fD as Me,gD as Ne,hD as Pe,iD as x,iO as Fe,jD as Ie,kD as Le,lD as Re,mD as ze,nD as S,nO as Be,oD as C,pD as Ve,qD as He,qE as w,rD as T,rO as Ue,sD as E,tD as D,tO as We,uD as Ge,vD as Ke,vj as qe,wD as Je,xD as Ye,xj as O,yD as Xe,zD as Ze,zE as k}from"./dist-B7IaMcdm.js";import{n as A}from"./dist-UNwILdG2.js";import{i as Qe}from"./dist-D87j9TcT.js";import{t as j}from"./button-B9CsHmrJ.js";import{A as M,C as N,H as $e,Jt as et,Kt as tt,S as P,Ut as F,V as nt,b as I,ct as L,dt as R,ft as z,k as B,lt as V,mt as H,pt as U,qt as rt,st as W,u as it,ut as G,w as K,x as q}from"./index-DYfClpT4.js";import{t as at}from"./FilterBar-Z4TZZeJs.js";import{t as ot}from"./DataTableShell-BwOKMopJ.js";import{t as st}from"./roleDescriptions-ow1wfNQF.js";var J=t(e(),1),Y=n(),ct=[{value:`never`,label:()=>s(),days:null},{value:`30`,label:()=>Ce(),days:30},{value:`90`,label:()=>f(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=et({from:`/settings/serviceAccounts`}),t=rt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Z,[a,s]=(0,J.useState)(Z),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),u=O(o.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:i===Z?void 0:i===`disabled`}}),d=O(o.apiKeys.listKeys,{}),f=O(o.apiKeys.listRoles,{}),p=v(o.apiKeys.createServiceAccount),Ce=v(o.apiKeys.updateServiceAccount),m=v(o.apiKeys.deleteServiceAccount),h=qe(o.apiKeys.mintApiKey),g=v(o.apiKeys.revokeApiKey),_=$e(),y=nt(),je=n!==``||a!==Z||i!==Z;function x(){s(Z),t({search:{},replace:!0})}let[S,C]=(0,J.useState)(!1),[w,T]=(0,J.useState)(Q),[E,D]=(0,J.useState)(null),[k,A]=(0,J.useState)(new Set),[M,F]=(0,J.useState)(null),R=(0,J.useRef)(!1),[z,B]=(0,J.useState)(new Set),[V,H]=(0,J.useState)({}),[U,G]=(0,J.useState)(null),X=(0,J.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function $(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{E?(await Ce({serviceAccountId:E,name:w.name,roleKey:w.roleKey,description:w.description}),y.success(ne())):await p({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Q),D(null),C(!1)}catch(e){y.error(E?Je():ye(),e)}}function ft(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),D(e._id),C(!0)}async function pt(e){if(R.current)return;R.current=!0;let t=V[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 h({serviceAccountId:e._id,expiresAt:r});G({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(ve(),e)}finally{R.current=!1,F(null)}}async function mt(e){if(await _({title:Ye(),description:(0,Y.jsxs)(Y.Fragment,{children:[ke(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Xe(),` `,(0,Y.jsx)(`strong`,{children:Ke()}),` `,De()]}),confirmWord:e.name,confirmLabel:Ne(),destructive:!0}))try{await m({serviceAccountId:e._id}),y.success(Pe(),e.name)}catch(e){y.error(ze(),e)}}async function ht(e){if(await _({title:Ve(),description:(0,Y.jsxs)(Y.Fragment,{children:[Me(),` `,(0,Y.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Ae()]}),confirmLabel:Ge(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){y.error(Re(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()}),(0,Y.jsxs)(at,{q:n,onQChange:c,searchPlaceholder:Fe(),onReset:x,canReset:je,children:[(0,Y.jsxs)(I,{value:a,onValueChange:s,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Y.jsx)(K,{placeholder:Ue()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(P,{value:Z,children:Be()}),(f??[]).map(e=>(0,Y.jsx)(P,{value:e.key,children:e.key},e._id))]})]}),(0,Y.jsxs)(I,{value:i,onValueChange:l,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(K,{})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(P,{value:Z,children:We()}),(0,Y.jsx)(P,{value:`active`,children:b()}),(0,Y.jsx)(P,{value:`disabled`,children:r()})]})]})]}),(0,Y.jsx)(ot,{title:ge(),rows:u,addLabel:Ee(),onAdd:()=>{T(Q),D(null),C(!0)},emptyHint:we(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,Y.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:ue(),onSelect:()=>ft(e)},{label:Te(),onSelect:()=>void pt(e)},{label:k.has(e._id)?le():He(),onSelect:()=>$(e._id)},{label:oe(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Se():be(),onClick:()=>$(e._id),children:k.has(e._id)?(0,Y.jsx)(Qe,{}):(0,Y.jsx)(tt,{})})},{header:se(),sort:e=>e.name,cell:e=>(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:xe(),sort:e=>e.roleKey,cell:e=>(0,Y.jsx)(W,{variant:`secondary`,children:e.roleKey})},{header:te(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,Y.jsx)(W,{variant:`destructive`,children:r()}):(0,Y.jsx)(W,{variant:`outline`,children:b()})},{header:Ze(),cell:e=>(0,Y.jsxs)(I,{value:V[e._id]??`never`,onValueChange:t=>H(n=>({...n,[e._id]:t})),children:[(0,Y.jsx)(N,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(K,{})}),(0,Y.jsx)(q,{children:ct.map(e=>(0,Y.jsx)(P,{value:e.value,children:e.label()},e.value))})]})},{header:_e(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,Y.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?de():ce({count:t})})}}]}),(0,Y.jsx)(it,{open:S,onOpenChange:e=>{C(e),e||D(null)},title:E?ae():fe(),description:E?he():Ie(),canSubmit:!!(w.name&&w.roleKey),onSubmit:dt,submitLabel:E?pe():ee(),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:Le()}),(0,Y.jsx)(L,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:me()}),(0,Y.jsxs)(I,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,Y.jsx)(N,{className:`w-full`,children:(0,Y.jsx)(K,{placeholder:re()})}),(0,Y.jsx)(q,{children:(f??[]).map(e=>(0,Y.jsxs)(P,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===w.roleKey),t=e?st(e):null;return t?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:ie()}),(0,Y.jsx)(L,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,Y.jsx)(ut,{minted:U,onClose:()=>G(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,Y.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,Y.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[y(),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):(0,Y.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{children:C()}),(0,Y.jsx)(`th`,{children:_()}),(0,Y.jsx)(`th`,{children:x()}),(0,Y.jsx)(`th`,{children:T()}),(0,Y.jsx)(`th`,{children:S()}),(0,Y.jsx)(`th`,{children:D()}),(0,Y.jsx)(`th`,{})]})}),(0,Y.jsx)(`tbody`,{children:t.map(t=>(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`td`,{children:(0,Y.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,Y.jsx)(`td`,{children:(0,Y.jsx)(W,{variant:`secondary`,children:e.roleKey})}),(0,Y.jsx)(`td`,{children:M(t.createdAt)}),(0,Y.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,Y.jsx)(`td`,{children:pt(t.expiresAt)}),(0,Y.jsx)(`td`,{children:mt(t)}),(0,Y.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,Y.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?je():i()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,J.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,Y.jsx)(V,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,Y.jsxs)(G,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,Y.jsxs)(U,{children:[(0,Y.jsx)(H,{children:d()}),(0,Y.jsx)(R,{children:g({name:e.accountName})})]}),(0,Y.jsx)(`div`,{className:`oc-sa__minted-warning`,children:m()}),(0,Y.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Y.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,Y.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":h(),children:[n?(0,Y.jsx)(A,{}):(0,Y.jsx)(F,{}),n?l():w()]})]}),(0,Y.jsx)(z,{children:(0,Y.jsx)(j,{onClick:()=>{r(!1),t()},children:u()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?c():M(e)}function pt(e){return e===null?`—`:B(e)}function mt(e){return e.disabled?(0,Y.jsx)(W,{variant:`destructive`,children:p()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,Y.jsx)(W,{variant:`outline`,children:a()}):(0,Y.jsx)(W,{variant:`outline`,children:k()})}export{$ as ServiceAccountsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,Ca as i,E as a,Gi as o,Hi as s,Ji as c,Ki as l,Qi as u,Sa as d,Ta as f,Ui as p,Vi as m,Wi as h,Xi as g,Yi as _,Zi as v,_a as y,aa as b,ba as x,bj as S,ca as C,da as w,ea as T,fa as E,ga as D,ha as O,ia as k,la as A,ma as j,na as M,oa as N,pa as P,qi as F,ra as I,sa as L,ta as R,ua as ee,va as z,wa as B,xa as V,xj as H,ya as U}from"./dist-B7IaMcdm.js";import{t as W}from"./button-B9CsHmrJ.js";import{A as G,H as K}from"./index-DYfClpT4.js";import{t as q}from"./DataTableShell-BwOKMopJ.js";var J=t(e(),1),Y=n(),X={hung:()=>C(),wrong_result:()=>L(),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=S(a.subAgentReports.respondToReport),[i,s]=(0,J.useState)(e.thread),[d,f]=(0,J.useState)(``),[p,m]=(0,J.useState)(!1);async function y(){let t=d.trim();if(!(!t||p)){m(!0);try{await n({reportId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{m(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,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:I()}),(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`?R():T()}),(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:u(),value:d,maxLength:2e3,rows:3,onChange:e=>f(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void y(),disabled:!d.trim()||p,children:p?g():v()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[_({count:t.children.length}),t.childrenTruncated?` ${c()}`:``,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?` · ${l()}`:``]}),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:o()}),(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:h()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=H(a.subAgentReports.listForAdmin,{}),t=S(a.subAgentReports.readReport),n=S(a.subAgentReports.deleteReport),r=K(),[o,c]=(0,J.useState)(null),[l,u]=(0,J.useState)({});async function h(e){if(o===e._id){c(null);return}if(!l[e._id]){let n=await t({reportId:e._id});u(t=>({...t,[e._id]:n}))}c(e._id)}async function g(e){await r({title:p(),description:s(),confirmLabel:m(),destructive:!0})&&(await n({reportId:e._id}),o===e._id&&c(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[i(),` `,(0,Y.jsx)(`strong`,{children:d()}),` `,V()]}),(0,Y.jsx)(q,{title:f(),rows:e,emptyHint:B(),isExpanded:e=>o===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Y.jsx)($,{data:l[e._id]}):null,columns:[{header:x(),cell:e=>G(e.at),sort:e=>e.at},{header:U(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:z(),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:D(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:O(),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:E()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:o===e._id?ee():w(),onSelect:()=>void h(e)},{label:A(),onSelect:()=>void g(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,$k as i,Ak as a,Bi as o,Bk as s,Ck as c,D as l,Dk as u,E as d,Ek as f,Fk as p,GO as m,Gk as h,HO as g,Hk as _,Ik as v,JO as y,Jk as b,KO as ee,Kk as te,Li as ne,Lk as re,Mk as ie,Nk as ae,Ok as oe,Pk as se,QO as ce,Qk as le,Ri as ue,Rk as de,Sk as fe,Tk as pe,UO as me,Uk as he,VO as ge,Vk as _e,WO as ve,Wk as ye,XO as be,Xk as xe,YO as x,Yk as Se,ZO as Ce,Zk as we,_k as Te,aA as Ee,ak as De,bj as S,bk as Oe,cA as ke,cj as Ae,ck as je,dk as Me,eA as Ne,ek as Pe,fk as Fe,gk as Ie,hk as Le,iA as Re,ik as ze,jk as Be,kk as Ve,lA as He,lj as Ue,lk as We,mk as Ge,n as Ke,nA as qe,nk as Je,oA as Ye,ok as Xe,pk as Ze,qO as Qe,qk as $e,rA as et,rk as tt,sA as nt,sk as C,tA as rt,tk as it,uj as at,uk as ot,vj as st,vk as ct,wk as lt,xj as w,xk as ut,yk as dt,zi as T,zk as ft}from"./dist-B7IaMcdm.js";import{n as E}from"./dist-UNwILdG2.js";import{t as D}from"./x-CJSI-sn5.js";import{t as O}from"./button-B9CsHmrJ.js";import{C as k,Ht as pt,S as A,Vt as j,at as M,b as N,bt as P,ct as F,gt as mt,ht,it as gt,nt as _t,ot as vt,p as I,rt as L,st as R,tt as yt,w as z,x as B}from"./index-DYfClpT4.js";import{t as bt}from"./localePickerView-C2RmOS86.js";import{a as xt,i as St,n as Ct,o as wt,r as Tt,t as Et}from"./card-CMDVfuXr.js";import{a as Dt,i as V,n as Ot,o as H,r as U,t as kt}from"./table-r4XuUszk.js";import{t as At}from"./TimeRangePicker-CcUEMoXD.js";import{t as jt}from"./FilterBar-Z4TZZeJs.js";import{t as Mt}from"./AdvancedFilter-BnA7f0yX.js";var W=l(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),G=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 K(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(ot());if(e.size>Bt)throw Error(We());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(C());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(C());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);K(e.data,d.width,d.height)?Rt(e.data,t.variantFor===`dark`?Pt:Ft):zt(e.data),p.putImageData(e,0,0)}let m=K(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await J(f,`image/webp`,Ut)??await J(f,`image/png`);if(!h)throw Error(Xe());return{blob:h,hasAlpha:m}}finally{a()}}async function Gt(e){if(e.type===`image/svg+xml`)return q(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 q(e)}async function q(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(je())),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 J(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Y=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 X=`__all__`,Z={kind:`relative`,from:`now-24h`,to:`now`},qt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Y.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Jt(e){return e===`light`?at():e===`dark`?Ue():Ae()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,Y.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,Y.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function $({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:s}){return(0,Y.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:Ke(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Y.jsx)(E,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Y.jsx)(Xt,{tokens:r,mode:i}):(0,Y.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Y.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Y.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),s?(0,Y.jsx)(O,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:s,"aria-label":o(),title:o(),children:(0,Y.jsx)(pt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=w(d.charts.listMyCharts),r=S(d.charts.setMyChart);async function a(e){try{await r({name:e})}catch{}}return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:rt()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(0,Y.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Y.jsx)($,{selected:e===null,title:i(),subtitle:le(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?we():n.via===`owner`?xe():Se({group:n.via.group});return(0,Y.jsx)($,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(n.key),onExport:()=>Kt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:b()}):null]})}function Qt(){let e=S(d.charts.importChart),[t,n]=(0,G.useState)(``),[r,i]=(0,G.useState)(``),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1);async function h(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(f())}}}async function g(){if(s(null),l(!1),t.trim()===``){s(lt());return}let a;try{a=JSON.parse(r)}catch{s(f());return}m(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{m(!1)}}return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:se()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ae()})]}),(0,Y.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:ie()}),(0,Y.jsx)(F,{value:t,onChange:e=>n(e.target.value),placeholder:Be(),maxLength:60})]}),(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:a()}),(0,Y.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:Ve(),rows:8,spellCheck:!1})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Y.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Y.jsx)(W,{className:`size-4`}),oe(),(0,Y.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void h(e)})]})}),(0,Y.jsx)(O,{size:`sm`,disabled:p,onClick:()=>void g(),children:u()})]}),o?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,Y.jsx)(`p`,{className:`oc-chart-import__ok`,children:pe()}):null]})]})}function $t({chart:e}){let t=st(d.charts.setChartLogo),n=S(d.charts.removeChartLogo),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await 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 l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Te():Ie()}),(0,Y.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Y.jsx)(`img`,{src:t,alt:``}):null}),(0,Y.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Y.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Y.jsx)(W,{className:`size-4`}),t?Ge():Le(),(0,Y.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:Fe()}):null,t?(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Ze()}):null]})}return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ct()}),(0,Y.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Y.jsx)(p,{mode:`light`}),(0,Y.jsx)(p,{mode:`dark`})]}),r?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:Me()}):null,a?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=w(d.me.getMe,{host:P}),n=S(d.charts.addChartDomain),r=S(d.charts.removeChartDomain),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function f(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function p(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:De()}),(0,Y.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Y.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:it()}):u.map(e=>(0,Y.jsxs)(R,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Y.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Pe({domain:e}),onClick:()=>void p(e),children:(0,Y.jsx)(D,{className:`size-3`})})]},e))}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(F,{value:i,onChange:e=>a(e.target.value),placeholder:tt(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,Y.jsx)(O,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void f(),children:Je()})]}),(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:ze()}),o?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function tn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=S(d.charts.updateChart),n=S(d.charts.deleteChart),[i,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(e.name),[c,l]=(0,G.useState)(()=>tn(e.tokens)),[u,p]=(0,G.useState)(e.tokens.bpm??0),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(!1);function v(){s(e.name),l(tn(e.tokens)),p(e.tokens.bpm??0),h(null),a(!0)}async function y(){if(e.chartId===void 0)return;h(null);let n;try{n=JSON.parse(c)}catch{h(f());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}_(!0);try{await t({chartId:e.chartId,name:o.trim(),tokens:n}),a(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(x()))try{await n({chartId:e.chartId})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:i?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`outline`,size:`sm`,onClick:v,children:Oe()}),(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:dt()})]})})]}),i?(0,Y.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:Ce()}),(0,Y.jsx)(F,{value:o,onChange:e=>s(e.target.value),maxLength:60})]}),(0,Y.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:T()}),(0,Y.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Y.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>p(Number(e.target.value)),"aria-label":T()}),(0,Y.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?ue():`${u} BPM`})]}),(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:ne()})]}),(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:be()}),(0,Y.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),m?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:m}):null,(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{size:`sm`,disabled:g,onClick:()=>void y(),children:r()}),(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:ce()})]})]}):null,(0,Y.jsx)($t,{chart:e}),(0,Y.jsx)(en,{chart:e})]})}function rn(){let e=w(d.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:c()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),e!==void 0&&t.length===0?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ut()}):(0,Y.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Y.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=S(d.charts.addChartToGroupPool),r=S(d.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),c=t.filter(e=>!o.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Y.jsx)(R,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?s():e.kind===`custom`&&e.scope===`personal`?m():_e()}),e.isGlobalDefault?(0,Y.jsx)(R,{variant:`default`,children:ft()}):null]}),(0,Y.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:re()}),(a??[]).map(e=>(0,Y.jsxs)(R,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Y.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":p({group:e.name}),onClick:()=>void u(e.groupId),children:(0,Y.jsx)(D,{className:`size-3`})})]},e.groupId)),c.length>0?(0,Y.jsxs)(N,{value:``,onValueChange:e=>void l(e),children:[(0,Y.jsx)(k,{size:`sm`,className:`w-56`,children:(0,Y.jsx)(z,{placeholder:v()})}),(0,Y.jsx)(B,{children:c.map(e=>(0,Y.jsx)(A,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:de()}):null]})]})}function on({chart:e}){let t=S(d.charts.promoteChartToCommon),n=S(d.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(x()))try{await n({chartId:e.chartId})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Y.jsx)(R,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?ve():m()}),e.ownerLabel?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:ee({owner:e.ownerLabel})}):null]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Y.jsx)(O,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:me()}):null,(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:g()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=S(d.admin.setDefaultThemeMode),a=S(d.admin.setDefaultLocale),o=S(d.charts.setDefaultChart),s=w(d.charts.listChartsAdmin),c=w(d.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,Y.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:et()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:qe()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:$e()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:i()}),mt.map(e=>(0,Y.jsx)(O,{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,Y.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:h()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ye()})]}),(0,Y.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Y.jsx)(an,{chart:e,groups:c??[]},e.key))})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:he()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:_()})]}),(0,Y.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Y.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Y.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Y.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Y.jsx)(en,{chart:e})]},e.key))})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:y()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Qe()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ge()}):(0,Y.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Y.jsx)(on,{chart:e},e.key))})})()]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:He()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ke()})]}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Y.jsx)(O,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Jt(e)},e))})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:nt()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Ye()})]}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:bt().map(e=>(0,Y.jsx)(O,{variant:u===e.value?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e.value}),children:e.label},e.value))}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]})]})}function cn(){let e=w(d.me.getMe,{host:P}),t=ht(e?.resolvedThemeMode);return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Y.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Y.jsx)(Qt,{}),(0,Y.jsx)(rn,{}),e?.role===`admin`?(0,Y.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,G.useState)(!0),[n,r]=(0,G.useState)(`per-user`),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(X),[c,l]=(0,G.useState)(X),[u,d]=(0,G.useState)(Z),f=i!==``||o!==X||c!==X;function p(){a(``),s(X),l(X),d(Z)}return(0,Y.jsxs)(`div`,{className:`oc-show`,children:[(0,Y.jsx)(cn,{}),(0,Y.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Y.jsx)(`summary`,{className:`oc-show__title`,children:Re()}),(0,Y.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{children:`Default`}),(0,Y.jsx)(O,{variant:`secondary`,children:`Secondary`}),(0,Y.jsx)(O,{variant:`outline`,children:`Outline`}),(0,Y.jsx)(O,{variant:`ghost`,children:`Ghost`}),(0,Y.jsx)(O,{variant:`destructive`,children:`Destructive`}),(0,Y.jsx)(O,{variant:`link`,children:`Link`})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{size:`sm`,children:`Small`}),(0,Y.jsx)(O,{children:`Default`}),(0,Y.jsx)(O,{size:`lg`,children:`Large`}),(0,Y.jsx)(O,{size:`icon`,"aria-label":`more`,children:(0,Y.jsx)(j,{})}),(0,Y.jsx)(O,{disabled:!0,children:`Disabled`})]})]}),(0,Y.jsx)(Q,{title:`Badges`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(R,{children:`Default`}),(0,Y.jsx)(R,{variant:`secondary`,children:`Secondary`}),(0,Y.jsx)(R,{variant:`outline`,children:`Outline`}),(0,Y.jsx)(R,{variant:`destructive`,children:`Destructive`})]})}),(0,Y.jsx)(Q,{title:`Inputs & selection`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Y.jsx)(F,{placeholder:`Text input…`}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsxs)(N,{value:n,onValueChange:r,children:[(0,Y.jsx)(k,{className:`w-56`,children:(0,Y.jsx)(z,{placeholder:`Select…`})}),(0,Y.jsxs)(B,{children:[(0,Y.jsx)(A,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Y.jsx)(A,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Y.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Y.jsx)(I,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Y.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Y.jsxs)(jt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Y.jsxs)(N,{value:o,onValueChange:s,children:[(0,Y.jsx)(k,{size:`sm`,children:(0,Y.jsx)(z,{})}),(0,Y.jsxs)(B,{children:[(0,Y.jsx)(A,{value:X,children:`Toutes directions`}),(0,Y.jsx)(A,{value:`inbound`,children:`inbound`}),(0,Y.jsx)(A,{value:`outbound`,children:`outbound`}),(0,Y.jsx)(A,{value:`internal`,children:`internal`})]})]}),(0,Y.jsxs)(N,{value:c,onValueChange:l,children:[(0,Y.jsx)(k,{size:`sm`,children:(0,Y.jsx)(z,{})}),(0,Y.jsxs)(B,{children:[(0,Y.jsx)(A,{value:X,children:`Toutes sévérités`}),(0,Y.jsx)(A,{value:`info`,children:`info`}),(0,Y.jsx)(A,{value:`warn`,children:`warn`}),(0,Y.jsx)(A,{value:`critical`,children:`critical`})]})]})]}),(0,Y.jsx)(Mt,{fields:qt,onChange:()=>{}}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Y.jsx)(At,{value:u,onChange:d})]})]})}),(0,Y.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Y.jsxs)(yt,{children:[(0,Y.jsx)(vt,{asChild:!0,children:(0,Y.jsx)(O,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Y.jsx)(j,{})})}),(0,Y.jsxs)(_t,{align:`start`,children:[(0,Y.jsx)(gt,{children:`Actions`}),(0,Y.jsx)(M,{}),(0,Y.jsx)(L,{children:`Edit`}),(0,Y.jsx)(L,{children:`Duplicate`}),(0,Y.jsx)(M,{}),(0,Y.jsx)(L,{variant:`destructive`,children:`Delete`})]})]})}),(0,Y.jsx)(Q,{title:`Card`,children:(0,Y.jsxs)(Et,{className:`w-80`,children:[(0,Y.jsxs)(xt,{children:[(0,Y.jsx)(wt,{children:`Instance`}),(0,Y.jsx)(Tt,{children:`Non-secret metadata only.`})]}),(0,Y.jsx)(Ct,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Y.jsxs)(St,{className:`gap-2`,children:[(0,Y.jsx)(O,{size:`sm`,children:`Save`}),(0,Y.jsx)(O,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Y.jsx)(Q,{title:`Table`,children:(0,Y.jsxs)(kt,{children:[(0,Y.jsx)(Dt,{children:(0,Y.jsxs)(H,{children:[(0,Y.jsx)(V,{className:`w-8`,children:(0,Y.jsx)(I,{"aria-label":`select all`})}),(0,Y.jsx)(V,{children:`Name`}),(0,Y.jsx)(V,{children:`Mode`}),(0,Y.jsx)(V,{className:`text-right`,children:`Status`}),(0,Y.jsx)(V,{className:`w-8`})]})}),(0,Y.jsx)(Ot,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Y.jsxs)(H,{children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(I,{"aria-label":`select ${e.n}`})}),(0,Y.jsx)(U,{className:`font-medium`,children:e.n}),(0,Y.jsx)(U,{children:(0,Y.jsx)(R,{variant:`secondary`,children:e.m})}),(0,Y.jsx)(U,{className:`text-right`,children:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Y.jsx)(E,{className:`size-3.5`}),` `,e.s]})}),(0,Y.jsx)(U,{children:(0,Y.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Y.jsx)(j,{})})})]},e.n))})]})}),(0,Y.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Y.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Y.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Y.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Y.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Y.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Y.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Y.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Y.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Y.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Y.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bn as r,Cm as i,Fn as a,In as o,Ln as s,Rn as c,Sm as l,Vn as u,_m as d,bm as f,fm as p,gm as m,hm as h,mm as g,pm as _,vm as v,wm as y,xm as b,ym as x,zn as S}from"./dist-Bcr-KIFN.js";import{t as C}from"./button-CvJAYeHx.js";import{A as w,Ht as T,St as E,bt as D,jt as O,ot as k,xt as A,yt as j}from"./index--Drh_B6c.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:y(),from:`now-5m`},{label:i(),from:`now-15m`},{label:l(),from:`now-30m`},{label:b(),from:`now-1h`},{label:f(),from:`now-3h`},{label:x(),from:`now-6h`},{label:v(),from:`now-12h`},{label:d(),from:`now-24h`},{label:m(),from:`now-2d`},{label:h(),from:`now-7d`},{label:g(),from:`now-30d`},{label:_(),from:`now-90d`},{label:p(),from:`now-520w`}];function L(e){return w(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,i]=(0,M.useState)(!1),[l,d]=(0,M.useState)(``),f=F(e),[p,m]=(0,M.useState)(()=>z(f.from)),[h,g]=(0,M.useState)(()=>z(f.to));function _(t){if(t){let t=F(e);m(z(t.from)),g(z(t.to)),d(``)}i(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),i(!1)}function y(){let e=B(p),n=B(h);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),i(!1))}let b=(0,M.useMemo)(()=>{let e=l.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[l]),x=B(p)!==null&&B(h)!==null;return(0,H.jsxs)(A,{open:n,onOpenChange:_,children:[(0,H.jsx)(E,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(T,{}),R(e)]})}),(0,H.jsx)(D,{children:(0,H.jsx)(j,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:u()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,H.jsx)(k,{type:`datetime-local`,value:p,onChange:e=>m(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:S()}),(0,H.jsx)(k,{type:`datetime-local`,value:h,onChange:e=>g(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!x,onClick:y,children:c()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(O,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(k,{value:l,onChange:e=>d(e.target.value),placeholder:s(),"aria-label":o()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:a()}):b.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>v(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bn as r,Cm as i,Hn as a,In as o,Ln as s,Rn as c,Sm as l,Tm as u,Vn as d,_m as f,bm as p,gm as m,hm as h,mm as g,pm as _,vm as v,wm as y,xm as b,ym as x,zn as S}from"./dist-B7IaMcdm.js";import{t as C}from"./button-B9CsHmrJ.js";import{A as w,Ct as T,Nt as E,St as D,Wt as O,ct as k,wt as A,xt as j}from"./index-DYfClpT4.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:u(),from:`now-5m`},{label:y(),from:`now-15m`},{label:i(),from:`now-30m`},{label:l(),from:`now-1h`},{label:b(),from:`now-3h`},{label:p(),from:`now-6h`},{label:x(),from:`now-12h`},{label:v(),from:`now-24h`},{label:f(),from:`now-2d`},{label:m(),from:`now-7d`},{label:h(),from:`now-30d`},{label:g(),from:`now-90d`},{label:_(),from:`now-520w`}];function L(e){return w(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,i]=(0,M.useState)(!1),[l,u]=(0,M.useState)(``),f=F(e),[p,m]=(0,M.useState)(()=>z(f.from)),[h,g]=(0,M.useState)(()=>z(f.to));function _(t){if(t){let t=F(e);m(z(t.from)),g(z(t.to)),u(``)}i(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),i(!1)}function y(){let e=B(p),n=B(h);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),i(!1))}let b=(0,M.useMemo)(()=>{let e=l.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[l]),x=B(p)!==null&&B(h)!==null;return(0,H.jsxs)(T,{open:n,onOpenChange:_,children:[(0,H.jsx)(A,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(O,{}),R(e)]})}),(0,H.jsx)(D,{children:(0,H.jsx)(j,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:a()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:d()}),(0,H.jsx)(k,{type:`datetime-local`,value:p,onChange:e=>m(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,H.jsx)(k,{type:`datetime-local`,value:h,onChange:e=>g(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!x,onClick:y,children:S()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(E,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(k,{value:l,onChange:e=>u(e.target.value),placeholder:c(),"aria-label":s()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:o()}):b.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>v(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};