@lacneu/atrium 0.47.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/assets/{AccessTab-BnX4PmPs.js → AccessTab-DMtobe3Y.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-CKkRCk45.js → AdvancedFilter-B6lCXnk_.js} +1 -1
  3. package/dist/assets/AgentFilesTab-DgC5PVEh.js +3 -0
  4. package/dist/assets/AnomaliesTab-D_NGV0y1.js +1 -0
  5. package/dist/assets/AuditTab-Rr5xuXKd.js +1 -0
  6. package/dist/assets/BridgeTab-Cg51jMGo.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-3cQQbcJp.js +1 -0
  8. package/dist/assets/{DataTableShell-BYMlgvYE.js → DataTableShell-Bzopt4OT.js} +1 -1
  9. package/dist/assets/{DetailChips-C89Nbaor.js → DetailChips-PKnLEOOY.js} +1 -1
  10. package/dist/assets/FeedbacksTab-Bvdu_42J.js +1 -0
  11. package/dist/assets/{FieldLabel-BPLfm9JW.js → FieldLabel-RnB1EBjO.js} +1 -1
  12. package/dist/assets/FilesTab-Dizy2z9U.js +1 -0
  13. package/dist/assets/{FilterBar-Br5EycxW.js → FilterBar-Dy10_IPZ.js} +1 -1
  14. package/dist/assets/GroupsTab-DfguxlfH.js +1 -0
  15. package/dist/assets/InstancesTab-CTlgjqaF.js +1 -0
  16. package/dist/assets/IntegrationsTab-DDj4VHj-.js +1 -0
  17. package/dist/assets/{KpiTab-qboMswTC.js → KpiTab-CxrZ8A9u.js} +1 -1
  18. package/dist/assets/PreferencesTab-4GLPWMHl.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-dPl70NdT.js +4 -0
  20. package/dist/assets/RolesTab-CmIvQLbD.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-kzUegapD.js +1 -0
  22. package/dist/assets/SubAgentReportsTab-DDkU2OZ0.js +1 -0
  23. package/dist/assets/ThemeShowroom-ClrciIxw.js +1 -0
  24. package/dist/assets/{TimeRangePicker-DZi8tuoy.js → TimeRangePicker-CZSYqXhd.js} +1 -1
  25. package/dist/assets/TracesTab-CYp5UZUL.js +1 -0
  26. package/dist/assets/UsersTab-CeGA0ymg.js +1 -0
  27. package/dist/assets/VoiceTab-DfO3ivrS.js +1 -0
  28. package/dist/assets/{button-LIt-3xv6.js → button-D5AXX04a.js} +1 -1
  29. package/dist/assets/{card-DzsZ59WU.js → card-DYY__lMj.js} +1 -1
  30. package/dist/assets/chevrons-up-down-C-bHailH.js +1 -0
  31. package/dist/assets/{compatView-CJb6IBah.js → compatView-DWV4JVj_.js} +1 -1
  32. package/dist/assets/dispatchErrorInfo-BtpDRwp-.js +1 -0
  33. package/dist/assets/dist-CGzSsL4i.js +44 -0
  34. package/dist/assets/{dist-DsZthEtc.js → dist-Cy-5Eo9H.js} +1 -1
  35. package/dist/assets/{dist-DLoYO0vC.js → dist-DVwJLFHG.js} +1 -1
  36. package/dist/assets/{dist-CVh1Fq15.js → dist-fE9pwpr-.js} +1 -1
  37. package/dist/assets/{highlighted-body-OFNGDK62-C_RIODx7.js → highlighted-body-OFNGDK62-BAuJrSyk.js} +1 -1
  38. package/dist/assets/index-B0Kloary.js +233 -0
  39. package/dist/assets/{index-CaAfBY4r.css → index-CaPvOhvq.css} +1 -1
  40. package/dist/assets/mermaid-GHXKKRXX-DqdnANNu.js +1 -0
  41. package/dist/assets/{pdf-Dn84Ah8f.js → pdf-Di4Z0VhC.js} +1 -1
  42. package/dist/assets/roleDescriptions-BXezQ4Y4.js +1 -0
  43. package/dist/assets/{table-BWvBHDcJ.js → table-BDhz0ajJ.js} +1 -1
  44. package/dist/assets/{tabs-DewZd9lc.js → tabs-Cd17i-th.js} +1 -1
  45. package/dist/assets/x-CQuunpf5.js +1 -0
  46. package/dist/index.html +8 -8
  47. package/package.json +1 -1
  48. package/dist/assets/AgentFilesTab-CkLgkVsj.js +0 -3
  49. package/dist/assets/AnomaliesTab-DoBVOf86.js +0 -1
  50. package/dist/assets/AuditTab-DMryP-0z.js +0 -1
  51. package/dist/assets/BridgeTab-D0zXMFxl.js +0 -1
  52. package/dist/assets/ChatDefaultsTab-DXTx_IWc.js +0 -1
  53. package/dist/assets/FeedbacksTab-DBkOUMkj.js +0 -1
  54. package/dist/assets/FilesTab-Djlcb2FA.js +0 -1
  55. package/dist/assets/GroupsTab-ZueGeQG8.js +0 -1
  56. package/dist/assets/InstancesTab-BhlWHuUE.js +0 -1
  57. package/dist/assets/IntegrationsTab-CVRwsVxC.js +0 -1
  58. package/dist/assets/PreferencesTab-Zxx8mWLT.js +0 -1
  59. package/dist/assets/PromptInjectionsTab-B66bzRPn.js +0 -4
  60. package/dist/assets/RolesTab-u-d5x70T.js +0 -1
  61. package/dist/assets/ServiceAccountsTab-HabO_UTG.js +0 -1
  62. package/dist/assets/SubAgentReportsTab-C7lBvZWl.js +0 -1
  63. package/dist/assets/ThemeShowroom-B76h-pqY.js +0 -1
  64. package/dist/assets/TracesTab-CX-EEGmG.js +0 -1
  65. package/dist/assets/UsersTab-CcKwRns7.js +0 -1
  66. package/dist/assets/VoiceTab-WUCBEthA.js +0 -1
  67. package/dist/assets/chevrons-up-down-De8tZoyW.js +0 -1
  68. package/dist/assets/dispatchErrorInfo-CQMEEMco.js +0 -1
  69. package/dist/assets/dist-DxRkWXyO.js +0 -44
  70. package/dist/assets/index-DA0_EAyp.js +0 -233
  71. package/dist/assets/mermaid-GHXKKRXX-CCS7XoEq.js +0 -1
  72. package/dist/assets/roleDescriptions-DZ_zo2SB.js +0 -1
  73. package/dist/assets/x-C5l8NTyh.js +0 -1
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,E as i,Gu as a,Ju as o,Ku as s,Qu as c,Uu as l,Vj as u,Wu as d,Xj as f,Xu as p,Yu as m,Zu as h,ed as g,nd as _,qu as v,rd as y,td as b}from"./dist-DxRkWXyO.js";import{C as x,S,b as C,ct as w,w as T,x as E}from"./index-DA0_EAyp.js";var D=t(e(),1);function O(e){return e===`user`?v():e===`all`?s():a({group:e.group})}function k(e){return e===`common`?d():e===`owner`?l():a({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=f(i.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=f(i.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),(0,A.jsxs)(C,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":_(),children:(0,A.jsx)(T,{placeholder:_()})}),(0,A.jsx)(E,{children:(e??[]).map(e=>(0,A.jsx)(S,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(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:g()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:a.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:r()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.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:c()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.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:o()}):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:h()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.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:p()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.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{$u as r,E as i,Ju as a,Kj as o,Ku as s,Qu as c,Xu as l,Yu as u,Zu as d,ad as f,ed as p,id as m,nd as h,od as g,qu as _,rd as v,tM as y,td as b}from"./dist-CGzSsL4i.js";import{C as x,S,b as C,ct as w,w as T,x as E}from"./index-B0Kloary.js";var D=t(e(),1);function O(e){return e===`user`?l():e===`all`?u():a({group:e.group})}function k(e){return e===`common`?_():e===`owner`?s():a({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=y(i.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=y(i.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),(0,A.jsxs)(C,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":f(),children:(0,A.jsx)(T,{placeholder:f()})}),(0,A.jsx)(E,{children:(e??[]).map(e=>(0,A.jsx)(S,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):a===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:a.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.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:b()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.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:d()}):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:p()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.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:r()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.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{cp as r,dp as i,fp as a,lp as o,mp as s,pp as c,up as l}from"./dist-DxRkWXyO.js";import{i as u}from"./dist-DsZthEtc.js";import{t as d}from"./x-C5l8NTyh.js";import{t as f}from"./button-LIt-3xv6.js";import{C as p,It as m,S as h,b as g,lt as _,w as v,x as y}from"./index-DA0_EAyp.js";import{r as b}from"./TimeRangePicker-DZi8tuoy.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:s()},{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 s=(0,x.useRef)(t),w=!!(s.current&&s.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(s.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),c(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(g,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-40`,children:(0,S.jsx)(v,{placeholder:i()})}),(0,S.jsx)(y,{children:e.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(g,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-28`,children:(0,S.jsx)(v,{})}),(0,S.jsx)(y,{children:C.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(_,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:l()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(m,{}),r()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_p as r,dp as i,fp as a,gp as o,hp as s,mp as c,pp as l}from"./dist-CGzSsL4i.js";import{i as u}from"./dist-Cy-5Eo9H.js";import{t as d}from"./x-CQuunpf5.js";import{t as f}from"./button-D5AXX04a.js";import{C as p,It as m,S as h,b as g,lt as _,w as v,x as y}from"./index-B0Kloary.js";import{r as b}from"./TimeRangePicker-CZSYqXhd.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:r()},{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 r=(0,x.useRef)(t),w=!!(r.current&&r.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(r.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),o(),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:s()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(g,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-40`,children:(0,S.jsx)(v,{placeholder:c()})}),(0,S.jsx)(y,{children:e.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(g,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-28`,children:(0,S.jsx)(v,{})}),(0,S.jsx)(y,{children:C.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(_,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:l()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(m,{}),i()]})]}):null]})}export{D as t};
@@ -0,0 +1,3 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ac as r,Ar as i,Bc as a,Br as o,Cc as s,Cr as c,Dc as l,Dr as u,E as d,Ec as f,Er as p,FE as m,Fc as h,Fr as g,Hr as _,Ic as v,Ir as y,Jj as b,Kj as x,Lc as S,Lr as C,Mc as w,Mr as T,Nc as E,Nr as D,Oc as O,Or as k,Pc as A,Pr as j,Qj as M,Rc as ee,Rr as te,Sc as N,Sl as ne,Sr as P,Tc as F,Tr as I,Vc as L,Vr as R,_c as re,bc as ie,dr as ae,eM as z,fc as B,fr as V,gc as oe,hc as se,hr as H,jc as ce,jr as U,kc as le,kr as ue,lr as de,mc as fe,mr as pe,pc as me,pr as he,tM as W,ur as ge,vc as _e,wc as ve,wl as G,wr as ye,xc as be,yc as xe,zc as Se,zr as Ce}from"./dist-CGzSsL4i.js";import{t as K}from"./button-D5AXX04a.js";import{At as q,C as we,G as Te,H as Ee,J as De,K as Oe,S as ke,U as Ae,W as je,Y as Me,b as Ne,ct as Pe,dt as Fe,ft as Ie,ht as Le,mt as Re,q as ze,ut as Be,w as Ve,x as He,xt as Ue,y as We,z as J}from"./index-B0Kloary.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-DWV4JVj_.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(e,t){let n=new Map;for(let t of e.split(`
2
+ `))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
3
+ `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=W(d.me.getMe,{host:Ue}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=W(d.admin.listInstances,e!==void 0&&t?{}:`skip`),[o,s]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!i||i.length===0||(!o||!i.some(e=>e.name===o))&&s(i[0].name)},[t,i,o]);let c=W(d.agents.listAgentsForInstance,t&&o?{instanceName:o}:`skip`),l=W(d.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return o===null||c===void 0?i!==void 0&&i.length===0?[]:void 0:c.agents.map(e=>({instanceName:o,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,o,c,i,l]),[f,p]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!u||u.length===0||(!f||!u.some(e=>$(e)===f))&&p($(u[0]))},[u,f]);let m=u?.find(e=>$(e)===f)??null,g=M(d.agentFiles.listAgentFiles),[_,y]=(0,Y.useState)({status:`idle`}),T=m?.instanceName??null,D=m?.agentId??null,O=W(d.compat.forInstance,n&&T!==null?{instanceName:T}:`skip`),k=n&&T!==null?We(O,`agentFiles`):null,j=k===null?!1:k===`loading`?null:k.blocked,N=(0,Y.useCallback)(async()=>{if(!(T===null||D===null)){y({status:`loading`});try{y({status:`done`,files:(await g({instanceName:T,agentId:D})).files})}catch{y({status:`error`})}}},[g,T,D]);(0,Y.useEffect)(()=>{j===!1&&N()},[N,j]);let[P,F]=(0,Y.useState)(null),I=W(d.agentFileCuration.listCurations,t&&T!==null&&D!==null?{instanceName:T,agentId:D}:`skip`),R=W(d.agentFileCuration.curationSettings,t&&T!==null?{instanceName:T}:`skip`),re=M(d.agentFileCuration.requestCuration),[ie,ae]=(0,Y.useState)(null),[z,B]=(0,Y.useState)(null),{toast:V}=J(),oe=(0,Y.useMemo)(()=>{let e=new Map;for(let t of I??[])e.has(t.name)||e.set(t.name,t);return e},[I]),se=(0,Y.useCallback)(async e=>{if(!(T===null||D===null)){ae(e);try{let t=await re({instanceName:T,agentId:D,name:e,trigger:`manual`});t.ok?V({title:Ce(),variant:`success`}):V({title:te({reason:t.reason??`unknown`}),variant:`error`})}catch{V({title:C(),variant:`error`})}finally{ae(null)}}},[re,T,D,V]),H=b(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(H,{maximumFractionDigits:0}),[H]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:L()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ne,{value:o??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":a(),children:(0,Q.jsx)(Ve,{})}),(0,Q.jsx)(He,{children:(i??[]).map(e=>(0,Q.jsx)(ke,{value:e.name,children:e.name},e.name))})]}):null,u.length>0?(0,Q.jsxs)(Ne,{value:f??``,onValueChange:e=>p(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":Se(),children:(0,Q.jsx)(Ve,{})}),(0,Q.jsx)(He,{children:u.map(e=>(0,Q.jsx)(ke,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ee()})]}),m===null?null:k===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):k!==null&&k.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,qe(k.gatewayVersion,k.provider)]}):_.status===`loading`||_.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):_.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[v(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void N(),children:ne()})]}):_.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:_.files.map(e=>{let n=Ye(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)(Pe,{variant:`outline`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:A({size:Z(e.size,H)})}),(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:E({pct:U.format(n)})}),i?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":w()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>F(e),children:t?r():le()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:R?.budgetChars??null,enabled:R?.enabled??!1,curation:oe.get(e.name)??null,inFlight:ie===e.name,onCurate:()=>void se(e.name),onReview:e=>B(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ce({used:Z(Ze(_.files),H),total:Z(Je,H),pct:U.format(Xe(Ze(_.files)))})})]}),P&&m?(0,Q.jsx)(rt,{instanceName:m.instanceName,agentId:m.agentId,name:P.name,isAdmin:t,onClose:()=>F(null),onSaved:()=>void N()}):null,z?(0,Q.jsx)(it,{curationId:z,onClose:()=>B(null),onApplied:()=>{B(null),N()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:s,onReview:c}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(i._id),children:R()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Pe,{variant:`outline`,className:`oc-afiles__curate-status`,children:o()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:_()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=M(d.agentFiles.getAgentFile),c=M(d.agentFiles.setAgentFile),u=J(),[p,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(``),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),[E,D]=(0,Y.useState)(!1),[k,A]=(0,Y.useState)(!1),j=(0,Y.useCallback)(async r=>{_(!1);try{let i=await o({instanceName:e,agentId:t,name:n});h({content:i.content,updatedAtMs:i.updatedAtMs}),r||y(i.content),D(!1)}catch{_(!0)}},[o,e,t,n]);(0,Y.useEffect)(()=>{j(!1)},[j]);async function ee(){if(p!==null){T(!0),A(!1);try{await c({instanceName:e,agentId:t,name:n,content:v,baseUpdatedAtMs:p.updatedAtMs??void 0}),u.success(N({name:n})),a(),await j(!1)}catch(e){et(e)?D(!0):A(!0)}finally{T(!1)}}}let te=p!==null&&v!==p.content,P=(0,Y.useMemo)(()=>p===null?null:$e(p.content,v),[p,v]),I=v.length>X,L=b(),R=(0,Y.useMemo)(()=>new Intl.NumberFormat(L),[L]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:O({name:n})}),(0,Q.jsxs)(Ie,{children:[l({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,f()]})]})]}),g?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ie(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void j(!1),children:ne()})]}):p===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:v,readOnly:!r,spellCheck:!1,onChange:e=>y(e.target.value),"aria-label":O({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:F()}),E?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[xe(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void j(!0),children:_e()})]}):null,k?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:be()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${I?` is-over`:``}`,children:ve({count:R.format(v.length),max:R.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!te||w||E,onClick:()=>C(!0),children:w?G():s()}):null]})]}),(0,Q.jsx)(Ee,{open:S,onOpenChange:C,children:(0,Q.jsxs)(Te,{children:[(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Me,{children:re({name:n})}),(0,Q.jsx)(Oe,{children:oe({agent:t})})]}),P?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:se({added:P.added,removed:P.removed})}),P.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:fe()}),P.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,P.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:me()}),P.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(ze,{children:[(0,Q.jsx)(je,{children:m()}),(0,Q.jsx)(Ae,{onClick:()=>void ee(),children:B()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=W(d.agentFileCuration.getProposal,{curationId:e}),a=M(d.agentFileCuration.approveCuration),o=z(d.agentFileCuration.rejectCuration),{toast:s}=J(),[l,f]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(``),S=b(),w=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function E(){f(`approve`);try{let t=await a({curationId:e});t.ok?(s({title:y(),variant:`success`}),n()):s({title:t.reason===`conflict`?j():D({reason:t.reason??`unknown`}),variant:`error`})}catch{s({title:C(),variant:`error`})}finally{f(null)}}async function O(n){f(`reject`);try{let r=_.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?s({title:n?ge():g(),variant:`success`}):s({title:i(),variant:`error`}),t()}catch{s({title:C(),variant:`error`})}finally{f(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:r?T({name:r.name}):x()}),(0,Q.jsx)(Ie,{children:U()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[ue({before:Z(r.beforeSize,S),after:Z(r.proposedSize,S)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,k()]}):null]}),w?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:u({added:w.added,removed:w.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:de({feedback:r.feedback})}):null,w&&w.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:P()}),(0,Q.jsx)(`ul`,{children:w.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:c()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:p()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),m?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:H()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:pe(),value:_,onChange:e=>v(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>h(!1),disabled:l!==null,children:he()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void O(!1),disabled:l!==null,children:l===`reject`?G():V()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void O(!0),disabled:l!==null,children:l===`reject`?G():ae()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>h(!0),disabled:l!==null||r==null,children:I()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void E(),disabled:l!==null||r==null,children:l===`approve`?G():ye()})]})]})})}export{tt as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Av as i,Bv as a,Dv as o,E as s,Fv as c,Gv as ee,Hv as l,Iv as te,Jv as ne,Kv as u,Lv as d,Mv as f,Nv as p,Ov as m,Pv as h,Qv as g,Rv as re,Uv as ie,Vv as ae,Wv as _,Xv as oe,Yv as se,Zv as ce,ay as le,cy as ue,dy as de,eM as fe,ey as pe,fy as me,hy as v,iy as he,jv as ge,kv as y,ly as b,my as x,ny as S,oy as C,py as w,qv as T,ry as E,sy as D,tM as O,ty as k,uy as A,zv as j}from"./dist-CGzSsL4i.js";import{B as M,C as N,S as P,Xt as F,Yt as I,a as L,b as R,ct as z,et as _e,r as ve,w as B,x as V,xt as ye,z as be}from"./index-B0Kloary.js";import{n as xe}from"./TimeRangePicker-CZSYqXhd.js";import{t as Se}from"./FilterBar-Dy10_IPZ.js";import{t as Ce}from"./DataTableShell-Bzopt4OT.js";import{t as H}from"./dispatchErrorInfo-BtpDRwp-.js";var U=t(e(),1),W=n(),G=`__all__`,we=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Te(e){return e===`open`?v():e===`acknowledged`?x():w()}var Ee=[`info`,`warn`,`critical`],De=[`detector`,`agent`,`user`],Oe={kind:`relative`,from:`now-30d`,to:`now`},ke=200,K=`all`;function q(){let e=F({from:`/settings/anomalies`}),t=I({from:`/settings/anomalies`}),n=e.q??``,i=e.status===K?G:e.status,o=e.severity??G,m=e.kind??G,[v,y]=(0,U.useState)(G),x=ve(e.from,e.to),{from:w,to:H}=xe(x),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,status:e===G?K:e})}),Y=e=>void t({search:t=>({...t,severity:e===G?void 0:e})}),Pe=e=>void t({search:t=>({...t,kind:e===G?void 0:e})}),Fe=e=>void t({search:t=>({...t,...L(e)})}),Ie=M(),X=be(),Z=fe(s.anomalies.resolveAnomaly),Le=(O(s.me.getMe,{host:ye})?.permissions??[]).includes(`admin.manage`),Q=O(s.anomalies.listAnomalies,{limit:ke,filter:{q:n||void 0,from:w,to:H,anomalyStatus:i===G?void 0:i,severity:o===G?void 0:o,source:v===G?void 0:v,kind:m===G?void 0:m}}),$=(0,U.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.kind);return[...e].sort()},[Q]),Re=n!==``||i!==`open`||o!==G||v!==G||m!==G||x.kind!==`relative`||x.from!==Oe.from;function ze(){y(G),t({search:{status:`open`},replace:!0})}async function Be(e){if(await Ie({title:me(),description:(0,W.jsxs)(W.Fragment,{children:[de(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,A(),` `,(0,W.jsx)(`strong`,{children:b()}),`.`,` `,ue()]}),confirmLabel:D()}))try{await Z({anomalyId:e._id,status:`resolved`}),X.success(C(),e.kind)}catch(e){X.error(le(),e)}}async function Ve(e){try{await Z({anomalyId:e._id,status:`acknowledged`}),X.success(he(),e.kind)}catch(e){X.error(E(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,W.jsx)(`strong`,{children:k()}),` `,pe(),` `,(0,W.jsx)(`strong`,{children:r()}),` `,g(),` `,(0,W.jsx)(`strong`,{children:ce()}),` `,oe(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:se()})]}),(0,W.jsxs)(Se,{q:n,onQChange:q,searchPlaceholder:ne(),timeRange:x,onTimeRangeChange:Fe,onReset:ze,canReset:Re,children:[(0,W.jsxs)(R,{value:i,onValueChange:J,children:[(0,W.jsx)(N,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(P,{value:G,children:T()}),we.map(e=>(0,W.jsx)(P,{value:e.value,children:Te(e.value)},e.value))]})]}),(0,W.jsxs)(R,{value:o,onValueChange:Y,children:[(0,W.jsx)(N,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:u()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(P,{value:G,children:ee()}),Ee.map(e=>(0,W.jsx)(P,{value:e,children:e},e))]})]}),(0,W.jsxs)(R,{value:v,onValueChange:y,children:[(0,W.jsx)(N,{size:`sm`,className:`w-32`,children:(0,W.jsx)(B,{placeholder:_()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(P,{value:G,children:ie()}),De.map(e=>(0,W.jsx)(P,{value:e,children:e},e))]})]}),(0,W.jsxs)(R,{value:m,onValueChange:Pe,children:[(0,W.jsx)(N,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:l()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(P,{value:G,children:ae()}),$.map(e=>(0,W.jsx)(P,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Ce,{title:a(),rows:Q,emptyHint:i===`open`?j():re(),rowActions:e=>Le&&e.status===`open`?[{label:d(),onSelect:()=>void Be(e)},{label:te(),onSelect:()=>void Ve(e)}]:[],columns:[{header:c(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:_e(e.at)}),sort:e=>e.at},{header:l(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:u(),cell:e=>(0,W.jsx)(je,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:h(),cell:e=>(0,W.jsx)(Me,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:_(),cell:e=>(0,W.jsx)(z,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:p(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:f(),cell:e=>(0,W.jsx)(Ae,{row:e}),sort:e=>e.evidence??null},{header:ge(),cell:e=>e.correlationId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:Ne(e.correlationId)}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function J(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Y(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Ae({row:e}){let t=I();if(e.kind===`subagent.failure`){let n=Y(e);return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,i()]}):null]})}let n=J(e);if(!n.dominantCode)return(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=H(n.dominantCode),a=n.sampleCorrelationId;return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,W.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,W.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),a?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:a,limit:100}}),children:[`↗ `,i()]}):null]})}function je({severity:e}){return(0,W.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Me({status:e}){return e===`open`?(0,W.jsx)(z,{variant:`destructive`,children:y()}):e===`acknowledged`?(0,W.jsx)(z,{variant:`secondary`,children:m()}):(0,W.jsx)(z,{variant:`outline`,children:o()})}function Ne(e){return e.length>8?e.slice(0,8):e}export{q as AnomaliesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{E as r,Sn as i,_b as a,_n as o,bb as s,bn as c,cb as l,db as u,fb as d,gb as f,hb as p,lb as m,mb as h,ob as g,pb as _,sb as v,tM as y,ub as b,vb as x,vn as S,xn as C,yb as w,yn as T}from"./dist-CGzSsL4i.js";import{C as E,S as D,Xt as O,Yt as k,a as A,b as j,et as M,i as N,o as P,r as F,t as I,w as L,x as R}from"./index-B0Kloary.js";import{n as ee}from"./TimeRangePicker-CZSYqXhd.js";import{t as z}from"./FilterBar-Dy10_IPZ.js";import{t as B}from"./AdvancedFilter-B6lCXnk_.js";import{t as V}from"./DataTableShell-Bzopt4OT.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:i()},{value:`realLabel`,label:C()},{value:`targetLabel`,label:c()},{value:`impersonated`,label:T()},{value:`resource`,label:S()},{value:`resourceId`,label:o()}];function q(){let e=O({from:`/settings/audit`}),t=k({from:`/settings/audit`}),n=e.q??``,i=e.action??G,o=e.impersonated??G,c=e.resource??G,S=F(e.from,e.to),C=(0,H.useMemo)(()=>P(e.adv),[e.adv]),{from:T,to:I}=ee(S),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...A(e)})}),Q=e=>void t({search:t=>({...t,adv:N(e)}),replace:!0}),$=y(r.admin.listAudit,{filter:{q:n||void 0,from:T,to:I,action:i===G?void 0:i,resource:c===G?void 0:c,impersonated:o===G?void 0:o===`yes`,advanced:C.length>0?C:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||i!==G||o!==G||c!==G||C.length>0||S.kind!==`relative`||S.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:w()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:x(),timeRange:S,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(j,{value:i,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:a()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:f()}),te.map(e=>(0,U.jsx)(D,{value:e,children:e},e))]})]}),(0,U.jsxs)(j,{value:o,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:p()}),(0,U.jsx)(D,{value:`yes`,children:h()}),(0,U.jsx)(D,{value:`no`,children:_()})]})]}),(0,U.jsxs)(j,{value:c,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:d()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:u()}),ne.map(e=>(0,U.jsx)(D,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:C,onChange:Q}),(0,U.jsx)(V,{title:b(),rows:$,emptyHint:m(),columns:[{header:l(),cell:e=>M(e.at),sort:e=>e.at},{header:a(),cell:e=>e.action,sort:e=>e.action},{header:v(),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{q as AuditTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,$s as i,Ah as a,Bh as o,Bt as s,Cg as c,Ch as l,D as u,Dg as d,Dh as f,E as p,Eh as m,Fh as h,Gh as ee,Gs as g,Hh as te,Ht as _,Ih as v,Js as y,Kh as ne,Ks as re,Kt as b,Lh as ie,Mh as ae,Nh as oe,Og as se,Oh as ce,Ph as le,Qj as ue,Qm as de,Qs as fe,Rh as pe,Sg as me,Sh as he,Tg as ge,Th as _e,Uh as ve,Us as ye,Ut as be,Vh as xe,Vt as Se,Wh as Ce,Ws as we,Xs as Te,Ys as Ee,Zm as De,Zs as Oe,_h as ke,ah as Ae,bg as je,bh as Me,ch as Ne,dh as x,eM as Pe,ec as Fe,eh as Ie,fh as Le,gh as Re,hg as ze,hh as Be,ih as Ve,jh as He,kh as Ue,lh as We,mg as Ge,mh as Ke,nh as qe,oh as Je,ph as Ye,qs as Xe,rh as Ze,sh as Qe,tM as S,tc as $e,th as et,uh as tt,vg as nt,vh as rt,wg as it,wh as at,xg as ot,xh as st,yg as ct,yh as lt,zh as ut,zs as dt,zt as ft}from"./dist-CGzSsL4i.js";import{i as C,r as pt}from"./dist-Cy-5Eo9H.js";import{t as mt}from"./chevrons-up-down-C-bHailH.js";import{i as ht,n as w,o as gt,r as _t,s as vt}from"./FieldLabel-RnB1EBjO.js";import{i as yt,n as bt,r as xt,t as St}from"./tabs-Cd17i-th.js";import{t as Ct}from"./button-D5AXX04a.js";import{At as T,C as E,Kt as wt,Nt as D,Q as Tt,S as O,X as Et,Xt as Dt,Yt as k,Z as Ot,b as A,ct as j,dt as kt,et as M,ft as At,ht as jt,lt as N,m as Mt,mt as Nt,p as Pt,qt as Ft,tt as P,ut as It,w as F,x as I,xt as Lt,z as Rt,zt}from"./index-B0Kloary.js";import{r as Bt}from"./locales-CPjguROj.js";import{a as Vt,i as L,n as R,o as z,r as B,t as V}from"./table-BDhz0ajJ.js";import{t as Ht}from"./FilterBar-Dy10_IPZ.js";import{a as H,n as Ut,o as U,r as W,s as Wt,t as Gt}from"./compatView-DWV4JVj_.js";import{t as G}from"./dispatchErrorInfo-BtpDRwp-.js";var Kt=u(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),qt=u(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=t(e(),1);function Jt(e){return e.filter(e=>e.state===`error`)}function Yt(e){return e.reachable&&Jt(e.targets).length===0}function Xt(e){return e.state===`error`&&e.lastErrorCode!==null}function Zt(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function Qt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function $t(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Qt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,en={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function tn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function nn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function rn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function an(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return U(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function on(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=rn(t.key,e),a=rn(t.key,r);return i&&a?0:i?1:a?-1:n*an(t.key,e,r)})}function sn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function cn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function ln(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>U(e,t)??Z(e,t))}var Q=n();function un({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(en),[i,a]=(0,K.useState)(null),o=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),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,K.useMemo)(()=>sn(o),[o]),c=(0,K.useMemo)(()=>cn(o),[o]),l=(0,K.useMemo)(()=>ln(o),[o]),u=(0,K.useMemo)(()=>on(nn(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,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Be()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Ht,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Le(),onReset:()=>r(en),canReset:tn(n),children:[(0,Q.jsxs)(A,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(E,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{placeholder:tt()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(O,{value:Y,children:x()}),s.map(e=>(0,Q.jsx)(O,{value:e,children:fn(e)},e))]})]}),(0,Q.jsxs)(A,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(E,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(F,{placeholder:We()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(O,{value:Y,children:x()}),c.map(e=>(0,Q.jsx)(O,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(A,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(E,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{placeholder:Ne()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(O,{value:Y,children:x()}),l.map(e=>(0,Q.jsx)(O,{value:e,children:e},e))]})]})]}),u.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Qe()}):(0,Q.jsxs)(V,{className:`oc-conn__table`,children:[(0,Q.jsx)(Vt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:Je(),sortKey:`target`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Ae(),sortKey:`state`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Ve(),sortKey:`instance`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Ze(),sortKey:`host`,sort:i,onSort:d}),(0,Q.jsx)($,{label:qe(),sortKey:`version`,sort:i,onSort:d}),(0,Q.jsx)(L,{children:et()}),(0,Q.jsx)($,{label:Ie(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Q.jsx)(R,{children:u.map(e=>(0,Q.jsx)(dn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(L,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(pt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(C,{size:13,"aria-hidden":!0}):(0,Q.jsx)(mt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function dn({r:e}){let t=Xt(e)?G(e.lastErrorCode):null,n=Zt(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(z,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(B,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(pn,{state:e.state})}),(0,Q.jsx)(B,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(B,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:Ke({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(B,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:P(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(z,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(B,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${P(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ye({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${P(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function fn(e){return e===`connected`?r():e===`error`?de():De()}function pn({state:e}){return e===`connected`?(0,Q.jsx)(j,{variant:`secondary`,children:r()}):e===`error`?(0,Q.jsx)(j,{variant:`destructive`,children:de()}):(0,Q.jsx)(j,{variant:`outline`,children:De()})}function mn(){return S(p.bridgeHealth.getBridgeHealth,{})}function hn(){let e=mn(),t=S(p.compat.getBridgeCompat,{}),n=S(p.me.getMe,{host:Lt})?.role===`admin`,r=S(p.admin.listInstances,n?{}:`skip`),i=S(p.agents.usageForInstances,n?{}:`skip`),a=k(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),c=$t(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=Dt({from:`/settings/bridge`}),u=k({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,m=d!==null&&Ut(d,`hermes`)&&!c.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(gn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:ae()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:He()}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(Vt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)(L,{children:be()}),(0,Q.jsx)(L,{children:_()}),(0,Q.jsx)(L,{children:Se()}),(0,Q.jsx)(L,{children:s()}),(0,Q.jsx)(L,{children:ft()})]})}),(0,Q.jsx)(R,{children:i.flatMap(e=>{let t=Mt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(z,{children:[(0,Q.jsx)(B,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(B,{children:t.provider}),(0,Q.jsx)(B,{children:t.label}),(0,Q.jsx)(B,{children:(0,Q.jsxs)(j,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(B,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,c.length>0?(0,Q.jsxs)(St,{value:c.some(e=>e.key===l)?l:c[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Q.jsx)(xt,{className:`w-full`,children:c.map(e=>(0,Q.jsxs)(yt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(D,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),c.map(e=>(0,Q.jsx)(bt,{value:e.key,children:(0,Q.jsx)(_n,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:dt()}):null]})}function gn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(t.bridgeVersion)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:i(),children:[`(`,a,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,fe({build:t.buildVersion??`?`})]}):null,` · `,Oe(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?Te():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:at()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:l()});let s=Jt(e.targets),c=!e.reachable,u=Yt(e),d=u?`ok`:`error`,f=M(e.checkedAt),p=e.startedAt==null?null:M(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u?(0,Q.jsx)(wt,{size:22}):c?(0,Q.jsx)(qt,{size:22}):(0,Q.jsx)(T,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:u?he():c?st():Me({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Kt,{size:12,"aria-hidden":!0}),` `,lt({time:f})]}),p?(0,Q.jsx)(`span`,{children:rt({time:p})}):null,o]}),c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:ke()})]})}function _n({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Wt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Gt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(D,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),f?(0,Q.jsx)(j,{variant:f===`beyond`?`destructive`:`secondary`,children:W(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:$e()}),(0,Q.jsx)(yn,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(vn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(C,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Ft,{size:13,"aria-hidden":!0}),Re({count:t.length})]}),p?(0,Q.jsx)(un,{connections:t,displayByInstance:c}):null]})}function vn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[a(),i.length>0?(0,Q.jsx)(j,{variant:`destructive`,children:ce({count:i.length})}):(0,Q.jsx)(j,{variant:`secondary`,children:Ue()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[f({version:e.vendoredVersion}),r?` · `+m({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(C,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Ft,{size:13,"aria-hidden":!0}),_e({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function yn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:at()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:b({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:Xe({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:Te()}),e?(0,Q.jsx)(Cn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(e.version)}),(0,Q.jsx)(j,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:W(e.state)})]},e.instanceName))})]})}function bn({instance:e,onClose:t}){return(0,Q.jsx)(It,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(kt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Nt,{children:[(0,Q.jsx)(jt,{children:se({instance:e.displayName??e.name})}),(0,Q.jsx)(At,{children:d()})]}),(0,Q.jsx)(Sn,{instance:e,onClose:t})]})})}function xn({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(wt,{"aria-hidden":!0}):(0,Q.jsx)(T,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?v():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,h()]}):null}function Sn({instance:e,onClose:t}){let n=Pe(p.admin.upsertInstanceConfig),r=ue(p.bridge.validateMediaPaths),i=Rt(),a=Bt(e.config?.contentLocale,void 0),[s,l]=(0,K.useState)(()=>ht(e.config??{},a)),[u,d]=(0,K.useState)(!1),[f,m]=(0,K.useState)(!1),[h,g]=(0,K.useState)(null),_=s.inboundMediaMode===`shared-fs`,v=s.mediaMode===`shared-fs`,y=_||v;async function re(){m(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error(o(),e)}finally{m(!1)}}async function b(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(s,r,a)}),t()}catch(e){i.error(je(),e)}finally{d(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:ge(),help:ct()}),(0,Q.jsxs)(A,{value:s.mediaMode,onValueChange:e=>l({...s,mediaMode:e}),children:[(0,Q.jsx)(E,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(I,{children:vt.map(e=>(0,Q.jsx)(O,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:it(),help:nt()}),(0,Q.jsxs)(A,{value:s.inboundMediaMode,onValueChange:e=>l({...s,inboundMediaMode:e}),children:[(0,Q.jsx)(E,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(I,{children:gt.map(e=>(0,Q.jsx)(O,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:c(),help:ze()}),(0,Q.jsx)(N,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>l({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:ne(),help:ee()}),(0,Q.jsx)(N,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>l({...s,inboundAgentMount:e.target.value})})]}),v&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:Ce(),help:ve()}),(0,Q.jsx)(N,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>l({...s,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Pt,{checked:s.rehydration,onCheckedChange:e=>l({...s,rehydration:e===!0})}),(0,Q.jsx)(w,{label:me(),help:Ge()})]}),y&&h!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(T,{"aria-hidden":!0}),oe({reason:h.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xn,{label:pe(),result:h.inbound}),(0,Q.jsx)(xn,{label:ie(),result:h.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ut()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(T,{"aria-hidden":!0}),le()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Q.jsxs)(Ct,{variant:`outline`,size:`sm`,onClick:()=>void re(),disabled:f,children:[f?(0,Q.jsx)(zt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?xe():te()]}),(0,Q.jsx)(Ct,{size:`sm`,onClick:()=>void b(),disabled:u,children:ot()})]})]})})}function Cn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Et,{children:[(0,Q.jsx)(Tt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?re():g({count:e.length}),(0,Q.jsx)(C,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Ot,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:we()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(j,{variant:`secondary`,children:e},e))})]})]})}export{hn as BridgeTab,bn as InstanceConfigDialog};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ai as r,Bc as i,Di as a,E as o,Eg as s,Fi as c,Gt as l,Ii as u,Kj as d,Mi as f,Ni as p,Oi as m,Pi as h,Qj as g,Sl as _,_l as v,ac as y,cc as b,eM as x,ic as S,ji as C,ki as w,lc as T,nc as E,oc as D,rc as O,sc as k,tM as A,uc as j,vl as M,wl as N}from"./dist-CGzSsL4i.js";import{t as P}from"./button-D5AXX04a.js";import{At as F,C as I,S as L,b as R,d as z,f as B,lt as V,p as H,w as U,x as W,y as G}from"./index-B0Kloary.js";import{i as K}from"./compatView-DWV4JVj_.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(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 X=n();function Z({instance:e}){let t=x(o.admin.upsertInstanceConfig),n=A(o.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,q.useState)(r),[s,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(r),c(`idle`)},[e._id,r]);let l=`__none__`,u=i!==r;async function d(){c(`saving`);try{let n={...e.config??{}};i===``||i===l?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}let m=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(R,{value:i===``?l:i,onValueChange:e=>a(e===l?``:e),children:[(0,X.jsx)(I,{className:`oc-cdefaults__select`,"aria-label":p(),children:(0,X.jsx)(U,{placeholder:C()})}),(0,X.jsxs)(W,{children:[(0,X.jsx)(L,{value:l,children:C()}),m.map(e=>(0,X.jsx)(L,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!u||s===`saving`,onClick:()=>void d(),children:s===`saving`?N():S()})]}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null]})}function Q({instance:e}){let t=x(o.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,s]=(0,q.useState)(n),[c,l]=(0,q.useState)(i===null?``:String(i)),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(n),l(i===null?``:String(i)),d(`idle`)},[e._id,n,i]);let f=c.trim(),p=f===``?null:/^\d+$/.test(f)?Number.parseInt(f,10):NaN,g=!a||p===null||Number.isInteger(p)&&p>=4e3&&p<=6e4,_=a!==n||(p??null)!==i;async function v(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||p===null||Number.isNaN(p)?delete n.curationBudgetChars:n.curationBudgetChars=p,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(H,{checked:a,onCheckedChange:e=>s(e===!0),"aria-label":h()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:h()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":r(),disabled:!a}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!g||u===`saving`,onClick:()=>void v(),children:u===`saving`?N():S()})]}),g?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:w()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:m()})]})}function $({instance:e}){let t=x(o.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[s,l]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),l(`idle`)},[e._id,n]);let d=r.trim(),f=d===``?null:/^\d+$/.test(d)?Number.parseInt(d,10):NaN,p=f===null||Number.isInteger(f)&&f>=1e3&&f<=2e5,m=(f??null)!==n;async function h(){l(`saving`);try{let n={...e.config??{}};f===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=f,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p}),(0,X.jsx)(P,{size:`sm`,disabled:!m||!p||s===`saving`,onClick:()=>void h(),children:s===`saving`?N():S()})]}),p?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:a()}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()})]})}function ee(){let e=g(o.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=A(o.admin.listInstances,{}),[a,c]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!a||!r.some(e=>e.name===a))&&c(r[0].name)},[r,a]);let u=(r?.length??0)>1,f=r!==void 0&&r.length===0,p=A(o.compat.forInstance,a?{instanceName:a}:`skip`),m=a?G(p,`configDefaults`):`loading`,h=m===`loading`?null:m.blocked,x=(0,q.useMemo)(()=>u&&a?{instanceName:a}:{},[u,a]),S=(0,q.useRef)(0),C=(0,q.useCallback)(async()=>{let t=++S.current;n({status:`loading`});try{let r=Y(await e(x));if(S.current!==t)return;n({status:`done`,current:r})}catch{if(S.current!==t)return;n({status:`error`})}},[e,x]);(0,q.useEffect)(()=>{h===!1&&(u&&!a||C())},[C,h,u,a]);let w=t.status===`done`?t.current:null,E=(0,q.useMemo)(()=>J.map(e=>({id:e,label:B(e)})),[]),O=(0,q.useMemo)(()=>[{id:`fast`,label:M()},{id:`standard`,label:v()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),u&&a?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,X.jsxs)(R,{value:a,onValueChange:e=>c(e),children:[(0,X.jsx)(I,{size:`sm`,"aria-label":i(),children:(0,X.jsx)(U,{})}),(0,X.jsx)(W,{children:(r??[]).map(e=>(0,X.jsx)(L,{value:e.name,children:e.name},e.name))})]})]}):null,f?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:s()}):m===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):m.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(F,{size:14,"aria-hidden":!0}),` `,K(m.gatewayVersion,m.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[y(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:_()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,X.jsx)(z,{options:E,value:w?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:b()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,X.jsx)(z,{options:O,value:w===null||w.fastModeDefault===null?null:w.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:D()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:l()})]}),(()=>{let e=r?.find(e=>e.name===(a??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cf as r,Ef as i,Sf as a,Tf as o,bf as s,wf as c,xf as l}from"./dist-DxRkWXyO.js";import{i as u,r as d}from"./dist-DsZthEtc.js";import{t as f}from"./chevrons-up-down-De8tZoyW.js";import{t as p}from"./button-LIt-3xv6.js";import{Ht as m,It as h,it as g,jt as _,nt as v,ot as y,p as b,rt as x,st as S}from"./index-DA0_EAyp.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-BWvBHDcJ.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=i(),bulkActions:F,emptyHint:I=o(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(_,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(h,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(b,{"aria-label":r(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":s({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(b,{"aria-label":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)(v,{children:[(0,M.jsx)(S,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(x,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(y,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cf as r,Df as i,Ef as a,Of as o,Tf as s,kf as c,wf as l}from"./dist-CGzSsL4i.js";import{i as u,r as d}from"./dist-Cy-5Eo9H.js";import{t as f}from"./chevrons-up-down-C-bHailH.js";import{t as p}from"./button-D5AXX04a.js";import{Ht as m,It as h,it as g,jt as _,nt as v,ot as y,p as b,rt as x,st as S}from"./index-B0Kloary.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-BDhz0ajJ.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=c(),bulkActions:F,emptyHint:I=o(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(_,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(h,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(b,{"aria-label":a(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":r({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(b,{"aria-label":s(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(S,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(x,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(y,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{ct as t}from"./index-DA0_EAyp.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{ct as t}from"./index-B0Kloary.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,AC as i,BS as a,CC as o,DC as s,E as c,EC as l,FC as u,FS as d,GS as f,HS as p,IC as m,IS as h,JS as g,Jr as _,KS as ee,Kr as te,LS as ne,MC as re,NC as ie,OC as v,PC as y,QS as b,RS as x,SC as S,TC as C,US as w,VS as T,WS as E,XS as D,YS as O,ZS as k,_C as A,aC as j,bC as M,cC as N,dC as P,eC as F,eM as I,fC as L,gC as R,hC as z,iC as B,jC as V,kC as ae,lC as H,mC as U,nC as W,oC as G,pC as K,qS as q,rC as J,sC as oe,tC as se,tM as ce,uC as le,vC as ue,wC as de,xC as fe,yC as pe,zS as me}from"./dist-CGzSsL4i.js";import{t as he}from"./button-D5AXX04a.js";import{B as ge,et as _e}from"./index-B0Kloary.js";import{t as Y}from"./DataTableShell-Bzopt4OT.js";var X=t(e(),1),Z=n(),ve={altered_words:()=>m(),incorrect:()=>u(),incoherence:()=>y(),formatting:()=>ie(),latency:()=>re(),api_error:()=>V(),other:()=>i()},Q=e=>ve[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:v()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:s()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ae()})}function ye({data:e,closeReason:t}){let n=e.snapshot,r=I(c.feedback.respondToFeedback),[i,a]=(0,X.useState)(e.thread),[s,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(!1);async function p(){let t=s.trim();if(!(!t||d)){f(!0);try{await r({feedbackId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{f(!1)}}}let m=[];try{m=n.contextJson?JSON.parse(n.contextJson):[]}catch{m=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${l()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:T()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:de()}),i.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?o():e.authorRole===`agent`?e.authorLabel??_():S()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:fe()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:M(),value:s,maxLength:2e3,rows:3,onChange:e=>u(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(he,{size:`sm`,onClick:()=>void p(),disabled:!s.trim()||d,children:d?pe():ue()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||R()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||R()})]}):null,n.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,m.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K({count:n.contextCount??m.length,truncated:n.contextTruncated?L():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:m.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:P()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?N({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[oe(),` `,n.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,G()]})]}):null,n.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function be(){let e=ce(c.feedback.listForAdmin,{}),t=I(c.feedback.readSnapshot),n=I(c.feedback.deleteFeedback),i=ge(),[o,s]=(0,X.useState)(null),[l,u]=(0,X.useState)({});async function m(e){if(o===e._id){s(null);return}if(!l[e._id]){let n=await t({feedbackId:e._id});u(t=>({...t,[e._id]:n}))}s(e._id)}async function _(e){await i({title:ne(),description:h(),confirmLabel:d(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[j(),` `,(0,Z.jsx)(`strong`,{children:B()}),` `,J()]}),(0,Z.jsx)(Y,{title:W(),rows:e,emptyHint:se(),isExpanded:e=>o===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Z.jsx)(ye,{data:l[e._id],closeReason:e.userCloseReason}):null,columns:[{header:F(),cell:e=>_e(e.at),sort:e=>e.at},{header:r(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:b(),cell:e=>e.messageRole===`user`?k():D(),sort:e=>e.messageRole},{header:O(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${g({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:q(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ee(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:f(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:E()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:w()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:te()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:p()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?a():me(),onSelect:()=>void m(e)},{label:x(),onSelect:()=>void _(e),variant:`destructive`}]})]})}export{be as FeedbacksTab};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,rM as n}from"./dist-DxRkWXyO.js";import{_ as r,g as i,h as a,v as o}from"./index-DA0_EAyp.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,cM as n}from"./dist-CGzSsL4i.js";import{_ as r,g as i,h as a,v as o}from"./index-B0Kloary.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
2
2
  Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`,en:`[DELIVERY]
3
3
  To make a file you generate downloadable by the user in this webchat: write it under {outboundDir}/ then add, in your final reply, a dedicated line EXACTLY in the format MEDIA:<absolute file path>. Do NOT use a markdown link to a local path — it would not be clickable.`}},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:{fr:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
4
4
  {references}`,en:`Provide the downloadable source files matching EXACTLY these document references (one file per reference, named after the reference). Reply only with the files, no commentary:
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,Cj as i,E as a,Ej as o,FE as s,GA as ee,JA as te,Jj as ne,KA as re,Kj as ie,QA as ae,Qr as c,Sj as l,Tj as u,XA as oe,YA as se,ZA as ce,Zr as le,_j as ue,aj as de,bj as fe,cj as pe,dj as d,eM as me,ej as he,fj as f,gj as ge,hj as p,ij as _e,lj as m,mj as h,nj as ve,oj as ye,pj as g,qA as be,rj as xe,sj as Se,tM as _,tj as v,uj as y,vj as b,wj as x,xj as S,yj as C}from"./dist-CGzSsL4i.js";import{t as w}from"./button-D5AXX04a.js";import{C as T,Ft as E,G as D,H as O,Ht as k,J as A,K as j,S as M,U as Ce,Ut as N,W as we,Y as Te,b as P,ct as F,it as I,jt as Ee,nt as De,p as Oe,q as ke,rt as Ae,st as je,w as L,x as R,z as Me}from"./index-B0Kloary.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-BDhz0ajJ.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return p();case`audio`:return h();case`video`:return g();case`pdf`:return f();case`document`:return d();case`archive`:return y();default:return m()}}function K(){let[e,t]=(0,H.useState)(W),[n,d]=(0,H.useState)(W),[f,p]=(0,H.useState)(W),[m,h]=(0,H.useState)(W),[g,y]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=me(a.files.softDelete),Y=Me();function Ie(){t(W),d(W),p(W),h(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(ae())}catch(e){Y.error(ce(),e)}}let X=_(a.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:f===W?void 0:f,category:m===W?void 0:m,includeAutoGenerated:g||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(ne(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ie()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||f!==W||m!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(P,{value:e,onValueChange:t,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":u(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:x()}),(0,U.jsx)(M,{value:`inbound`,children:i()}),(0,U.jsx)(M,{value:`outbound`,children:l()})]})]}),(0,U.jsxs)(P,{value:n,onValueChange:d,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":S(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:fe()}),Q.chats.map(e=>(0,U.jsx)(M,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(P,{value:f,onValueChange:p,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":C(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:b()}),Q.instances.map(e=>(0,U.jsx)(M,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(P,{value:m,onValueChange:h,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":ue(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:ge()}),Q.categories.map(e=>(0,U.jsx)(M,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:g,onCheckedChange:e=>y(e===!0),"aria-label":c()}),(0,U.jsx)(`span`,{children:c()})]}),$?(0,U.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(E,{size:14,"aria-hidden":!0}),v()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?re():be()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:pe()}),(0,U.jsx)(z,{children:Se()}),(0,U.jsx)(z,{children:ye()}),(0,U.jsx)(z,{children:de()}),(0,U.jsx)(z,{children:_e()}),(0,U.jsx)(z,{className:`text-right`,children:xe()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(F,{variant:`outline`,style:{marginLeft:6},children:le()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(F,{variant:`secondary`,children:e.direction===`inbound`?i():l()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(De,{children:[(0,U.jsx)(je,{asChild:!0,children:(0,U.jsx)(w,{variant:`ghost`,size:`icon`,"aria-label":he(),children:(0,U.jsx)(k,{size:16})})}),(0,U.jsxs)(Ae,{align:`end`,children:[e.url?(0,U.jsx)(I,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(N,{size:14}),ve()]})}):(0,U.jsxs)(I,{disabled:!0,children:[(0,U.jsx)(N,{size:14}),te()]}),(0,U.jsxs)(I,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),r()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ee({cap:Be})}):null]}),(0,U.jsx)(O,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(D,{children:[(0,U.jsxs)(A,{children:[(0,U.jsx)(Te,{children:oe()}),(0,U.jsx)(j,{children:se()})]}),(0,U.jsxs)(ke,{children:[(0,U.jsx)(we,{children:s()}),(0,U.jsx)(Ce,{onClick:()=>void Le(),children:r()})]})]})})]})}export{K as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Df as r,Of as i}from"./dist-DxRkWXyO.js";import{t as a}from"./button-LIt-3xv6.js";import{Ft as o,Pt as s,lt as c}from"./index-DA0_EAyp.js";import{t as l}from"./TimeRangePicker-DZi8tuoy.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(c,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),r()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Af as r,jf as i}from"./dist-CGzSsL4i.js";import{t as a}from"./button-D5AXX04a.js";import{Ft as o,Pt as s,lt as c}from"./index-B0Kloary.js";import{t as l}from"./TimeRangePicker-CZSYqXhd.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(c,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),r()]})]})}export{p as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,Au as i,Bl as a,Bu as o,Cu as s,D as c,Du as l,E as u,Eu as d,Fu as f,Gl as p,Gu as m,Hl as h,Hu as g,Il as _,Iu as v,Jl as y,Kl as b,Ll as x,Lu as ee,Mu as S,Nu as C,Ou as te,Pu as w,Ql as T,Rl as E,Ru as ne,Su as D,Tu as re,Ul as O,Uu as k,Vl as A,Vu as j,Wl as M,Wu as ie,Xl as N,Yl as P,Zl as F,_u as ae,au as oe,bu as se,cu as I,du as ce,eM as L,eu as le,fu as ue,gu as R,hu as de,iu as fe,ju as pe,ku as me,lu as he,mu as ge,nu as _e,ou as ve,pu as ye,ql as be,ru as xe,su as z,tM as B,tu as Se,uu as Ce,vu as we,wu as Te,xu as Ee,yu as De,zl as Oe,zu as ke}from"./dist-CGzSsL4i.js";import{t as Ae}from"./x-CQuunpf5.js";import{i as V,n as H,r as je,t as Me}from"./tabs-Cd17i-th.js";import{t as U}from"./button-D5AXX04a.js";import{B as Ne,C as Pe,Jt as Fe,Mt as W,Nt as G,S as Ie,b as Le,ct as K,dt as Re,ft as ze,ht as Be,lt as q,mt as Ve,p as J,qt as He,u as Ue,ut as We,w as Ge,x as Ke,xt as qe,z as Y}from"./index-B0Kloary.js";import{t as Je}from"./FilterBar-Dy10_IPZ.js";import{t as Ye}from"./DataTableShell-Bzopt4OT.js";import{t as X}from"./DetailChips-PKnLEOOY.js";var Xe=c(`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`}]]),Z=c(`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`}]]),Ze=c(`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`}]]),Q=t(e(),1);function Qe(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 $e(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 et(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 tt(e){switch(e){case`admin`:return ue();case`user`:return ce();case`pending`:return Ce();default:return e}}function nt(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 rt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var $=n(),it={name:``,description:``};function at(){let e=B(u.groups.listGroups,{}),t=B(u.me.getMe,{host:qe})?.role===`admin`,n=L(u.groups.createGroup),r=L(u.groups.updateGroup),a=L(u.groups.deleteGroup),s=Ne(),c=Y(),[p,h]=(0,Q.useState)(!1),[_,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(it),[T,D]=(0,Q.useState)(null),[O,A]=(0,Q.useState)(``),M=(0,Q.useMemo)(()=>{if(!e)return e;let t=O.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,O]);function N(){y(null),x(it),h(!0)}function P(e){y(e),x({name:e.name,description:e.description??``}),h(!0)}async function F(){try{_?await r({groupId:_._id,name:b.name,description:b.description}):await n({name:b.name,description:b.description||void 0}),x(it),y(null),h(!1)}catch(e){c.error(Oe(),e)}}async function ae(e){if(await s({title:d({name:e.name}),description:re(),confirmWord:e.name,confirmLabel:Te(),cancelLabel:S(),destructive:!0}))try{await a({groupId:e._id})}catch(e){c.error(E(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,$.jsx)(Je,{q:O,onQChange:A,onReset:()=>A(``),canReset:O!==``,searchPlaceholder:ee()}),(0,$.jsx)(Ye,{title:m(),rows:M,addLabel:k(),onAdd:t?N:void 0,emptyHint:g(),columns:[{header:j(),cell:e=>e.name,sort:e=>e.name},{header:o(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Z,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:ke(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(G,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ne(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Xe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:v(),onSelect:()=>D({groupId:e._id,name:e.name})},...t?[{label:f(),onSelect:()=>P(e)},{label:w(),variant:`destructive`,onSelect:()=>void ae(e)}]:[]]}),(0,$.jsx)(Ue,{open:p,onOpenChange:h,title:_?i():pe(),description:me(),canSubmit:!!b.name.trim(),onSubmit:F,submitLabel:C(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,$.jsx)(q,{value:b.name,onChange:e=>x({...b,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:l()}),(0,$.jsx)(q,{value:b.description,onChange:e=>x({...b,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:T?.groupId??null,groupName:T?.name??``,open:T!==null,onOpenChange:e=>{e||D(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Fe,{size:14,"aria-hidden":!0}),de()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ye({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ge(),(0,$.jsx)(He,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=B(u.groups.getGroup,n&&e?{groupId:e}:`skip`),a=B(u.groups.listAssignableInstances,n?{}:`skip`),o=B(u.groups.listAssignableUsers,n?{}:`skip`),c=L(u.groups.addMember),l=L(u.groups.removeMember),d=L(u.groups.bulkSetMembers),f=L(u.groups.setGroupManager),p=Y(),[m,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(`members`),[ee,S]=(0,Q.useState)(1),[C,te]=(0,Q.useState)(new Set),w=(0,Q.useRef)(null),E=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),ne=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),re=i?.viewerIsAdmin===!0,k=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Q.useEffect)(()=>{g(``),v(``),b(`members`),S(1),w.current=null},[n,e]),(0,Q.useEffect)(()=>{S(1)},[m]),(0,Q.useEffect)(()=>{n&&i&&e&&w.current!==e&&(w.current=e,te(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let j=(0,Q.useMemo)(()=>o?Qe(o,m,C):[],[o,m,C]);async function ie(t,n){if(e)try{n?await l({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){p.error(x(),e)}}async function N(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(A(),e)}}let P=nt(j,e=>E.has(e.userId)),F=j.filter(e=>E.has(e.userId)).length,I=rt(j,ee,ot);async function ce(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:P!==`all`})}catch(e){p.error(x(),e)}}return(0,$.jsx)(We,{open:n,onOpenChange:r,children:(0,$.jsxs)(Re,{className:`oc-access`,children:[(0,$.jsxs)(Ve,{children:[(0,$.jsx)(Be,{children:s({name:t})}),(0,$.jsx)(ze,{children:D()})]}),(0,$.jsxs)(Me,{value:y,onValueChange:b,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),Ee(),i?(0,$.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:E.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(G,{size:13,"aria-hidden":!0}),De(),i?(0,$.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),T(),i?(0,$.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:o===void 0||i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):o.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:oe()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:m,onChange:e=>g(e.target.value),placeholder:se(),className:`oc-access__search`}),j.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):(0,$.jsxs)($.Fragment,{children:[j.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(J,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":R()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,$.jsxs)(K,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,j.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=E.has(e.userId),n=et(e),r=ne.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(J,{checked:t,onCheckedChange:()=>void ie(e.userId,t),"aria-label":he({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(K,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&re?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?h():O(),title:r?h():O(),onClick:()=>void N(e.userId,r),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":M(),title:M(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:I.page,pageCount:I.pageCount,onPage:S})]})]})}),(0,$.jsx)(H,{value:`agents`,children:a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()}):a.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:_,onChange:e=>v(e.target.value),placeholder:we(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:a.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:_},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:i,query:a}){let o=B(u.groups.listAssignableAgents,{instanceName:t}),s=L(u.groups.assignAgentToGroup),c=L(u.groups.removeAgentFromGroup),l=L(u.groups.bulkSetGroupAgents),d=Y(),[f,p]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{p(1)},[a]),!e)return null;let m=$e(o?.agents??[],a),h=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),v=nt(g,e=>i.has(`${t}/${e.agentId}`)),y=rt(m,f,ot);async function b(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(_(),e)}}async function x(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){d.error(_(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(G,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(K,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,$.jsx)(K,{variant:`outline`,className:`oc-access__stale`,children:Se()}):null]}),o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ve()}):m.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:h?_e():xe()}):(0,$.jsxs)($.Fragment,{children:[g.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(J,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":R()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,a=i.has(n),o=e.presentInLastOk===!1,s=!e.enabled;return(0,$.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,$.jsx)(J,{checked:a,disabled:(o||s)&&!a,onCheckedChange:()=>void b(e.agentId,a),"aria-label":I({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":r(),title:r(),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):null,o?(0,$.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:le()}):null]},e.agentId)}),(0,$.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=B(u.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=L(u.charts.assignChartToGroup),r=L(u.charts.removeChartFromGroup),i=L(u.charts.setGroupDefaultChart),o=L(u.charts.addChartToGroupPool),s=L(u.charts.removeChartFromGroupPool),c=Y();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:z()});let{pool:l,addable:d,canManagePool:f}=t;if(l.length===0&&!f)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:F()});async function m(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(a(),e)}}async function h(t){try{await i({groupId:e,chartKey:t})}catch(e){c.error(a(),e)}}async function g(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(a(),e)}}async function _(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(a(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(J,{checked:e.selected,onCheckedChange:()=>void m(e.chartKey,e.selected),"aria-label":be({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":b(),title:b(),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:p()}):null,f?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":y({name:e.name}),title:y({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),f?d.length>0?(0,$.jsxs)(Le,{value:``,onValueChange:e=>void g(e),children:[(0,$.jsx)(Pe,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ge,{placeholder:P()})}),(0,$.jsx)(Ke,{children:d.map(e=>(0,$.jsx)(Ie,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:N()}):null:null]})}export{at as GroupsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$i as i,$x as a,Ab as o,Ax as s,Bb as c,Bx as l,Cb as u,Cx as d,DD as f,Db as p,Dx as m,E as h,Eb as g,Ex as _,Fb as v,Fx as y,Gb as b,Gx as x,Hb as S,Hx as C,Ib as w,Ix as ee,Jb as T,Jt as E,Jx as te,Kb as ne,Kx as re,Lb as ie,Lx as ae,Mb as oe,Mx as se,Nb as ce,Nx as le,OD as ue,Ob as de,Ox as fe,Pb as pe,Px as me,Qb as he,Qi as ge,Qj as D,Qx as _e,Rb as ve,Rx as ye,Sb as be,Sx as xe,Tb as Se,Tx as Ce,Ub as we,Ux as Te,Vb as Ee,Vx as De,Wb as Oe,Wx as ke,Xb as Ae,Xt as je,Xx as Me,Yb as Ne,Yt as Pe,Yx as Fe,Zb as Ie,Zi as Le,Zx as Re,_g as ze,_x as Be,aS as Ve,ax as He,bx as Ue,cx as We,dx as Ge,eM as O,eS as Ke,ea as qe,ex as Je,fx as Ye,gg as Xe,gx as Ze,hx as Qe,iS as $e,ix as et,jb as tt,jx as nt,kb as rt,kx as it,lx as at,mx as ot,nS as st,nx as ct,oS as lt,ox as ut,px as k,qb as A,qx as j,rS as dt,rx as ft,sS as pt,sx as mt,tM as M,tS as ht,tx as gt,ux as _t,vx as vt,wb as yt,wx as N,xb as bt,xx as xt,yx as St,zb as Ct,zx as wt}from"./dist-CGzSsL4i.js";import{a as Tt,c as Et}from"./FieldLabel-RnB1EBjO.js";import{t as P}from"./button-D5AXX04a.js";import{B as Dt,C as F,Q as Ot,S as I,X as kt,Z as At,b as L,ct as R,dt as z,ft as B,ht as V,lt as H,mt as U,p as W,u as jt,ut as G,w as K,x as q,z as J}from"./index-B0Kloary.js";import{t as Mt}from"./DataTableShell-Bzopt4OT.js";import{InstanceConfigDialog as Nt}from"./BridgeTab-Cg51jMGo.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],Pt=new Set(X),Ft=`conversational`;function It(e){let t=new Set((e??[]).filter(e=>Pt.has(e)));return t.size===0?[Ft]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Tt},Lt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Rt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function zt(){let e=M(h.admin.listInstances,{}),t=M(h.agents.listAllInstanceAgents,{}),n=O(h.admin.upsertInstance),r=O(h.admin.deleteInstance),i=J(),[o,c]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(Q),[f,p]=(0,Y.useState)(null),[m,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[b,S]=(0,Y.useState)(null);async function w(){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,transport:u.kind===`hermes`?u.transport:void 0,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),d(Q),S(null),c(!1)}catch(e){i.error(Ve(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[$e(),(0,Z.jsx)(`strong`,{children:dt()}),st()]}),(0,Z.jsx)(Mt,{title:ht(),rows:e,addLabel:Ke(),onAdd:()=>{S(null),d(Q),c(!0)},emptyHint:a(),columns:[{header:_e(),cell:e=>e.name,sort:e=>e.name},{header:Re(),cell:e=>(0,Z.jsx)(R,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Me(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Fe(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:pt(),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)(R,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?be():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:x(),onSelect:()=>{S(e._id),d(Rt(e)),c(!0)}},{label:lt(),onSelect:()=>p(e.name)},{label:s(),onSelect:()=>v(e)},{label:te(),onSelect:()=>g(e)},{label:j(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:j(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(jt,{open:o,onOpenChange:c,title:b?ke():re(),description:C(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:w,submitLabel:De(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:l(),children:[(0,Z.jsx)(H,{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:Te()}):null]}),(0,Z.jsx)($,{label:wt(),children:(0,Z.jsxs)(L,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(I,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(I,{value:`hermes`,children:`Hermes`})]})]})}),u.kind===`hermes`?(0,Z.jsx)($,{label:je(),children:(0,Z.jsxs)(L,{value:u.transport,onValueChange:e=>d({...u,transport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(I,{value:`ws`,children:Pe()}),(0,Z.jsx)(I,{value:`rest`,children:E()})]})]})}):null,(0,Z.jsx)($,{label:ye(),children:(0,Z.jsx)(H,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:ae(),children:(0,Z.jsx)(H,{value:u.bridgeUrl,placeholder:ee(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:y(),children:(0,Z.jsx)(H,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:ze(),children:[(0,Z.jsxs)(L,{value:u.streamTransport,onValueChange:e=>d({...u,streamTransport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsx)(q,{children:Et.map(e=>(0,Z.jsx)(I,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Xe()})]}),(0,Z.jsx)($,{label:me(),children:(0,Z.jsx)(H,{value:u.gatewayVersion,placeholder:le(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:se(),children:(0,Z.jsx)(H,{value:u.gatewayHttpUrl,placeholder:nt(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Yt,{instanceName:f,open:f!==null,onOpenChange:e=>{e||p(null)}}),m?(0,Z.jsx)(Nt,{instance:m,onClose:()=>g(null)},m._id):null,_?(0,Z.jsx)(Bt,{instance:_,onClose:()=>v(null)},_._id):null]})}function Bt({instance:e,onClose:t}){let n=M(h.instanceSecrets.listInstanceSecretStatus,{}),r=Lt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(G,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(z,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{children:it({instance:e.displayName??e.name})}),(0,Z.jsx)(B,{children:fe()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Ut,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ht,{instance:e})}),(0,Z.jsx)(Vt,{instance:e})]})})}function Vt({instance:e}){let t=D(h.instanceSync.forceInstanceSync),n=J(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(We());break;case`no_agents`:n.success(ut());break;case`no_bridge_url`:n.error(He());break;case`deploy_misconfigured`:n.error(et());break;case`unauthorized`:n.error(ct());break;case`not_served`:n.error(gt());break;default:n.error(ft());break}}catch(e){n.error(mt(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?at():_t()})})]})}function Ht({instance:e}){let t=M(h.bridgeAuth.listBridgeAuthStatus,{}),n=D(h.bridgeAuth.mintBridgeSecret),i=O(h.bridgeAuth.revokeBridgeSecret),a=J(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,p]=(0,Y.useState)(!1),m=(t??[]).find(t=>t.instanceId===e._id),g=m!==void 0;async function _(){if(!o){s(!0);try{l((await n({instanceId:e._id})).plaintext),p(!1)}catch(e){a.error(A(),e)}finally{s(!1)}}}async function v(){if(!o){s(!0);try{await i({instanceId:e._id}),l(null),a.success(T())}catch(e){a.error(A(),e)}finally{s(!1)}}}async function y(){if(c)try{await navigator.clipboard.writeText(c),p(!0)}catch{}}return(0,Z.jsxs)($,{label:r(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:he()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:g?`outline`:`secondary`,children:g?`${N()} · ${m.prefix}…${m.lastFour}`:d()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void _(),disabled:o,children:g?Ae():Ie()}),g?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void v(),disabled:o,children:Ne()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ne()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void y(),children:u?ue():f()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),p(!1)},children:b()})]}):null]})}function Ut({instanceId:e,field:t,updatedAt:n}){let r=D(h.instanceSecrets.setInstanceSecret),i=O(h.instanceSecrets.clearInstanceSecret),a=D(h.deviceIdentity.generateDeviceIdentity),o=J(),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1),[p,g]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),x=n!==null,S=t===`deviceIdentity`,C=t===`token`?m():t===`deviceIdentity`?_():Ce();async function w(){if(!(!s.trim()||l)){u(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),g(null),y(!1),o.success(vt())}catch(e){o.error(Be(),e)}finally{u(!1)}}}async function ee(){if(!l){u(!0);try{await i({instanceId:e,field:t}),g(null),y(!1),o.success(Ze())}catch(e){o.error(Be(),e)}finally{u(!1)}}}async function T(){if(!l){u(!0);try{g(await a({instanceId:e})),y(!1),o.success(k())}catch(e){o.error(Ge(),e)}finally{u(!1)}}}let E=p?`openclaw devices approve ${p.id}`:``;async function te(){if(E)try{await navigator.clipboard.writeText(E),y(!0)}catch{}}return(0,Z.jsxs)($,{label:C,children:[S?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:x?`outline`:`secondary`,children:x?N():d()}),(0,Z.jsx)(H,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:x?xt():xe(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void w(),disabled:l||s.trim().length===0,children:Ue()}),S?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void T(),disabled:l,children:Qe()}):null,x?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void ee(),disabled:l,children:St()}):null]})]}),p?(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:Ye()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:v?ue():f()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{g(null),y(!1)},children:b()})]}):null]})}var Wt={conversational:ie,documentary:v,summarizer:qe,curator:ge},Gt={conversational:w,documentary:pe,summarizer:i,curator:Le},Kt=e=>(Wt[e]??(()=>e))(),qt=e=>(Gt[e]??(()=>``))();function Jt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:Ee()}),t.map(e=>(0,Z.jsx)(R,{variant:`secondary`,className:`oc-agenttype__chip`,title:qt(e),children:Kt(e)},e)),(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(Ot,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:c()})}),(0,Z.jsxs)(At,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Ct()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:ve()}),(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)(W,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Kt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:qt(r)})]})]},r)})})]})]})]})}function Yt({instanceName:e,open:t,onOpenChange:n}){let r=M(h.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=O(h.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(h.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(h.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=O(h.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(h.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(h.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=O(h.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(h.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=It(r);e.setQuery(h.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=O(h.agents.removeInstanceAgent),l=Dt(),d=J();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(S(),e)}}async function m(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){d.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 s({instanceName:e,agentId:t,types:i})}catch(e){d.error(S(),e)}}async function v(t,n){if(e&&await l({title:tt({name:n}),description:o(),confirmLabel:rt(),destructive:!0}))try{await c({instanceName:e,agentId:t}),d.success(de())}catch(e){d.error(S(),e)}}return(0,Z.jsx)(G,{open:t,onOpenChange:n,children:(0,Z.jsxs)(z,{className:`oc-access`,children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{children:Oe({name:e??``})}),(0,Z.jsx)(B,{children:we()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:p()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?g():r.discovery.lastPollOk?Se():yt({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:u()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(W,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void f(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)(R,{variant:`outline`,className:`oc-access__gone`,children:bt()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(e.agentId,i),children:oe()})]}):n?(0,Z.jsx)(R,{variant:`default`,children:be()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void m(e.agentId),children:ce()})]}),e.enabled?(0,Z.jsx)(Jt,{agentId:e.agentId,types:a,onToggle:t=>void _(e.agentId,t,a)}):null]},e.agentId)})})]})]})})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{zt as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BC as r,E as i,GC as a,HC as o,JC as s,KC as c,LC as l,Qj as u,RC as d,UC as f,VC as p,WC as m,XC as h,YC as g,_o as _,bo as v,eM as y,go as b,ho as x,mo as S,po as C,qC as w,tM as T,vo as E,xo as D,yo as O,zC as k}from"./dist-CGzSsL4i.js";import{t as A}from"./button-D5AXX04a.js";import{ct as j,lt as M,p as N}from"./index-B0Kloary.js";var P=t(e(),1),F=n();function I(){let e=T(i.integrations.status.status,{}),t=y(i.admin.setIntegrationConfig),[n,u]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&u(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:h()});let _=n,b=(e,t,n)=>u({..._,[e]:{..._[e],[t]:n}}),x=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),` `,(0,F.jsx)(`strong`,{children:s()}),` `,w()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:c()}):(0,F.jsx)(j,{variant:`outline`,children:a()}):(0,F.jsx)(j,{variant:`outline`,children:m()}),note:f(),children:[(0,F.jsx)(R,{label:p(),children:(0,F.jsx)(M,{value:_.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>b(`langfuse`,`host`,e.target.value),onBlur:()=>x(`langfuse`,{host:_.langfuse.host??``})})}),(0,F.jsx)(z,{label:l(),checked:_.langfuse.enabled??!0,onChange:e=>{b(`langfuse`,`enabled`,e),x(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:c()}):(0,F.jsx)(j,{variant:`outline`,children:a()}):(0,F.jsx)(j,{variant:`outline`,children:m()}),note:o(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(M,{value:_.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>b(`opik`,`baseUrl`,e.target.value),onBlur:()=>x(`opik`,{baseUrl:_.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:k(),children:(0,F.jsx)(M,{value:_.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||d(),onChange:e=>b(`opik`,`workspace`,e.target.value),onBlur:()=>x(`opik`,{workspace:_.opik.workspace??``})})}),(0,F.jsx)(z,{label:l(),checked:_.opik.enabled??!0,onChange:e=>{b(`opik`,`enabled`,e),x(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:c()}):(0,F.jsx)(j,{variant:`outline`,children:a()}):(0,F.jsx)(j,{variant:`outline`,children:D()}),note:v(),children:[(0,F.jsx)(R,{label:O(),children:(0,F.jsx)(M,{value:_.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>b(`otlp`,`endpoint`,e.target.value),onBlur:()=>x(`otlp`,{endpoint:_.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:l(),checked:_.otlp.enabled??!0,onChange:e=>{b(`otlp`,`enabled`,e),x(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=u(i.integrations.otlpSecret.setOtlpHeaders),n=y(i.integrations.otlpSecret.clearOtlpHeaders),[r,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1),d=async()=>{l(!0),s(null);try{await t({headersJson:r}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,F.jsxs)(R,{label:E(),children:[(0,F.jsx)(M,{value:r,placeholder:e?_():b(),onChange:e=>a(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void d(),children:x()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:S()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:C()})]})}export{I as IntegrationsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Am as r,Aw as i,Cm as a,Dm as o,Dw as s,E as c,Em as l,Mm as u,Nm as d,Om as f,Ow as p,Pm as m,Sm as h,Tm as g,Xj as _,bw as v,jm as y,km as b,kw as x,tT as S,wm as C,xm as w,yw as T}from"./dist-DxRkWXyO.js";import{Xt as E,Yt as D,a as ee,n as te,r as ne,xt as re}from"./index-DA0_EAyp.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-DzsZ59WU.js";import{n as N,t as P}from"./TimeRangePicker-DZi8tuoy.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=_(c.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=_(c.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:S()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:i()}),(0,I.jsx)(j,{children:p()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),a=t=>6+t*468/(e.length-1),o=e=>74-e*68/r,s=e=>e.map((e,t)=>`${t===0?`M`:`L`}${a(t).toFixed(1)},${o(e).toFixed(1)}`).join(` `),c=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[T(),` p50 `,R(c.cP50),` `,x()]}),(0,I.jsxs)(`span`,{children:[v(),` p50 `,R(c.aP50),` `,x()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":i(),children:[(0,I.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:m(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:d(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:u(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:y(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:r(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:b(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=E({from:`/settings/kpi`}),t=D({from:`/settings/kpi`}),n=ne(e.from,e.to,te,`now`),r=e=>void t({search:t=>({...t,...ee(e)})}),{from:i,to:a}=N(n),{rowLimit:s,buckets:u}=K(i,a),d=_(c.kpi.listKpis,{limit:s,filter:{from:i,to:a}}),p=(0,F.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>u&&e.set(t,n.slice(n.length-u));return e},[d,u]),m=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:o()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return d===void 0?(0,I.jsxs)(I.Fragment,{children:[m,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:l()})]}):d.length===0?(0,I.jsxs)(I.Fragment,{children:[m,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]}):(0,I.jsxs)(I.Fragment,{children:[m,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(p.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:p.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:C({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:a()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:h({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":w({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Am as r,Aw as i,Cw as a,Dm as o,E as s,Em as c,Fm as l,Im as u,Lm as d,Mm as f,Mw as p,Nm as m,Nw as h,Om as g,Pm as _,Sw as v,Tm as y,iT as b,jm as x,jw as S,km as C,tM as w,wm as T}from"./dist-CGzSsL4i.js";import{Xt as E,Yt as D,a as ee,n as te,r as ne,xt as re}from"./index-B0Kloary.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-DYY__lMj.js";import{n as N,t as P}from"./TimeRangePicker-CZSYqXhd.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=w(s.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=w(s.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:b()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:h()}),(0,I.jsx)(j,{children:S()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),o=e=>74-e*68/r,s=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${o(e).toFixed(1)}`).join(` `),c=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[v(),` p50 `,R(c.cP50),` `,p()]}),(0,I.jsxs)(`span`,{children:[a(),` p50 `,R(c.aP50),` `,p()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":h(),children:[(0,I.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:d(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:u(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:l(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:_(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:m(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:f(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=E({from:`/settings/kpi`}),t=D({from:`/settings/kpi`}),n=ne(e.from,e.to,te,`now`),i=e=>void t({search:t=>({...t,...ee(e)})}),{from:a,to:o}=N(n),{rowLimit:c,buckets:l}=K(a,o),u=w(s.kpi.listKpis,{limit:c,filter:{from:a,to:o}}),d=(0,F.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>l&&e.set(t,n.slice(n.length-l));return e},[u,l]),f=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:r()})]}),(0,I.jsx)(J,{value:n,onChange:i})]});return u===void 0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:C()})]}):u.length===0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]}):(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:o({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:c()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:y({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":T({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,A as i,Aj as a,BO as o,E as s,F as c,Fj as l,G as u,GO as d,HO as f,I as p,Ij as m,JO as ee,KO as te,Kj as ne,L as re,Lj as ie,M as ae,Mj as oe,N as se,Nj as ce,Oj as h,P as le,Pj as ue,QO as de,Rj as fe,UO as pe,VO as me,Vj as he,Vx as ge,WO as g,X as _,XO as v,YO as y,Z as b,ZO as x,_k as S,ak as C,bk as w,ck as T,dk as E,eM as D,ek as O,fk as k,gk as A,hk as j,ik as M,j as N,jj as P,kj as F,lk as I,mk as L,n as R,nk as _e,ok as ve,pk as ye,qO as z,rk as be,sk as xe,tM as B,tk as Se,uk as Ce,vk as we,yk as Te}from"./dist-CGzSsL4i.js";import{t as V}from"./button-D5AXX04a.js";import{A as Ee,C as H,S as U,b as De,bt as Oe,ct as W,lt as G,p as K,vt as ke,w as Ae,x as je,xt as q,yt as Me,z as Ne}from"./index-B0Kloary.js";import{t as Pe}from"./localePickerView-C2RmOS86.js";var J=t(e(),1),Y=n();function Fe({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:R(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,Y.jsx)(`span`,{className:R(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var X=[{id:`messages`,label:()=>w()},{id:`composer`,label:()=>Te()},{id:`sidebar`,label:()=>we()},{id:`other`,label:()=>S()}],Z={showSource:{category:`messages`,label:()=>A(),help:()=>j()},showReport:{category:`messages`,label:()=>L(),help:()=>ye()},copyAssistant:{category:`messages`,label:()=>k()},copyUser:{category:`messages`,label:()=>E()},showDelete:{category:`messages`,label:()=>Ce()},showTools:{category:`messages`,label:()=>I(),help:()=>T()},voiceInput:{category:`composer`,label:()=>xe(),help:()=>ve()},showUsage:{category:`composer`,label:()=>C(),help:()=>M()},autoReadAloud:{category:`composer`,label:()=>b(),help:()=>_()},showChatAge:{category:`sidebar`,label:()=>be(),help:()=>_e()},showChatProvider:{category:`sidebar`,label:()=>Se(),help:()=>O()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ie(e,t){let n=Q(t.trim()),r=new Map(X.map(e=>[e.id,e.label()])),i=new Map(X.map(e=>[e.id,[]]));for(let t of e){let e=Z[t],a=e?.category??`other`;n&&!Q(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return X.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var Le=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`,`showUsage`,`autoReadAloud`],Re={voiceInput:`voiceInput`};function ze(e){return Le.includes(e)}function $(e){return e===`admin`}function Be(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Ve(e){return e===`on`?!0:e===`off`?!1:null}function He(e){return ze(e)?Re[e]:void 0}var Ue={voiceInput:()=>g()};function We({prefKey:e,ui:t}){let n=D(s.admin.setUiPrefDefault),r=D(s.admin.setFeatureEnabled),i=He(e),a=i?Ue[e]?.():void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,Y.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ee()}),(0,Y.jsxs)(De,{value:Be(t.defaults[e]),onValueChange:t=>void n({key:e,value:Ve(t)}),children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(Ae,{})}),(0,Y.jsxs)(je,{children:[(0,Y.jsx)(U,{value:`on`,children:f()}),(0,Y.jsx)(U,{value:`off`,children:me()}),(0,Y.jsx)(U,{value:`inherit`,children:o()})]})]}),i?(0,Y.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,Y.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":z()}),z()]}):null]}),a?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Ge({current:e,enabled:t}){let n=D(s.me.setDictationShortcut),[r,a]=(0,J.useState)(!1),[o,l]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Me(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(l(!0),window.setTimeout(()=>l(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,Y.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[re(),e?(0,Y.jsx)(W,{variant:`secondary`,children:Oe(e,ke())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:o?le():r?c():p()})]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:i()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?N():e?ae():se()})]})]})}function Ke(){let[e,t]=(0,J.useState)(``),[n,i]=(0,J.useState)(!1),a=B(s.me.getMe,{host:q}),o=a?.ui,c=$(a?.role)&&n,l=D(s.me.setUiPref).withOptimisticUpdate(Ee),f=(0,J.useMemo)(()=>o?Ie(Object.keys(o.effective),e):[],[o,e]);return o?(0,Y.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(a?.role)?(0,Y.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,Y.jsx)(K,{checked:n,onCheckedChange:e=>i(e===!0),"aria-label":y()}),y()]}):null,c?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:te()}),(0,Y.jsx)(`p`,{children:d()}),(0,Y.jsx)(`p`,{children:pe()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:r(),"aria-label":r(),className:`mb-2`}),f.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:de()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:f.map(e=>(0,Y.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,Y.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Z[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],s=o.userOverrides[e]!==void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,Y.jsx)(W,{variant:`outline`,children:x()}):s?(0,Y.jsx)(W,{variant:`secondary`,children:u()}):null]}),r?(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&s?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:v()}):null,(0,Y.jsx)(Fe,{checked:a,disabled:i,onCheckedChange:t=>void l({key:e,value:t}),"aria-label":n})]}),c?(0,Y.jsx)(We,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,Y.jsx)(Ge,{current:a?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:ne()})}function qe(){let e=B(s.me.getMe,{host:q}),t=D(s.me.setLocale),n=D(s.me.setMyName),r=Ne(),i=e?.locale??`default`,o=e?.name??``,[c,u]=(0,J.useState)(null),d=c??o,f=d.trim()!==o.trim();async function p(){try{await n({name:d}),u(null),r.success(ue())}catch(e){r.error(ce(),e)}}return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:fe()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:d,maxLength:120,placeholder:m(),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),p())}}),(0,Y.jsx)(V,{size:`sm`,disabled:!f,onClick:()=>void p(),children:ge()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:l()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:oe()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:P()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[Pe().map(e=>(0,Y.jsx)(V,{variant:i===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(V,{variant:i==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:he()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:a()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:F()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(0,Y.jsx)(Ke,{})]})]})}export{qe as PreferencesTab};
@@ -0,0 +1,4 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,$t as i,E as a,Jh as o,Qh as s,Qt as c,Xh as l,Yh as u,Zh as d,Zt as f,_r as p,aa as m,ag as h,bg as g,br as _,cg as v,dg as y,eM as b,eg as x,fg as S,gr as C,ia as w,ig as T,lg as ee,na as E,ng as D,og as te,pg as ne,ra as re,rg as ie,sg as ae,tM as O,ta as k,tg as A,ug as j,vr as M,xg as N,xr as P,yr as F}from"./dist-CGzSsL4i.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as H,u as U}from"./FieldLabel-RnB1EBjO.js";import{t as W}from"./button-D5AXX04a.js";import{C as G,S as K,b as q,p as J,w as Y,x as X,xt as oe,z as se}from"./index-B0Kloary.js";import{r as Z,t as ce}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:v,help:ae},documentary_fetch:{label:te,help:h},inbound_files:{label:T,help:ie},history_summary:{label:m,help:w},file_curation:{label:P,help:_}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
+ - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
+ Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
+ - [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:l,references:u,files:o,previous_summary:re,new_messages:E,max_chars:k,file_name:F,budget_chars:M,feedback:p,content:C};function pe(){let e=O(a.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:A()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:ne(),help:S()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:D()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsx)(X,{children:e.map(e=>(0,$.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=b(a.admin.upsertInstanceConfig),n=se(),r=O(a.me.getMe,{host:oe}),o=e.config??{},s=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[l,u]=(0,Q.useState)(()=>R(o,s));(0,Q.useEffect)(()=>{u(R(o,s))},[s,e._id]);let[d,p]=(0,Q.useState)(!1),m=l.promptInjections,h=(e,t)=>u({...l,promptInjections:{...m,[e]:{...m[e],...t}}});async function _(){p(!0);try{await t({instanceId:e._id,config:V(l,o,s)})}catch(e){n.error(g(),e)}finally{p(!1)}}async function v(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(g(),e)}}let y=e.config?.contentLocale??`default`,x=ce[Z(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:i()}),(0,$.jsxs)(q,{value:y,onValueChange:e=>void v(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{value:`default`,children:f({locale:x})}),le().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}),U.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:m[e]??{enabled:!0,template:z[e].defaultTemplate[s]},contentLocale:s,onChange:t=>h(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void _(),disabled:d,children:N()})})]})}function he({injKey:e,def:t,i18n:n,row:i,contentLocale:a,onChange:o}){let[c,l]=(0,Q.useState)(!1),u=i.template.trim()!==t.defaultTemplate[a],f=t.togglable&&!i.enabled,p=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),m=I(e,i,a),h=m?L(m,p):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(J,{checked:i.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),u&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:j()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:f,rows:8,spellCheck:!1,onChange:e=>o({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:ee()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>l(e=>!e),children:c?r():x()}),u&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:y()})]})]}),c&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:s()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:d()})})]})}export{pe as PromptInjectionsTab};
@@ -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 a,Cy as ee,E as o,Fy as s,Gr as c,Gy as l,Hy as u,Iy as d,Jy as f,Ky as p,Ly as m,My as h,Ny as te,Py as ne,Qy as g,Ry as re,Sy as _,Uy as v,Vy as y,Wy as b,Xy as x,Yy as S,Zy as C,_y as ie,ab as w,by as T,eM as E,eb as D,gy as O,ib as k,jy as A,nb as j,qy as M,rb as N,tM as P,tb as F,vy as I,wy as L,xy as R,yy as ae,zy as z}from"./dist-CGzSsL4i.js";import{t as B}from"./button-D5AXX04a.js";import{B as V,Rt as H,ct as U,lt as W,p as G,u as K,z as q}from"./index-B0Kloary.js";import{t as J}from"./roleDescriptions-BXezQ4Y4.js";var Y=t(e(),1),X=n(),Z=[{group:()=>w(),keys:[{key:`traces.read`,label:()=>D()},{key:`traces.read.content`,label:()=>r(),phi:!0},{key:`traces.write`,label:()=>g()}]},{group:()=>k(),keys:[{key:`kpi.read`,label:()=>D()},{key:`kpi.write`,label:()=>g()}]},{group:()=>N(),keys:[{key:`openclaw.query`,label:()=>C()},{key:`anomalies.read`,label:()=>x()},{key:`anomalies.report`,label:()=>S()}]},{group:()=>j(),keys:[{key:`chats.read`,label:()=>D()},{key:`selfheal`,label:()=>M()},{key:`feedback.respond`,label:()=>c()}]},{group:()=>F(),keys:[{key:`admin.manage`,label:()=>f()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=P(o.apiKeys.listRoles,{}),t=E(o.apiKeys.createRole),n=E(o.apiKeys.ensureRolesSeeded),r=E(o.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(o.apiKeys.listRoles,{});r&&e.setQuery(o.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),c=V(),f=q(),[g,x]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)($),[w,D]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{f.error(l(),e)})},[n,f]);let k=e??[];async function j(e,t){if(Q(e.permissions)||w.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await c({title:b({name:e.name}),description:v(),confirmLabel:u()}))){D(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){f.error(y(),e)}finally{D(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function M(){try{await t({key:S.key,name:S.name,description:S.description||void 0,permissions:[]}),C($),x(!1)}catch(e){f.error(a(),e)}}let N=e===void 0,F=!N&&k.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[z(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,re(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,m()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:d()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{C($),x(!0)},children:s()})})]}),N?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):F?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:h()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?p({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:k.map(e=>{let t=Q(e.permissions),n=w.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,A()]}):(0,X.jsx)(U,{variant:`secondary`,children:i()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?L():n?ee():r,onCheckedChange:()=>void j(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(K,{open:g,onOpenChange:x,title:_(),description:R(),canSubmit:!!(S.key&&S.name),onSubmit:M,submitLabel:T(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ae()}),(0,X.jsx)(W,{value:S.key,placeholder:I(),onChange:e=>C({...S,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ie()}),(0,X.jsx)(W,{value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:O()}),(0,X.jsx)(W,{value:S.description,onChange:e=>C({...S,description:e.target.value})})]})]})})]})}export{se as RolesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,AD as i,AO as ee,BD as a,CD as o,CO as te,DD as s,DO as ne,E as c,ED as l,EO as re,FD as u,FO as ie,GD as ae,HD as d,ID as f,IO as oe,JD as se,KD as ce,LD as p,LO as le,MD as m,MO as ue,ND as h,NO as g,OD as _,OO as de,PD as fe,PO as pe,QD as me,Qj as he,RD as v,RO as ge,SD as y,SO as _e,TD as ve,TO as ye,UD as be,VD as b,WD as xe,XD as Se,YD as Ce,ZD as we,_O as Te,aO as Ee,bD as x,bO as De,cO as Oe,dO as ke,eM as S,eO as Ae,fO as je,gO as Me,hO as Ne,iO as Pe,jD as C,jO as Fe,kD as w,kO as Ie,lO as Le,mO as Re,nO as ze,oO as Be,pO as Ve,qD as He,rO as Ue,sO as We,tM as T,tO as Ge,uO as Ke,vO as qe,wD as E,wO as Je,xD as D,xO as Ye,yD as O,yO as Xe,zD as k,zO as Ze}from"./dist-CGzSsL4i.js";import{n as A}from"./dist-fE9pwpr-.js";import{i as Qe}from"./dist-Cy-5Eo9H.js";import{t as j}from"./button-D5AXX04a.js";import{$ as M,B as $e,C as N,S as P,Wt as F,Xt as et,Yt as tt,b as I,ct as L,dt as R,et as z,ft as B,ht as V,lt as H,mt as U,pt as nt,qt as rt,u as it,ut as W,w as G,x as K,z as at}from"./index-B0Kloary.js";import{t as ot}from"./FilterBar-Dy10_IPZ.js";import{t as st}from"./DataTableShell-Bzopt4OT.js";import{t as ct}from"./roleDescriptions-BXezQ4Y4.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>ve(),days:null},{value:`30`,label:()=>E(),days:30},{value:`90`,label:()=>o(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=et({from:`/settings/serviceAccounts`}),t=tt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Z,[a,o]=(0,q.useState)(Z),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),u=T(c.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:i===Z?void 0:i===`disabled`}}),d=T(c.apiKeys.listKeys,{}),f=T(c.apiKeys.listRoles,{}),p=S(c.apiKeys.createServiceAccount),m=S(c.apiKeys.updateServiceAccount),h=S(c.apiKeys.deleteServiceAccount),_=he(c.apiKeys.mintApiKey),fe=S(c.apiKeys.revokeApiKey),v=$e(),y=at(),ve=n!==``||a!==Z||i!==Z;function b(){o(Z),t({search:{},replace:!0})}let[x,C]=(0,q.useState)(!1),[w,E]=(0,q.useState)(Q),[D,O]=(0,q.useState)(null),[k,A]=(0,q.useState)(new Set),[M,F]=(0,q.useState)(null),R=(0,q.useRef)(!1),[z,B]=(0,q.useState)(new Set),[V,U]=(0,q.useState)({}),[nt,W]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function $(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{D?(await m({serviceAccountId:D,name:w.name,roleKey:w.roleKey,description:w.description}),y.success(Ue())):await p({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),E(Q),O(null),C(!1)}catch(e){y.error(D?Pe():Ee(),e)}}function ft(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function pt(e){if(R.current)return;R.current=!0;let t=V[e._id]??`never`,n=Y.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await _({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(ze(),e)}finally{R.current=!1,F(null)}}async function mt(e){if(await v({title:Ge(),description:(0,J.jsxs)(J.Fragment,{children:[Ae(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,r(),` `,(0,J.jsx)(`strong`,{children:me()}),` `,we()]}),confirmWord:e.name,confirmLabel:Se(),destructive:!0}))try{await h({serviceAccountId:e._id}),y.success(Ce(),e.name)}catch(e){y.error(se(),e)}}async function ht(e){if(await v({title:He(),description:(0,J.jsxs)(J.Fragment,{children:[ce(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ae()]}),confirmLabel:xe(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await fe({keyId:e._id})}catch(e){y.error(be(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}),(0,J.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:ge(),onReset:b,canReset:ve,children:[(0,J.jsxs)(I,{value:a,onValueChange:o,children:[(0,J.jsx)(N,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:le()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:oe()}),(f??[]).map(e=>(0,J.jsx)(P,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(I,{value:i,onValueChange:l,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(P,{value:Z,children:ie()}),(0,J.jsx)(P,{value:`active`,children:pe()}),(0,J.jsx)(P,{value:`disabled`,children:g()})]})]})]}),(0,J.jsx)(st,{title:ue(),rows:u,addLabel:Fe(),onAdd:()=>{E(Q),O(null),C(!0)},emptyHint:ee(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:re(),onSelect:()=>ft(e)},{label:Ie(),onSelect:()=>void pt(e)},{label:k.has(e._id)?de():ne(),onSelect:()=>$(e._id)},{label:ye(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Je():te(),onClick:()=>$(e._id),children:k.has(e._id)?(0,J.jsx)(Qe,{}):(0,J.jsx)(rt,{})})},{header:_e(),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:Ye(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:De(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:g()}):(0,J.jsx)(L,{variant:`outline`,children:pe()})},{header:Xe(),cell:e=>(0,J.jsxs)(I,{value:V[e._id]??`never`,onValueChange:t=>U(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(N,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:Y.map(e=>(0,J.jsx)(P,{value:e.value,children:e.label()},e.value))})]})},{header:qe(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?Te():Me({count:t})})}}]}),(0,J.jsx)(it,{open:x,onOpenChange:e=>{C(e),e||O(null)},title:D?Ne():je(),description:D?Re():ke(),canSubmit:!!(w.name&&w.roleKey),onSubmit:dt,submitLabel:D?Ve():Ke(),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:Le()}),(0,J.jsx)(H,{value:w.name,onChange:e=>E({...w,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Oe()}),(0,J.jsxs)(I,{value:w.roleKey||void 0,onValueChange:e=>E({...w,roleKey:e}),children:[(0,J.jsx)(N,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:We()})}),(0,J.jsx)(K,{children:(f??[]).map(e=>(0,J.jsxs)(P,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===w.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Be()}),(0,J.jsx)(H,{value:w.description,onChange:e=>E({...w,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:nt,onClose:()=>W(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[d(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:a()}),(0,J.jsx)(`th`,{children:k()}),(0,J.jsx)(`th`,{children:v()}),(0,J.jsx)(`th`,{children:p()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{children:u()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:z(t.createdAt)}),(0,J.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:pt(t.expiresAt)}),(0,J.jsx)(`td`,{children:mt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?fe():h()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function ee(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(W,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(R,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(U,{children:[(0,J.jsx)(V,{children:m()}),(0,J.jsx)(B,{children:C({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:i()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void ee(),"aria-label":w(),children:[n?(0,J.jsx)(A,{}):(0,J.jsx)(F,{}),n?_():s()]})]}),(0,J.jsx)(nt,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:l()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?y():z(e)}function pt(e){return e===null?`—`:M(e)}function mt(e){return e.disabled?(0,J.jsx)(L,{variant:`destructive`,children:D()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(L,{variant:`outline`,children:x()}):(0,J.jsx)(L,{variant:`outline`,children:O()})}export{$ as ServiceAccountsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Aa as r,Ba as i,Ca as a,Da as o,E as s,Ea as c,Fa as l,Ga as u,Ha as d,Ia as f,Ja as p,Ka as m,La as h,Ma as g,Na as _,Oa as v,Pa as y,Ra as b,Sa as x,Ta as S,Ua as C,Va as w,Wa as T,_a as E,ba as D,da as O,eM as k,fa as A,ga as j,ha as M,ja as N,ka as P,ma as F,pa as I,qa as L,tM as ee,ua as R,va as z,wa as B,xa as V,ya as H,za as U}from"./dist-CGzSsL4i.js";import{t as W}from"./button-D5AXX04a.js";import{B as G,et as K}from"./index-B0Kloary.js";import{t as q}from"./DataTableShell-Bzopt4OT.js";var J=t(e(),1),Y=n(),X={hung:()=>N(),wrong_result:()=>r(),error:()=>P(),other:()=>v()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=k(s.subAgentReports.respondToReport),[r,i]=(0,J.useState)(e.thread),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1);async function p(){let t=l.trim();if(!(!t||d)){f(!0);try{await n({reportId:e._id,text:t}),i(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{f(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,o({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:c()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:S()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?B():a()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:x()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:V(),value:l,maxLength:2e3,rows:3,onChange:e=>u(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void p(),disabled:!l.trim()||d,children:d?H():D()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[z({count:t.children.length}),t.childrenTruncated?` ${E()}`:``,t.textTruncated?` ${j()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${M()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=ee(s.subAgentReports.listForAdmin,{}),t=k(s.subAgentReports.readReport),n=k(s.subAgentReports.deleteReport),r=G(),[a,o]=(0,J.useState)(null),[c,v]=(0,J.useState)({});async function x(e){if(a===e._id){o(null);return}if(!c[e._id]){let n=await t({reportId:e._id});v(t=>({...t,[e._id]:n}))}o(e._id)}async function S(e){await r({title:A(),description:O(),confirmLabel:R(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&o(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,Y.jsx)(`strong`,{children:u()}),` `,T()]}),(0,Y.jsx)(q,{title:p(),rows:e,emptyHint:L(),isExpanded:e=>a===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Y.jsx)($,{data:c[e._id]}):null,columns:[{header:C(),cell:e=>K(e.at),sort:e=>e.at},{header:d(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:w(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:i(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${h({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:U(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:b(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:f()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:l()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?_():y(),onSelect:()=>void x(e)},{label:g(),onSelect:()=>void S(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,AA as i,Ak as a,BA as o,Bk as s,CA as c,Ck as l,D as u,DA as d,Dk as f,E as p,EA as m,Ek as h,FA as g,Fk as _,Gk as v,HA as y,Hj as b,Hk as ee,IA as te,Ik as ne,Jk as re,Kk as ie,LA as ae,Lk as oe,MA as se,Mk as ce,NA as x,Nk as le,OA as ue,Ok as de,PA as fe,Pk as pe,Qj as me,Qk as he,RA as ge,Rk as _e,SA as ve,Sk as ye,TA as be,Tk as S,UA as xe,Uj as Se,Uk as Ce,VA as we,Vk as C,Wj as Te,Wk as Ee,Xk as De,Yk as Oe,Zk as ke,_A as Ae,aA as je,bA as Me,cA as Ne,ca as Pe,dA as Fe,eA as Ie,eM as w,fA as Le,gA as Re,hA as ze,iA as Be,jA as Ve,jk as He,kA as Ue,kk as T,lA as We,la as E,mA as Ge,n as Ke,nA as qe,oA as D,oa as Je,pA as Ye,qk as Xe,rA as Ze,sA as Qe,sa as $e,tA as et,tM as O,uA as tt,vA as nt,wA as rt,wk as it,xA as at,xk as ot,yA as st,zA as ct,zk as lt}from"./dist-CGzSsL4i.js";import{n as k}from"./dist-fE9pwpr-.js";import{t as A}from"./x-CQuunpf5.js";import{t as j}from"./button-D5AXX04a.js";import{C as M,Ht as N,S as P,Ut as ut,_t as dt,at as ft,b as F,ct as I,gt as pt,it as L,lt as R,nt as mt,ot as ht,p as z,rt as gt,st as _t,w as B,x as V,xt as H}from"./index-B0Kloary.js";import{t as vt}from"./localePickerView-C2RmOS86.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-DYY__lMj.js";import{a as Tt,i as U,n as Et,o as W,r as G,t as Dt}from"./table-BDhz0ajJ.js";import{t as Ot}from"./TimeRangePicker-CZSYqXhd.js";import{t as kt}from"./FilterBar-Dy10_IPZ.js";import{t as At}from"./AdvancedFilter-B6lCXnk_.js";var K=u(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),q=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Ft(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function J(e,t,n){return Ft(e,t,n)>=jt}function It(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Lt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(Ee());if(e.size>Rt)throw Error(Ce());let{source:n,width:r,height:i,cleanup:a}=await Ut(e);try{let a=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/i,a?1/0:1),c=Math.max(1,Math.round(r*o)),l=Math.max(1,Math.round(i*o)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)throw Error(C());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(C());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);J(e.data,f.width,f.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),m.putImageData(e,0,0)}let h=J(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await X(p,`image/webp`,Vt)??await X(p,`image/png`);if(!g)throw Error(s());return{blob:g,hasAlpha:h}}finally{a()}}async function Ut(e){if(e.type===`image/svg+xml`)return Y(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Y(e)}async function Y(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(ee())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function X(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Z=n();function Wt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Q=`__all__`,Gt={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?Te():e===`dark`?Se():b()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,Z.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,Z.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,Z.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:Ke(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Z.jsx)(k,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Z.jsx)(Yt,{tokens:r,mode:i}):(0,Z.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Z.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Z.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":E(),title:E(),children:(0,Z.jsx)(ut,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=O(p.charts.listMyCharts),r=w(p.charts.setMyChart);async function a(e){try{await r({name:e})}catch{}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:g()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Z.jsx)(Xt,{selected:e===null,title:x(),subtitle:se(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?Ve():n.via===`owner`?i():Ue({group:n.via.group});return(0,Z.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(n.key),onExport:()=>Wt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ue()}):null]})}function Qt(){let e=w(p.charts.importChart),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(!1);async function d(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(D())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(Be());return}let a;try{a=JSON.parse(r)}catch{o(D());return}u(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{u(!1)}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Ge()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ye()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Le()}),(0,Z.jsx)(R,{value:t,onChange:e=>n(e.target.value),placeholder:Fe(),maxLength:60})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:tt()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:We(),rows:8,spellCheck:!1})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(K,{className:`size-4`}),Ne(),(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,Z.jsx)(j,{size:`sm`,disabled:l,onClick:()=>void f(),children:Qe()})]}),a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,Z.jsx)(`p`,{className:`oc-chart-import__ok`,children:je()}):null]})]})}function $t({chart:e}){let t=me(p.charts.setChartLogo),n=w(p.charts.removeChartLogo),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ht(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?ke():De()}),(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Z.jsx)(`img`,{src:t,alt:``}):null}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(K,{className:`size-4`}),t?re():Oe(),(0,Z.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:ie()}):null,t?(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Xe()}):null]})}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:he()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Z.jsx)(f,{mode:`light`}),(0,Z.jsx)(f,{mode:`dark`})]}),r?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:v()}):null,a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=O(p.me.getMe,{host:H}),n=w(p.charts.addChartDomain),r=w(p.charts.removeChartDomain),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function f(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:lt()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:_()}):u.map(e=>(0,Z.jsxs)(I,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":pe({domain:e}),onClick:()=>void f(e),children:(0,Z.jsx)(A,{className:`size-3`})})]},e))}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(R,{value:i,onChange:e=>a(e.target.value),placeholder:oe(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:ne()})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:_e()}),o?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function tn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=w(p.charts.updateChart),n=w(p.charts.deleteChart),[i,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(e.name),[l,u]=(0,q.useState)(()=>tn(e.tokens)),[d,f]=(0,q.useState)(e.tokens.bpm??0),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(!1);function v(){c(e.name),u(tn(e.tokens)),f(e.tokens.bpm??0),h(null),o(!0)}async function y(){if(e.chartId===void 0)return;h(null);let n;try{n=JSON.parse(l)}catch{h(D());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;d>0?e.bpm=d:delete e.bpm}_(!0);try{await t({chartId:e.chartId,name:s.trim(),tokens:n}),o(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(T()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:i?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:v,children:Ie()}),(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:r()})]})})]}),i?(0,Z.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:He()}),(0,Z.jsx)(R,{value:s,onChange:e=>c(e.target.value),maxLength:60})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Pe()}),(0,Z.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Z.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:d,onChange:e=>f(Number(e.target.value)),"aria-label":Pe()}),(0,Z.jsx)(`span`,{className:`oc-chart-bpm__value`,children:d===0?$e():`${d} BPM`})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Je()})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:a()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:l,onChange:e=>u(e.target.value),rows:10,spellCheck:!1})]}),m?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:m}):null,(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{size:`sm`,disabled:g,onClick:()=>void y(),children:le()}),(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>o(!1),children:ce()})]})]}):null,(0,Z.jsx)($t,{chart:e}),(0,Z.jsx)(en,{chart:e})]})}function rn(){let e=O(p.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Ze()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:qe()})]}),e!==void 0&&t.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:et()}):(0,Z.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Z.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=w(p.charts.addChartToGroupPool),r=w(p.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(I,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Me():e.kind===`custom`&&e.scope===`personal`?S():at()}),e.isGlobalDefault?(0,Z.jsx)(I,{variant:`default`,children:st()}):null]}),(0,Z.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ae()}),(a??[]).map(e=>(0,Z.jsxs)(I,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ze({group:e.name}),onClick:()=>void l(e.groupId),children:(0,Z.jsx)(A,{className:`size-3`})})]},e.groupId)),s.length>0?(0,Z.jsxs)(F,{value:``,onValueChange:e=>void c(e),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(B,{placeholder:Re()})}),(0,Z.jsx)(V,{children:s.map(e=>(0,Z.jsx)(P,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:nt()}):null]})]})}function on({chart:e}){let t=w(p.charts.promoteChartToCommon),n=w(p.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(T()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(I,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?it():S()}),e.ownerLabel?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:h({owner:e.ownerLabel})}):null]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:l()}):null,(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:ye()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=w(p.admin.setDefaultThemeMode),i=w(p.admin.setDefaultLocale),a=w(p.charts.setDefaultChart),s=O(p.charts.listChartsAdmin),l=O(p.groups.listGroups,{}),u=e??`system`,h=t??`fr`;return(0,Z.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:ae()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:d()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:m()})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:x()}),dt.map(e=>(0,Z.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Z.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:be()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:rt()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Z.jsx)(an,{chart:e,groups:l??[]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:c()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Z.jsx)(en,{chart:e})]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:de()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:f()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ot()}):(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Z.jsx)(on,{chart:e},e.key))})})()]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:xe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Z.jsx)(j,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:we()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:vt().map(e=>(0,Z.jsx)(j,{variant:h===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ct()})]})]})}function cn(){let e=O(p.me.getMe,{host:H}),t=pt(e?.resolvedThemeMode);return(0,Z.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Z.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Z.jsx)(Qt,{}),(0,Z.jsx)(rn,{}),e?.role===`admin`?(0,Z.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,q.useState)(!0),[n,r]=(0,q.useState)(`per-user`),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(Q),[c,l]=(0,q.useState)(Q),[u,d]=(0,q.useState)(Gt),f=i!==``||o!==Q||c!==Q;function p(){a(``),s(Q),l(Q),d(Gt)}return(0,Z.jsxs)(`div`,{className:`oc-show`,children:[(0,Z.jsx)(cn,{}),(0,Z.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Z.jsx)(`summary`,{className:`oc-show__title`,children:ge()}),(0,Z.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{children:`Default`}),(0,Z.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(j,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(j,{variant:`ghost`,children:`Ghost`}),(0,Z.jsx)(j,{variant:`destructive`,children:`Destructive`}),(0,Z.jsx)(j,{variant:`link`,children:`Link`})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{size:`sm`,children:`Small`}),(0,Z.jsx)(j,{children:`Default`}),(0,Z.jsx)(j,{size:`lg`,children:`Large`}),(0,Z.jsx)(j,{size:`icon`,"aria-label":`more`,children:(0,Z.jsx)(N,{})}),(0,Z.jsx)(j,{disabled:!0,children:`Disabled`})]})]}),(0,Z.jsx)($,{title:`Badges`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(I,{children:`Default`}),(0,Z.jsx)(I,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(I,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(I,{variant:`destructive`,children:`Destructive`})]})}),(0,Z.jsx)($,{title:`Inputs & selection`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(R,{placeholder:`Text input…`}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsxs)(F,{value:n,onValueChange:r,children:[(0,Z.jsx)(M,{className:`w-56`,children:(0,Z.jsx)(B,{placeholder:`Select…`})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(P,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Z.jsx)(P,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Z.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Z.jsx)(z,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Z.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsxs)(kt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Z.jsxs)(F,{value:o,onValueChange:s,children:[(0,Z.jsx)(M,{size:`sm`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(P,{value:Q,children:`Toutes directions`}),(0,Z.jsx)(P,{value:`inbound`,children:`inbound`}),(0,Z.jsx)(P,{value:`outbound`,children:`outbound`}),(0,Z.jsx)(P,{value:`internal`,children:`internal`})]})]}),(0,Z.jsxs)(F,{value:c,onValueChange:l,children:[(0,Z.jsx)(M,{size:`sm`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(P,{value:Q,children:`Toutes sévérités`}),(0,Z.jsx)(P,{value:`info`,children:`info`}),(0,Z.jsx)(P,{value:`warn`,children:`warn`}),(0,Z.jsx)(P,{value:`critical`,children:`critical`})]})]})]}),(0,Z.jsx)(At,{fields:Kt,onChange:()=>{}}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Z.jsx)(Ot,{value:u,onChange:d})]})]})}),(0,Z.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Z.jsxs)(mt,{children:[(0,Z.jsx)(_t,{asChild:!0,children:(0,Z.jsx)(j,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Z.jsx)(N,{})})}),(0,Z.jsxs)(gt,{align:`start`,children:[(0,Z.jsx)(ft,{children:`Actions`}),(0,Z.jsx)(ht,{}),(0,Z.jsx)(L,{children:`Edit`}),(0,Z.jsx)(L,{children:`Duplicate`}),(0,Z.jsx)(ht,{}),(0,Z.jsx)(L,{variant:`destructive`,children:`Delete`})]})]})}),(0,Z.jsx)($,{title:`Card`,children:(0,Z.jsxs)(wt,{className:`w-80`,children:[(0,Z.jsxs)(yt,{children:[(0,Z.jsx)(St,{children:`Instance`}),(0,Z.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,Z.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Z.jsxs)(bt,{className:`gap-2`,children:[(0,Z.jsx)(j,{size:`sm`,children:`Save`}),(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Z.jsx)($,{title:`Table`,children:(0,Z.jsxs)(Dt,{children:[(0,Z.jsx)(Tt,{children:(0,Z.jsxs)(W,{children:[(0,Z.jsx)(U,{className:`w-8`,children:(0,Z.jsx)(z,{"aria-label":`select all`})}),(0,Z.jsx)(U,{children:`Name`}),(0,Z.jsx)(U,{children:`Mode`}),(0,Z.jsx)(U,{className:`text-right`,children:`Status`}),(0,Z.jsx)(U,{className:`w-8`})]})}),(0,Z.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Z.jsxs)(W,{children:[(0,Z.jsx)(G,{children:(0,Z.jsx)(z,{"aria-label":`select ${e.n}`})}),(0,Z.jsx)(G,{className:`font-medium`,children:e.n}),(0,Z.jsx)(G,{children:(0,Z.jsx)(I,{variant:`secondary`,children:e.m})}),(0,Z.jsx)(G,{className:`text-right`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Z.jsx)(k,{className:`size-3.5`}),` `,e.s]})}),(0,Z.jsx)(G,{children:(0,Z.jsx)(j,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Z.jsx)(N,{})})})]},e.n))})]})}),(0,Z.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Z.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Z.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Z.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Z.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Z.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Z.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Z.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Z.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Z.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};