@lacneu/atrium 0.10.18 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/assets/{AccessTab-wgwrrOkq.js → AccessTab-CdyF1j7K.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-CQA9SSeX.js → AdvancedFilter-0hIaeD_5.js} +1 -1
  3. package/dist/assets/AgentFilesTab-BcyT_Ep9.js +3 -0
  4. package/dist/assets/AnomaliesTab-D8uOqg5K.js +1 -0
  5. package/dist/assets/{AuditTab-BCGc5fh-.js → AuditTab-C-N4POzp.js} +1 -1
  6. package/dist/assets/BridgeTab-DwwnrXwF.js +1 -0
  7. package/dist/assets/{ChatDefaultsTab-C4KGYhV-.js → ChatDefaultsTab-hdfiXKvr.js} +1 -1
  8. package/dist/assets/{DataTableShell-B62Qv-tB.js → DataTableShell-B_P8ehdH.js} +1 -1
  9. package/dist/assets/{DetailChips-fND9q0WY.js → DetailChips-DccwdoeS.js} +1 -1
  10. package/dist/assets/FeedbacksTab-BKfLDVev.js +1 -0
  11. package/dist/assets/FieldLabel-CtF9VFJv.js +4 -0
  12. package/dist/assets/FilesTab-C0sB2U_I.js +1 -0
  13. package/dist/assets/{FilterBar-CWlA8nZ0.js → FilterBar-BmFEn3qs.js} +1 -1
  14. package/dist/assets/GroupsTab-SlcsoVZV.js +1 -0
  15. package/dist/assets/InstancesTab-D4d7ISJ6.js +1 -0
  16. package/dist/assets/IntegrationsTab-BCXFK88J.js +1 -0
  17. package/dist/assets/{KpiTab-Cn6U4E5D.js → KpiTab-DNfNa6Oo.js} +1 -1
  18. package/dist/assets/PreferencesTab-CUiAii9X.js +1 -0
  19. package/dist/assets/{PromptInjectionsTab-ZwimzgiF.js → PromptInjectionsTab-Dncvuu7j.js} +2 -2
  20. package/dist/assets/RolesTab-Cieo--3o.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-DrIUUd8f.js +1 -0
  22. package/dist/assets/ThemeShowroom-BPEHKIyD.js +1 -0
  23. package/dist/assets/{TimeRangePicker-CXb27Tev.js → TimeRangePicker-BDN2rIcO.js} +1 -1
  24. package/dist/assets/TracesTab-C1P-cd2o.js +1 -0
  25. package/dist/assets/UsersTab-dqn0iQJZ.js +1 -0
  26. package/dist/assets/{button-G-_IqZDp.js → button-DuXPa4Vl.js} +1 -1
  27. package/dist/assets/{card-B3VbgixI.js → card-CWLBezSK.js} +1 -1
  28. package/dist/assets/chevrons-up-down-DGeJvEkD.js +1 -0
  29. package/dist/assets/{compatView-hfeNAe7g.js → compatView-6XUIK3Ob.js} +1 -1
  30. package/dist/assets/{dispatchErrorInfo-DpmUia7q.js → dispatchErrorInfo-Y76YNHBy.js} +1 -1
  31. package/dist/assets/{dist--S7AYRAA.js → dist-DjXzB84V.js} +1 -1
  32. package/dist/assets/{dist-BDPwn3r0.js → dist-ZW9rNZ8M.js} +1 -1
  33. package/dist/assets/dist-cXwNU958.js +5 -0
  34. package/dist/assets/{dist-CgXYe09h.js → dist-ws-D-Lv-.js} +1 -1
  35. package/dist/assets/{highlighted-body-OFNGDK62-5MhDiezJ.js → highlighted-body-OFNGDK62-whVEKGek.js} +1 -1
  36. package/dist/assets/index-Bp-uQn4K.js +226 -0
  37. package/dist/assets/mermaid-GHXKKRXX-Dg9-NNvT.js +1 -0
  38. package/dist/assets/roleDescriptions-KrB9-er6.js +1 -0
  39. package/dist/assets/{table-xKqB5hyP.js → table-CoglL6L8.js} +1 -1
  40. package/dist/assets/x-D96nOW2m.js +1 -0
  41. package/dist/index.html +7 -7
  42. package/package.json +1 -1
  43. package/dist/assets/AgentFilesTab-DpvNcKxY.js +0 -3
  44. package/dist/assets/AnomaliesTab-CsVaUK9r.js +0 -1
  45. package/dist/assets/BridgeTab-CI5Pr3zt.js +0 -1
  46. package/dist/assets/FeedbacksTab-xd7LisqB.js +0 -1
  47. package/dist/assets/FieldLabel-DkIcKewT.js +0 -4
  48. package/dist/assets/FilesTab-BzZTNirP.js +0 -1
  49. package/dist/assets/GroupsTab-DDGHlCam.js +0 -1
  50. package/dist/assets/InstancesTab-CENcOK8c.js +0 -1
  51. package/dist/assets/IntegrationsTab-DSfAaftT.js +0 -1
  52. package/dist/assets/PreferencesTab-SI6PHYsQ.js +0 -1
  53. package/dist/assets/RolesTab-Dm9rHjli.js +0 -1
  54. package/dist/assets/ServiceAccountsTab-Oxuo-aSo.js +0 -1
  55. package/dist/assets/ThemeShowroom-O_cVLe2-.js +0 -1
  56. package/dist/assets/TracesTab-CWvJFPjX.js +0 -1
  57. package/dist/assets/UsersTab-Co8sYpJL.js +0 -1
  58. package/dist/assets/chevrons-up-down-BlHpdE9v.js +0 -1
  59. package/dist/assets/dist-0Nx0BXy1.js +0 -5
  60. package/dist/assets/index-BmXiVWTf.js +0 -221
  61. package/dist/assets/mermaid-GHXKKRXX-CNK1PBuN.js +0 -1
  62. package/dist/assets/roleDescriptions-I2Mil-DA.js +0 -1
  63. package/dist/assets/x-CpLBfKr9.js +0 -1
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cr as r,Dr as i,Er as a,IC as o,Sr as s,Tr as c,_r as l,br as u,gr as d,gw as f,hr as p,lw as m,mr as h,pr as g,vr as _,wr as v,xr as y,yr as b}from"./dist-CgXYe09h.js";import{C as x,S,b as C,m as w,x as T,y as E}from"./index-BmXiVWTf.js";var D=t(e(),1);function O(e){return e===`user`?l():e===`all`?d():p({group:e.group})}function k(e){return e===`common`?h():e===`owner`?g():p({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=f(m.admin.listUsers,{}),[t,n]=(0,D.useState)(``),l=f(m.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":a(),children:(0,A.jsx)(x,{placeholder:a()})}),(0,A.jsx)(C,{children:(e??[]).map(e=>(0,A.jsx)(T,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):l===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(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:v()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:l.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:l.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:r()}),l.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:l.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:s()}),l.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:l.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:_()}):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:y()}),l.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:l.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:u()}),l.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:l.permissions.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cr as r,Dr as i,Er as a,LC as o,Sr as s,Tr as c,_r as l,_w as u,br as d,gr as f,hr as p,mr as m,pr as h,uw as g,vr as _,wr as v,xr as y,yr as b}from"./dist-ws-D-Lv-.js";import{C as x,S,b as C,m as w,x as T,y as E}from"./index-Bp-uQn4K.js";var D=t(e(),1);function O(e){return e===`user`?l():e===`all`?f():p({group:e.group})}function k(e){return e===`common`?m():e===`owner`?h():p({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=u(g.admin.listUsers,{}),[t,n]=(0,D.useState)(``),l=u(g.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":a(),children:(0,A.jsx)(x,{placeholder:a()})}),(0,A.jsx)(C,{children:(e??[]).map(e=>(0,A.jsx)(T,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):l===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(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:v()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:l.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:l.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:r()}),l.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:l.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:s()}),l.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:l.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:_()}):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:y()}),l.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:l.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:d()}),l.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:l.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{Fa as r,Ia as i,La as a,Ma as o,Na as s,Pa as c,Ra as l}from"./dist-CgXYe09h.js";import{i as u}from"./dist-BDPwn3r0.js";import{r as d}from"./TimeRangePicker-CXb27Tev.js";import{t as f}from"./x-CpLBfKr9.js";import{t as p}from"./button-G-_IqZDp.js";import{C as m,J as h,S as g,b as _,bt as v,x as y,y as b}from"./index-BmXiVWTf.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:d(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:i()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(b,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(g,{size:`sm`,className:`w-40`,children:(0,S.jsx)(m,{placeholder:r()})}),(0,S.jsx)(_,{children:e.map(e=>(0,S.jsx)(y,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(b,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(g,{size:`sm`,className:`w-28`,children:(0,S.jsx)(m,{})}),(0,S.jsx)(_,{children:C.map(e=>(0,S.jsx)(y,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(h,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:c()}),(0,S.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),onClick:()=>P(t.id),children:(0,S.jsx)(f,{})})]},t.id))}),(0,S.jsxs)(p,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(v,{}),o()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Fa as r,Ia as i,La as a,Ma as o,Na as s,Pa as c,Ra as l}from"./dist-ws-D-Lv-.js";import{i as u}from"./dist-ZW9rNZ8M.js";import{r as d}from"./TimeRangePicker-BDN2rIcO.js";import{t as f}from"./x-D96nOW2m.js";import{t as p}from"./button-DuXPa4Vl.js";import{C as m,J as h,S as g,b as _,bt as v,x as y,y as b}from"./index-Bp-uQn4K.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:d(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:i()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(b,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(g,{size:`sm`,className:`w-40`,children:(0,S.jsx)(m,{placeholder:r()})}),(0,S.jsx)(_,{children:e.map(e=>(0,S.jsx)(y,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(b,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(g,{size:`sm`,className:`w-28`,children:(0,S.jsx)(m,{})}),(0,S.jsx)(_,{children:C.map(e=>(0,S.jsx)(y,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(h,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:c()}),(0,S.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),onClick:()=>P(t.id),children:(0,S.jsx)(f,{})})]},t.id))}),(0,S.jsxs)(p,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(v,{}),o()]})]}):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{$ as r,Av as i,B as a,F as o,G as s,Gt as c,H as l,I as u,J as d,K as f,L as p,LC as m,Q as ee,R as h,U as g,Ut as _,V as v,W as y,X as te,Y as b,Z as x,_w as S,at as C,ct as ne,et as re,it as w,lt as ie,mw as T,nt as ae,ot as E,q as D,rt as O,st as k,tt as oe,ut as A,uw as j,z as M,zC as se}from"./dist-ws-D-Lv-.js";import{t as N}from"./button-DuXPa4Vl.js";import{B as P,C as F,F as I,G as L,H as ce,I as le,K as ue,P as de,R as fe,S as R,U as pe,V as me,W as he,_ as z,b as B,j as ge,m as _e,mt as V,ot as H,q as ve,x as U,y as W,z as ye}from"./index-Bp-uQn4K.js";import{i as G}from"./compatView-6XUIK3Ob.js";/* empty css */var K=t(e(),1),q=2e4,J=6e4;function Y(e){return typeof e!=`number`||e<=0?0:Math.round(e/q*100)}function X(e){return e<=0?0:Math.round(e/J*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function be(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var xe=3;function Se(e,t){let n=new Map;for(let t of e.split(`
2
+ `))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
3
+ `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<xe&&a.push(e)):t>0&&(i+=t,o.length<xe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function Ce(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function we(){let e=S(j.me.getMe,{host:H}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=S(j.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let s=S(j.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),c=S(j.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return a===null||s===void 0?i!==void 0&&i.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,i,c]),[u,d]=(0,K.useState)(null);(0,K.useEffect)(()=>{!l||l.length===0||(!u||!l.some(e=>$(e)===u))&&d($(l[0]))},[l,u]);let f=l?.find(e=>$(e)===u)??null,p=T(j.agentFiles.listAgentFiles),[h,g]=(0,K.useState)({status:`idle`}),v=f?.instanceName??null,y=f?.agentId??null,te=S(j.compat.forInstance,n&&v!==null?{instanceName:v}:`skip`),b=n&&v!==null?z(te,`agentFiles`):null,x=b===null?!1:b===`loading`?null:b.blocked,D=(0,K.useCallback)(async()=>{if(!(v===null||y===null)){g({status:`loading`});try{g({status:`done`,files:(await p({instanceName:v,agentId:y})).files})}catch{g({status:`error`})}}},[p,v,y]);(0,K.useEffect)(()=>{x===!1&&D()},[D,x]);let[M,P]=(0,K.useState)(null),I=se(),L=(0,K.useMemo)(()=>new Intl.NumberFormat(I,{maximumFractionDigits:0}),[I]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:A()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(W,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(R,{size:`sm`,"aria-label":ie(),children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(B,{children:(i??[]).map(e=>(0,Q.jsx)(U,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(W,{value:u??``,onValueChange:e=>d(e),children:[(0,Q.jsx)(R,{size:`sm`,"aria-label":ne(),children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(B,{children:l.map(e=>(0,Q.jsx)(U,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()})]}),f===null?null:b===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):b!==null&&b.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(V,{size:14,"aria-hidden":!0}),` `,G(b.gatewayVersion)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[C(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:_()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Y(e.size),i=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)(_e,{variant:`outline`,children:w()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:O({size:Z(e.size,I)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` 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:ae({pct:L.format(n)})}),i?(0,Q.jsx)(V,{size:14,className:`oc-afiles__warn`,"aria-label":oe()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(N,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>P(e),children:t?r():ee()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:re({used:Z(be(h.files),I),total:Z(J,I),pct:L.format(X(be(h.files)))})})]}),M&&f?(0,Q.jsx)(Te,{instanceName:f.instanceName,agentId:f.agentId,name:M.name,isAdmin:t,onClose:()=>P(null),onSaved:()=>void D()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:ee,onSaved:S}){let C=T(j.agentFiles.getAgentFile),ne=T(j.agentFiles.setAgentFile),re=ge(),[w,ie]=(0,K.useState)(null),[ae,E]=(0,K.useState)(!1),[O,k]=(0,K.useState)(``),[oe,A]=(0,K.useState)(!1),[F,R]=(0,K.useState)(!1),[z,B]=(0,K.useState)(!1),[_e,V]=(0,K.useState)(!1),H=(0,K.useCallback)(async r=>{E(!1);try{let i=await C({instanceName:e,agentId:t,name:n});ie({content:i.content,updatedAtMs:i.updatedAtMs}),r||k(i.content),B(!1)}catch{E(!0)}},[C,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(w!==null){R(!0),V(!1);try{await ne({instanceName:e,agentId:t,name:n,content:O,baseUpdatedAtMs:w.updatedAtMs??void 0}),re.success(s({name:n})),S(),await H(!1)}catch(e){Ce(e)?B(!0):V(!0)}finally{R(!1)}}}let W=w!==null&&O!==w.content,G=(0,K.useMemo)(()=>w===null?null:Se(w.content,O),[w,O]),J=O.length>q,Y=se(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(de,{open:!0,onOpenChange:e=>!e&&ee(),children:(0,Q.jsxs)(I,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(fe,{children:[(0,Q.jsx)(ye,{children:x({name:n})}),(0,Q.jsxs)(le,{children:[te({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,b()]})]})]}),ae?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[g(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:_()})]}):w===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:O,readOnly:!r,spellCheck:!1,onChange:e=>k(e.target.value),"aria-label":x({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:d()}),z?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[l(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:v()})]}):null,_e?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:y()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:D({count:X.format(O.length),max:X.format(q)})}),r?(0,Q.jsx)(N,{size:`sm`,disabled:!W||F||z,onClick:()=>A(!0),children:F?c():f()}):null]})]}),(0,Q.jsx)(P,{open:oe,onOpenChange:A,children:(0,Q.jsxs)(pe,{children:[(0,Q.jsxs)(ue,{children:[(0,Q.jsx)(ve,{children:a({name:n})}),(0,Q.jsx)(he,{children:M({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:h({added:G.added,removed:G.removed})}),G.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:p()}),G.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,G.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:u()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(L,{children:[(0,Q.jsx)(ce,{children:i()}),(0,Q.jsx)(me,{onClick:()=>void U(),children:o()})]})]})})]})})}export{we as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,Au as i,Bu as a,Du as o,Eu as s,Fu as ee,Gu as c,Hu as l,Iu as te,Ju as ne,Ku as re,Lu as ie,Mu as u,Nu as d,Ou as f,Pu as p,Qu as m,Ru as ae,Tu as h,Uu as oe,Vu as se,Wu as g,Xu as ce,Yu as le,Zu as ue,_w as _,ad as de,cd as fe,dd as v,ed as pe,fd as y,gw as me,id as he,ju as b,ku as x,ld as S,nd as C,od as w,pd as T,qu as E,rd as D,sd as O,td as k,ud as A,uw as j,zu as M}from"./dist-ws-D-Lv-.js";import{n as N}from"./TimeRangePicker-BDN2rIcO.js";import{C as P,M as F,Ot as I,S as L,a as R,b as z,j as ge,kt as _e,m as B,ot as ve,r as ye,x as V,y as H}from"./index-Bp-uQn4K.js";import{t as be}from"./FilterBar-BmFEn3qs.js";import{t as xe}from"./DataTableShell-B_P8ehdH.js";import{t as U}from"./dispatchErrorInfo-Y76YNHBy.js";var W=t(e(),1),G=n(),K=`__all__`,Se=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ce(e){return e===`open`?T():e===`acknowledged`?y():v()}var we=[`info`,`warn`,`critical`],Te=[`detector`,`agent`],Ee={kind:`relative`,from:`now-30d`,to:`now`},De=200,q=`all`;function J(){let e=_e({from:`/settings/anomalies`}),t=I({from:`/settings/anomalies`}),n=e.q??``,o=e.status===q?K:e.status,s=e.severity??K,f=e.kind??K,[h,v]=(0,W.useState)(K),y=ye(e.from,e.to),{from:T,to:U}=N(y),J=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Y=e=>void t({search:t=>({...t,status:e===K?q:e})}),Me=e=>void t({search:t=>({...t,severity:e===K?void 0:e})}),Ne=e=>void t({search:t=>({...t,kind:e===K?void 0:e})}),X=e=>void t({search:t=>({...t,...R(e)})}),Pe=F(),Z=ge(),Q=me(j.anomalies.resolveAnomaly),Fe=(_(j.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=_(j.anomalies.listAnomalies,{limit:De,filter:{q:n||void 0,from:T,to:U,anomalyStatus:o===K?void 0:o,severity:s===K?void 0:s,source:h===K?void 0:h,kind:f===K?void 0:f}}),Ie=(0,W.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||o!==`open`||s!==K||h!==K||f!==K||y.kind!==`relative`||y.from!==Ee.from;function Re(){v(K),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:A(),description:(0,G.jsxs)(G.Fragment,{children:[S(),` `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,fe(),` `,(0,G.jsx)(`strong`,{children:O()}),`.`,` `,w()]}),confirmLabel:de()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(he(),e.kind)}catch(e){Z.error(D(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(C(),e.kind)}catch(e){Z.error(k(),e)}}return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`oc-admin__hint`,children:[pe(),` `,(0,G.jsx)(`strong`,{children:r()}),` `,m(),` `,(0,G.jsx)(`strong`,{children:ue()}),` `,ce(),` `,(0,G.jsx)(`strong`,{children:le()}),` `,ne(),` `,(0,G.jsx)(`span`,{className:`oc-filter__window`,children:E()})]}),(0,G.jsxs)(be,{q:n,onQChange:J,searchPlaceholder:re(),timeRange:y,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,G.jsxs)(H,{value:o,onValueChange:Y,children:[(0,G.jsx)(L,{size:`sm`,className:`w-36`,children:(0,G.jsx)(P,{})}),(0,G.jsxs)(z,{children:[(0,G.jsx)(V,{value:K,children:c()}),Se.map(e=>(0,G.jsx)(V,{value:e.value,children:Ce(e.value)},e.value))]})]}),(0,G.jsxs)(H,{value:s,onValueChange:Me,children:[(0,G.jsx)(L,{size:`sm`,className:`w-36`,children:(0,G.jsx)(P,{placeholder:g()})}),(0,G.jsxs)(z,{children:[(0,G.jsx)(V,{value:K,children:oe()}),we.map(e=>(0,G.jsx)(V,{value:e,children:e},e))]})]}),(0,G.jsxs)(H,{value:h,onValueChange:v,children:[(0,G.jsx)(L,{size:`sm`,className:`w-32`,children:(0,G.jsx)(P,{placeholder:l()})}),(0,G.jsxs)(z,{children:[(0,G.jsx)(V,{value:K,children:se()}),Te.map(e=>(0,G.jsx)(V,{value:e,children:e},e))]})]}),(0,G.jsxs)(H,{value:f,onValueChange:Ne,children:[(0,G.jsx)(L,{size:`sm`,className:`w-36`,children:(0,G.jsx)(P,{placeholder:a()})}),(0,G.jsxs)(z,{children:[(0,G.jsx)(V,{value:K,children:M()}),Ie.map(e=>(0,G.jsx)(V,{value:e,children:e},e))]})]})]}),(0,G.jsx)(xe,{title:ae(),rows:$,emptyHint:o===`open`?ie():te(),rowActions:e=>Fe&&e.status===`open`?[{label:ee(),onSelect:()=>void ze(e)},{label:p(),onSelect:()=>void Be(e)}]:[],columns:[{header:d(),cell:e=>(0,G.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:a(),cell:e=>(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:g(),cell:e=>(0,G.jsx)(ke,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:u(),cell:e=>(0,G.jsx)(Ae,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:l(),cell:e=>(0,G.jsx)(B,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:b(),cell:e=>(0,G.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:i(),cell:e=>(0,G.jsx)(Oe,{row:e}),sort:e=>e.evidence??null},{header:x(),cell:e=>e.correlationId?(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:je(e.correlationId)}):(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Y(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 Oe({row:e}){let t=I(),n=Y(e);if(!n.dominantCode)return(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=U(n.dominantCode),i=n.sampleCorrelationId;return(0,G.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,G.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,G.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,G.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,G.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,f()]}):null]})}function ke({severity:e}){return(0,G.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ae({status:e}){return e===`open`?(0,G.jsx)(B,{variant:`destructive`,children:o()}):e===`acknowledged`?(0,G.jsx)(B,{variant:`secondary`,children:s()}):(0,G.jsx)(B,{variant:`outline`,children:h()})}function je(e){return e.length>8?e.slice(0,8):e}export{J as AnomaliesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_f as r,af as i,cf as a,df as o,ff as s,gf as c,gw as l,hf as u,if as ee,lf as d,lw as f,mf as p,of as m,pf as h,rf as g,sf as _,uf as v}from"./dist-CgXYe09h.js";import{n as y}from"./TimeRangePicker-CXb27Tev.js";import{C as b,Ot as x,S,a as C,b as w,i as T,kt as E,o as D,r as O,t as k,x as A,y as j}from"./index-BmXiVWTf.js";import{t as M}from"./FilterBar-CWlA8nZ0.js";import{t as N}from"./AdvancedFilter-CQA9SSeX.js";import{t as P}from"./DataTableShell-B62Qv-tB.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:k,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=E({from:`/settings/audit`}),t=x({from:`/settings/audit`}),n=e.q??``,k=e.action??R,B=e.impersonated??R,V=e.resource??R,H=O(e.from,e.to),U=(0,F.useMemo)(()=>D(e.adv),[e.adv]),{from:W,to:G}=y(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...C(e)})}),Z=e=>void t({search:t=>({...t,adv:T(e)}),replace:!0}),Q=l(f.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:k===R?void 0:k,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||k!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[r(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:c()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:u(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(j,{value:k,onValueChange:q,children:[(0,I.jsx)(S,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{placeholder:p()})}),(0,I.jsxs)(w,{children:[(0,I.jsx)(A,{value:R,children:h()}),$.map(e=>(0,I.jsx)(A,{value:e,children:e},e))]})]}),(0,I.jsxs)(j,{value:B,onValueChange:J,children:[(0,I.jsx)(S,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{})}),(0,I.jsxs)(w,{children:[(0,I.jsx)(A,{value:R,children:s()}),(0,I.jsx)(A,{value:`yes`,children:o()}),(0,I.jsx)(A,{value:`no`,children:v()})]})]}),(0,I.jsxs)(j,{value:V,onValueChange:Y,children:[(0,I.jsx)(S,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{placeholder:d()})}),(0,I.jsxs)(w,{children:[(0,I.jsx)(A,{value:R,children:a()}),te.map(e=>(0,I.jsx)(A,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:_(),rows:Q,emptyHint:m(),columns:[{header:i(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:p(),cell:e=>e.action,sort:e=>e.action},{header:ee(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:g(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:d(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_f as r,_w as i,af as a,cf as o,df as s,ff as c,gf as l,hf as u,if as ee,lf as d,mf as f,of as p,pf as m,sf as h,uf as g,uw as _,vf as v}from"./dist-ws-D-Lv-.js";import{n as y}from"./TimeRangePicker-BDN2rIcO.js";import{C as b,Ot as x,S,a as C,b as w,i as T,kt as E,o as D,r as O,t as k,x as A,y as j}from"./index-Bp-uQn4K.js";import{t as M}from"./FilterBar-BmFEn3qs.js";import{t as N}from"./AdvancedFilter-0hIaeD_5.js";import{t as P}from"./DataTableShell-B_P8ehdH.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:k,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=E({from:`/settings/audit`}),t=x({from:`/settings/audit`}),n=e.q??``,k=e.action??R,B=e.impersonated??R,V=e.resource??R,H=O(e.from,e.to),U=(0,F.useMemo)(()=>D(e.adv),[e.adv]),{from:W,to:G}=y(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...C(e)})}),Z=e=>void t({search:t=>({...t,adv:T(e)}),replace:!0}),Q=i(_.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:k===R?void 0:k,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||k!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:r()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:l(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(j,{value:k,onValueChange:q,children:[(0,I.jsx)(S,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{placeholder:u()})}),(0,I.jsxs)(w,{children:[(0,I.jsx)(A,{value:R,children:f()}),$.map(e=>(0,I.jsx)(A,{value:e,children:e},e))]})]}),(0,I.jsxs)(j,{value:B,onValueChange:J,children:[(0,I.jsx)(S,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{})}),(0,I.jsxs)(w,{children:[(0,I.jsx)(A,{value:R,children:m()}),(0,I.jsx)(A,{value:`yes`,children:c()}),(0,I.jsx)(A,{value:`no`,children:s()})]})]}),(0,I.jsxs)(j,{value:V,onValueChange:Y,children:[(0,I.jsx)(S,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{placeholder:g()})}),(0,I.jsxs)(w,{children:[(0,I.jsx)(A,{value:R,children:d()}),te.map(e=>(0,I.jsx)(A,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:o(),rows:Q,emptyHint:h(),columns:[{header:p(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:u(),cell:e=>e.action,sort:e=>e.action},{header:a(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:ee(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:g(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{As as r,Bs as i,Cc as a,Cs as o,Dc as s,Ds as c,Ec as l,Es as u,Fs as d,Gs as f,Hs as p,Is as ee,Ls as te,Ms as ne,Ns as re,Os as m,Ps as h,Rs as ie,Sc as ae,Ss as g,Ts as _,Us as oe,Vs as se,Ws as ce,_ as v,_c as le,_s as y,_w as b,a as x,as as S,b as ue,bc as de,bs as fe,cs as pe,d as me,ds as he,dw as ge,f as _e,fs as ve,g as ye,gs as be,gw as xe,h as Se,hs as Ce,is as C,js as we,ks as Te,l as Ee,ls as De,m as Oe,mc as ke,ms as Ae,mw as je,os as Me,p as Ne,pc as Pe,ps as Fe,rs as w,ss as Ie,u as Le,us as Re,uw as T,v as ze,vc as Be,vs as Ve,wc as He,ws as Ue,xc as We,xs as Ge,y as Ke,yc as qe,ys as Je,zs as Ye}from"./dist-ws-D-Lv-.js";import{i as E,r as Xe}from"./dist-ZW9rNZ8M.js";import{t as Ze}from"./chevrons-up-down-DGeJvEkD.js";import{i as Qe,n as D,o as $e,r as et,s as tt}from"./FieldLabel-CtF9VFJv.js";import{t as O}from"./button-DuXPa4Vl.js";import{C as k,Dt as nt,Et as A,F as rt,I as it,J as j,O as at,Ot as ot,P as st,R as ct,S as M,St as lt,X as ut,Y as dt,Z as ft,_t as pt,b as N,j as mt,m as P,mt as F,ot as ht,x as I,y as L,z as gt}from"./index-Bp-uQn4K.js";import{a as _t,i as R,n as vt,o as z,r as B,t as yt}from"./table-CoglL6L8.js";import{t as bt}from"./FilterBar-BmFEn3qs.js";import{a as V,n as xt,o as H,r as U,s as St,t as Ct}from"./compatView-6XUIK3Ob.js";import{t as W}from"./dispatchErrorInfo-Y76YNHBy.js";var wt=ge(`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`}]]),Tt=ge(`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`}]]),G=t(e(),1);function Et(e){return e.filter(e=>e.state===`error`)}function Dt(e){return e.reachable&&Et(e.targets).length===0}function Ot(e){return e.state===`error`&&e.lastErrorCode!==null}function kt(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function At(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function jt(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return At(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function Mt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,Nt={q:``,state:q,instance:q,version:q},J={connected:0,error:1,idle:2};function Pt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Ft(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Y(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function X(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function It(e,t,n){switch(e){case`state`:return(J[t.state]??99)-(J[n.state]??99);case`instance`:return Y(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Y(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return H(e,r)??Y(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Y(t.targetLabel,n.targetLabel)}}function Lt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=X(t.key,e),a=X(t.key,r);return i&&a?0:i?1:a?-1:n*It(t.key,e,r)})}function Rt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(J[e]??99)-(J[t]??99))}function zt(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)=>Y(e.label,t.label))}function Bt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>H(e,t)??Y(e,t))}var Z=n();function Vt({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(Nt),[i,a]=(0,G.useState)(null),o=(0,G.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]),s=(0,G.useMemo)(()=>Rt(o),[o]),c=(0,G.useMemo)(()=>zt(o),[o]),l=(0,G.useMemo)(()=>Bt(o),[o]),u=(0,G.useMemo)(()=>Lt(Ft(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(bt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Ve(),onReset:()=>r(Nt),canReset:Pt(n),children:[(0,Z.jsxs)(L,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(k,{placeholder:be()})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(I,{value:q,children:y()}),s.map(e=>(0,Z.jsx)(I,{value:e,children:Ut(e)},e))]})]}),(0,Z.jsxs)(L,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(k,{placeholder:Ce()})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(I,{value:q,children:y()}),c.map(e=>(0,Z.jsx)(I,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(L,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(k,{placeholder:Ae()})}),(0,Z.jsxs)(N,{children:[(0,Z.jsx)(I,{value:q,children:y()}),l.map(e=>(0,Z.jsx)(I,{value:e,children:e},e))]})]})]}),u.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):(0,Z.jsxs)(yt,{className:`oc-conn__table`,children:[(0,Z.jsx)(_t,{children:(0,Z.jsxs)(z,{children:[(0,Z.jsx)(Q,{label:ve(),sortKey:`target`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:he(),sortKey:`state`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Re(),sortKey:`instance`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:De(),sortKey:`host`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:pe(),sortKey:`version`,sort:i,onSort:d}),(0,Z.jsx)(R,{children:Ie()}),(0,Z.jsx)(Q,{label:Me(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Z.jsx)(vt,{children:u.map(e=>(0,Z.jsx)(Ht,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(R,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(Xe,{size:13,"aria-hidden":!0}):(0,Z.jsx)(E,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Ze,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Ht({r:e}){let t=Ot(e)?W(e.lastErrorCode):null,n=kt(e)?W(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(z,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(B,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(B,{children:(0,Z.jsx)(Wt,{state:e.state})}),(0,Z.jsx)(B,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(B,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(B,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(B,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:fe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(B,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(z,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(B,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Je({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Ut(e){return e===`connected`?S():e===`error`?C():w()}function Wt({state:e}){return e===`connected`?(0,Z.jsx)(P,{variant:`secondary`,children:S()}):e===`error`?(0,Z.jsx)(P,{variant:`destructive`,children:C()}):(0,Z.jsx)(P,{variant:`outline`,children:w()})}function Gt(){return b(T.bridgeHealth.getBridgeHealth,{})}function Kt(){let e=Gt(),t=b(T.compat.getBridgeCompat,{}),n=b(T.me.getMe,{host:ht})?.role===`admin`,r=b(T.admin.listInstances,n?{}:`skip`),i=ot(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=jt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&xt(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(qt,{health:e,compat:t,onSeeAnomalies:a}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:we()}),o.map(e=>(0,Z.jsx)(Jt,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0},e.key)),l?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):null]})}function qt({health:e,compat:t,onSeeAnomalies:n}){let i=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:V(t.bridgeVersion)}),` · `,ze(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?v():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:r()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Te()});let a=Et(e.targets),s=!e.reachable,l=Dt(e),d=l?`ok`:`error`,f=new Date(e.checkedAt).toLocaleString(`fr-FR`),p=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l?(0,Z.jsx)(A,{size:22}):s?(0,Z.jsx)(Tt,{size:22}):(0,Z.jsx)(F,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l?m():s?c():u({count:a.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(wt,{size:12,"aria-hidden":!0}),` `,_({time:f})]}),p?(0,Z.jsx)(`span`,{children:Ue({time:p})}):null,i]}),s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:o()})]})}function Jt({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a}){let o=r?St(r,e):null,s=new Map;for(let e of n)s.set(e.name,e.displayName??e.name);let c=[],l=new Set;for(let n of t){if(!n.instanceName||l.has(n.instanceName))continue;l.add(n.instanceName);let t=n.gatewayVersion??null;c.push({instanceName:n.instanceName,displayName:s.get(n.instanceName)??n.instanceName,version:t,state:Ct(t,e,r)})}let u=c.map(e=>e.state),d=u.includes(`beyond`)?`beyond`:u.length>0&&u.every(e=>e===`supported`)?`supported`:null,[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(pt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Mt(e)}),d?(0,Z.jsx)(P,{variant:d===`beyond`?`destructive`:`secondary`,children:U(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ue()}),(0,Z.jsx)(Yt,{support:o,compatStatus:i,compatReachable:a,manifest:r,instanceRows:c}),(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(E,{size:13,"aria-hidden":!0}):(0,Z.jsx)(nt,{size:13,"aria-hidden":!0}),g({count:t.length})]}),f?(0,Z.jsx)(Vt,{connections:t,displayByInstance:s}):null]})}function Yt({support:e,compatStatus:t,compatReachable:n,manifest:i,instanceRows:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}),i===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Oe()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:Ne({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:v()}),e?(0,Z.jsx)(Qt,{versions:e.validatedVersions}):null]}),a.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:a.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:V(e.version)}),(0,Z.jsx)(P,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:U(e.state)})]},e.instanceName))})]})}function Xt({instance:e,onClose:t}){return(0,Z.jsx)(st,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(rt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(ct,{children:[(0,Z.jsx)(gt,{children:s({instance:e.displayName??e.name})}),(0,Z.jsx)(it,{children:l()})]}),(0,Z.jsx)(Zt,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.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,Z.jsx)(A,{"aria-hidden":!0}):(0,Z.jsx)(F,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?d():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,h()]}):null}function Zt({instance:e,onClose:t}){let n=xe(T.admin.upsertInstanceConfig),r=je(T.bridge.validateMediaPaths),o=mt(),[s,c]=(0,G.useState)(()=>Qe(e.config??{})),[l,u]=(0,G.useState)(!1),[d,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=s.inboundMediaMode===`shared-fs`,v=s.mediaMode===`shared-fs`,y=_||v;async function b(){m(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){o.error(Ye(),e)}finally{m(!1)}}async function x(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:et(s,r)}),t()}catch(e){o.error(qe(),e)}finally{u(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:He(),help:Be()}),(0,Z.jsxs)(L,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(k,{})}),(0,Z.jsx)(N,{children:tt.map(e=>(0,Z.jsx)(I,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:a(),help:le()}),(0,Z.jsxs)(L,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(k,{})}),(0,Z.jsx)(N,{children:$e.map(e=>(0,Z.jsx)(I,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:ae(),help:ke()}),(0,Z.jsx)(j,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>c({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:f(),help:ce()}),(0,Z.jsx)(j,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:oe(),help:p()}),(0,Z.jsx)(j,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>c({...s,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(at,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Z.jsx)(D,{label:We(),help:Pe()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(F,{"aria-hidden":!0}),ne({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:te(),result:h.inbound}),(0,Z.jsx)($,{label:ee(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ie()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(F,{"aria-hidden":!0}),re()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(O,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:d,children:[d?(0,Z.jsx)(lt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?i():se()]}),(0,Z.jsx)(O,{size:`sm`,onClick:()=>void x(),disabled:l,children:de()})]})]})})}function Qt({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(dt,{children:[(0,Z.jsx)(ft,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?_e():me({count:e.length}),(0,Z.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(ut,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:Le()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(P,{variant:`secondary`,children:e},e))})]})]})}export{Kt as BridgeTab,Xt as InstanceConfigDialog};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,C as i,Cc as a,D as o,E as s,Gt as c,IC as l,M as ee,N as te,O as ne,Rt as re,S as ie,T as ae,Ut as u,gw as d,j as oe,k as f,kv as p,lt as m,lw as h,pw as g,w as se,x as ce,zt as le}from"./dist-CgXYe09h.js";import{t as _}from"./button-G-_IqZDp.js";import{B as ue,C as de,G as fe,H as pe,K as me,S as he,U as v,V as y,W as b,_ as x,b as S,g as C,j as w,mt as T,q as E,v as D,x as O,y as k}from"./index-BmXiVWTf.js";import{i as A}from"./compatView-hfeNAe7g.js";/* empty css */var j=t(e(),1),M=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function N(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 P=n();function F(){let e=g(h.agentFiles.getChatDefaults),t=g(h.agentFiles.setChatDefaults),n=w(),[F,I]=(0,j.useState)({status:`loading`}),[L,R]=(0,j.useState)({thinkingDefault:null,fastModeDefault:null}),[ge,z]=(0,j.useState)(!1),[B,V]=(0,j.useState)(!1),H=d(h.admin.listInstances,{}),[U,W]=(0,j.useState)(null);(0,j.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,_e=H!==void 0&&H.length===0,ve=d(h.compat.forInstance,U?{instanceName:U}:`skip`),K=U?x(ve,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,j.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,j.useRef)(0),X=(0,j.useCallback)(async()=>{let t=++Y.current;I({status:`loading`});try{let n=N(await e(J));if(Y.current!==t)return;I({status:`done`,current:n}),R(n)}catch{if(Y.current!==t)return;I({status:`error`})}},[e,J]);(0,j.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=F.status===`done`?F.current:null,Q=Z!==null&&L.thinkingDefault!==null&&L.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&L.fastModeDefault!==null&&L.fastModeDefault!==Z.fastModeDefault,ye=Q||$;async function be(){V(!0);try{await t({...J,...Q?{thinkingDefault:L.thinkingDefault}:{},...$?{fastModeDefault:L.fastModeDefault}:{}}),n.success(s()),await X()}catch(e){n.error(ae(),e)}finally{V(!1)}}let xe=(0,j.useMemo)(()=>M.map(e=>({id:e,label:D(e)})),[]),Se=(0,j.useMemo)(()=>[{id:`fast`,label:le()},{id:`standard`,label:re()}],[]);return(0,P.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),G&&U?(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,P.jsxs)(k,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,P.jsx)(he,{size:`sm`,"aria-label":m(),children:(0,P.jsx)(de,{})}),(0,P.jsx)(S,{children:(H??[]).map(e=>(0,P.jsx)(O,{value:e.name,children:e.name},e.name))})]})]}):null,_e?(0,P.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):K===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):K.blocked?(0,P.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,P.jsx)(T,{size:14,"aria-hidden":!0}),` `,A(K.gatewayVersion)]}):F.status===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):F.status===`error`?(0,P.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ne(),` `,(0,P.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:u()})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:ee()}),(0,P.jsx)(C,{options:xe,value:L.thinkingDefault,onChange:e=>R({...L,thinkingDefault:e}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:oe()})]}),(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,P.jsx)(C,{options:Se,value:L.fastModeDefault===null?null:L.fastModeDefault?`fast`:`standard`,onChange:e=>R({...L,fastModeDefault:e===`fast`}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:f()})]}),(0,P.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,P.jsx)(_,{size:`sm`,disabled:!ye||B,onClick:()=>z(!0),children:B?c():o()})}),(0,P.jsx)(`p`,{className:`oc-cdefaults__note`,children:se()})]}),(0,P.jsx)(ue,{open:ge,onOpenChange:z,children:(0,P.jsxs)(v,{children:[(0,P.jsxs)(me,{children:[(0,P.jsx)(E,{children:i()}),(0,P.jsx)(b,{children:ie()})]}),(0,P.jsxs)(fe,{children:[(0,P.jsx)(pe,{children:p()}),(0,P.jsx)(y,{onClick:()=>void be(),children:ce()})]})]})})]})}export{F as ChatDefaultsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,Av as i,C as a,D as o,E as s,Gt as c,LC as l,M as ee,N as te,O as ne,Rt as re,S as ie,T as ae,Tc as u,Ut as d,_w as f,j as p,k as oe,lt as m,mw as h,uw as g,w as _,x as se,zt as ce}from"./dist-ws-D-Lv-.js";import{t as v}from"./button-DuXPa4Vl.js";import{B as le,C as ue,G as de,H as fe,K as pe,S as me,U as he,V as y,W as b,_ as x,b as S,g as C,j as w,mt as T,q as E,v as D,x as O,y as k}from"./index-Bp-uQn4K.js";import{i as A}from"./compatView-6XUIK3Ob.js";/* empty css */var j=t(e(),1),M=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function N(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 P=n();function F(){let e=h(g.agentFiles.getChatDefaults),t=h(g.agentFiles.setChatDefaults),n=w(),[F,I]=(0,j.useState)({status:`loading`}),[L,R]=(0,j.useState)({thinkingDefault:null,fastModeDefault:null}),[ge,z]=(0,j.useState)(!1),[B,V]=(0,j.useState)(!1),H=f(g.admin.listInstances,{}),[U,W]=(0,j.useState)(null);(0,j.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,_e=H!==void 0&&H.length===0,ve=f(g.compat.forInstance,U?{instanceName:U}:`skip`),K=U?x(ve,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,j.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,j.useRef)(0),X=(0,j.useCallback)(async()=>{let t=++Y.current;I({status:`loading`});try{let n=N(await e(J));if(Y.current!==t)return;I({status:`done`,current:n}),R(n)}catch{if(Y.current!==t)return;I({status:`error`})}},[e,J]);(0,j.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=F.status===`done`?F.current:null,Q=Z!==null&&L.thinkingDefault!==null&&L.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&L.fastModeDefault!==null&&L.fastModeDefault!==Z.fastModeDefault,ye=Q||$;async function be(){V(!0);try{await t({...J,...Q?{thinkingDefault:L.thinkingDefault}:{},...$?{fastModeDefault:L.fastModeDefault}:{}}),n.success(s()),await X()}catch(e){n.error(ae(),e)}finally{V(!1)}}let xe=(0,j.useMemo)(()=>M.map(e=>({id:e,label:D(e)})),[]),Se=(0,j.useMemo)(()=>[{id:`fast`,label:ce()},{id:`standard`,label:re()}],[]);return(0,P.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),G&&U?(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,P.jsxs)(k,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,P.jsx)(me,{size:`sm`,"aria-label":m(),children:(0,P.jsx)(ue,{})}),(0,P.jsx)(S,{children:(H??[]).map(e=>(0,P.jsx)(O,{value:e.name,children:e.name},e.name))})]})]}):null,_e?(0,P.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):K===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):K.blocked?(0,P.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,P.jsx)(T,{size:14,"aria-hidden":!0}),` `,A(K.gatewayVersion)]}):F.status===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):F.status===`error`?(0,P.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ne(),` `,(0,P.jsx)(v,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:d()})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:ee()}),(0,P.jsx)(C,{options:xe,value:L.thinkingDefault,onChange:e=>R({...L,thinkingDefault:e}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:p()})]}),(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,P.jsx)(C,{options:Se,value:L.fastModeDefault===null?null:L.fastModeDefault?`fast`:`standard`,onChange:e=>R({...L,fastModeDefault:e===`fast`}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:oe()})]}),(0,P.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,P.jsx)(v,{size:`sm`,disabled:!ye||B,onClick:()=>z(!0),children:B?c():o()})}),(0,P.jsx)(`p`,{className:`oc-cdefaults__note`,children:_()})]}),(0,P.jsx)(le,{open:ge,onOpenChange:z,children:(0,P.jsxs)(he,{children:[(0,P.jsxs)(pe,{children:[(0,P.jsx)(E,{children:a()}),(0,P.jsx)(b,{children:ie()})]}),(0,P.jsxs)(de,{children:[(0,P.jsx)(fe,{children:i()}),(0,P.jsx)(y,{onClick:()=>void be(),children:se()})]})]})})]})}export{F as ChatDefaultsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gi as r,Ji as i,Ki as a,Wi as o,Xi as s,Yi as c,qi as l}from"./dist-CgXYe09h.js";import{i as u,r as d}from"./dist-BDPwn3r0.js";import{t as f}from"./chevrons-up-down-BlHpdE9v.js";import{t as p}from"./button-G-_IqZDp.js";import{$ as m,Ct as h,O as g,Q as _,bt as v,et as y,ht as b,nt as x,rt as S}from"./index-BmXiVWTf.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-xKqB5hyP.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=s(),bulkActions:F,emptyHint:I=c(),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)(b,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(v,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(g,{"aria-label":l(),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":o({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],i=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(g,{"aria-label":a(),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)(_,{children:[(0,M.jsx)(S,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":r(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(h,{})})}),(0,M.jsx)(m,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(x,{}):null,(0,M.jsx)(y,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),i&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gi as r,Ji as i,Ki as a,Wi as o,Xi as s,Yi as c,qi as l}from"./dist-ws-D-Lv-.js";import{i as u,r as d}from"./dist-ZW9rNZ8M.js";import{t as f}from"./chevrons-up-down-DGeJvEkD.js";import{t as p}from"./button-DuXPa4Vl.js";import{$ as m,Ct as h,O as g,Q as _,bt as v,et as y,ht as b,nt as x,rt as S}from"./index-Bp-uQn4K.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CoglL6L8.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=s(),bulkActions:F,emptyHint:I=c(),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)(b,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(v,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(g,{"aria-label":l(),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":o({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],i=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(g,{"aria-label":a(),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)(_,{children:[(0,M.jsx)(S,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":r(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(h,{})})}),(0,M.jsx)(m,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(x,{}):null,(0,M.jsx)(y,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),i&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{m as t}from"./index-BmXiVWTf.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{m as t}from"./index-Bp-uQn4K.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{$m as r,Ah as i,Bm as a,Ch as o,Dh as s,Eh as c,Fm as l,Gm as u,Hm as d,Im as f,Jm as p,Km as m,Lm as ee,Mh as h,Nh as g,Nm as te,Oh as _,Ph as ne,Pm as re,Qm as ie,Rm as ae,Sh as v,Th as y,Um as b,Vm as x,Wm as S,Xm as C,Ym as w,Zm as T,_h as E,_w as D,ah as O,bh as k,ch as A,dh as j,eh as M,fh as N,gh as P,gw as F,hh as I,ih as L,jh as R,kh as z,lh as B,mh as V,nh as oe,oh as H,ph as U,qm as W,rh as G,sh as K,th as q,uh as se,uw as J,vh as ce,wh as le,xh as ue,yh as de,zm as fe}from"./dist-ws-D-Lv-.js";import{t as pe}from"./button-DuXPa4Vl.js";import{M as me}from"./index-Bp-uQn4K.js";import{t as he}from"./DataTableShell-B_P8ehdH.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>ne(),incorrect:()=>g(),incoherence:()=>h(),formatting:()=>R(),latency:()=>i(),api_error:()=>z(),other:()=>_()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:c()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:y()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:s()})}function ge({data:e,closeReason:t}){let n=e.snapshot,r=F(J.feedback.respondToFeedback),[i,a]=(0,Y.useState)(e.thread),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1);async function d(){let t=s.trim();if(!(!t||l)){u(!0);try{await r({feedbackId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),c(``)}finally{u(!1)}}}let f=[];try{f=n.contextJson?JSON.parse(n.contextJson):[]}catch{f=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${le()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:o()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:v()}),i.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,X.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?ue():k()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:de()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:ce(),value:s,maxLength:2e3,rows:3,onChange:e=>c(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(pe,{size:`sm`,onClick:()=>void d(),disabled:!s.trim()||l,children:l?E():P()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||V()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||V()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,f.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j({count:n.contextCount??f.length,truncated:n.contextTruncated?se():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:f.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:B()}),(0,X.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?H({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[O(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,L()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=D(J.feedback.listForAdmin,{}),t=F(J.feedback.readSnapshot),n=F(J.feedback.deleteFeedback),i=me(),[o,s]=(0,Y.useState)(null),[c,h]=(0,Y.useState)({});async function g(e){if(o===e._id){s(null);return}if(!c[e._id]){let n=await t({feedbackId:e._id});h(t=>({...t,[e._id]:n}))}s(e._id)}async function _(e){await i({title:l(),description:re(),confirmLabel:te(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&s(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[G(),` `,(0,X.jsx)(`strong`,{children:oe()}),` `,q()]}),(0,X.jsx)(he,{title:M(),rows:e,emptyHint:r(),isExpanded:e=>o===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,X.jsx)(ge,{data:c[e._id],closeReason:e.userCloseReason}):null,columns:[{header:ie(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:T(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:C(),cell:e=>e.messageRole===`user`?w():p(),sort:e=>e.messageRole},{header:W(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${m({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:u(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:S(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:b(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:d()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:x()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:a()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:o===e._id?ae():ee(),onSelect:()=>void g(e)},{label:f(),onSelect:()=>void _(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
@@ -0,0 +1,4 @@
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{dw as t,ww as n}from"./dist-ws-D-Lv-.js";import{c as r,l as i,s as a,u as o}from"./index-Bp-uQn4K.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:`[LIVRAISON]
2
+ Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
3
+ {references}`,disabledTemplate:`{references}`},inbound_files:{key:`inbound_files`,appliedIn:`bridge`,togglable:!0,placeholders:[`files`],defaultTemplate:`[FICHIERS REÇUS]
4
+ {files}`}},l=Object.keys(c);function u(e,t){return t.enabled?t.template:c[e].disabledTemplate??``}function d(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:r})}var f=[`gateway-http`,`shared-fs`,`off`],p=[`inline`,`shared-fs`],m=[`reactive`,`sse`],h=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var g={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function _(e){let t={};for(let n of l){let r=e?.[n];t[n]={enabled:r?.enabled??!0,template:typeof r?.template==`string`&&r.template.length>0?r.template:c[n].defaultTemplate}}return t}function v(e){let t={};for(let n of l){let r=c[n],i=e[n];if(!i)continue;let a={};r.togglable&&i.enabled===!1&&(a.enabled=!1);let o=i.template.trim();o.length>0&&o!==r.defaultTemplate&&(a.template=o),(a.enabled!==void 0||a.template!==void 0)&&(t[n]=a)}return t}function y(e){return{mediaMode:e.mediaMode??g.mediaMode,inboundMediaMode:e.inboundMediaMode??g.inboundMediaMode,rehydration:e.rehydration??g.rehydration,mediaMaxMb:e.mediaMaxMb??g.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??g.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??g.outboundAgentMount,promptInjections:_(e.promptInjections)}}function b(e,t){let n={},r=r=>{(e[r]!==g[r]||t[r]!==void 0)&&(n[r]=e[r])};r(`mediaMode`),r(`inboundMediaMode`),r(`rehydration`),r(`mediaMaxMb`),r(`inboundAgentMount`),r(`outboundAgentMount`);let i=v(e.promptInjections);return Object.keys(i).length>0&&(n.promptInjections=i),n}var x=e();function S({text:e}){return(0,x.jsx)(i,{delayDuration:150,children:(0,x.jsxs)(a,{children:[(0,x.jsx)(o,{asChild:!0,children:(0,x.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,x.jsx)(s,{"aria-hidden":!0})})}),(0,x.jsx)(r,{className:`max-w-xs text-pretty`,children:e})]})})}function C({label:e,help:t}){return(0,x.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,x.jsx)(S,{text:t})]})}export{h as a,m as c,u as d,d as f,y as i,c as l,C as n,p as o,b as r,f as s,S as t,l as u};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,Av as ee,BS as i,FS as te,GS as ne,HS as a,IS as re,JS as ie,KS as o,LC as s,LS as c,PS as l,QS as u,RS as d,US as f,VS as ae,WS as oe,XS as se,YS as ce,ZS as le,_w as ue,aC as de,cC as fe,dC as p,eC as m,fC as h,gw as pe,hC as me,iC as g,lC as he,mC as ge,nC as _,oC as _e,pC as ve,qS as v,rC as y,sC as b,tC as x,uC as S,uw as C,zC as w,zS as T}from"./dist-ws-D-Lv-.js";import{t as E}from"./button-DuXPa4Vl.js";import{$ as D,B as O,C as k,Ct as A,G as j,H as M,K as N,Q as P,S as F,U as ye,V as be,W as xe,b as I,et as L,ht as Se,j as Ce,m as we,q as Te,rt as Ee,wt as R,x as z,y as B,yt as De}from"./index-Bp-uQn4K.js";import{a as Oe,i as V,n as ke,o as H,r as U,t as Ae}from"./table-CoglL6L8.js";var W=t(e(),1),G=n(),K=`all`;function q(e){switch(e){case`image`:return g();case`audio`:return y();case`video`:return _();case`pdf`:return x();case`document`:return m();case`archive`:return r();default:return u()}}function J(){let[e,t]=(0,W.useState)(K),[n,r]=(0,W.useState)(K),[u,m]=(0,W.useState)(K),[g,_]=(0,W.useState)(K),[y,x]=(0,W.useState)(null),J=pe(C.files.softDelete),Y=Ce();function je(){t(K),r(K),m(K),_(K)}async function Me(){let e=y;if(x(null),e)try{await J({fileId:e.id}),Y.success(ae())}catch(e){Y.error(i(),e)}}let X=ue(C.files.listMine,{direction:e===K?void 0:e,chatId:n===K?void 0:n,instanceName:u===K?void 0:u,category:g===K?void 0:g}),Ne=(0,W.useMemo)(()=>new Intl.DateTimeFormat(w(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:s()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=X,$=e!==K||n!==K||u!==K||g!==K;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:me()}),(0,G.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,G.jsxs)(B,{value:e,onValueChange:t,children:[(0,G.jsx)(F,{size:`sm`,"aria-label":ge(),children:(0,G.jsx)(k,{})}),(0,G.jsxs)(I,{children:[(0,G.jsx)(z,{value:K,children:ve()}),(0,G.jsx)(z,{value:`inbound`,children:h()}),(0,G.jsx)(z,{value:`outbound`,children:p()})]})]}),(0,G.jsxs)(B,{value:n,onValueChange:r,children:[(0,G.jsx)(F,{size:`sm`,"aria-label":S(),children:(0,G.jsx)(k,{})}),(0,G.jsxs)(I,{children:[(0,G.jsx)(z,{value:K,children:he()}),Q.chats.map(e=>(0,G.jsx)(z,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,G.jsxs)(B,{value:u,onValueChange:m,children:[(0,G.jsx)(F,{size:`sm`,"aria-label":fe(),children:(0,G.jsx)(k,{})}),(0,G.jsxs)(I,{children:[(0,G.jsx)(z,{value:K,children:b()}),Q.instances.map(e=>(0,G.jsx)(z,{value:e,children:e},e))]})]}):null,(0,G.jsxs)(B,{value:g,onValueChange:_,children:[(0,G.jsx)(F,{size:`sm`,"aria-label":_e(),children:(0,G.jsx)(k,{})}),(0,G.jsxs)(I,{children:[(0,G.jsx)(z,{value:K,children:de()}),Q.categories.map(e=>(0,G.jsx)(z,{value:e,children:q(e)},e))]})]}),$?(0,G.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:je,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,G.jsx)(De,{size:14,"aria-hidden":!0}),oe()]}):null]}),Z.length===0?(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:$?te():re()}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Ae,{children:[(0,G.jsx)(Oe,{children:(0,G.jsxs)(H,{children:[(0,G.jsx)(V,{children:le()}),(0,G.jsx)(V,{children:se()}),(0,G.jsx)(V,{children:ce()}),(0,G.jsx)(V,{children:ie()}),(0,G.jsx)(V,{children:v()}),(0,G.jsx)(V,{className:`text-right`,children:o()})]})}),(0,G.jsx)(ke,{children:Z.map(e=>(0,G.jsxs)(H,{children:[(0,G.jsx)(U,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,G.jsx)(U,{title:e.mimeType,children:q(e.category)}),(0,G.jsx)(U,{children:(0,G.jsx)(we,{variant:`secondary`,children:e.direction===`inbound`?h():p()})}),(0,G.jsx)(U,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,G.jsx)(U,{className:`whitespace-nowrap text-muted-foreground`,children:Ne.format(e.createdAt)}),(0,G.jsx)(U,{className:`text-right`,children:(0,G.jsxs)(P,{children:[(0,G.jsx)(Ee,{asChild:!0,children:(0,G.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":f(),children:(0,G.jsx)(A,{size:16})})}),(0,G.jsxs)(D,{align:`end`,children:[e.url?(0,G.jsx)(L,{asChild:!0,children:(0,G.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,G.jsx)(R,{size:14}),ne()]})}):(0,G.jsxs)(L,{disabled:!0,children:[(0,G.jsx)(R,{size:14}),c()]}),(0,G.jsxs)(L,{variant:`destructive`,onSelect:()=>x({id:e._id,filename:e.filename}),children:[(0,G.jsx)(Se,{size:14}),a()]})]})]})})]},e._id))})]}),Pe?(0,G.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:l({cap:Fe})}):null]}),(0,G.jsx)(O,{open:y!==null,onOpenChange:e=>!e&&x(null),children:(0,G.jsxs)(ye,{children:[(0,G.jsxs)(N,{children:[(0,G.jsx)(Te,{children:T()}),(0,G.jsx)(xe,{children:d()})]}),(0,G.jsxs)(j,{children:[(0,G.jsx)(M,{children:ee()}),(0,G.jsx)(be,{onClick:()=>void Me(),children:a()})]})]})})]})}export{J as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Qi as r,Zi as i}from"./dist-CgXYe09h.js";import{t as a}from"./TimeRangePicker-CXb27Tev.js";import{t as o}from"./button-G-_IqZDp.js";import{J as s,vt as c,yt as l}from"./index-BmXiVWTf.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),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)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{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)(a,{value:m,onChange:h}):null,(0,d.jsxs)(o,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(l,{}),i()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Qi as r,Zi as i}from"./dist-ws-D-Lv-.js";import{t as a}from"./TimeRangePicker-BDN2rIcO.js";import{t as o}from"./button-DuXPa4Vl.js";import{J as s,vt as c,yt as l}from"./index-Bp-uQn4K.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),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)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{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)(a,{value:m,onChange:h}):null,(0,d.jsxs)(o,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(l,{}),i()]})]})}export{p as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,$n as i,An as a,Bn as o,Cn as s,Dn as c,En as l,Fn as u,Gn as d,Hn as f,In as p,JC as m,Jn as h,Kn as g,Ln as _,Mn as v,Nn as y,On as b,Pn as x,Qn as ee,Rn as te,Sn as S,Tn as ne,Un as re,Vn as ie,Wn as ae,XC as oe,Xn as C,YC as w,Yn as se,Zn as T,_n as E,_w as D,an as ce,ar as le,bn as O,cn as ue,cr as k,dn as de,dr as fe,dw as A,er as j,fn as pe,fr as M,gn as me,gw as N,hn as he,in as ge,ir as _e,jn as ve,kn as ye,ln as be,lr as xe,mn as Se,n as P,nr as Ce,nw as F,on as we,or as Te,pn as Ee,qn as De,rn as Oe,rr as ke,rw as I,sn as L,sr as Ae,t as je,tr as Me,un as Ne,ur as Pe,uw as R,vn as Fe,wn as Ie,xn as Le,yn as Re,zn as ze}from"./dist-ws-D-Lv-.js";import{t as Be}from"./dist-ZW9rNZ8M.js";import{t as Ve}from"./x-D96nOW2m.js";import{t as z}from"./button-DuXPa4Vl.js";import{C as He,Dt as Ue,F as We,I as Ge,J as B,M as Ke,O as V,P as qe,R as Je,S as Ye,_t as H,b as Xe,dt as Ze,ft as Qe,gt as U,h as $e,j as W,m as G,ot as et,pt as tt,x as nt,y as rt,z as it}from"./index-Bp-uQn4K.js";import{t as at}from"./FilterBar-BmFEn3qs.js";import{t as ot}from"./DataTableShell-B_P8ehdH.js";import{t as K}from"./DetailChips-DccwdoeS.js";var st=A(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ct=A(`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`}]]),q=A(`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`}]]),lt=A(`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`}]]),J=t(e(),1),Y=n(),X=`Tabs`,[ut,dt]=r(X,[tt]),ft=tt(),[pt,Z]=ut(X),mt=J.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Be(s),[d,f]=oe({prop:r,onChange:i,defaultProp:a??``,caller:X});return(0,Y.jsx)(pt,{scope:n,baseId:m(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,Y.jsx)(I.div,{dir:u,"data-orientation":o,...l,ref:t})})});mt.displayName=X;var ht=`TabsList`,gt=J.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Z(ht,n),o=ft(n);return(0,Y.jsx)(Qe,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,Y.jsx)(I.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});gt.displayName=ht;var _t=`TabsTrigger`,vt=J.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Z(_t,n),s=ft(n),c=xt(o.baseId,r),l=St(o.baseId,r),u=r===o.value;return(0,Y.jsx)(Ze,{asChild:!0,...s,focusable:!i,active:u,children:(0,Y.jsx)(I.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:F(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:F(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:F(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});vt.displayName=_t;var yt=`TabsContent`,bt=J.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Z(yt,n),c=xt(s.baseId,r),l=St(s.baseId,r),u=r===s.value,d=J.useRef(u);return J.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,Y.jsx)(w,{present:i||u,children:({present:n})=>(0,Y.jsx)(I.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});bt.displayName=yt;function xt(e,t){return`${e}-trigger-${t}`}function St(e,t){return`${e}-content-${t}`}var Ct=mt,wt=gt,Tt=vt,Et=bt;function Dt(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 Ot(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 kt(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 At(e){switch(e){case`admin`:return y();case`user`:return v();case`pending`:return ve();default:return e}}function jt(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 Mt(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}}function Nt({className:e,orientation:t=`horizontal`,...n}){return(0,Y.jsx)(Ct,{"data-slot":`tabs`,"data-orientation":t,className:P(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Pt=je(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Ft({className:e,variant:t=`default`,...n}){return(0,Y.jsx)(wt,{"data-slot":`tabs-list`,"data-variant":t,className:P(Pt({variant:t}),e),...n})}function Q({className:e,...t}){return(0,Y.jsx)(Tt,{"data-slot":`tabs-trigger`,className:P(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function $({className:e,...t}){return(0,Y.jsx)(Et,{"data-slot":`tabs-content`,className:P(`flex-1 text-sm outline-none`,e),...t})}var It={name:``,description:``};function Lt(){let e=D(R.groups.listGroups,{}),t=D(R.me.getMe,{host:et})?.role===`admin`,n=N(R.groups.createGroup),r=N(R.groups.updateGroup),a=N(R.groups.deleteGroup),o=Ke(),s=W(),[c,l]=(0,J.useState)(!1),[u,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(It),[_,v]=(0,J.useState)(null),[y,b]=(0,J.useState)(``),x=(0,J.useMemo)(()=>{if(!e)return e;let t=y.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,y]);function te(){f(null),m(It),l(!0)}function S(e){f(e),m({name:e.name,description:e.description??``}),l(!0)}async function ne(){try{u?await r({groupId:u._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),m(It),f(null),l(!1)}catch(e){s.error(we(),e)}}async function re(e){if(await o({title:De({name:e.name}),description:g(),confirmWord:e.name,confirmLabel:d(),cancelLabel:i(),destructive:!0}))try{await a({groupId:e._id})}catch(e){s.error(ce(),e)}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}),(0,Y.jsx)(at,{q:y,onQChange:b,onReset:()=>b(``),canReset:y!==``,searchPlaceholder:_e()}),(0,Y.jsx)(ot,{title:M(),rows:x,addLabel:Pe(),onAdd:t?te:void 0,emptyHint:xe(),columns:[{header:k(),cell:e=>e.name,sort:e=>e.name},{header:Ae(),cell:e=>(0,Y.jsx)(K,{icon:(0,Y.jsx)(lt,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Y.jsx)(q,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:Te(),cell:e=>(0,Y.jsx)(K,{icon:(0,Y.jsx)(H,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:le(),cell:e=>(0,Y.jsx)(K,{icon:(0,Y.jsx)(ct,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Y.jsx)(U,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:ke(),onSelect:()=>v({groupId:e._id,name:e.name})},...t?[{label:Ce(),onSelect:()=>S(e)},{label:Me(),variant:`destructive`,onSelect:()=>void re(e)}]:[]]}),(0,Y.jsx)($e,{open:c,onOpenChange:l,title:u?T():ee(),description:C(),canSubmit:!!p.name.trim(),onSubmit:ne,submitLabel:j(),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:se()}),(0,Y.jsx)(B,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:h()}),(0,Y.jsx)(B,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})}),(0,Y.jsx)(Bt,{groupId:_?.groupId??null,groupName:_?.name??``,open:_!==null,onOpenChange:e=>{e||v(null)}})]})}var Rt=8;function zt({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Y.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Y.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Y.jsx)(st,{size:14,"aria-hidden":!0}),p()]}),(0,Y.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":x({page:e,pages:t}),children:[e,` / `,t]}),(0,Y.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[u(),(0,Y.jsx)(Ue,{size:14,"aria-hidden":!0})]})]})}function Bt({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=D(R.groups.getGroup,n&&e?{groupId:e}:`skip`),s=D(R.groups.listAssignableInstances,n?{}:`skip`),c=D(R.groups.listAssignableUsers,n?{}:`skip`),u=N(R.groups.addMember),d=N(R.groups.removeMember),p=N(R.groups.bulkSetMembers),m=N(R.groups.setGroupManager),h=W(),[g,v]=(0,J.useState)(``),[y,x]=(0,J.useState)(``),[ee,S]=(0,J.useState)(`members`),[oe,C]=(0,J.useState)(1),[w,se]=(0,J.useState)(new Set),T=(0,J.useRef)(null),E=(0,J.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),ce=(0,J.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),le=i?.viewerIsAdmin===!0,O=(0,J.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,J.useEffect)(()=>{v(``),x(``),S(`members`),C(1),T.current=null},[n,e]),(0,J.useEffect)(()=>{C(1)},[g]),(0,J.useEffect)(()=>{n&&i&&e&&T.current!==e&&(T.current=e,se(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let k=(0,J.useMemo)(()=>c?Dt(c,g,w):[],[c,g,w]);async function fe(t,n){if(e)try{n?await d({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){h.error(ge(),e)}}async function A(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){h.error(ue(),e)}}let j=jt(k,e=>E.has(e.userId)),pe=k.filter(e=>E.has(e.userId)).length,M=Mt(k,oe,Rt);async function me(){if(!e||k.length===0)return;let t=k.map(e=>e.userId);try{await p({groupId:e,userIds:t,member:j!==`all`})}catch(e){h.error(ge(),e)}}return(0,Y.jsx)(qe,{open:n,onOpenChange:r,children:(0,Y.jsxs)(We,{className:`oc-access`,children:[(0,Y.jsxs)(Je,{children:[(0,Y.jsx)(it,{children:ae({name:t})}),(0,Y.jsx)(Ge,{children:re()})]}),(0,Y.jsxs)(Nt,{value:ee,onValueChange:S,className:`oc-access__tabs`,children:[(0,Y.jsxs)(Ft,{className:`w-full`,children:[(0,Y.jsxs)(Q,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(lt,{size:13,"aria-hidden":!0}),f(),i?(0,Y.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:E.size}):null]}),(0,Y.jsxs)(Q,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(H,{size:13,"aria-hidden":!0}),o(),i?(0,Y.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,Y.jsxs)(Q,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(ct,{size:13,"aria-hidden":!0}),Re(),i?(0,Y.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Y.jsx)($,{value:`members`,children:c===void 0||i===void 0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:b()}):c.length===0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:l()}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(B,{value:g,onChange:e=>v(e.target.value),placeholder:ie(),className:`oc-access__search`}),k.length===0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:te()}):(0,Y.jsxs)(Y.Fragment,{children:[k.length>1?(0,Y.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Y.jsx)(V,{checked:j===`all`?!0:j===`some`?`indeterminate`:!1,onCheckedChange:()=>void me(),"aria-label":_()}),(0,Y.jsx)(`span`,{className:`oc-access__label`,children:_()}),(0,Y.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[pe,` / `,k.length]})]}):null,(0,Y.jsx)(`div`,{className:`oc-access__list`,children:M.pageItems.map(e=>{let t=E.has(e.userId),n=kt(e),r=ce.has(e.userId);return(0,Y.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Y.jsx)(V,{checked:t,onCheckedChange:()=>void fe(e.userId,t),"aria-label":a({user:n.primary})}),(0,Y.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Y.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Y.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Y.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:At(e.role)}),(0,Y.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&le?(0,Y.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?be():Ne(),title:r?be():Ne(),onClick:()=>void A(e.userId,r),children:(0,Y.jsx)(q,{size:15,"aria-hidden":!0})}):t&&r?(0,Y.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":de(),title:de(),children:(0,Y.jsx)(q,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Y.jsx)(zt,{page:M.page,pageCount:M.pageCount,onPage:C})]})]})}),(0,Y.jsx)($,{value:`agents`,children:s===void 0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:b()}):s.length===0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:ne()}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(B,{value:y,onChange:e=>x(e.target.value),placeholder:ze(),className:`oc-access__search`}),(0,Y.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Y.jsx)(Vt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:O,query:y},`${e}-${t._id}`))})]})}),(0,Y.jsx)($,{value:`charts`,children:(0,Y.jsx)(Ht,{groupId:e})})]})]})})}function Vt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=D(R.groups.listAssignableAgents,{instanceName:t}),o=N(R.groups.assignAgentToGroup),l=N(R.groups.removeAgentFromGroup),u=N(R.groups.bulkSetGroupAgents),d=W(),[f,p]=(0,J.useState)(1);if((0,J.useEffect)(()=>{p(1)},[i]),!e)return null;let m=Ot(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1),v=jt(g,e=>r.has(`${t}/${e.agentId}`)),y=Mt(m,f,Rt);async function b(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(Oe(),e)}}async function x(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){d.error(Oe(),e)}}return(0,Y.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Y.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Y.jsx)(H,{size:13,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:t}),(0,Y.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,Y.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:S()}):null]}),a===void 0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:c()}):m.length===0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:h?s():Ie()}):(0,Y.jsxs)(Y.Fragment,{children:[g.length>1?(0,Y.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Y.jsx)(V,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":_()}),(0,Y.jsx)(`span`,{className:`oc-access__label`,children:_()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,Y.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Y.jsx)(V,{checked:i,disabled:a&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":ye({name:e.displayName??e.agentId})}),(0,Y.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Y.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Y.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":O(),title:O(),children:(0,Y.jsx)(U,{size:14,fill:`currentColor`})}):null,a?(0,Y.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Le()}):null]},e.agentId)}),(0,Y.jsx)(zt,{page:y.page,pageCount:y.pageCount,onPage:p})]})]})}function Ht({groupId:e}){let t=D(R.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=N(R.charts.assignChartToGroup),r=N(R.charts.removeChartFromGroup),i=N(R.charts.setGroupDefaultChart),a=N(R.charts.addChartToGroupPool),o=N(R.charts.removeChartFromGroupPool),s=W();if(!e)return null;if(t===void 0)return(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:b()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:Fe()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(L(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(L(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(L(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(L(),e)}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,Y.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Y.jsx)(V,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":Se({name:e.name})}),(0,Y.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Y.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":Ee(),title:Ee(),children:(0,Y.jsx)(U,{size:14,fill:`currentColor`})}):(0,Y.jsx)(z,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:pe()}):null,u?(0,Y.jsx)(z,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":he({name:e.name}),title:he({name:e.name}),onClick:()=>void m(e.chartKey),children:(0,Y.jsx)(Ve,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,Y.jsxs)(rt,{value:``,onValueChange:e=>void p(e),children:[(0,Y.jsx)(Ye,{size:`sm`,className:`oc-access__search`,children:(0,Y.jsx)(He,{placeholder:me()})}),(0,Y.jsx)(Xe,{children:l.map(e=>(0,Y.jsx)(nt,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:E()}):null:null]})}export{Lt as GroupsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,$p as i,Af as a,Ap as o,Bf as s,Bp as c,Cf as l,Cp as u,Df as d,Dp as f,Ef as p,Ep as m,Ff as h,Fp as g,Gf as _,Gp as v,Hf as y,Hp as ee,If as b,Ip as x,Jf as S,Jp as te,Kf as C,Kp as ne,Lf as re,Lp as ie,Mf as ae,Mp as oe,Nf as se,Np as ce,Of as le,Op as ue,Pf as de,Pp as fe,Qf as pe,Qp as me,Rf as he,Rp as ge,Sf as _e,Sp as w,Tf as ve,Tp as ye,Uf as T,Up as be,Vf as xe,Vp as Se,Wf as Ce,Wp as we,Xf as Te,Xp as Ee,Yf as De,Yp as Oe,Zf as ke,Zp as Ae,_p as je,_w as E,_y as D,am as Me,ap as Ne,bf as O,bp as Pe,cp as Fe,dp as k,em as Ie,ep as Le,fp as Re,gc as ze,gp as Be,gw as A,hc as Ve,hp as j,im as He,ip as Ue,jf as We,jp as Ge,kf as Ke,kp as qe,lp as Je,mp as Ye,mw as M,nm as Xe,np as Ze,op as Qe,pp as $e,qf as et,qp as tt,rm as nt,rp as rt,sp as it,tm as at,tp as ot,up as st,uw as N,vp as ct,vy as P,wf as lt,wp as ut,xf as dt,xp as ft,yf as pt,yp as mt,zf as ht,zp as gt}from"./dist-ws-D-Lv-.js";import{a as _t,c as vt}from"./FieldLabel-CtF9VFJv.js";import{t as F}from"./button-DuXPa4Vl.js";import{C as yt,F as I,I as L,J as R,M as bt,O as z,P as B,R as V,S as H,X as xt,Y as St,Z as Ct,b as U,h as wt,j as W,m as G,x as K,y as q,z as J}from"./index-Bp-uQn4K.js";import{t as Tt}from"./DataTableShell-B_P8ehdH.js";import{InstanceConfigDialog as Et}from"./BridgeTab-DwwnrXwF.js";var Y=t(e(),1),X=[`conversational`,`documentary`],Dt=new Set(X),Ot=`conversational`;function kt(e){let t=new Set((e??[]).filter(e=>Dt.has(e)));return t.size===0?[Ot]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:_t},At={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function jt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Mt(){let e=E(N.admin.listInstances,{}),t=E(N.agents.listAllInstanceAgents,{}),n=A(N.admin.upsertInstance),r=A(N.admin.deleteInstance),a=W(),[s,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(Q),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(null),[_,y]=(0,Y.useState)(null),[b,S]=(0,Y.useState)(null);async function C(){try{await n({instanceId:b??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),d(Q),S(null),l(!1)}catch(e){a.error(nt(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Xe(),(0,Z.jsx)(`strong`,{children:at()}),Ie()]}),(0,Z.jsx)(Tt,{title:i(),rows:e,addLabel:me(),onAdd:()=>{S(null),d(Q),l(!0)},emptyHint:Ae(),columns:[{header:Ee(),cell:e=>e.name,sort:e=>e.name},{header:Oe(),cell:e=>(0,Z.jsx)(G,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:te(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:tt(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Me(),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)(G,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?O():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:be(),onSelect:()=>{S(e._id),d(jt(e)),l(!0)}},{label:He(),onSelect:()=>p(e.name)},{label:ue(),onSelect:()=>y(e)},{label:ne(),onSelect:()=>h(e)},{label:v(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:v(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(wt,{open:s,onOpenChange:l,title:b?ee():we(),description:c(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:C,submitLabel:gt(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:ge(),children:[(0,Z.jsx)(R,{value:u.name,disabled:b!==null,onChange:e=>d({...u,name:e.target.value})}),b?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Se()}):null]}),(0,Z.jsx)($,{label:ie(),children:(0,Z.jsxs)(q,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,Z.jsx)(H,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(yt,{})}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(K,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(K,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:x(),children:(0,Z.jsx)(R,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:g(),children:(0,Z.jsx)(R,{value:u.bridgeUrl,placeholder:fe(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:ce(),children:(0,Z.jsx)(R,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:ze(),children:[(0,Z.jsxs)(q,{value:u.streamTransport,onValueChange:e=>d({...u,streamTransport:e}),children:[(0,Z.jsx)(H,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(yt,{})}),(0,Z.jsx)(U,{children:vt.map(e=>(0,Z.jsx)(K,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ve()})]}),(0,Z.jsx)($,{label:oe(),children:(0,Z.jsx)(R,{value:u.gatewayVersion,placeholder:Ge(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:o(),children:(0,Z.jsx)(R,{value:u.gatewayHttpUrl,placeholder:qe(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Ht,{instanceName:f,open:f!==null,onOpenChange:e=>{e||p(null)}}),m?(0,Z.jsx)(Et,{instance:m,onClose:()=>h(null)},m._id):null,_?(0,Z.jsx)(Nt,{instance:_,onClose:()=>y(null)},_._id):null]})}function Nt({instance:e,onClose:t}){let n=E(N.instanceSecrets.listInstanceSecretStatus,{}),r=At[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)(B,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(I,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(J,{children:f({instance:e.displayName??e.name})}),(0,Z.jsx)(L,{children:m()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(It,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ft,{instance:e})}),(0,Z.jsx)(Pt,{instance:e})]})})}function Pt({instance:e}){let t=M(N.instanceSync.forceInstanceSync),n=W(),[i,a]=(0,Y.useState)(!1);async function o(){if(!i){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(Qe());break;case`no_agents`:n.success(Ue());break;case`no_bridge_url`:n.error(rt());break;case`deploy_misconfigured`:n.error(Ze());break;case`unauthorized`:n.error(Le());break;case`not_served`:n.error(r());break;default:n.error(ot());break}}catch(e){n.error(Ne(),e)}finally{a(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:i,children:i?it():Fe()})})]})}function Ft({instance:e}){let t=E(N.bridgeAuth.listBridgeAuthStatus,{}),n=M(N.bridgeAuth.mintBridgeSecret),r=A(N.bridgeAuth.revokeBridgeSecret),i=W(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(_(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(C())}catch(e){i.error(_(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:ke(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:f?`outline`:`secondary`,children:f?`${w()} · ${d.prefix}…${d.lastFour}`:ft()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?S():De()}),f?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:et()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:Ce()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?P():D()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:T()})]}):null]})}function It({instanceId:e,field:t,updatedAt:n}){let r=M(N.instanceSecrets.setInstanceSecret),i=A(N.instanceSecrets.clearInstanceSecret),a=M(N.deviceIdentity.generateDeviceIdentity),o=W(),[s,c]=(0,Y.useState)(``),[l,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?ye():t===`deviceIdentity`?ut():u();async function y(){if(!(!s.trim()||l)){d(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),p(null),h(!1),o.success(Be())}catch(e){o.error(j(),e)}finally{d(!1)}}}async function ee(){if(!l){d(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(Ye())}catch(e){o.error(j(),e)}finally{d(!1)}}}async function b(){if(!l){d(!0);try{p(await a({instanceId:e})),h(!1),o.success(k())}catch(e){o.error(Je(),e)}finally{d(!1)}}}let x=f?`openclaw devices approve ${f.id}`:``;async function S(){if(x)try{await navigator.clipboard.writeText(x),h(!0)}catch{}}return(0,Z.jsxs)($,{label:v,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Re()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:g?`outline`:`secondary`,children:g?w():ft()}),(0,Z.jsx)(R,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?mt():Pe(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void y(),disabled:l||s.trim().length===0,children:ct()}),_?(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void b(),disabled:l,children:$e()}):null,g?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void ee(),disabled:l,children:je()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:k()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:st()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:x}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void S(),children:m?P():D()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:T()})]}):null]})}var Lt={conversational:h,documentary:se},Rt={conversational:de,documentary:ae},zt=e=>(Lt[e]??(()=>e))(),Bt=e=>(Rt[e]??(()=>``))();function Vt({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:ht()}),t.map(e=>(0,Z.jsx)(G,{variant:`secondary`,className:`oc-agenttype__chip`,title:Bt(e),children:zt(e)},e)),(0,Z.jsxs)(St,{children:[(0,Z.jsx)(Ct,{asChild:!0,children:(0,Z.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:he()})}),(0,Z.jsxs)(xt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:re()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:b()}),(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)(z,{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:zt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Bt(r)})]})]},r)})})]})]})]})}function Ht({instanceName:e,open:t,onOpenChange:n}){let r=E(N.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=A(N.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=A(N.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),c=A(N.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=kt(r);e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),u=A(N.agents.removeInstanceAgent),f=bt(),m=W();async function h(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){m.error(s(),e)}}async function g(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){m.error(s(),e)}}async function _(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await c({instanceName:e,agentId:t,types:i})}catch(e){m.error(s(),e)}}async function v(t,n){if(e&&await f({title:Ke({name:n}),description:le(),confirmLabel:d(),destructive:!0}))try{await u({instanceName:e,agentId:t}),m.success(p())}catch(e){m.error(s(),e)}}return(0,Z.jsx)(B,{open:t,onOpenChange:n,children:(0,Z.jsxs)(I,{className:`oc-access`,children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(J,{children:y({name:e??``})}),(0,Z.jsx)(L,{children:xe()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ve()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?lt():r.discovery.lastPollOk?l():_e({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:dt()}):(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,o=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)(z,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void h(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)(G,{variant:`outline`,className:`oc-access__gone`,children:pt()}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(e.agentId,i),children:a()})]}):n?(0,Z.jsx)(G,{variant:`default`,children:O()}):(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void g(e.agentId),children:We()})]}),e.enabled?(0,Z.jsx)(Vt,{agentId:e.agentId,types:o,onToggle:t=>void _(e.agentId,t,o)}):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{Mt as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Bh as ee,Cg as i,Dg as a,Eg as o,Fh as s,Gh as c,Hh as l,Ih as u,Jh as d,Kh as f,Lh as te,Qh as ne,Rh as re,Sg as p,Tg as ie,Uh as ae,Vh as oe,Wh as se,Xh as ce,Yh as le,Zh as m,_g as h,_w as g,ag as _,bg as v,cg as y,dg as b,eg as x,fg as S,gg as C,gw as w,hg as T,ig as E,lg as D,mg as O,ng as k,og as A,pg as j,qh as M,rg as N,sg as ue,tg as P,ug as F,uw as I,vg as L,wg as R,xg as z,yg as B,zh as V}from"./dist-ws-D-Lv-.js";import{C as H,J as U,O as W,S as G,b as K,m as q,x as de,y as fe}from"./index-Bp-uQn4K.js";import{t as pe}from"./DataTableShell-B_P8ehdH.js";var J=t(e(),1),Y=n();function me(){let e=g(I.integrations.status.status,{}),t=w(I.admin.setIntegrationConfig),[n,H]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&H(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:a()});let W=n,G=(e,t,n)=>H({...W,[e]:{...W[e],[t]:n}}),K=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[o(),` `,(0,Y.jsx)(`strong`,{children:ie()}),` `,R()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(q,{variant:`secondary`,children:i()}):(0,Y.jsx)(q,{variant:`outline`,children:p()}):(0,Y.jsx)(q,{variant:`outline`,children:z()}),note:B(),children:[(0,Y.jsx)(Z,{label:h(),children:(0,Y.jsx)(U,{value:W.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>G(`langfuse`,`host`,e.target.value),onBlur:()=>K(`langfuse`,{host:W.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:j(),checked:W.langfuse.enabled??!0,onChange:e=>{G(`langfuse`,`enabled`,e),K(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(q,{variant:`secondary`,children:i()}):(0,Y.jsx)(q,{variant:`outline`,children:p()}):(0,Y.jsx)(q,{variant:`outline`,children:z()}),note:L(),children:[(0,Y.jsx)(Z,{label:C(),children:(0,Y.jsx)(U,{value:W.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>G(`opik`,`baseUrl`,e.target.value),onBlur:()=>K(`opik`,{baseUrl:W.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:T(),children:(0,Y.jsx)(U,{value:W.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||O(),onChange:e=>G(`opik`,`workspace`,e.target.value),onBlur:()=>K(`opik`,{workspace:W.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:j(),checked:W.opik.enabled??!0,onChange:e=>{G(`opik`,`enabled`,e),K(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:S(),status:(0,Y.jsx)(q,{variant:`outline`,children:v()}),note:b(),children:[(0,Y.jsx)(Z,{label:F(),children:(0,Y.jsx)($,{value:W.tts.auto??`off`,options:[[`off`,D()],[`always`,y()],[`inbound`,ue()],[`tagged`,A()]],onChange:e=>{G(`tts`,`auto`,e),K(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:_(),children:(0,Y.jsx)($,{value:W.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,E()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{G(`tts`,`provider`,e),K(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:N(),children:(0,Y.jsx)(U,{value:W.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>G(`tts`,`model`,e.target.value),onBlur:()=>K(`tts`,{model:W.tts.model??``})})}),(0,Y.jsx)(Z,{label:k(),children:(0,Y.jsx)(U,{value:W.tts.voice??``,placeholder:P(),onChange:e=>G(`tts`,`voice`,e.target.value),onBlur:()=>K(`tts`,{voice:W.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:x(),status:(0,Y.jsx)(q,{variant:`outline`,children:v()}),note:e.secrets.openai?r():ne(),children:[(0,Y.jsx)(Q,{label:m(),checked:W.talk.enabled??!1,onChange:e=>{G(`talk`,`enabled`,e),K(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:ce(),children:(0,Y.jsx)($,{value:W.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{G(`talk`,`realtimeProvider`,e),K(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:le(),children:(0,Y.jsx)(U,{value:W.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>G(`talk`,`realtimeModel`,e.target.value),onBlur:()=>K(`talk`,{realtimeModel:W.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:k(),children:(0,Y.jsx)(U,{value:W.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>G(`talk`,`voice`,e.target.value),onBlur:()=>K(`talk`,{voice:W.talk.voice??``})})}),(0,Y.jsx)(Z,{label:d(),children:(0,Y.jsx)($,{value:W.talk.transport??`webrtc`,options:[[`webrtc`,M()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{G(`talk`,`transport`,e),K(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:f(),children:(0,Y.jsx)(U,{value:W.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>G(`talk`,`speechLocale`,e.target.value),onBlur:()=>K(`talk`,{speechLocale:W.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:c(),checked:W.talk.interruptOnSpeech??!0,onChange:e=>{G(`talk`,`interruptOnSpeech`,e),K(`talk`,{interruptOnSpeech:e})}})]}),(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:se()}),(0,Y.jsx)(q,{variant:`outline`,children:ae()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[l(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(pe,{title:oe(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:ee(),columns:[{header:V(),cell:e=>(0,Y.jsx)(q,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:re(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:te(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:u(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:s(),cell:e=>e.lastError??`—`,sort:e=>e.lastError??null}]})]})}function X({title:e,status:t,note:n,children:r}){return(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,Y.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`label`,{className:`oc-int__field`,children:[(0,Y.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function Q({label:e,checked:t,onChange:n}){return(0,Y.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,Y.jsx)(W,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(fe,{value:e,onValueChange:n,children:[(0,Y.jsx)(G,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(K,{children:t.map(([e,t])=>(0,Y.jsx)(de,{value:e,children:t},e))})]})}export{me as IntegrationsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bo as r,Fo as i,Ho as a,Io as o,Lo as s,Mo as c,No as l,Po as u,Ro as d,Uo as f,Vo as p,Wo as m,gw as h,jo as g,lw as _,zo as v}from"./dist-CgXYe09h.js";import{n as y,t as b}from"./TimeRangePicker-CXb27Tev.js";import{Ot as x,a as S,kt as C,n as w,r as T}from"./index-BmXiVWTf.js";import{a as E,n as D,o as O,r as k,t as A}from"./card-B3VbgixI.js";var j=t(e(),1),M=n(),N=[{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:a(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:p(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:r(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:v(),unit:`/h`,group:`Assistant`,isError:!0}],P=N.length,F=[`API`,`OpenClaw`,`Chat`,`Assistant`],I=1e3,L=36e5;function R(e,t){let n=Math.max(1,Math.ceil((t-e)/L)),r=Math.min(n*P,I);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/P))}}function z(){let e=C({from:`/settings/kpi`}),t=x({from:`/settings/kpi`}),n=T(e.from,e.to,w,`now`),r=e=>void t({search:t=>({...t,...S(e)})}),{from:a,to:c}=y(n),{rowLimit:l,buckets:u}=R(a,c),f=h(_.kpi.listKpis,{limit:l,filter:{from:a,to:c}}),p=(0,j.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>u&&e.set(t,n.slice(n.length-u));return e},[f,u]),m=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`p`,{className:`oc-admin__hint`,children:[d(),` `,(0,M.jsx)(`span`,{className:`oc-filter__window`,children:s()})]}),(0,M.jsx)(B,{value:n,onChange:r})]});return f===void 0?(0,M.jsxs)(M.Fragment,{children:[m,(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}):f.length===0?(0,M.jsxs)(M.Fragment,{children:[m,(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()})]}):(0,M.jsxs)(M.Fragment,{children:[m,F.map(e=>{let t=N.filter(t=>t.group===e);return t.some(e=>(p.get(e.metric)??[]).length>0)?(0,M.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,M.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,M.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,M.jsx)(V,{config:e,series:p.get(e.metric)??[]},e.metric))})]},e):null})]})}function B({value:e,onChange:t}){return(0,M.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,M.jsx)(b,{value:e,onChange:t})})}function V({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,M.jsxs)(A,{size:`sm`,className:`oc-kpi__card`,children:[(0,M.jsxs)(E,{children:[(0,M.jsx)(O,{className:`oc-kpi__card-title`,children:e.label}),(0,M.jsx)(k,{className:`oc-kpi__card-metric`,children:(0,M.jsx)(`code`,{children:e.metric})})]}),(0,M.jsxs)(D,{className:`oc-kpi__card-body`,children:[(0,M.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,M.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:K(r)}),(0,M.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,M.jsx)(G,{series:t,isError:e.isError,unit:e.unit}),(0,M.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,M.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:u({value:q(n.bucket)})}):(0,M.jsx)(`span`,{className:`oc-kpi__muted`,children:l()}),(0,M.jsx)(`span`,{className:`oc-kpi__muted`,children:c({count:t.length})})]})]})]})}var H=240,U=48,W=1;function G({series:e,isError:t,unit:n}){if(e.length===0)return(0,M.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=H/e.length,a=Math.max(i-W,1);return(0,M.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${H} ${U}`,preserveAspectRatio:`none`,role:`img`,"aria-label":g({max:K(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(U-1):0,c=o*i,l=U-s;return(0,M.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,M.jsxs)(`title`,{children:[q(e.bucket),` · `,K(e.value),` `,n]})},e.bucket)})})}function K(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function q(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{z as KpiTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bo as r,Fo as i,Ho as a,Io as o,Lo as s,Mo as c,No as l,Po as u,Ro as d,Uo as f,Vo as p,Wo as m,_w as h,jo as g,uw as _,zo as v}from"./dist-ws-D-Lv-.js";import{n as y,t as b}from"./TimeRangePicker-BDN2rIcO.js";import{Ot as x,a as S,kt as C,n as w,r as T}from"./index-Bp-uQn4K.js";import{a as E,n as D,o as O,r as k,t as A}from"./card-CWLBezSK.js";var j=t(e(),1),M=n(),N=[{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:a(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:p(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:r(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:v(),unit:`/h`,group:`Assistant`,isError:!0}],P=N.length,F=[`API`,`OpenClaw`,`Chat`,`Assistant`],I=1e3,L=36e5;function R(e,t){let n=Math.max(1,Math.ceil((t-e)/L)),r=Math.min(n*P,I);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/P))}}function z(){let e=C({from:`/settings/kpi`}),t=x({from:`/settings/kpi`}),n=T(e.from,e.to,w,`now`),r=e=>void t({search:t=>({...t,...S(e)})}),{from:a,to:c}=y(n),{rowLimit:l,buckets:u}=R(a,c),f=h(_.kpi.listKpis,{limit:l,filter:{from:a,to:c}}),p=(0,j.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>u&&e.set(t,n.slice(n.length-u));return e},[f,u]),m=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`p`,{className:`oc-admin__hint`,children:[d(),` `,(0,M.jsx)(`span`,{className:`oc-filter__window`,children:s()})]}),(0,M.jsx)(B,{value:n,onChange:r})]});return f===void 0?(0,M.jsxs)(M.Fragment,{children:[m,(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}):f.length===0?(0,M.jsxs)(M.Fragment,{children:[m,(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()})]}):(0,M.jsxs)(M.Fragment,{children:[m,F.map(e=>{let t=N.filter(t=>t.group===e);return t.some(e=>(p.get(e.metric)??[]).length>0)?(0,M.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,M.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,M.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,M.jsx)(V,{config:e,series:p.get(e.metric)??[]},e.metric))})]},e):null})]})}function B({value:e,onChange:t}){return(0,M.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,M.jsx)(b,{value:e,onChange:t})})}function V({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,M.jsxs)(A,{size:`sm`,className:`oc-kpi__card`,children:[(0,M.jsxs)(E,{children:[(0,M.jsx)(O,{className:`oc-kpi__card-title`,children:e.label}),(0,M.jsx)(k,{className:`oc-kpi__card-metric`,children:(0,M.jsx)(`code`,{children:e.metric})})]}),(0,M.jsxs)(D,{className:`oc-kpi__card-body`,children:[(0,M.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,M.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:K(r)}),(0,M.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,M.jsx)(G,{series:t,isError:e.isError,unit:e.unit}),(0,M.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,M.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:u({value:q(n.bucket)})}):(0,M.jsx)(`span`,{className:`oc-kpi__muted`,children:l()}),(0,M.jsx)(`span`,{className:`oc-kpi__muted`,children:c({count:t.length})})]})]})]})}var H=240,U=48,W=1;function G({series:e,isError:t,unit:n}){if(e.length===0)return(0,M.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=H/e.length,a=Math.max(i-W,1);return(0,M.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${H} ${U}`,preserveAspectRatio:`none`,role:`img`,"aria-label":g({max:K(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(U-1):0,c=o*i,l=U-s;return(0,M.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,M.jsxs)(`title`,{children:[q(e.bucket),` · `,K(e.value),` `,n]})},e.bucket)})})}function K(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function q(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{z as KpiTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,Ab as i,Bb as a,CC as o,DC as s,EC as c,Fb as l,Gb as u,Hb as d,Ib as f,Jb as p,Kb as m,LC as ee,Lb as h,MC as g,Mb as _,Nb as v,OC as te,Pb as ne,Qb as re,Rb as ie,SC as ae,TC as oe,Ub as se,Vb as ce,Wb as y,Xb as le,Yb as ue,Zb as de,_C as fe,_w as b,ax as x,bC as S,cx as C,ex as w,gw as T,ix as E,jb as D,kC as O,lx as k,nx as A,ox as j,qb as M,rx as N,sx as P,tx as F,uw as I,vC as L,wC as R,xC as z,yC as B,zb as V,zp as pe}from"./dist-ws-D-Lv-.js";import{t as H}from"./button-DuXPa4Vl.js";import{C as me,J as U,O as W,S as he,b as ge,j as _e,k as ve,ot as G,x as K,y as ye}from"./index-Bp-uQn4K.js";var q=t(e(),1),J=[{id:`messages`,label:()=>k()},{id:`composer`,label:()=>C()},{id:`sidebar`,label:()=>P()},{id:`other`,label:()=>j()}],Y={showSource:{category:`messages`,label:()=>x(),help:()=>E()},showReport:{category:`messages`,label:()=>N(),help:()=>A()},copyAssistant:{category:`messages`,label:()=>F()},copyUser:{category:`messages`,label:()=>w()},showDelete:{category:`messages`,label:()=>r()},showTools:{category:`messages`,label:()=>re(),help:()=>de()},voiceInput:{category:`composer`,label:()=>le(),help:()=>ue()},showChatAge:{category:`sidebar`,label:()=>p(),help:()=>M()},showChatProvider:{category:`sidebar`,label:()=>m(),help:()=>u()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function be(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],Se={voiceInput:`voiceInput`};function Ce(e){return xe.includes(e)}function Z(e){return e===`admin`}function we(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Q(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Ce(e)?Se[e]:void 0}var $=n(),Ee={voiceInput:()=>ne()};function De({prefKey:e,ui:t}){let n=T(I.admin.setUiPrefDefault),r=T(I.admin.setFeatureEnabled),a=Te(e),o=a?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ie()}),(0,$.jsxs)(ye,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(he,{size:`sm`,className:`w-36`,children:(0,$.jsx)(me,{})}),(0,$.jsxs)(ge,{children:[(0,$.jsx)(K,{value:`on`,children:_()}),(0,$.jsx)(K,{value:`off`,children:D()}),(0,$.jsx)(K,{value:`inherit`,children:i()})]})]}),a?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(W,{checked:t.featuresEnabled[a]===!0,onCheckedChange:e=>void r({key:a,enabled:e===!0}),"aria-label":h()}),h()]}):null]}),o?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=b(I.me.getMe,{host:G}),o=i?.ui,s=Z(i?.role)&&n,c=T(I.me.setUiPref).withOptimisticUpdate(ve),u=(0,q.useMemo)(()=>o?be(Object.keys(o.effective),e):[],[o,e]);return o?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":V()}),V()]}):null,s?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:f()}),(0,$.jsx)(`p`,{children:l()}),(0,$.jsx)(`p`,{children:v()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:y(),"aria-label":y(),className:`mb-2`}),u.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:se()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:u.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],l=o.effective[e],u=o.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${u&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:d()}):u?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:ce()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&u?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:a()}):null,(0,$.jsx)(W,{checked:l,disabled:i,onCheckedChange:t=>void c({key:e,value:t===!0}),"aria-label":n})]}),s?(0,$.jsx)(De,{prefKey:e,ui:o}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:ee()})}function ke(){let e=b(I.me.getMe,{host:G}),t=T(I.me.setLocale),n=T(I.me.setMyName),r=_e(),i=e?.locale??`default`,a=e?.name??``,[l,u]=(0,q.useState)(null),d=l??a,f=d.trim()!==a.trim();async function p(){try{await n({name:d}),u(null),r.success(oe())}catch(e){r.error(R(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:O()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{className:`max-w-xs`,value:d,maxLength:120,placeholder:s(),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),p())}}),(0,$.jsx)(H,{size:`sm`,disabled:!f,onClick:()=>void p(),children:pe()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:o()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ae()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:i===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?L():e===`en`?fe():g()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:z()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:S()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:B()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
@@ -1,2 +1,2 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$s as r,Js as i,Qs as a,Xs as o,Ys as s,Zs as c,_c as l,ac as u,cc as d,dc as f,ec as p,fc as m,gw as h,hw as g,ic as _,lc as v,lw as y,nc as b,oc as x,qs as S,rc as C,sc as w,tc as T,uc as E,vc as D}from"./dist-CgXYe09h.js";import{c as O,i as k,l as A,n as j,r as M,s as N,t as P,u as F}from"./FieldLabel-DkIcKewT.js";import{t as I}from"./button-G-_IqZDp.js";import{C as L,O as R,S as z,b as B,j as V,x as H,y as U}from"./index-BmXiVWTf.js";/* empty css */var W=t(e(),1),G=n(),K={media_delivery:{label:w,help:x},documentary_fetch:{label:u,help:_},inbound_files:{label:C,help:b}},q={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
- - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`},J={outboundDir:s,references:i,files:S};function Y(){let e=h(y.admin.listInstances,{}),[t,n]=(0,W.useState)(null);if(e===void 0)return(0,G.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,G.jsx)(`div`,{className:`oc-injtab`,children:(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:p()})});let r=e.find(e=>e._id===t)??e[0];return(0,G.jsxs)(`div`,{className:`oc-injtab`,children:[(0,G.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,G.jsx)(j,{label:m(),help:f()}),(0,G.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,G.jsx)(`span`,{children:T()}),(0,G.jsxs)(U,{value:r._id,onValueChange:e=>n(e),children:[(0,G.jsx)(z,{size:`sm`,className:`min-w-44`,children:(0,G.jsx)(L,{})}),(0,G.jsx)(B,{children:e.map(e=>(0,G.jsx)(H,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,G.jsx)(X,{instance:r},r._id)]})}function X({instance:e}){let t=g(y.admin.upsertInstanceConfig),n=V(),r=e.config??{},[i,a]=(0,W.useState)(()=>k(r)),[o,s]=(0,W.useState)(!1),c=i.promptInjections,u=(e,t)=>a({...i,promptInjections:{...c,[e]:{...c[e],...t}}});async function d(){s(!0);try{await t({instanceId:e._id,config:M(i,r)})}catch(e){n.error(l(),e)}finally{s(!1)}}return(0,G.jsxs)(`div`,{className:`oc-injtab__body`,children:[O.map(e=>(0,G.jsx)(Z,{injKey:e,def:N[e],i18n:K[e],row:c[e]??{enabled:!0,template:N[e].defaultTemplate},onChange:t=>u(e,t)},e)),(0,G.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,G.jsx)(I,{size:`sm`,onClick:()=>void d(),disabled:o,children:D()})})]})}function Z({injKey:e,def:t,i18n:n,row:i,onChange:s}){let[l,u]=(0,W.useState)(!1),f=i.template.trim()!==t.defaultTemplate,p=t.togglable&&!i.enabled,m=Object.fromEntries(t.placeholders.map(e=>[e,q[e]??`{${e}}`])),h=A(e,i),g=h?F(h,m):``;return(0,G.jsxs)(`section`,{className:`oc-injcard`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,G.jsxs)(`label`,{className:`oc-field--row`,children:[(0,G.jsx)(R,{checked:i.enabled,onCheckedChange:e=>s({enabled:e===!0})}),(0,G.jsx)(j,{label:n.label(),help:n.help()})]}):(0,G.jsx)(j,{label:n.label(),help:n.help()}),f&&(0,G.jsx)(`span`,{className:`oc-injection__badge`,children:v()})]}),(0,G.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:p,rows:8,spellCheck:!1,onChange:e=>s({template:e.target.value})}),(0,G.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:d()}),t.placeholders.map(e=>(0,G.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,G.jsx)(`code`,{children:`{${e}}`}),(0,G.jsx)(P,{text:(J[e]??(()=>e))()})]},e))]}),(0,G.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>u(e=>!e),children:l?a():r()}),f&&(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>s({template:t.defaultTemplate}),children:E()})]})]}),l&&(0,G.jsx)(`div`,{className:`oc-injcard__preview`,children:g?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:g}),(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:c()})]}):(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:o()})})]})}export{Y as PromptInjectionsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$s as r,Js as i,Qs as a,Xs as o,Ys as s,Zs as c,_w as l,ac as u,bc as d,cc as f,dc as p,ec as m,fc as h,gw as g,ic as _,lc as v,nc as y,oc as b,qs as x,rc as S,sc as C,tc as w,uc as T,uw as E,yc as D}from"./dist-ws-D-Lv-.js";import{d as O,f as k,i as A,l as j,n as M,r as N,t as P,u as F}from"./FieldLabel-CtF9VFJv.js";import{t as I}from"./button-DuXPa4Vl.js";import{C as L,O as R,S as z,b as B,j as V,x as H,y as U}from"./index-Bp-uQn4K.js";/* empty css */var W=t(e(),1),G=n(),K={media_delivery:{label:C,help:b},documentary_fetch:{label:u,help:_},inbound_files:{label:S,help:y}},q={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
+ - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`},J={outboundDir:s,references:i,files:x};function Y(){let e=l(E.admin.listInstances,{}),[t,n]=(0,W.useState)(null);if(e===void 0)return(0,G.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,G.jsx)(`div`,{className:`oc-injtab`,children:(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:m()})});let r=e.find(e=>e._id===t)??e[0];return(0,G.jsxs)(`div`,{className:`oc-injtab`,children:[(0,G.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,G.jsx)(M,{label:h(),help:p()}),(0,G.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,G.jsx)(`span`,{children:w()}),(0,G.jsxs)(U,{value:r._id,onValueChange:e=>n(e),children:[(0,G.jsx)(z,{size:`sm`,className:`min-w-44`,children:(0,G.jsx)(L,{})}),(0,G.jsx)(B,{children:e.map(e=>(0,G.jsx)(H,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,G.jsx)(X,{instance:r},r._id)]})}function X({instance:e}){let t=g(E.admin.upsertInstanceConfig),n=V(),r=e.config??{},[i,a]=(0,W.useState)(()=>A(r)),[o,s]=(0,W.useState)(!1),c=i.promptInjections,l=(e,t)=>a({...i,promptInjections:{...c,[e]:{...c[e],...t}}});async function u(){s(!0);try{await t({instanceId:e._id,config:N(i,r)})}catch(e){n.error(D(),e)}finally{s(!1)}}return(0,G.jsxs)(`div`,{className:`oc-injtab__body`,children:[F.map(e=>(0,G.jsx)(Z,{injKey:e,def:j[e],i18n:K[e],row:c[e]??{enabled:!0,template:j[e].defaultTemplate},onChange:t=>l(e,t)},e)),(0,G.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,G.jsx)(I,{size:`sm`,onClick:()=>void u(),disabled:o,children:d()})})]})}function Z({injKey:e,def:t,i18n:n,row:i,onChange:s}){let[l,u]=(0,W.useState)(!1),d=i.template.trim()!==t.defaultTemplate,p=t.togglable&&!i.enabled,m=Object.fromEntries(t.placeholders.map(e=>[e,q[e]??`{${e}}`])),h=O(e,i),g=h?k(h,m):``;return(0,G.jsxs)(`section`,{className:`oc-injcard`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,G.jsxs)(`label`,{className:`oc-field--row`,children:[(0,G.jsx)(R,{checked:i.enabled,onCheckedChange:e=>s({enabled:e===!0})}),(0,G.jsx)(M,{label:n.label(),help:n.help()})]}):(0,G.jsx)(M,{label:n.label(),help:n.help()}),d&&(0,G.jsx)(`span`,{className:`oc-injection__badge`,children:v()})]}),(0,G.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:p,rows:8,spellCheck:!1,onChange:e=>s({template:e.target.value})}),(0,G.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:f()}),t.placeholders.map(e=>(0,G.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,G.jsx)(`code`,{children:`{${e}}`}),(0,G.jsx)(P,{text:(J[e]??(()=>e))()})]},e))]}),(0,G.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>u(e=>!e),children:l?a():r()}),d&&(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>s({template:t.defaultTemplate}),children:T()})]})]}),l&&(0,G.jsx)(`div`,{className:`oc-injcard__preview`,children:g?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:g}),(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:c()})]}):(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:o()})})]})}export{Y as PromptInjectionsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Ad as i,Bd as ee,Fd as a,Gd as o,Hd as te,Id as ne,Jd as s,Kd as c,Ld as l,Md as u,Nd as d,Od as f,Pd as p,Qd as m,Rd as h,Sd as g,Ud as _,Vd as v,Wd as y,Xd as b,Yd as x,Zd as S,_d as re,_w as ie,bd as C,ef as w,gd as T,gw as E,hd as D,jd as O,kd as k,md as A,nf as j,qd as M,rf as N,tf as P,uw as F,vd as I,xd as L,yd as R,zd as ae}from"./dist-ws-D-Lv-.js";import{t as z}from"./button-DuXPa4Vl.js";import{J as B,M as V,O as H,h as U,j as W,m as G,xt as K}from"./index-Bp-uQn4K.js";import{t as q}from"./roleDescriptions-KrB9-er6.js";var J=t(e(),1),Y=n(),X=[{group:()=>N(),keys:[{key:`traces.read`,label:()=>m()},{key:`traces.read.content`,label:()=>S(),phi:!0},{key:`traces.write`,label:()=>b()}]},{group:()=>j(),keys:[{key:`kpi.read`,label:()=>m()},{key:`kpi.write`,label:()=>b()}]},{group:()=>P(),keys:[{key:`openclaw.query`,label:()=>x()},{key:`anomalies.read`,label:()=>s()},{key:`anomalies.report`,label:()=>M()}]},{group:()=>w(),keys:[{key:`chats.read`,label:()=>m()},{key:`selfheal`,label:()=>o()}]},{group:()=>r(),keys:[{key:`admin.manage`,label:()=>c()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=ie(F.apiKeys.listRoles,{}),t=E(F.apiKeys.createRole),n=E(F.apiKeys.ensureRolesSeeded),r=E(F.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(F.apiKeys.listRoles,{});r&&e.setQuery(F.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),o=V(),s=W(),[c,m]=(0,J.useState)(!1),[b,x]=(0,J.useState)(Q),[S,w]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{s.error(_(),e)})},[n,s]);let j=e??[];async function M(e,t){if(Z(e.permissions)||S.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await o({title:te({name:e.name}),description:v(),confirmLabel:ee()}))){w(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){s.error(ae(),e)}finally{w(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function N(){try{await t({key:b.key,name:b.name,description:b.description||void 0,permissions:[]}),x(Q),m(!1)}catch(e){s.error(h(),e)}}let P=e===void 0,$=!P&&j.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,ne(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,a()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:p()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{x(Q),m(!0)},children:d()})})]}),P?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:i()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?y({key:e.key}):e.key,children:[e.label(),e.phi?(0,Y.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,Y.jsx)(`tbody`,{children:j.map(e=>{let t=Z(e.permissions),n=S.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(G,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,k()]}):(0,Y.jsx)(G,{variant:`secondary`,children:f()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(r=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(H,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?g():n?L():r,onCheckedChange:()=>void M(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(U,{open:c,onOpenChange:m,title:C(),description:R(),canSubmit:!!(b.key&&b.name),onSubmit:N,submitLabel:I(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:re()}),(0,Y.jsx)(B,{value:b.key,placeholder:T(),onChange:e=>x({...b,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:D()}),(0,Y.jsx)(B,{value:b.name,onChange:e=>x({...b,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:A()}),(0,Y.jsx)(B,{value:b.description,onChange:e=>x({...b,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Ay as i,By as ee,Cb as a,Cy as o,Db as te,Dy as s,Eb as ne,Ey as c,Fy as re,Gy as ie,Hy as ae,Iy as oe,Jy as se,Ky as ce,Ly as le,My as l,Ny as ue,Ob as de,Oy as u,Py as fe,Qy as pe,Ry as me,Sb as he,Sy as d,Tb as ge,Ty as f,Uy as _e,Vy as ve,Wy as ye,Xy as be,Yy as xe,Zy as Se,_b as Ce,_w as p,_y as we,ab as Te,bb as Ee,by as m,cb as De,db as Oe,dy as ke,eb as Ae,fb as je,fy as h,gb as Me,gw as g,gy as _,hb as Ne,hy as v,ib as Pe,jy as y,kb as Fe,ky as b,lb as Ie,ly as x,mb as Le,mw as Re,my as S,nb as ze,ob as Be,pb as Ve,py as C,qy as He,rb as Ue,sb as We,tb as Ge,ub as Ke,uw as w,uy as T,vb as qe,vy as E,wb as D,wy as O,xb as Je,xy as k,yb as Ye,yy as A,zy as Xe}from"./dist-ws-D-Lv-.js";import{n as j}from"./dist-DjXzB84V.js";import{i as Ze}from"./dist-ZW9rNZ8M.js";import{t as M}from"./button-DuXPa4Vl.js";import{C as N,Dt as Qe,F as P,I as F,J as I,L,M as $e,Ot as et,P as R,R as z,S as B,Tt as V,b as H,h as tt,j as nt,kt as rt,m as U,x as W,y as G,z as K}from"./index-Bp-uQn4K.js";import{t as it}from"./FilterBar-BmFEn3qs.js";import{t as at}from"./DataTableShell-B_P8ehdH.js";import{t as ot}from"./roleDescriptions-KrB9-er6.js";var q=t(e(),1),J=n(),st=[{value:`never`,label:()=>v(),days:null},{value:`30`,label:()=>S(),days:30},{value:`90`,label:()=>C(),days:90}],ct=720*60*60*1e3,Y=`__all__`,X={name:``,roleKey:``,description:``};function Z(){let e=rt({from:`/settings/serviceAccounts`}),t=et({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Y,[o,s]=(0,q.useState)(Y),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===Y?void 0:e})}),u=p(w.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===Y?void 0:o,disabled:i===Y?void 0:i===`disabled`}}),d=p(w.apiKeys.listKeys,{}),f=p(w.apiKeys.listRoles,{}),we=g(w.apiKeys.createServiceAccount),m=g(w.apiKeys.updateServiceAccount),ke=g(w.apiKeys.deleteServiceAccount),h=Re(w.apiKeys.mintApiKey),_=g(w.apiKeys.revokeApiKey),v=$e(),y=nt(),b=n!==``||o!==Y||i!==Y;function x(){s(Y),t({search:{},replace:!0})}let[S,C]=(0,q.useState)(!1),[T,E]=(0,q.useState)(X),[O,k]=(0,q.useState)(null),[A,j]=(0,q.useState)(new Set),[P,F]=(0,q.useState)(null),L=(0,q.useRef)(!1),[R,z]=(0,q.useState)(new Set),[V,K]=(0,q.useState)({}),[ct,Z]=(0,q.useState)(null),Q=(0,q.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function $(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{O?(await m({serviceAccountId:O,name:T.name,roleKey:T.roleKey,description:T.description}),y.success(He())):await we({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(X),k(null),C(!1)}catch(e){y.error(O?se():xe(),e)}}function ft(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),C(!0)}async function pt(e){if(L.current)return;L.current=!0;let t=V[e._id]??`never`,n=st.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});Z({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(ce(),e)}finally{L.current=!1,F(null)}}async function mt(e){if(await v({title:ie(),description:(0,J.jsxs)(J.Fragment,{children:[ye(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,_e(),` `,(0,J.jsx)(`strong`,{children:ae()}),` `,ve()]}),confirmWord:e.name,confirmLabel:ee(),destructive:!0}))try{await ke({serviceAccountId:e._id}),y.success(Xe(),e.name)}catch(e){y.error(me(),e)}}async function ht(e){if(await v({title:le(),description:(0,J.jsxs)(J.Fragment,{children:[oe(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,re()]}),confirmLabel:fe(),destructive:!0})&&!R.has(e._id)){z(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){y.error(ue(),e)}finally{z(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}),(0,J.jsxs)(it,{q:n,onQChange:c,searchPlaceholder:de(),onReset:x,canReset:b,children:[(0,J.jsxs)(G,{value:o,onValueChange:s,children:[(0,J.jsx)(B,{size:`sm`,className:`w-40`,children:(0,J.jsx)(N,{placeholder:te()})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(W,{value:Y,children:ne()}),(f??[]).map(e=>(0,J.jsx)(W,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(G,{value:i,onValueChange:l,children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(N,{})}),(0,J.jsxs)(H,{children:[(0,J.jsx)(W,{value:Y,children:ge()}),(0,J.jsx)(W,{value:`active`,children:D()}),(0,J.jsx)(W,{value:`disabled`,children:a()})]})]})]}),(0,J.jsx)(at,{title:he(),rows:u,addLabel:Je(),onAdd:()=>{E(X),k(null),C(!0)},emptyHint:Ee(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:Q.get(e._id)??[],onRevoke:ht,revoking:R}),rowActions:e=>[{label:Me(),onSelect:()=>ft(e)},{label:Ye(),onSelect:()=>void pt(e)},{label:A.has(e._id)?qe():Ce(),onSelect:()=>$(e._id)},{label:Ne(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?Le():Ve(),onClick:()=>$(e._id),children:A.has(e._id)?(0,J.jsx)(Ze,{}):(0,J.jsx)(Qe,{})})},{header:je(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Oe(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(U,{variant:`secondary`,children:e.roleKey})},{header:Ke(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(U,{variant:`destructive`,children:a()}):(0,J.jsx)(U,{variant:`outline`,children:D()})},{header:Ie(),cell:e=>(0,J.jsxs)(G,{value:V[e._id]??`never`,onValueChange:t=>K(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(N,{})}),(0,J.jsx)(H,{children:st.map(e=>(0,J.jsx)(W,{value:e.value,children:e.label()},e.value))})]})},{header:De(),sort:e=>(Q.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Q.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:P===e._id?We():Be({count:t})})}}]}),(0,J.jsx)(tt,{open:S,onOpenChange:e=>{C(e),e||k(null)},title:O?Te():ze(),description:O?Pe():Ge(),canSubmit:!!(T.name&&T.roleKey),onSubmit:dt,submitLabel:O?Ue():Ae(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,J.jsx)(I,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:pe()}),(0,J.jsxs)(G,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,J.jsx)(B,{className:`w-full`,children:(0,J.jsx)(N,{placeholder:Se()})}),(0,J.jsx)(H,{children:(f??[]).map(e=>(0,J.jsxs)(W,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===T.roleKey),t=e?ot(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:be()}),(0,J.jsx)(I,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:ct,onClose:()=>Z(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[l(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:i()}),(0,J.jsx)(`th`,{children:b()}),(0,J.jsx)(`th`,{children:u()}),(0,J.jsx)(`th`,{children:s()}),(0,J.jsx)(`th`,{children:c()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(U,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:Q(t.createdAt)}),(0,J.jsx)(`td`,{className:$(t.lastUsedAt)?`oc-sa__stale`:``,children:dt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:ft(t.expiresAt)}),(0,J.jsx)(`td`,{children:pt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?O():o()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(R,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(P,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(z,{children:[(0,J.jsx)(K,{children:d()}),(0,J.jsx)(F,{children:k({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:m()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":A(),children:[n?(0,J.jsx)(j,{}):(0,J.jsx)(V,{}),n?E():we()]})]}),(0,J.jsx)(L,{children:(0,J.jsx)(M,{onClick:()=>{r(!1),t()},children:_()})})]}):null})}function Q(e){return new Date(e).toLocaleString(`fr-FR`)}function $(e){return e===null?!1:Date.now()-e>ct}function dt(e){return e===null?h():new Date(e).toLocaleString(`fr-FR`)}function ft(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function pt(e){return e.disabled?(0,J.jsx)(U,{variant:`destructive`,children:ke()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(U,{variant:`outline`,children:T()}):(0,J.jsx)(U,{variant:`outline`,children:x()})}export{Z as ServiceAccountsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,AS as i,Ax as a,Bx as o,CS as s,Cx as c,DS as l,Dx as u,ES as d,Ex as f,FC as p,Fx as m,Gx as h,Hx as g,Ix as ee,Jx as te,Kx as ne,Lx as re,MS as ie,Mx as ae,NC as oe,Nx as se,OS as ce,Ox as le,PC as ue,Px as de,Qx as fe,Rx as pe,SS as _,Sx as me,TS as he,Tx as ge,Ux as _e,Vx as ve,Wx as ye,Xx as be,Yx as v,Zx as xe,_C as Se,_S as Ce,_w as y,_x as we,aS as Te,bS as Ee,bx as De,cS as Oe,dS as ke,dw as Ae,dx as je,eS as Me,fS as Ne,fx as Pe,gS as Fe,gw as b,gx as Ie,hS as Le,hx as Re,iS as ze,jS as Be,jx as Ve,kS as He,kx as Ue,lS as We,mS as Ge,mw as Ke,mx as x,n as qe,nS as Je,oS as Ye,pS as Xe,px as Ze,qx as Qe,rS as $e,sS as et,tS as tt,uS as nt,uw as S,ux as rt,vC as it,vS as at,vx as C,wS as ot,wx as st,xS as ct,xx as lt,yS as ut,yx as dt,zx as ft}from"./dist-ws-D-Lv-.js";import{n as w}from"./dist-DjXzB84V.js";import{t as pt}from"./TimeRangePicker-BDN2rIcO.js";import{t as T}from"./x-D96nOW2m.js";import{t as E}from"./button-DuXPa4Vl.js";import{$ as mt,C as D,Ct as O,J as k,O as A,Q as ht,S as j,at as gt,b as M,et as N,it as _t,m as P,nt as F,ot as I,rt as vt,tt as yt,x as L,y as R}from"./index-Bp-uQn4K.js";import{a as bt,i as xt,n as St,o as Ct,r as wt,t as Tt}from"./card-CWLBezSK.js";import{a as Et,i as z,n as Dt,o as B,r as V,t as Ot}from"./table-CoglL6L8.js";import{t as kt}from"./FilterBar-BmFEn3qs.js";import{t as At}from"./AdvancedFilter-0hIaeD_5.js";var H=Ae(`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`}]]),U=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Ft(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function W(e,t,n){return Ft(e,t,n)>=jt}function It(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Lt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(se());if(e.size>Rt)throw Error(ae());let{source:n,width:r,height:i,cleanup:o}=await Ut(e);try{let o=e.type===`image/svg+xml`,s=Math.min(zt/r,Bt/i,o?1/0:1),c=Math.max(1,Math.round(r*s)),l=Math.max(1,Math.round(i*s)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)throw Error(a());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,c,l);let f=Pt(d.getImageData(0,0,c,l).data,c,l)??{x:0,y:0,width:c,height:l},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(a());if(m.drawImage(u,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);W(e.data,f.width,f.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),m.putImageData(e,0,0)}let h=W(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await K(p,`image/webp`,Vt)??await K(p,`image/png`);if(!g)throw Error(Ue());return{blob:g,hasAlpha:h}}finally{o()}}async function Ut(e){if(e.type===`image/svg+xml`)return G(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 G(e)}async function G(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(Ve())),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 K(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var q=n(),J=`__all__`,Y={kind:`relative`,from:`now-24h`,to:`now`},X=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Z({title:e,description:t,children:n}){return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,q.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Wt(e){return e===`light`?p():e===`dark`?ue():oe()}var Gt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Kt({tokens:e,mode:t}){let n=e.colors[t];return(0,q.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Gt.map(e=>{let t=n[e];return(0,q.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Q({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a}){return(0,q.jsxs)(`button`,{type:`button`,className:qe(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,q.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,q.jsx)(w,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,q.jsx)(Kt,{tokens:r,mode:i}):(0,q.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,q.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,q.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]})}function qt({selectedKey:e,resolvedMode:t}){let n=y(S.charts.listMyCharts),r=b(S.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:ot()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,q.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,q.jsx)(Q,{selected:e===null,title:_(),subtitle:ct(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?Ee():n.via===`owner`?ut():at({group:n.via.group});return(0,q.jsx)(Q,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key)},n.key)})]}),n!==void 0&&n.length===0?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:Ce()}):null]})}function Jt(){let e=b(S.charts.importChart),[t,n]=(0,U.useState)(``),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(v())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(Qe());return}let r;try{r=JSON.parse(i)}catch{s(v());return}d(!0);try{await e({name:t.trim(),tokens:r}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:$e()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:Je()})]}),(0,q.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:tt()}),(0,q.jsx)(k,{value:t,onChange:e=>n(e.target.value),placeholder:Me(),maxLength:60})]}),(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:r()}),(0,q.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:fe(),rows:8,spellCheck:!1})]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(E,{variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,q.jsx)(H,{className:`size-4`}),xe(),(0,q.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,q.jsx)(E,{size:`sm`,disabled:u,onClick:()=>void p(),children:be()})]}),o?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,q.jsx)(`p`,{className:`oc-chart-import__ok`,children:te()}):null]})]})}function Yt({chart:e}){let t=Ke(S.charts.setChartLogo),n=b(S.charts.removeChartLogo),[r,i]=(0,U.useState)(!1),[a,s]=(0,U.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){s(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ht(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,q.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?o():ft()}),(0,q.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,q.jsx)(`img`,{src:t,alt:``}):null}),(0,q.jsx)(E,{variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,q.jsx)(H,{className:`size-4`}),t?re():pe(),(0,q.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,q.jsx)(E,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:m()}):null,t?(0,q.jsx)(E,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:ee()}):null]})}return(0,q.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ve()}),(0,q.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,q.jsx)(p,{mode:`light`}),(0,q.jsx)(p,{mode:`dark`})]}),r?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:de()}):null,a?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function $({chart:e}){let t=y(S.me.getMe,{host:I}),n=b(S.charts.addChartDomain),r=b(S.charts.removeChartDomain),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(null),[l,d]=(0,U.useState)(!1);if(t?.role!==`admin`)return null;let p=e.domains??[];async function m(){let t=i.trim();if(t!==``){s(null),d(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}}async function h(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:le()}),(0,q.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,q.jsx)(`div`,{className:`oc-chart-avail__groups`,children:p.length===0?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:st()}):p.map(e=>(0,q.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,q.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":c({domain:e}),onClick:()=>void h(e),children:(0,q.jsx)(T,{className:`size-3`})})]},e))}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(k,{value:i,onChange:e=>a(e.target.value),placeholder:f(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&m()}}),(0,q.jsx)(E,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void m(),children:ge()})]}),(0,q.jsx)(`span`,{className:`oc-show__desc`,children:u()}),o?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function Xt({chart:e}){let t=b(S.charts.updateChart),n=b(S.charts.deleteChart),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(e.name),[s,c]=(0,U.useState)(()=>JSON.stringify(e.tokens,null,2)),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(!1);function p(){o(e.name),c(JSON.stringify(e.tokens,null,2)),u(null),i(!0)}async function m(){if(e.chartId===void 0)return;u(null);let n;try{n=JSON.parse(s)}catch{u(v());return}f(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){u(e instanceof Error?e.message:String(e))}finally{f(!1)}}async function h(){if(e.chartId!==void 0&&window.confirm(C()))try{await n({chartId:e.chartId})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,q.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,q.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(E,{variant:`outline`,size:`sm`,onClick:p,children:_e()}),(0,q.jsx)(E,{variant:`ghost`,size:`sm`,onClick:()=>void h(),children:g()})]})})]}),r?(0,q.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:De()}),(0,q.jsx)(k,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:dt()}),(0,q.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),l?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:l}):null,(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(E,{size:`sm`,disabled:d,onClick:()=>void m(),children:me()}),(0,q.jsx)(E,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:lt()})]})]}):null,(0,q.jsx)(Yt,{chart:e}),(0,q.jsx)($,{chart:e})]})}function Zt(){let e=y(S.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:ne()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),e!==void 0&&t.length===0?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:ye()}):(0,q.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,q.jsx)(Xt,{chart:e},e.key))})]})}function Qt({chart:e,groups:t}){let n=b(S.charts.addChartToGroupPool),r=b(S.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,q.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,q.jsx)(P,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?We():e.kind===`custom`&&e.scope===`personal`?x():nt()}),e.isGlobalDefault?(0,q.jsx)(P,{variant:`default`,children:Oe()}):null]}),(0,q.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ye()}),(a??[]).map(e=>(0,q.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,q.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ze({group:e.name}),onClick:()=>void l(e.groupId),children:(0,q.jsx)(T,{className:`size-3`})})]},e.groupId)),s.length>0?(0,q.jsxs)(R,{value:``,onValueChange:e=>void c(e),children:[(0,q.jsx)(j,{size:`sm`,className:`w-56`,children:(0,q.jsx)(D,{placeholder:Te()})}),(0,q.jsx)(M,{children:s.map(e=>(0,q.jsx)(L,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:et()}):null]})]})}function $t({chart:e}){let t=b(S.charts.promoteChartToCommon),n=b(S.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(C()))try{await n({chartId:e.chartId})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,q.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,q.jsx)(P,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Ze():x()}),e.ownerLabel?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:Re({owner:e.ownerLabel})}):null]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,q.jsx)(E,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:Pe()}):null,(0,q.jsx)(E,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:je()})]})]})}function en({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=b(S.admin.setDefaultThemeMode),a=b(S.admin.setDefaultLocale),o=b(S.charts.setDefaultChart),s=y(S.charts.listChartsAdmin),c=y(S.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,q.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:d()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:Fe()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:Le()})]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(E,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:_()}),gt.map(e=>(0,q.jsx)(E,{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,q.jsx)(E,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:Ge()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(0,q.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,q.jsx)(Qt,{chart:e,groups:c??[]},e.key))})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:Ne()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:ke()})]}),(0,q.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,q.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,q.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,q.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,q.jsx)($,{chart:e})]},e.key))})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:we()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:Ie()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:rt()}):(0,q.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,q.jsx)($t,{chart:e},e.key))})})()]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:ie()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:Be()})]}),(0,q.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,q.jsx)(E,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Wt(e)},e))})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:i()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:He()})]}),(0,q.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,q.jsx)(E,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e}),children:e===`fr`?it():Se()},e))}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:ce()})]})]})}function tn(){let e=y(S.me.getMe,{host:I}),t=_t(e?.resolvedThemeMode);return(0,q.jsxs)(`div`,{className:`oc-appearance`,children:[(0,q.jsx)(qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,q.jsx)(Jt,{}),(0,q.jsx)(Zt,{}),e?.role===`admin`?(0,q.jsx)(en,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function nn(){let[e,t]=(0,U.useState)(!0),[n,r]=(0,U.useState)(`per-user`),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(J),[c,u]=(0,U.useState)(J),[d,f]=(0,U.useState)(Y),p=i!==``||o!==J||c!==J;function m(){a(``),s(J),u(J),f(Y)}return(0,q.jsxs)(`div`,{className:`oc-show`,children:[(0,q.jsx)(tn,{}),(0,q.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,q.jsx)(`summary`,{className:`oc-show__title`,children:l()}),(0,q.jsxs)(Z,{title:`Buttons`,description:`Variants`,children:[(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(E,{children:`Default`}),(0,q.jsx)(E,{variant:`secondary`,children:`Secondary`}),(0,q.jsx)(E,{variant:`outline`,children:`Outline`}),(0,q.jsx)(E,{variant:`ghost`,children:`Ghost`}),(0,q.jsx)(E,{variant:`destructive`,children:`Destructive`}),(0,q.jsx)(E,{variant:`link`,children:`Link`})]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(E,{size:`sm`,children:`Small`}),(0,q.jsx)(E,{children:`Default`}),(0,q.jsx)(E,{size:`lg`,children:`Large`}),(0,q.jsx)(E,{size:`icon`,"aria-label":`more`,children:(0,q.jsx)(O,{})}),(0,q.jsx)(E,{disabled:!0,children:`Disabled`})]})]}),(0,q.jsx)(Z,{title:`Badges`,children:(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(P,{children:`Default`}),(0,q.jsx)(P,{variant:`secondary`,children:`Secondary`}),(0,q.jsx)(P,{variant:`outline`,children:`Outline`}),(0,q.jsx)(P,{variant:`destructive`,children:`Destructive`})]})}),(0,q.jsx)(Z,{title:`Inputs & selection`,children:(0,q.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,q.jsx)(k,{placeholder:`Text input…`}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsxs)(R,{value:n,onValueChange:r,children:[(0,q.jsx)(j,{className:`w-56`,children:(0,q.jsx)(D,{placeholder:`Select…`})}),(0,q.jsxs)(M,{children:[(0,q.jsx)(L,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,q.jsx)(L,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,q.jsxs)(`label`,{className:`oc-show__check`,children:[(0,q.jsx)(A,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,q.jsx)(Z,{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,q.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,q.jsxs)(kt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:d,onTimeRangeChange:f,onReset:m,canReset:p,children:[(0,q.jsxs)(R,{value:o,onValueChange:s,children:[(0,q.jsx)(j,{size:`sm`,children:(0,q.jsx)(D,{})}),(0,q.jsxs)(M,{children:[(0,q.jsx)(L,{value:J,children:`Toutes directions`}),(0,q.jsx)(L,{value:`inbound`,children:`inbound`}),(0,q.jsx)(L,{value:`outbound`,children:`outbound`}),(0,q.jsx)(L,{value:`internal`,children:`internal`})]})]}),(0,q.jsxs)(R,{value:c,onValueChange:u,children:[(0,q.jsx)(j,{size:`sm`,children:(0,q.jsx)(D,{})}),(0,q.jsxs)(M,{children:[(0,q.jsx)(L,{value:J,children:`Toutes sévérités`}),(0,q.jsx)(L,{value:`info`,children:`info`}),(0,q.jsx)(L,{value:`warn`,children:`warn`}),(0,q.jsx)(L,{value:`critical`,children:`critical`})]})]})]}),(0,q.jsx)(At,{fields:X,onChange:()=>{}}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,q.jsx)(pt,{value:d,onChange:f})]})]})}),(0,q.jsx)(Z,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,q.jsxs)(ht,{children:[(0,q.jsx)(vt,{asChild:!0,children:(0,q.jsx)(E,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,q.jsx)(O,{})})}),(0,q.jsxs)(mt,{align:`start`,children:[(0,q.jsx)(yt,{children:`Actions`}),(0,q.jsx)(F,{}),(0,q.jsx)(N,{children:`Edit`}),(0,q.jsx)(N,{children:`Duplicate`}),(0,q.jsx)(F,{}),(0,q.jsx)(N,{variant:`destructive`,children:`Delete`})]})]})}),(0,q.jsx)(Z,{title:`Card`,children:(0,q.jsxs)(Tt,{className:`w-80`,children:[(0,q.jsxs)(bt,{children:[(0,q.jsx)(Ct,{children:`Instance`}),(0,q.jsx)(wt,{children:`Non-secret metadata only.`})]}),(0,q.jsx)(St,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,q.jsxs)(xt,{className:`gap-2`,children:[(0,q.jsx)(E,{size:`sm`,children:`Save`}),(0,q.jsx)(E,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,q.jsx)(Z,{title:`Table`,children:(0,q.jsxs)(Ot,{children:[(0,q.jsx)(Et,{children:(0,q.jsxs)(B,{children:[(0,q.jsx)(z,{className:`w-8`,children:(0,q.jsx)(A,{"aria-label":`select all`})}),(0,q.jsx)(z,{children:`Name`}),(0,q.jsx)(z,{children:`Mode`}),(0,q.jsx)(z,{className:`text-right`,children:`Status`}),(0,q.jsx)(z,{className:`w-8`})]})}),(0,q.jsx)(Dt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,q.jsxs)(B,{children:[(0,q.jsx)(V,{children:(0,q.jsx)(A,{"aria-label":`select ${e.n}`})}),(0,q.jsx)(V,{className:`font-medium`,children:e.n}),(0,q.jsx)(V,{children:(0,q.jsx)(P,{variant:`secondary`,children:e.m})}),(0,q.jsx)(V,{className:`text-right`,children:(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,q.jsx)(w,{className:`size-3.5`}),` `,e.s]})}),(0,q.jsx)(V,{children:(0,q.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,q.jsx)(O,{})})})]},e.n))})]})}),(0,q.jsx)(Z,{title:`App fragments`,description:`Chat-specific components`,children:(0,q.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,q.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,q.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,q.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,q.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,q.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,q.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,q.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,q.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,q.jsx)(`span`,{className:`oc-run-status__dot`}),(0,q.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{nn as ThemeShowroom};