@lacneu/atrium 0.36.0 → 0.37.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 (71) hide show
  1. package/dist/assets/AccessTab-BrIt1Shn.js +1 -0
  2. package/dist/assets/{AdvancedFilter-S-HO9nIN.js → AdvancedFilter-WSiPBy4U.js} +1 -1
  3. package/dist/assets/AgentFilesTab-DJXF0Aoh.js +3 -0
  4. package/dist/assets/AnomaliesTab-CaxPbpG8.js +1 -0
  5. package/dist/assets/AuditTab-DJEltNBg.js +1 -0
  6. package/dist/assets/BridgeTab-DAbaJWeM.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-DK6PN4Ox.js +1 -0
  8. package/dist/assets/{DataTableShell-0Ttkz82b.js → DataTableShell-MMI0rbUm.js} +1 -1
  9. package/dist/assets/{DetailChips-DCOUgVDY.js → DetailChips-DYJCRnFu.js} +1 -1
  10. package/dist/assets/FeedbacksTab-Dk2qxzuw.js +1 -0
  11. package/dist/assets/{FieldLabel-BY0GU-yp.js → FieldLabel-Bq4HjU7s.js} +1 -1
  12. package/dist/assets/FilesTab-BxVYvqVK.js +1 -0
  13. package/dist/assets/{FilterBar-CkxsjoMo.js → FilterBar-Cj_JY0E6.js} +1 -1
  14. package/dist/assets/GroupsTab-CwVFISYr.js +1 -0
  15. package/dist/assets/InstancesTab-CPod41s7.js +1 -0
  16. package/dist/assets/IntegrationsTab-BPGkLpkW.js +1 -0
  17. package/dist/assets/KpiTab-D-oaIx6N.js +1 -0
  18. package/dist/assets/PreferencesTab-6OFkb2y9.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-D3qWQEjs.js +4 -0
  20. package/dist/assets/RolesTab-ZpqXyMkI.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-BTb0CHpP.js +1 -0
  22. package/dist/assets/SubAgentReportsTab-C2z44X1u.js +1 -0
  23. package/dist/assets/ThemeShowroom-BVz6uM7X.js +1 -0
  24. package/dist/assets/{TimeRangePicker-Dtnfk3jk.js → TimeRangePicker-CiPB_fhH.js} +1 -1
  25. package/dist/assets/TracesTab-BlMOULWz.js +1 -0
  26. package/dist/assets/UsersTab-CDm22cMX.js +1 -0
  27. package/dist/assets/{button-Bv-PK2-Y.js → button-NWqGTLKg.js} +1 -1
  28. package/dist/assets/{card-B1IlPRv3.js → card-Og1f_0lq.js} +1 -1
  29. package/dist/assets/chevrons-up-down-BwvukG4v.js +1 -0
  30. package/dist/assets/{compatView-dNW7KqXq.js → compatView-dGQzCWqS.js} +1 -1
  31. package/dist/assets/dispatchErrorInfo-DWqpuG4e.js +1 -0
  32. package/dist/assets/{dist-Cjlv3ZK-.js → dist-C6Mg6d5Y.js} +5 -5
  33. package/dist/assets/{dist-LRVQ8Aeg.js → dist-DAR1w68Y.js} +1 -1
  34. package/dist/assets/{dist-DIuY2jzI.js → dist-DJ0yfLRs.js} +1 -1
  35. package/dist/assets/{dist-DqF6O0L8.js → dist-G-3s1IYq.js} +1 -1
  36. package/dist/assets/{highlighted-body-OFNGDK62-M3coudTw.js → highlighted-body-OFNGDK62-AIq9irts.js} +1 -1
  37. package/dist/assets/{index-BJ8KUScf.css → index-CgYI5cZd.css} +1 -1
  38. package/dist/assets/index-DkxYxN0F.js +229 -0
  39. package/dist/assets/mermaid-GHXKKRXX-CoyKxXhe.js +1 -0
  40. package/dist/assets/roleDescriptions-BHmXwdXm.js +1 -0
  41. package/dist/assets/{table-Dv9jX9eF.js → table-D0CDjuoL.js} +1 -1
  42. package/dist/assets/{tabs-BSiIDxTa.js → tabs-CvkXeE_E.js} +1 -1
  43. package/dist/assets/x-Citg8_PC.js +1 -0
  44. package/dist/index.html +8 -8
  45. package/package.json +1 -1
  46. package/dist/assets/AccessTab-Cr3ztAfe.js +0 -1
  47. package/dist/assets/AgentFilesTab-vFxwzq66.js +0 -3
  48. package/dist/assets/AnomaliesTab-r5VxDkWH.js +0 -1
  49. package/dist/assets/AuditTab-BGhAhpvt.js +0 -1
  50. package/dist/assets/BridgeTab-RozR95O-.js +0 -1
  51. package/dist/assets/ChatDefaultsTab-hRkzEosi.js +0 -1
  52. package/dist/assets/FeedbacksTab-3VcXRruH.js +0 -1
  53. package/dist/assets/FilesTab-mOXihu5T.js +0 -1
  54. package/dist/assets/GroupsTab-Cpe1zCFE.js +0 -1
  55. package/dist/assets/InstancesTab-BxcnITXD.js +0 -1
  56. package/dist/assets/IntegrationsTab-DO__uVCz.js +0 -1
  57. package/dist/assets/KpiTab-DK6kxWKf.js +0 -1
  58. package/dist/assets/PreferencesTab-CuphjTEb.js +0 -1
  59. package/dist/assets/PromptInjectionsTab-Cfo4Mq-9.js +0 -4
  60. package/dist/assets/RolesTab-CDQcpiM5.js +0 -1
  61. package/dist/assets/ServiceAccountsTab-Bx5Kbxar.js +0 -1
  62. package/dist/assets/SubAgentReportsTab-CQuFTC8k.js +0 -1
  63. package/dist/assets/ThemeShowroom-Bb62MCzH.js +0 -1
  64. package/dist/assets/TracesTab-DKRy25rR.js +0 -1
  65. package/dist/assets/UsersTab-BLi7LEyO.js +0 -1
  66. package/dist/assets/chevrons-up-down-Drx4hbha.js +0 -1
  67. package/dist/assets/dispatchErrorInfo-BF7yQgVh.js +0 -1
  68. package/dist/assets/index-BWV7nAxJ.js +0 -229
  69. package/dist/assets/mermaid-GHXKKRXX-CHLSnVjI.js +0 -1
  70. package/dist/assets/roleDescriptions-Br5xnRg9.js +0 -1
  71. package/dist/assets/x-3dY-o4JV.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BA as r,E as i,Sl as a,_l as o,bl as s,cl as c,dl as l,fl as u,gl as d,hl as f,jA as p,ll as m,ml as h,pl as g,ul as _,vl as v,xl as y,yl as b}from"./dist-C6Mg6d5Y.js";import{C as x,S,b as C,et as w,w as T,x as E}from"./index-DkxYxN0F.js";var D=t(e(),1);function O(e){return e===`user`?u():e===`all`?l():_({group:e.group})}function k(e){return e===`common`?m():e===`owner`?c():_({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=r(i.admin.listUsers,{}),[t,n]=(0,D.useState)(``),c=r(i.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),(0,A.jsxs)(C,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":y(),children:(0,A.jsx)(T,{placeholder:y()})}),(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:s()}):c===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(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:b()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:c.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:c.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:v()}),c.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:c.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:o()}),c.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:c.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:g()}):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:d()}),c.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:c.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:f()}),c.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:c.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{Ad as r,Dd as i,Ed as a,Od as o,Td as s,kd as c,wd as l}from"./dist-Cjlv3ZK-.js";import{i as u}from"./dist-DIuY2jzI.js";import{t as d}from"./x-3dY-o4JV.js";import{t as f}from"./button-Bv-PK2-Y.js";import{C as p,S as m,b as h,tt as g,w as _,wt as v,x as y}from"./index-BWV7nAxJ.js";import{r as b}from"./TimeRangePicker-Dtnfk3jk.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}),c(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(h,{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)(_,{placeholder:i()})}),(0,S.jsx)(y,{children:e.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(h,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-28`,children:(0,S.jsx)(_,{})}),(0,S.jsx)(y,{children:C.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(g,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:a()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),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)(v,{}),l()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ad as r,Dd as i,Md as a,Nd as o,Od as s,jd as c,kd as l}from"./dist-C6Mg6d5Y.js";import{i as u}from"./dist-DJ0yfLRs.js";import{t as d}from"./x-Citg8_PC.js";import{t as f}from"./button-NWqGTLKg.js";import{C as p,S as m,b as h,tt as g,w as _,wt as v,x as y}from"./index-DkxYxN0F.js";import{r as b}from"./TimeRangePicker-CiPB_fhH.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:o()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let o=(0,x.useRef)(t),w=!!(o.current&&o.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(o.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),a(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(h,{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)(_,{placeholder:r()})}),(0,S.jsx)(y,{children:e.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(h,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-28`,children:(0,S.jsx)(_,{})}),(0,S.jsx)(y,{children:C.map(e=>(0,S.jsx)(m,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(g,{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":s(),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)(v,{}),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{$o as r,$t as i,Ao as a,BA as o,Bo as s,Bs as c,Bt as l,Ct as u,Dt as d,E as f,Et as p,Fo as m,Ft as h,Go as g,Gt as _,Ho as v,Ht as y,Io as b,It as x,Jo as S,Jt as C,Ko as w,Kt as T,LA as E,Lo as D,Lt as O,Mo as k,NA as A,No as j,Oo as M,Po as N,Pt as P,Qo as ee,Qt as F,Ro as I,Rs as te,Rt as L,St as R,Tt as z,Uo as ne,Ut as B,Vo as V,Vt as re,Wo as ie,Wt as H,Xo as U,Xt as ae,Yo as oe,Yt as W,Zo as se,Zt as ce,en as le,es as ue,jA as G,jo as de,ko as fe,ns as pe,qo as me,qt as he,rs as ge,ts as _e,wt as ve,xt as ye,yT as be,zA as xe,zo as Se,zt as Ce}from"./dist-C6Mg6d5Y.js";import{t as K}from"./button-NWqGTLKg.js";import{B as we,C as Te,H as Ee,L as De,P as q,R as Oe,S as ke,U as Ae,V as je,W as Me,b as Ne,et as Pe,it as Fe,nt as Ie,ot as Le,rt as Re,st as ze,ut as Be,vt as J,w as Ve,x as He,y as Ue,z as We}from"./index-DkxYxN0F.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-dGQzCWqS.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=o(f.me.getMe,{host:Be}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=o(f.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,s]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&s(i[0].name)},[t,i,a]);let c=o(f.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),l=o(f.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return a===null||c===void 0?i!==void 0&&i.length===0?[]:void 0:c.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,c,i,l]),[d,p]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!u||u.length===0||(!d||!u.some(e=>$(e)===d))&&p($(u[0]))},[u,d]);let m=u?.find(e=>$(e)===d)??null,h=E(f.agentFiles.listAgentFiles),[_,v]=(0,Y.useState)({status:`idle`}),y=m?.instanceName??null,b=m?.agentId??null,x=o(f.compat.forInstance,n&&y!==null?{instanceName:y}:`skip`),C=n&&y!==null?Ue(x,`agentFiles`):null,T=C===null?!1:C===`loading`?null:C.blocked,D=(0,Y.useCallback)(async()=>{if(!(y===null||b===null)){v({status:`loading`});try{v({status:`done`,files:(await h({instanceName:y,agentId:b})).files})}catch{v({status:`error`})}}},[h,y,b]);(0,Y.useEffect)(()=>{T===!1&&D()},[D,T]);let[O,k]=(0,Y.useState)(null),j=o(f.agentFileCuration.listCurations,t&&y!==null&&b!==null?{instanceName:y,agentId:b}:`skip`),M=o(f.agentFileCuration.curationSettings,t&&y!==null?{instanceName:y}:`skip`),N=E(f.agentFileCuration.requestCuration),[P,F]=(0,Y.useState)(null),[I,L]=(0,Y.useState)(null),{toast:R}=q(),z=(0,Y.useMemo)(()=>{let e=new Map;for(let t of j??[])e.has(t.name)||e.set(t.name,t);return e},[j]),ne=(0,Y.useCallback)(async e=>{if(!(y===null||b===null)){F(e);try{let t=await N({instanceName:y,agentId:b,name:e,trigger:`manual`});t.ok?R({title:ce(),variant:`success`}):R({title:ae({reason:t.reason??`unknown`}),variant:`error`})}catch{R({title:W(),variant:`error`})}finally{F(null)}}},[N,y,b,R]),B=A(),V=(0,Y.useMemo)(()=>new Intl.NumberFormat(B,{maximumFractionDigits:0}),[B]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ne,{value:a??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(Te,{size:`sm`,"aria-label":pe(),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:d??``,onValueChange:e=>p(e),children:[(0,Q.jsx)(Te,{size:`sm`,"aria-label":_e(),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:ue()})]}),m===null?null:C===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):C!==null&&C.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,qe(C.gatewayVersion)]}):_.status===`loading`||_.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):_.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ee(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:te()})]}):_.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:_.files.map(e=>{let n=Ye(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Pe,{variant:`outline`,children:se()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:U({size:Z(e.size,B)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:oe({pct:V.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":S()}):(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:()=>k(e),children:t?w():g()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:M?.budgetChars??null,enabled:M?.enabled??!1,curation:z.get(e.name)??null,inFlight:P===e.name,onCurate:()=>void ne(e.name),onReview:e=>L(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:me({used:Z(Ze(_.files),B),total:Z(Je,B),pct:V.format(Xe(Ze(_.files)))})})]}),O&&m?(0,Q.jsx)(rt,{instanceName:m.instanceName,agentId:m.agentId,name:O.name,isAdmin:t,onClose:()=>k(null),onSaved:()=>void D()}):null,I?(0,Q.jsx)(it,{curationId:I,onClose:()=>L(null),onApplied:()=>{L(null),D()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:a,inFlight:o,onCurate:s,onReview:c}){return a?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(a._id),children:i()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(Pe,{variant:`outline`,className:`oc-afiles__curate-status`,children:F()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:le()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:o}){let l=E(f.agentFiles.getAgentFile),u=E(f.agentFiles.setAgentFile),d=q(),[p,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),[y,x]=(0,Y.useState)(``),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),[O,P]=(0,Y.useState)(!1),[ee,F]=(0,Y.useState)(!1),L=(0,Y.useCallback)(async r=>{_(!1);try{let i=await l({instanceName:e,agentId:t,name:n});h({content:i.content,updatedAtMs:i.updatedAtMs}),r||x(i.content),P(!1)}catch{_(!0)}},[l,e,t,n]);(0,Y.useEffect)(()=>{L(!1)},[L]);async function R(){if(p!==null){T(!0),F(!1);try{await u({instanceName:e,agentId:t,name:n,content:y,baseUpdatedAtMs:p.updatedAtMs??void 0}),d.success(I({name:n})),o(),await L(!1)}catch(e){et(e)?P(!0):F(!0)}finally{T(!1)}}}let z=p!==null&&y!==p.content,B=(0,Y.useMemo)(()=>p===null?null:$e(p.content,y),[p,y]),re=y.length>X,H=A(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(H),[H]);return(0,Q.jsx)(Ie,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Le,{children:[(0,Q.jsx)(ze,{children:ie({name:n})}),(0,Q.jsxs)(Fe,{children:[ne({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,v()]})]})]}),g?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[b(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void L(!1),children:te()})]}):p===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:y,readOnly:!r,spellCheck:!1,onChange:e=>x(e.target.value),"aria-label":ie({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:V()}),O?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[m(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void L(!0),children:N()})]}):null,ee?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:D()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${re?` is-over`:``}`,children:s({count:U.format(y.length),max:U.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!z||w||O,onClick:()=>C(!0),children:w?c():Se()}):null]})]}),(0,Q.jsx)(De,{open:S,onOpenChange:C,children:(0,Q.jsxs)(we,{children:[(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(Me,{children:j({name:n})}),(0,Q.jsx)(je,{children:k({agent:t})})]}),B?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:de({added:B.added,removed:B.removed})}),B.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:a()}),B.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,B.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:fe()}),B.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(We,{children:be()}),(0,Q.jsx)(Oe,{onClick:()=>void R(),children:M()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=o(f.agentFileCuration.getProposal,{curationId:e}),i=E(f.agentFileCuration.approveCuration),a=xe(f.agentFileCuration.rejectCuration),{toast:s}=q(),[m,g]=(0,Y.useState)(null),[v,b]=(0,Y.useState)(!1),[S,w]=(0,Y.useState)(``),D=A(),k=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function j(){g(`approve`);try{let t=await i({curationId:e});t.ok?(s({title:C(),variant:`success`}),n()):s({title:t.reason===`conflict`?T():_({reason:t.reason??`unknown`}),variant:`error`})}catch{s({title:W(),variant:`error`})}finally{g(null)}}async function M(n){g(`reject`);try{let r=S.trim();(await a({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?s({title:n?R():he(),variant:`success`}):s({title:y(),variant:`error`}),t()}catch{s({title:W(),variant:`error`})}finally{g(null)}}return(0,Q.jsx)(Ie,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Le,{children:[(0,Q.jsx)(ze,{children:r?H({name:r.name}):G()}),(0,Q.jsx)(Fe,{children:B()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[re({before:Z(r.beforeSize,D),after:Z(r.proposedSize,D)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,l()]}):null]}),k?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:Ce({added:k.added,removed:k.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:ye({feedback:r.feedback})}):null,k&&k.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:k.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:h()}),(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:L()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),v?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:d()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:p(),value:S,onChange:e=>w(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>b(!1),disabled:m!==null,children:z()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void M(!1),disabled:m!==null,children:m===`reject`?c():ve()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void M(!0),disabled:m!==null,children:m===`reject`?c():u()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>b(!0),disabled:m!==null||r==null,children:O()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void j(),disabled:m!==null||r==null,children:m===`approve`?c():x()})]})]})})}export{tt as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,A_ as i,BA as a,C_ as ee,D_ as o,E as s,E_ as te,Gg as c,Hg as l,Jg as u,Kg as ne,O_ as d,Qg as re,S_ as ie,T_ as f,Ug as p,Wg as m,Xg as ae,Yg as oe,Zg as se,__ as ce,a_ as h,b_ as le,c_ as g,d_ as _,e_ as ue,f_ as de,g_ as fe,h_ as pe,i_ as me,k_ as v,l_ as he,m_ as ge,n_ as y,o_ as b,p_ as x,qg as S,r_ as C,s_ as w,t_ as T,u_ as E,v_ as D,w_ as O,x_ as k,y_ as A,zA as j}from"./dist-C6Mg6d5Y.js";import{A as M,C as N,F as P,Ft as F,It as I,P as L,S as R,a as _e,b as z,et as B,r as ve,ut as ye,w as V,x as H}from"./index-DkxYxN0F.js";import{n as be}from"./TimeRangePicker-CiPB_fhH.js";import{t as xe}from"./FilterBar-Cj_JY0E6.js";import{t as Se}from"./DataTableShell-MMI0rbUm.js";import{t as U}from"./dispatchErrorInfo-DWqpuG4e.js";var W=t(e(),1),G=n(),K=`__all__`,Ce=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function we(e){return e===`open`?i():e===`acknowledged`?v():d()}var Te=[`info`,`warn`,`critical`],Ee=[`detector`,`agent`,`user`],De={kind:`relative`,from:`now-30d`,to:`now`},Oe=200,q=`all`;function J(){let e=I({from:`/settings/anomalies`}),t=F({from:`/settings/anomalies`}),n=e.q??``,i=e.status===q?K:e.status,c=e.severity??K,l=e.kind??K,[d,p]=(0,W.useState)(K),m=ve(e.from,e.to),{from:v,to:U}=be(m),J=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Y=e=>void t({search:t=>({...t,status:e===K?q:e})}),X=e=>void t({search:t=>({...t,severity:e===K?void 0:e})}),Ne=e=>void t({search:t=>({...t,kind:e===K?void 0:e})}),Pe=e=>void t({search:t=>({...t,..._e(e)})}),Fe=P(),Z=L(),Q=j(s.anomalies.resolveAnomaly),Ie=(a(s.me.getMe,{host:ye})?.permissions??[]).includes(`admin.manage`),$=a(s.anomalies.listAnomalies,{limit:Oe,filter:{q:n||void 0,from:v,to:U,anomalyStatus:i===K?void 0:i,severity:c===K?void 0:c,source:d===K?void 0:d,kind:l===K?void 0:l}}),Le=(0,W.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Re=n!==``||i!==`open`||c!==K||d!==K||l!==K||m.kind!==`relative`||m.from!==De.from;function ze(){p(K),t({search:{status:`open`},replace:!0})}async function Be(e){if(await Fe({title:o(),description:(0,G.jsxs)(G.Fragment,{children:[te(),` `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,f(),` `,(0,G.jsx)(`strong`,{children:O()}),`.`,` `,ee()]}),confirmLabel:ie()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(k(),e.kind)}catch(e){Z.error(le(),e)}}async function Ve(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(A(),e.kind)}catch(e){Z.error(D(),e)}}return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`oc-admin__hint`,children:[ce(),` `,(0,G.jsx)(`strong`,{children:fe()}),` `,pe(),` `,(0,G.jsx)(`strong`,{children:ge()}),` `,x(),` `,(0,G.jsx)(`strong`,{children:de()}),` `,_(),` `,(0,G.jsx)(`span`,{className:`oc-filter__window`,children:E()})]}),(0,G.jsxs)(xe,{q:n,onQChange:J,searchPlaceholder:he(),timeRange:m,onTimeRangeChange:Pe,onReset:ze,canReset:Re,children:[(0,G.jsxs)(z,{value:i,onValueChange:Y,children:[(0,G.jsx)(N,{size:`sm`,className:`w-36`,children:(0,G.jsx)(V,{})}),(0,G.jsxs)(H,{children:[(0,G.jsx)(R,{value:K,children:g()}),Ce.map(e=>(0,G.jsx)(R,{value:e.value,children:we(e.value)},e.value))]})]}),(0,G.jsxs)(z,{value:c,onValueChange:X,children:[(0,G.jsx)(N,{size:`sm`,className:`w-36`,children:(0,G.jsx)(V,{placeholder:w()})}),(0,G.jsxs)(H,{children:[(0,G.jsx)(R,{value:K,children:b()}),Te.map(e=>(0,G.jsx)(R,{value:e,children:e},e))]})]}),(0,G.jsxs)(z,{value:d,onValueChange:p,children:[(0,G.jsx)(N,{size:`sm`,className:`w-32`,children:(0,G.jsx)(V,{placeholder:h()})}),(0,G.jsxs)(H,{children:[(0,G.jsx)(R,{value:K,children:me()}),Ee.map(e=>(0,G.jsx)(R,{value:e,children:e},e))]})]}),(0,G.jsxs)(z,{value:l,onValueChange:Ne,children:[(0,G.jsx)(N,{size:`sm`,className:`w-36`,children:(0,G.jsx)(V,{placeholder:C()})}),(0,G.jsxs)(H,{children:[(0,G.jsx)(R,{value:K,children:y()}),Le.map(e=>(0,G.jsx)(R,{value:e,children:e},e))]})]})]}),(0,G.jsx)(Se,{title:T(),rows:$,emptyHint:i===`open`?ue():r(),rowActions:e=>Ie&&e.status===`open`?[{label:re(),onSelect:()=>void Be(e)},{label:se(),onSelect:()=>void Ve(e)}]:[],columns:[{header:ae(),cell:e=>(0,G.jsx)(`span`,{className:`oc-traces__time`,children:M(e.at)}),sort:e=>e.at},{header:C(),cell:e=>(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:w(),cell:e=>(0,G.jsx)(Ae,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:oe(),cell:e=>(0,G.jsx)(je,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:h(),cell:e=>(0,G.jsx)(B,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:u(),cell:e=>(0,G.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:S(),cell:e=>(0,G.jsx)(ke,{row:e}),sort:e=>e.evidence??null},{header:ne(),cell:e=>e.correlationId?(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:Me(e.correlationId)}):(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Y(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function X(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function ke({row:e}){let t=F();if(e.kind===`subagent.failure`){let n=X(e);return(0,G.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,G.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,G.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,c()]}):null]})}let n=Y(e);if(!n.dominantCode)return(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=U(n.dominantCode),i=n.sampleCorrelationId;return(0,G.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,G.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,G.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,G.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,G.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,c()]}):null]})}function Ae({severity:e}){return(0,G.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function je({status:e}){return e===`open`?(0,G.jsx)(B,{variant:`destructive`,children:m()}):e===`acknowledged`?(0,G.jsx)(B,{variant:`secondary`,children:p()}):(0,G.jsx)(B,{variant:`outline`,children:l()})}function Me(e){return e.length>8?e.slice(0,8):e}export{J as AnomaliesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,Av as i,BA as a,Cv as o,Dv as s,E as c,Ev as l,Fv as u,J as d,Mv as f,Nv as p,Ov as m,Pv as h,Q as g,Sv as _,Tv as v,X as y,Y as b,Z as x,jv as S,kv as C,wv as w,xv as T}from"./dist-C6Mg6d5Y.js";import{A as E,C as D,Ft as O,It as k,S as A,a as j,b as M,i as N,o as P,r as F,t as I,w as L,x as R}from"./index-DkxYxN0F.js";import{n as ee}from"./TimeRangePicker-CiPB_fhH.js";import{t as z}from"./FilterBar-Cj_JY0E6.js";import{t as B}from"./AdvancedFilter-WSiPBy4U.js";import{t as V}from"./DataTableShell-MMI0rbUm.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:r()},{value:`realLabel`,label:g()},{value:`targetLabel`,label:x()},{value:`impersonated`,label:y()},{value:`resource`,label:b()},{value:`resourceId`,label:d()}];function q(){let e=k({from:`/settings/audit`}),t=O({from:`/settings/audit`}),n=e.q??``,r=e.action??G,d=e.impersonated??G,g=e.resource??G,y=F(e.from,e.to),b=(0,H.useMemo)(()=>P(e.adv),[e.adv]),{from:x,to:I}=ee(y),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,...j(e)})}),Q=e=>void t({search:t=>({...t,adv:N(e)}),replace:!0}),$=a(c.admin.listAudit,{filter:{q:n||void 0,from:x,to:I,action:r===G?void 0:r,resource:g===G?void 0:g,impersonated:d===G?void 0:d===`yes`,advanced:b.length>0?b: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!==``||r!==G||d!==G||g!==G||b.length>0||y.kind!==`relative`||y.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:[u(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:h()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:p(),timeRange:y,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(M,{value:r,onValueChange:J,children:[(0,U.jsx)(D,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:f()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(A,{value:G,children:S()}),te.map(e=>(0,U.jsx)(A,{value:e,children:e},e))]})]}),(0,U.jsxs)(M,{value:d,onValueChange:Y,children:[(0,U.jsx)(D,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(A,{value:G,children:i()}),(0,U.jsx)(A,{value:`yes`,children:C()}),(0,U.jsx)(A,{value:`no`,children:m()})]})]}),(0,U.jsxs)(M,{value:g,onValueChange:X,children:[(0,U.jsx)(D,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:s()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(A,{value:G,children:l()}),ne.map(e=>(0,U.jsx)(A,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:b,onChange:Q}),(0,U.jsx)(V,{title:v(),rows:$,emptyHint:w(),columns:[{header:o(),cell:e=>E(e.at),sort:e=>e.at},{header:f(),cell:e=>e.action,sort:e=>e.action},{header:_(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:T(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:s(),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{$a as r,$p as i,Am as a,Ap as o,BA as s,Bm as c,Bp as l,Cp as u,D as d,Dp as f,E as p,Ep as m,Fm as h,Fp as g,Gp as _,Hm as v,Hp as y,Im as ee,Ip as b,Jp as te,Kp as x,LA as ne,Lm as re,Lp as S,Mp as ie,Nm as ae,Np as oe,Op as se,Pm as ce,Pp as le,Qa as ue,Qp as de,Rm as fe,Rp as pe,Sp as me,Tp as he,Um as ge,Up as _e,Vp as ve,Wp as ye,Xp as be,Yp as xe,Za as Se,Zp as Ce,_p as we,am as Te,ao as C,bp as Ee,co as De,em as Oe,eo as ke,fp as w,gp as Ae,hp as je,im as Me,io as Ne,jp as Pe,km as Fe,kp as Ie,lo as Le,mp as T,nm as Re,no as ze,om as Be,oo as Ve,pp as E,qa as He,qp as Ue,rm as We,ro as Ge,sm as Ke,so as qe,tm as Je,to as Ye,uo as Xe,vp as Ze,wp as Qe,xp as $e,yp as et,zA as tt,zm as nt,zp as D}from"./dist-C6Mg6d5Y.js";import{i as O,r as rt}from"./dist-DJ0yfLRs.js";import{t as it}from"./chevrons-up-down-BwvukG4v.js";import{i as at,n as k,o as ot,r as st,s as ct}from"./FieldLabel-Bq4HjU7s.js";import{t as A}from"./button-NWqGTLKg.js";import{A as j,C as M,Et as lt,Ft as ut,G as dt,K as ft,Nt as N,P as pt,Pt as P,S as F,b as I,et as L,it as mt,j as R,m as ht,nt as gt,ot as _t,p as vt,q as yt,rt as bt,st as xt,tt as z,ut as St,vt as B,w as V,x as H,xt as Ct}from"./index-DkxYxN0F.js";import{r as wt}from"./locales-CPjguROj.js";import{a as Tt,i as U,n as Et,o as W,r as G,t as Dt}from"./table-D0CDjuoL.js";import{t as Ot}from"./FilterBar-Cj_JY0E6.js";import{a as kt,n as At,o as jt,r as Mt,s as Nt,t as Pt}from"./compatView-dGQzCWqS.js";import{t as K}from"./dispatchErrorInfo-DWqpuG4e.js";var Ft=d(`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`}]]),It=d(`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`}]]),q=t(e(),1);function Lt(e){return e.filter(e=>e.state===`error`)}function Rt(e){return e.reachable&&Lt(e.targets).length===0}function zt(e){return e.state===`error`&&e.lastErrorCode!==null}function Bt(e){return!!e.lastDownstreamRejectCode}function J(e){return e.kind??`openclaw`}function Vt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Ht(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,J(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(J(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Vt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>J(e)===r)}))}function Ut(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,Wt={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function Gt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Kt(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 qt(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Jt(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 jt(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function Yt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=qt(t.key,e),a=qt(t.key,r);return i&&a?0:i?1:a?-1:n*Jt(t.key,e,r)})}function Xt(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 Zt(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function Qt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>jt(e,t)??Z(e,t))}var Q=n();function $t({connections:e,displayByInstance:t}){let[n,r]=(0,q.useState)(Wt),[i,a]=(0,q.useState)(null),s=(0,q.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),c=(0,q.useMemo)(()=>Xt(s),[s]),l=(0,q.useMemo)(()=>Zt(s),[s]),d=(0,q.useMemo)(()=>Qt(s),[s]),p=(0,q.useMemo)(()=>Yt(Kt(s,n),i),[s,n,i]);function h(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Ot,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:f(),onReset:()=>r(Wt),canReset:Gt(n),children:[(0,Q.jsxs)(I,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(V,{placeholder:he()})}),(0,Q.jsxs)(H,{children:[(0,Q.jsx)(F,{value:Y,children:m()}),c.map(e=>(0,Q.jsx)(F,{value:e,children:tn(e)},e))]})]}),(0,Q.jsxs)(I,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(M,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(V,{placeholder:Qe()})}),(0,Q.jsxs)(H,{children:[(0,Q.jsx)(F,{value:Y,children:m()}),l.map(e=>(0,Q.jsx)(F,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(I,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(V,{placeholder:u()})}),(0,Q.jsxs)(H,{children:[(0,Q.jsx)(F,{value:Y,children:m()}),d.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))]})]})]}),p.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):(0,Q.jsxs)(Dt,{className:`oc-conn__table`,children:[(0,Q.jsx)(Tt,{children:(0,Q.jsxs)(W,{children:[(0,Q.jsx)($,{label:$e(),sortKey:`target`,sort:i,onSort:h}),(0,Q.jsx)($,{label:Ee(),sortKey:`state`,sort:i,onSort:h}),(0,Q.jsx)($,{label:et(),sortKey:`instance`,sort:i,onSort:h}),(0,Q.jsx)($,{label:Ze(),sortKey:`host`,sort:i,onSort:h}),(0,Q.jsx)($,{label:we(),sortKey:`version`,sort:i,onSort:h}),(0,Q.jsx)(U,{children:Ae()}),(0,Q.jsx)($,{label:je(),sortKey:`lastOk`,sort:i,onSort:h})]})}),(0,Q.jsx)(Et,{children:p.map(e=>(0,Q.jsx)(en,{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)(U,{"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)(rt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(O,{size:13,"aria-hidden":!0}):(0,Q.jsx)(it,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function en({r:e}){let t=zt(e)?K(e.lastErrorCode):null,n=Bt(e)?K(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(q.Fragment,{children:[(0,Q.jsxs)(W,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(G,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(G,{children:(0,Q.jsx)(nn,{state:e.state})}),(0,Q.jsx)(G,{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)(G,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(G,{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)(G,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:Ie({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(G,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:R(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(W,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(G,{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?` · ${R(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:[se({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function tn(e){return e===`connected`?T():e===`error`?E():w()}function nn({state:e}){return e===`connected`?(0,Q.jsx)(L,{variant:`secondary`,children:T()}):e===`error`?(0,Q.jsx)(L,{variant:`destructive`,children:E()}):(0,Q.jsx)(L,{variant:`outline`,children:w()})}function rn(){return s(p.bridgeHealth.getBridgeHealth,{})}function an(){let e=rn(),t=s(p.compat.getBridgeCompat,{}),n=s(p.me.getMe,{host:St})?.role===`admin`,r=s(p.admin.listInstances,n?{}:`skip`),i=s(p.agents.usageForInstances,n?{}:`skip`),a=ut(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),c=Ht(e?e.targets:[],t?t.targets:[],r??[]),l=t?.compat??null,u=t===void 0?`loading`:t===null?`nodata`:`ready`,d=l!==null&&At(l,`hermes`)&&!c.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(on,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Ue()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:x()}),i.map(e=>{let t=ht(e.usage,Date.now());return t?(0,Q.jsxs)(`div`,{className:`oc-bridge__usage-row`,children:[(0,Q.jsx)(`span`,{className:`oc-bridge__usage-instance`,children:e.instanceName}),(0,Q.jsx)(`span`,{className:`oc-bridge__usage-windows`,children:t.windows.map(e=>(0,Q.jsx)(`span`,{className:`oc-meter ${e.percentLeft<=10?`is-critical`:e.percentLeft<=25?`is-warn`:`is-ok`}`,children:(0,Q.jsxs)(`span`,{className:`oc-meter__label`,children:[e.provider,` `,e.label,`: `,e.percentLeft,`%`,e.resetText?` ⏱${e.resetText}`:``]})},`${e.provider}:${e.label}`))})]},e.instanceName):null})]}):null,c.map(e=>(0,Q.jsx)(sn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:l,compatStatus:u,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null},e.key)),d?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):null]})}function on({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:kt(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:De(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,qe({build:t.buildVersion??`?`})]}):null,` · `,Ve(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?C():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:D()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:pe()});let o=Lt(e.targets),s=!e.reachable,c=Rt(e),l=c?`ok`:`error`,u=j(e.checkedAt),d=e.startedAt==null?null:j(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${l}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c?(0,Q.jsx)(N,{size:22}):s?(0,Q.jsx)(It,{size:22}):(0,Q.jsx)(B,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:c?S():s?b():g({count:o.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Ft,{size:12,"aria-hidden":!0}),` `,le({time:u})]}),d?(0,Q.jsx)(`span`,{children:oe({time:d})}):null,a]}),s?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:K(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:ie()})]})}function sn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Nt(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:Pt(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,q.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)(Ct,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Ut(e)}),f?(0,Q.jsx)(L,{variant:f===`beyond`?`destructive`:`secondary`,children:Mt(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Xe()}),(0,Q.jsx)(ln,{support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(cn,{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)(O,{size:13,"aria-hidden":!0}):(0,Q.jsx)(P,{size:13,"aria-hidden":!0}),Pe({count:t.length})]}),p?(0,Q.jsx)($t,{connections:t,displayByInstance:c}):null]})}function cn({protocol:e}){let[t,n]=(0,q.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:[_(),i.length>0?(0,Q.jsx)(L,{variant:`destructive`,children:_e({count:i.length})}):(0,Q.jsx)(L,{variant:`secondary`,children:ye()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[y({version:e.vendoredVersion}),r?` · `+ve({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)(O,{size:13,"aria-hidden":!0}):(0,Q.jsx)(P,{size:13,"aria-hidden":!0}),l({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 ln({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Le()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:ze()}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:Ye({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:C()}),e?(0,Q.jsx)(pn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):(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:kt(e.version)}),(0,Q.jsx)(L,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Mt(e.state)})]},e.instanceName))})]})}function un({instance:e,onClose:t}){return(0,Q.jsx)(gt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(bt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(_t,{children:[(0,Q.jsx)(xt,{children:ge({instance:e.displayName??e.name})}),(0,Q.jsx)(mt,{children:v()})]}),(0,Q.jsx)(fn,{instance:e,onClose:t})]})})}function dn({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)(N,{"aria-hidden":!0}):(0,Q.jsx)(B,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Ce():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,be()]}):null}function fn({instance:e,onClose:t}){let n=tt(p.admin.upsertInstanceConfig),r=ne(p.bridge.validateMediaPaths),o=pt(),s=wt(e.config?.contentLocale,void 0),[l,u]=(0,q.useState)(()=>at(e.config??{},s)),[d,f]=(0,q.useState)(!1),[m,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(null),y=l.inboundMediaMode===`shared-fs`,b=l.mediaMode===`shared-fs`,x=y||b;async function S(){g(!0),v(null);try{v(await r({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){o.error(Je(),e)}finally{g(!1)}}async function ie(){f(!0);try{let r=e.config??{};await n({instanceId:e._id,config:st(l,r,s)}),t()}catch(e){o.error(h(),e)}finally{f(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:c(),help:ce()}),(0,Q.jsxs)(I,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Q.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(V,{})}),(0,Q.jsx)(H,{children:ct.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:nt(),help:ae()}),(0,Q.jsxs)(I,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Q.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(V,{})}),(0,Q.jsx)(H,{children:ot.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:fe(),help:a()}),(0,Q.jsx)(z,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:Ke(),help:Be()}),(0,Q.jsx)(z,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),b&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(k,{label:Te(),help:Me()}),(0,Q.jsx)(z,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(vt,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Q.jsx)(k,{label:re(),help:Fe()})]}),x&&_!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(B,{"aria-hidden":!0}),te({reason:_.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(dn,{label:i(),result:_.inbound}),(0,Q.jsx)(dn,{label:de(),result:_.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(B,{"aria-hidden":!0}),xe()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Q.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void S(),disabled:m,children:[m?(0,Q.jsx)(lt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,m?Re():We()]}),(0,Q.jsx)(A,{size:`sm`,onClick:()=>void ie(),disabled:d,children:ee()})]})]})})}function pn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(dt,{children:[(0,Q.jsx)(yt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?ke():r({count:e.length}),(0,Q.jsx)(O,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(ft,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:ue()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(L,{variant:`secondary`,children:e},e))})]})]})}export{an as BridgeTab,un as InstanceConfigDialog};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BA as r,Bn as i,Bs as a,Co as o,E as s,Eo as c,Gn as l,Hn as u,LA as d,Ns as f,Ps as p,Rs as m,So as h,To as g,Un as _,Vm as v,Vn as y,Wn as b,_o as ee,bo as x,do as te,fo as ne,go as S,ho as C,jA as w,mo as re,ns as T,po as ie,vo as ae,wo as oe,xo as se,yT as ce,yo as le,zA as E,zn as D}from"./dist-C6Mg6d5Y.js";import{t as O}from"./button-NWqGTLKg.js";import{B as ue,C as k,H as A,L as j,P as de,R as fe,S as pe,U as me,V as M,W as N,b as P,d as F,f as I,p as L,tt as R,vt as z,w as he,x as ge,y as _e,z as B}from"./index-DkxYxN0F.js";import{i as ve}from"./compatView-dGQzCWqS.js";/* empty css */var V=t(e(),1),ye=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function be(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 H=n();function xe({instance:e}){let t=E(s.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[o,c]=(0,V.useState)(n),[l,d]=(0,V.useState)(r===null?``:String(r)),[f,p]=(0,V.useState)(`idle`);(0,V.useEffect)(()=>{c(n),d(r===null?``:String(r)),p(`idle`)},[e._id,n,r]);let m=l.trim(),h=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,g=!o||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,v=o!==n||(h??null)!==r;async function b(){p(`saving`);try{let n={...e.config??{}};n.curationEnabled=o,!o||h===null||Number.isNaN(h)?delete n.curationBudgetChars:n.curationBudgetChars=h,await t({instanceId:e._id,config:n}),p(`done`)}catch{p(`error`)}}return(0,H.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,H.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,H.jsx)(L,{checked:o,onCheckedChange:e=>c(e===!0),"aria-label":_()}),(0,H.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()})]}),(0,H.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,H.jsx)(R,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:l,onChange:e=>d(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":u(),disabled:!o}),(0,H.jsx)(O,{size:`sm`,disabled:!v||!g||f===`saving`,onClick:()=>void b(),children:f===`saving`?a():x()})]}),g?null:(0,H.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}),f===`done`?(0,H.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):null,f===`error`?(0,H.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:C()}):null,(0,H.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()})]})}function Se({instance:e}){let t=E(s.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,V.useState)(n===null?``:String(n)),[o,c]=(0,V.useState)(`idle`);(0,V.useEffect)(()=>{i(n===null?``:String(n)),c(`idle`)},[e._id,n]);let u=r.trim(),d=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,f=d===null||Number.isInteger(d)&&d>=1e3&&d<=2e5,p=(d??null)!==n;async function m(){c(`saving`);try{let n={...e.config??{}};d===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=d,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}return(0,H.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,H.jsx)(`span`,{className:`oc-cdefaults__label`,children:l()}),(0,H.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,H.jsx)(R,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,H.jsx)(O,{size:`sm`,disabled:!p||!f||o===`saving`,onClick:()=>void m(),children:o===`saving`?a():x()})]}),f?null:(0,H.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:D()}),o===`done`?(0,H.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):null,o===`error`?(0,H.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:C()}):null,(0,H.jsx)(`p`,{className:`oc-cdefaults__help`,children:b()})]})}function U(){let e=d(s.agentFiles.getChatDefaults),t=d(s.agentFiles.setChatDefaults),n=d(s.agentFiles.clearChatDefaults),i=de(),[l,u]=(0,V.useState)({status:`loading`}),[_,y]=(0,V.useState)({thinkingDefault:null,fastModeDefault:null}),[b,E]=(0,V.useState)(!1),[D,L]=(0,V.useState)(!1),R=r(s.admin.listInstances,{}),[U,W]=(0,V.useState)(null);(0,V.useEffect)(()=>{!R||R.length===0||(!U||!R.some(e=>e.name===U))&&W(R[0].name)},[R,U]);let G=(R?.length??0)>1,Ce=R!==void 0&&R.length===0,we=r(s.compat.forInstance,U?{instanceName:U}:`skip`),K=U?_e(we,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,V.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,V.useRef)(0),X=(0,V.useCallback)(async()=>{let t=++Y.current;u({status:`loading`});try{let n=be(await e(J));if(Y.current!==t)return;u({status:`done`,current:n}),y(n)}catch{if(Y.current!==t)return;u({status:`error`})}},[e,J]);(0,V.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=l.status===`done`?l.current:null,Q=Z!==null&&_.thinkingDefault!==null&&_.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&_.fastModeDefault!==null&&_.fastModeDefault!==Z.fastModeDefault,Te=Q||$;async function Ee(){L(!0);try{await t({...J,...Q?{thinkingDefault:_.thinkingDefault}:{},...$?{fastModeDefault:_.fastModeDefault}:{}}),i.success(S()),await X()}catch(e){i.error(C(),e)}finally{L(!1)}}async function De(){L(!0);try{await n({...J}),i.success(ee()),await X()}catch(e){i.error(C(),e)}finally{L(!1)}}let Oe=(0,V.useMemo)(()=>ye.map(e=>({id:e,label:I(e)})),[]),ke=(0,V.useMemo)(()=>[{id:`fast`,label:p()},{id:`standard`,label:f()}],[]);return(0,H.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:c()}),G&&U?(0,H.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,H.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,H.jsxs)(P,{value:U,onValueChange:e=>W(e),disabled:D,children:[(0,H.jsx)(k,{size:`sm`,"aria-label":T(),children:(0,H.jsx)(he,{})}),(0,H.jsx)(ge,{children:(R??[]).map(e=>(0,H.jsx)(pe,{value:e.name,children:e.name},e.name))})]})]}):null,Ce?(0,H.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:v()}):K===`loading`?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):K.blocked?(0,H.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,H.jsx)(z,{size:14,"aria-hidden":!0}),` `,ve(K.gatewayVersion)]}):l.status===`loading`?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):l.status===`error`?(0,H.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[se(),` `,(0,H.jsx)(O,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:m()})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,H.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()}),(0,H.jsx)(F,{options:Oe,value:_.thinkingDefault,onChange:e=>y({..._,thinkingDefault:e}),disabled:D}),(0,H.jsx)(`p`,{className:`oc-cdefaults__help`,children:oe()})]}),(0,H.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,H.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()}),(0,H.jsx)(F,{options:ke,value:_.fastModeDefault===null?null:_.fastModeDefault?`fast`:`standard`,onChange:e=>y({..._,fastModeDefault:e===`fast`}),disabled:D}),(0,H.jsx)(`p`,{className:`oc-cdefaults__help`,children:h()})]}),(0,H.jsxs)(`div`,{className:`oc-cdefaults__actions`,children:[(0,H.jsx)(O,{variant:`outline`,size:`sm`,disabled:D,onClick:()=>void De(),title:ae(),children:le()}),(0,H.jsx)(O,{size:`sm`,disabled:!Te||D,onClick:()=>E(!0),children:D?a():x()})]}),(0,H.jsx)(`p`,{className:`oc-cdefaults__note`,children:re()})]}),(()=>{let e=R?.find(e=>e.name===(U??R[0]?.name));return e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Se,{instance:e}),(0,H.jsx)(xe,{instance:e})]}):null})(),(0,H.jsx)(j,{open:b,onOpenChange:E,children:(0,H.jsxs)(ue,{children:[(0,H.jsxs)(me,{children:[(0,H.jsx)(N,{children:ie()}),(0,H.jsx)(M,{children:ne()})]}),(0,H.jsxs)(A,{children:[(0,H.jsx)(B,{children:ce()}),(0,H.jsx)(fe,{onClick:()=>void Ee(),children:te()})]})]})})]})}export{U as ChatDefaultsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bu as r,Hu as i,Iu as a,Lu as o,Ru as s,Vu as c,zu as l}from"./dist-Cjlv3ZK-.js";import{i as u,r as d}from"./dist-DIuY2jzI.js";import{t as f}from"./chevrons-up-down-Drx4hbha.js";import{t as p}from"./button-Bv-PK2-Y.js";import{$ as m,J as h,Q as g,X as _,Y as v,kt as y,p as b,wt as x,yt as S}from"./index-BWV7nAxJ.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-Dv9jX9eF.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=c(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(S,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):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":l(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":a({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],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)(h,{children:[(0,M.jsx)(m,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(y,{})})}),(0,M.jsx)(v,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(g,{}):null,(0,M.jsx)(_,{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{Bu as r,Gu as i,Hu as a,Uu as o,Vu as s,Wu as c,zu as l}from"./dist-C6Mg6d5Y.js";import{i as u,r as d}from"./dist-DJ0yfLRs.js";import{t as f}from"./chevrons-up-down-BwvukG4v.js";import{t as p}from"./button-NWqGTLKg.js";import{$ as m,J as h,Q as g,X as _,Y as v,kt as y,p as b,wt as x,yt as S}from"./index-DkxYxN0F.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-D0CDjuoL.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=c(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(S,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):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":l({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],i=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(b,{"aria-label":s(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(h,{children:[(0,M.jsx)(m,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":r(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(y,{})})}),(0,M.jsx)(v,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(g,{}):null,(0,M.jsx)(_,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),i&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{et as t}from"./index-BWV7nAxJ.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{et as t}from"./index-DkxYxN0F.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{$b as r,Ax as i,BA as a,Bx as o,Cx as s,Dx as c,E as l,Ex as u,Fx as d,Gx as f,Hx as p,Ix as ee,Jx as m,Kx as h,Lx as g,Mx as _,Nx as v,Ox as te,Px as ne,Qb as y,Rx as re,Sx as ie,Tx as ae,Ux as b,Vx as x,Wx as S,Xb as C,Xx as w,Yx as T,Zb as E,Zx as D,_x as O,ax as k,bx as A,cx as j,dx as M,ex as N,fx as P,gx as F,hx as I,in as L,ix as R,jx as z,kx as B,lx as V,mx as H,nx as U,on as oe,ox as W,px as G,qx as K,rx as q,sx as se,tx as ce,ux as le,vx as ue,wx as de,xx as fe,yx as pe,zA as J,zx as me}from"./dist-C6Mg6d5Y.js";import{t as he}from"./button-NWqGTLKg.js";import{A as ge,F as _e}from"./index-DkxYxN0F.js";import{t as Y}from"./DataTableShell-MMI0rbUm.js";var X=t(e(),1),Z=n(),ve={altered_words:()=>D(),incorrect:()=>w(),incoherence:()=>T(),formatting:()=>m(),latency:()=>K(),api_error:()=>h(),other:()=>f()},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:b()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:p()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:S()})}function ye({data:e,closeReason:t}){let n=e.snapshot,r=J(l.feedback.respondToFeedback),[a,f]=(0,X.useState)(e.thread),[p,m]=(0,X.useState)(``),[h,y]=(0,X.useState)(!1);async function b(){let t=p.trim();if(!(!t||h)){y(!0);try{await r({feedbackId:e._id,text:t}),f(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),m(``)}finally{y(!1)}}}let S=[];try{S=n.contextJson?JSON.parse(n.contextJson):[]}catch{S=[]}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?` · ${x()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:o()}),(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:U()}),(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:me()}),a.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:a.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`?re():e.authorRole===`agent`?e.authorLabel??oe():g()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ee()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:d(),value:p,maxLength:2e3,rows:3,onChange:e=>m(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 b(),disabled:!p.trim()||h,children:h?ne():v()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||z()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:i()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||z()})]}):null,n.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:B()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,S.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:te({count:n.contextCount??S.length,truncated:n.contextTruncated?c():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:S.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:u()}),(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:ae()}),(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:de()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?s({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:[ie(),` `,n.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,fe()]})]}):null,n.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function be(){let e=a(l.feedback.listForAdmin,{}),t=J(l.feedback.readSnapshot),n=J(l.feedback.deleteFeedback),i=_e(),[o,s]=(0,X.useState)(null),[c,u]=(0,X.useState)({});async function d(e){if(o===e._id){s(null);return}if(!c[e._id]){let n=await t({feedbackId:e._id});u(t=>({...t,[e._id]:n}))}s(e._id)}async function f(e){await i({title:y(),description:E(),confirmLabel:C(),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:[A(),` `,(0,Z.jsx)(`strong`,{children:pe()}),` `,ue()]}),(0,Z.jsx)(Y,{title:O(),rows:e,emptyHint:F(),isExpanded:e=>o===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Z.jsx)(ye,{data:c[e._id],closeReason:e.userCloseReason}):null,columns:[{header:I(),cell:e=>ge(e.at),sort:e=>e.at},{header:H(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:G(),cell:e=>e.messageRole===`user`?P():M(),sort:e=>e.messageRole},{header:le(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${V({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:j(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:se(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:W(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:k()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:R()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:L()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:q()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?ce():N(),onSelect:()=>void d(e)},{label:r(),onSelect:()=>void f(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,WA as n}from"./dist-Cjlv3ZK-.js";import{_ as r,g as i,h as a,v as o}from"./index-BWV7nAxJ.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,qA as n}from"./dist-C6Mg6d5Y.js";import{_ as r,g as i,h as a,v as o}from"./index-DkxYxN0F.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{$k as r,Ak as ee,BA as te,Bk as ne,E as i,Fk as re,Gk as ie,Hk as ae,Ik as oe,Jk as a,Kk as o,Lk as s,Mk as c,NA as l,Nk as u,Pk as se,Qk as d,Rk as f,Uk as ce,Vk as le,Wk as ue,Xk as p,Yk as m,Zk as h,aA as de,cA as g,dA as fe,eA as _,iA as pe,jA as me,jk as he,lA as ge,ln as _e,nA as ve,oA as ye,qk as be,rA as xe,sA as v,tA as y,uA as b,un as x,yT as S,zA as C,zk as w}from"./dist-C6Mg6d5Y.js";import{t as T}from"./button-NWqGTLKg.js";import{$ as E,At as D,B as O,C as k,Ct as A,H as j,J as M,L as Se,P as Ce,R as we,S as N,U as Te,V as Ee,W as De,X as P,Y as Oe,b as F,et as I,kt as ke,p as Ae,w as L,x as R,yt as je,z as Me}from"./index-DkxYxN0F.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-D0CDjuoL.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return _();case`audio`:return r();case`video`:return d();case`pdf`:return h();case`document`:return p();case`archive`:return m();default:return a()}}function K(){let[e,t]=(0,H.useState)(W),[n,r]=(0,H.useState)(W),[a,d]=(0,H.useState)(W),[p,m]=(0,H.useState)(W),[h,_]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=C(i.files.softDelete),Y=Ce();function Ie(){t(W),r(W),d(W),m(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(s())}catch(e){Y.error(oe(),e)}}let X=te(i.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:a===W?void 0:a,category:p===W?void 0:p,includeAutoGenerated:h||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(l(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:me()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||a!==W||p!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(F,{value:e,onValueChange:t,children:[(0,U.jsx)(k,{size:`sm`,"aria-label":b(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:ge()}),(0,U.jsx)(N,{value:`inbound`,children:g()}),(0,U.jsx)(N,{value:`outbound`,children:v()})]})]}),(0,U.jsxs)(F,{value:n,onValueChange:r,children:[(0,U.jsx)(k,{size:`sm`,"aria-label":ye(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:de()}),Q.chats.map(e=>(0,U.jsx)(N,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(F,{value:a,onValueChange:d,children:[(0,U.jsx)(k,{size:`sm`,"aria-label":pe(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:xe()}),Q.instances.map(e=>(0,U.jsx)(N,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(F,{value:p,onValueChange:m,children:[(0,U.jsx)(k,{size:`sm`,"aria-label":ve(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:y()}),Q.categories.map(e=>(0,U.jsx)(N,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Ae,{checked:h,onCheckedChange:e=>_(e===!0),"aria-label":x()}),(0,U.jsx)(`span`,{children:x()})]}),$?(0,U.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(A,{size:14,"aria-hidden":!0}),ne()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?he():c()}):(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:be()}),(0,U.jsx)(z,{children:o()}),(0,U.jsx)(z,{children:ie()}),(0,U.jsx)(z,{children:ue()}),(0,U.jsx)(z,{children:ce()}),(0,U.jsx)(z,{className:`text-right`,children:ae()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(I,{variant:`outline`,style:{marginLeft:6},children:_e()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(I,{variant:`secondary`,children:e.direction===`inbound`?g():v()})}),(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)(M,{children:[(0,U.jsx)(E,{asChild:!0,children:(0,U.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":w(),children:(0,U.jsx)(ke,{size:16})})}),(0,U.jsxs)(Oe,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(D,{size:14}),le()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(D,{size:14}),u()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(je,{size:14}),f()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ee({cap:Be})}):null]}),(0,U.jsx)(Se,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(O,{children:[(0,U.jsxs)(Te,{children:[(0,U.jsx)(De,{children:re()}),(0,U.jsx)(Ee,{children:se()})]}),(0,U.jsxs)(j,{children:[(0,U.jsx)(Me,{children:S()}),(0,U.jsx)(we,{onClick:()=>void Le(),children:f()})]})]})})]})}export{K as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Uu as r,Wu as i}from"./dist-Cjlv3ZK-.js";import{t as a}from"./button-Bv-PK2-Y.js";import{Ct as o,St as s,tt as c}from"./index-BWV7nAxJ.js";import{t as l}from"./TimeRangePicker-Dtnfk3jk.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{Ku as r,qu as i}from"./dist-C6Mg6d5Y.js";import{t as a}from"./button-NWqGTLKg.js";import{Ct as o,St as s,tt as c}from"./index-DkxYxN0F.js";import{t as l}from"./TimeRangePicker-CiPB_fhH.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{$c as r,$s as i,Ac as a,BA as o,Bc as s,Cc as c,D as l,Dc as u,E as d,Ec as f,Fc as p,Gc as m,Hc as h,Ic as g,Jc as _,Kc as v,Lc as y,Mc as b,Nc as x,Oc as S,Pc as C,Qc as w,Qs as T,Rc as ee,Sc as E,Tc as te,Uc as D,Vc as ne,Wc as O,Xc as k,Yc as re,Zc as A,_c as j,ac as M,al as ie,bc as ae,cc as N,dc as P,ec as F,el as oe,fc as se,gc as I,hc as L,ic as ce,il as R,jc as le,kc as ue,lc as de,mc as fe,nc as z,nl as pe,oc as me,ol as he,pc as ge,qc as _e,rc as ve,rl as ye,sc as be,sl as xe,tc as Se,tl as Ce,uc as we,vc as Te,wc as Ee,xc as De,yc as Oe,zA as B,zc as ke}from"./dist-C6Mg6d5Y.js";import{t as Ae}from"./x-Citg8_PC.js";import{i as V,n as H,r as je,t as Me}from"./tabs-CvkXeE_E.js";import{t as U}from"./button-NWqGTLKg.js";import{C as Ne,F as Pe,P as W,Pt as Fe,S as Ie,b as Le,bt as G,et as K,it as Re,nt as ze,ot as Be,p as q,rt as Ve,st as He,tt as J,u as Ue,ut as We,w as Ge,x as Ke,xt as Y}from"./index-DkxYxN0F.js";import{t as qe}from"./FilterBar-Cj_JY0E6.js";import{t as Je}from"./DataTableShell-MMI0rbUm.js";import{t as X}from"./DetailChips-DYJCRnFu.js";var Ye=l(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Xe=l(`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=l(`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=l(`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 S();case`user`:return u();case`pending`:return f();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=o(d.groups.listGroups,{}),t=o(d.me.getMe,{host:We})?.role===`admin`,n=B(d.groups.createGroup),i=B(d.groups.updateGroup),a=B(d.groups.deleteGroup),c=Pe(),l=W(),[u,f]=(0,Q.useState)(!1),[p,g]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(it),[x,S]=(0,Q.useState)(null),[C,T]=(0,Q.useState)(``),ee=(0,Q.useMemo)(()=>{if(!e)return e;let t=C.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,C]);function E(){g(null),b(it),f(!0)}function te(e){g(e),b({name:e.name,description:e.description??``}),f(!0)}async function j(){try{p?await i({groupId:p._id,name:y.name,description:y.description}):await n({name:y.name,description:y.description||void 0}),b(it),g(null),f(!1)}catch(e){l.error(Se(),e)}}async function M(e){if(await c({title:h({name:e.name}),description:ne(),confirmWord:e.name,confirmLabel:s(),cancelLabel:_(),destructive:!0}))try{await a({groupId:e._id})}catch(e){l.error(F(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:he()}),(0,$.jsx)(qe,{q:C,onQChange:T,onReset:()=>T(``),canReset:C!==``,searchPlaceholder:r()}),(0,$.jsx)(Je,{title:xe(),rows:ee,addLabel:ie(),onAdd:t?E:void 0,emptyHint:R(),columns:[{header:ye(),cell:e=>e.name,sort:e=>e.name},{header:pe(),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:Ce(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Y,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:oe(),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)(G,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:w(),onSelect:()=>S({groupId:e._id,name:e.name})},...t?[{label:A(),onSelect:()=>te(e)},{label:k(),variant:`destructive`,onSelect:()=>void M(e)}]:[]]}),(0,$.jsx)(Ue,{open:u,onOpenChange:f,title:p?v():_e(),description:m(),canSubmit:!!y.name.trim(),onSubmit:j,submitLabel:re(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:O()}),(0,$.jsx)(J,{value:y.name,onChange:e=>b({...y,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:D()}),(0,$.jsx)(J,{value:y.description,onChange:e=>b({...y,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:x?.groupId??null,groupName:x?.name??``,open:x!==null,onOpenChange:e=>{e||S(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)(Ye,{size:14,"aria-hidden":!0}),le()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ue({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[a(),(0,$.jsx)(Fe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=o(d.groups.getGroup,n&&e?{groupId:e}:`skip`),s=o(d.groups.listAssignableInstances,n?{}:`skip`),l=o(d.groups.listAssignableUsers,n?{}:`skip`),u=B(d.groups.addMember),f=B(d.groups.removeMember),m=B(d.groups.bulkSetMembers),h=B(d.groups.setGroupManager),_=W(),[v,S]=(0,Q.useState)(``),[w,T]=(0,Q.useState)(``),[E,D]=(0,Q.useState)(`members`),[ne,O]=(0,Q.useState)(1),[k,re]=(0,Q.useState)(new Set),A=(0,Q.useRef)(null),j=(0,Q.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),ie=(0,Q.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),N=a?.viewerIsAdmin===!0,P=(0,Q.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Q.useEffect)(()=>{S(``),T(``),D(`members`),O(1),A.current=null},[n,e]),(0,Q.useEffect)(()=>{O(1)},[v]),(0,Q.useEffect)(()=>{n&&a&&e&&A.current!==e&&(A.current=e,re(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let F=(0,Q.useMemo)(()=>l?Qe(l,v,k):[],[l,v,k]);async function oe(t,n){if(e)try{n?await f({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){_.error(i(),e)}}async function se(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){_.error(ve(),e)}}let I=nt(F,e=>j.has(e.userId)),L=F.filter(e=>j.has(e.userId)).length,R=rt(F,ne,ot);async function le(){if(!e||F.length===0)return;let t=F.map(e=>e.userId);try{await m({groupId:e,userIds:t,member:I!==`all`})}catch(e){_.error(i(),e)}}return(0,$.jsx)(ze,{open:n,onOpenChange:r,children:(0,$.jsxs)(Ve,{className:`oc-access`,children:[(0,$.jsxs)(Be,{children:[(0,$.jsx)(He,{children:ke({name:t})}),(0,$.jsx)(Re,{children:ee()})]}),(0,$.jsxs)(Me,{value:E,onValueChange:D,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}),y(),a?(0,$.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Y,{size:13,"aria-hidden":!0}),p(),a?(0,$.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:P.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),fe(),a?(0,$.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:l===void 0||a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:c()}):l.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:De()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{value:v,onChange:e=>S(e.target.value),placeholder:g(),className:`oc-access__search`}),F.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:x()}):(0,$.jsxs)($.Fragment,{children:[F.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(q,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void le(),"aria-label":b()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:b()}),(0,$.jsxs)(K,{variant:`outline`,className:`oc-access__count`,children:[L,` / `,F.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:R.pageItems.map(e=>{let t=j.has(e.userId),n=et(e),r=ie.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(q,{checked:t,onCheckedChange:()=>void oe(e.userId,t),"aria-label":te({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&&N?(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?ce():M(),title:r?ce():M(),onClick:()=>void se(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":me(),title:me(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:R.page,pageCount:R.pageCount,onPage:O})]})]})}),(0,$.jsx)(H,{value:`agents`,children:s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:c()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{value:w,onChange:e=>T(e.target.value),placeholder:C(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:P,query:w},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=o(d.groups.listAssignableAgents,{instanceName:t}),s=B(d.groups.assignAgentToGroup),c=B(d.groups.removeAgentFromGroup),l=B(d.groups.bulkSetGroupAgents),u=W(),[f,p]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{p(1)},[i]),!e)return null;let m=$e(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1),_=nt(g,e=>r.has(`${t}/${e.agentId}`)),v=rt(m,f,ot);async function y(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(T(),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:_!==`all`})}catch(e){u.error(T(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(Y,{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:j()}):null]}),a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:E()}):m.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:h?Te():Oe()}):(0,$.jsxs)($.Fragment,{children:[g.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(q,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":b()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:b()})]}):null,v.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(q,{checked:i,disabled:a&&!i,onCheckedChange:()=>void y(e.agentId,i),"aria-label":Ee({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":L(),title:L(),children:(0,$.jsx)(G,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:I()}):null]},e.agentId)}),(0,$.jsx)(st,{page:v.page,pageCount:v.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=o(d.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=B(d.charts.assignChartToGroup),r=B(d.charts.removeChartFromGroup),i=B(d.charts.setGroupDefaultChart),a=B(d.charts.addChartToGroupPool),s=B(d.charts.removeChartFromGroupPool),l=W();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:c()});let{pool:u,addable:f,canManagePool:p}=t;if(u.length===0&&!p)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ge()});async function m(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){l.error(z(),e)}}async function h(t){try{await i({groupId:e,chartKey:t})}catch(e){l.error(z(),e)}}async function g(t){try{await a({groupId:e,chartKey:t})}catch(e){l.error(z(),e)}}async function _(t){try{await s({groupId:e,chartKey:t})}catch(e){l.error(z(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(q,{checked:e.selected,onCheckedChange:()=>void m(e.chartKey,e.selected),"aria-label":de({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":N(),title:N(),children:(0,$.jsx)(G,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:be()}):null,p?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":we({name:e.name}),title:we({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),p?f.length>0?(0,$.jsxs)(Le,{value:``,onValueChange:e=>void g(e),children:[(0,$.jsx)(Ne,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ge,{placeholder:P()})}),(0,$.jsx)(Ke,{children:f.map(e=>(0,$.jsx)(Ie,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:se()}):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{$v as r,$y as i,Ay as a,BA as o,Bv as s,By as c,Cy as l,Dy as u,E as d,Ey as f,Fy as p,Gv as m,Gy as h,Hv as g,Hy as _,Iv as v,Iy as y,Jv as b,Jy as x,Kv as S,Ky as C,LA as w,Lv as T,Ly as ee,Mm as E,My as D,Ny as te,Oy as ne,Py as re,Qv as ie,Qy as ae,Rv as oe,Ry as se,Sb as O,Sy as k,Ty as ce,Uv as le,Uy as ue,Vv as de,Vy as fe,Wv as pe,Wy as me,Xv as he,Xy as ge,Yv as _e,Yy as ve,Zv as ye,Zy as be,_b as xe,_y as Se,ab as Ce,ay as we,bb as Te,by as Ee,cb as De,cr as Oe,cy as A,dE as j,db as ke,dy as Ae,eb as je,ey as Me,fE as M,fb as Ne,fy as Pe,gb as Fe,gy as Ie,hb as Le,hy as Re,ib as ze,iy as Be,jm as Ve,jy as He,ky as Ue,lb as We,lr as Ge,ly as Ke,mb as qe,my as Je,nb as Ye,ny as Xe,ob as Ze,or as Qe,oy as $e,pb as et,py as tt,qv as nt,qy as rt,rb as it,ry as N,sb as at,sr as ot,sy as st,tb as ct,ty as lt,ub as ut,uy as dt,vb as ft,vy as pt,wy as mt,xb as ht,xy as gt,yb as _t,yy as vt,zA as P,zv as yt,zy as F}from"./dist-C6Mg6d5Y.js";import{a as bt,c as xt}from"./FieldLabel-Bq4HjU7s.js";import{t as I}from"./button-NWqGTLKg.js";import{C as L,F as St,G as Ct,K as wt,P as R,S as z,b as B,et as V,it as H,nt as U,ot as W,p as G,q as Tt,rt as K,st as q,tt as J,u as Et,w as Dt,x as Ot}from"./index-DkxYxN0F.js";import{t as kt}from"./DataTableShell-MMI0rbUm.js";import{InstanceConfigDialog as At}from"./BridgeTab-DAbaJWeM.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],jt=new Set(X),Mt=`conversational`;function Nt(e){let t=new Set((e??[]).filter(e=>jt.has(e)));return t.size===0?[Mt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:bt},Pt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Ft(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function It(){let e=o(d.admin.listInstances,{}),t=o(d.agents.listAllInstanceAgents,{}),n=P(d.admin.upsertInstance),r=P(d.admin.deleteInstance),a=R(),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(Q),[f,p]=(0,Y.useState)(null),[m,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null);async function S(){try{await n({instanceId:y??void 0,name:l.name,gatewayUrl:l.gatewayUrl,bridgeUrl:l.bridgeUrl||void 0,displayName:l.displayName||void 0,kind:l.kind,gatewayVersion:l.gatewayVersion||void 0,gatewayHttpUrl:l.gatewayHttpUrl||void 0,streamTransport:l.streamTransport}),u(Q),b(null),c(!1)}catch(e){a.error(Te(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[_t(),(0,Z.jsx)(`strong`,{children:ft()}),xe()]}),(0,Z.jsx)(kt,{title:Fe(),rows:e,addLabel:Le(),onAdd:()=>{b(null),u(Q),c(!0)},emptyHint:qe(),columns:[{header:et(),cell:e=>e.name,sort:e=>e.name},{header:Ne(),cell:e=>(0,Z.jsx)(V,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:ke(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ut(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:O(),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)(V,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?T():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Ze(),onSelect:()=>{b(e._id),u(Ft(e)),c(!0)}},{label:ht(),onSelect:()=>p(e.name)},{label:h(),onSelect:()=>v(e)},{label:We(),onSelect:()=>g(e)},{label:De(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:De(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Et,{open:s,onOpenChange:c,title:y?Ce():at(),description:it(),canSubmit:!!(l.name&&l.gatewayUrl),onSubmit:S,submitLabel:Ye(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:ct(),children:[(0,Z.jsx)(J,{value:l.name,disabled:y!==null,onChange:e=>u({...l,name:e.target.value})}),y?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ze()}):null]}),(0,Z.jsx)($,{label:je(),children:(0,Z.jsxs)(B,{value:l.kind,onValueChange:e=>u({...l,kind:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(Dt,{})}),(0,Z.jsxs)(Ot,{children:[(0,Z.jsx)(z,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(z,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:i(),children:(0,Z.jsx)(J,{value:l.gatewayUrl,onChange:e=>u({...l,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:ae(),children:(0,Z.jsx)(J,{value:l.bridgeUrl,placeholder:be(),onChange:e=>u({...l,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:ge(),children:(0,Z.jsx)(J,{value:l.displayName,onChange:e=>u({...l,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:E(),children:[(0,Z.jsxs)(B,{value:l.streamTransport,onValueChange:e=>u({...l,streamTransport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(Dt,{})}),(0,Z.jsx)(Ot,{children:xt.map(e=>(0,Z.jsx)(z,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ve()})]}),(0,Z.jsx)($,{label:ve(),children:(0,Z.jsx)(J,{value:l.gatewayVersion,placeholder:x(),onChange:e=>u({...l,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:rt(),children:(0,Z.jsx)(J,{value:l.gatewayHttpUrl,placeholder:C(),onChange:e=>u({...l,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Kt,{instanceName:f,open:f!==null,onOpenChange:e=>{e||p(null)}}),m?(0,Z.jsx)(At,{instance:m,onClose:()=>g(null)},m._id):null,_?(0,Z.jsx)(Lt,{instance:_,onClose:()=>v(null)},_._id):null]})}function Lt({instance:e,onClose:t}){let n=o(d.instanceSecrets.listInstanceSecretStatus,{}),r=Pt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(U,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(W,{children:[(0,Z.jsx)(q,{children:me({instance:e.displayName??e.name})}),(0,Z.jsx)(H,{children:ue()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Bt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(zt,{instance:e})}),(0,Z.jsx)(Rt,{instance:e})]})})}function Rt({instance:e}){let t=w(d.instanceSync.forceInstanceSync),n=R(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(l());break;case`no_agents`:n.success(gt());break;case`no_bridge_url`:n.error(Ee());break;case`deploy_misconfigured`:n.error(vt());break;case`unauthorized`:n.error(Se());break;case`not_served`:n.error(Ie());break;default:n.error(pt());break}}catch(e){n.error(k(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Re()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?mt():ce()})})]})}function zt({instance:e}){let t=o(d.bridgeAuth.listBridgeAuthStatus,{}),n=w(d.bridgeAuth.mintBridgeSecret),r=P(d.bridgeAuth.revokeBridgeSecret),i=R(),[a,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,f]=(0,Y.useState)(!1),p=(t??[]).find(t=>t.instanceId===e._id),m=p!==void 0;async function h(){if(!a){s(!0);try{l((await n({instanceId:e._id})).plaintext),f(!1)}catch(e){i.error(A(),e)}finally{s(!1)}}}async function g(){if(!a){s(!0);try{await r({instanceId:e._id}),l(null),i.success(Ke())}catch(e){i.error(A(),e)}finally{s(!1)}}}async function _(){if(c)try{await navigator.clipboard.writeText(c),f(!0)}catch{}}return(0,Z.jsxs)($,{label:Je(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:tt()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{variant:m?`outline`:`secondary`,children:m?`${F()} · ${p.prefix}…${p.lastFour}`:se()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void h(),disabled:a,children:m?Ae():Pe()}),m?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void g(),disabled:a,children:dt()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:st()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:u?M():j()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),f(!1)},children:$e()})]}):null]})}function Bt({instanceId:e,field:t,updatedAt:n}){let r=w(d.instanceSecrets.setInstanceSecret),i=P(d.instanceSecrets.clearInstanceSecret),o=w(d.deviceIdentity.generateDeviceIdentity),s=R(),[l,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(!1),[v,b]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(!1),C=n!==null,T=t===`deviceIdentity`,E=t===`token`?_():t===`deviceIdentity`?fe():c();async function ie(){if(!(!l.trim()||h)){g(!0);try{await r({instanceId:e,field:t,plaintext:l}),m(``),b(null),S(!1),s.success(te())}catch(e){s.error(D(),e)}finally{g(!1)}}}async function ae(){if(!h){g(!0);try{await i({instanceId:e,field:t}),b(null),S(!1),s.success(He())}catch(e){s.error(D(),e)}finally{g(!1)}}}async function oe(){if(!h){g(!0);try{b(await o({instanceId:e})),S(!1),s.success(ne())}catch(e){s.error(f(),e)}finally{g(!1)}}}let O=v?`openclaw devices approve ${v.id}`:``;async function k(){if(O)try{await navigator.clipboard.writeText(O),S(!0)}catch{}}return(0,Z.jsxs)($,{label:E,children:[T?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{variant:C?`outline`:`secondary`,children:C?F():se()}),(0,Z.jsx)(J,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:C?y():ee(),onChange:e=>m(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void ie(),disabled:h||l.trim().length===0,children:p()}),T?(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void oe(),disabled:h,children:a()}):null,C?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void ae(),disabled:h,children:re()}):null]})]}),v?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:ne()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:O}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void k(),children:x?M():j()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{b(null),S(!1)},children:$e()})]}):null]})}var Vt={conversational:ie,documentary:he,summarizer:Ge,curator:ot},Ht={conversational:ye,documentary:_e,summarizer:Oe,curator:Qe},Ut=e=>(Vt[e]??(()=>e))(),Wt=e=>(Ht[e]??(()=>``))();function Gt({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:Xe()}),t.map(e=>(0,Z.jsx)(V,{variant:`secondary`,className:`oc-agenttype__chip`,title:Wt(e),children:Ut(e)},e)),(0,Z.jsxs)(Ct,{children:[(0,Z.jsx)(Tt,{asChild:!0,children:(0,Z.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:lt()})}),(0,Z.jsxs)(wt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Me()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:r()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(G,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Ut(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Wt(r)})]})]},r)})})]})]})]})}function Kt({instanceName:e,open:t,onOpenChange:n}){let r=o(d.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=P(d.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(d.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(d.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=P(d.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(d.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(d.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),c=P(d.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(d.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Nt(r);e.setQuery(d.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),l=P(d.agents.removeInstanceAgent),u=St(),f=R();async function p(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){f.error(N(),e)}}async function h(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){f.error(N(),e)}}async function _(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await c({instanceName:e,agentId:t,types:i})}catch(e){f.error(N(),e)}}async function y(t,n){if(e&&await u({title:S({name:n}),description:m(),confirmLabel:pe(),destructive:!0}))try{await l({instanceName:e,agentId:t}),f.success(le())}catch(e){f.error(N(),e)}}return(0,Z.jsx)(U,{open:t,onOpenChange:n,children:(0,Z.jsxs)(K,{className:`oc-access`,children:[(0,Z.jsxs)(W,{children:[(0,Z.jsx)(q,{children:we({name:e??``})}),(0,Z.jsx)(H,{children:Be()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:g()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?de():r.discovery.lastPollOk?s():yt({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:oe()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(G,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void p(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)(V,{variant:`outline`,className:`oc-access__gone`,children:v()}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void y(e.agentId,i),children:nt()})]}):n?(0,Z.jsx)(V,{variant:`default`,children:T()}):(0,Z.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void h(e.agentId),children:b()})]}),e.enabled?(0,Z.jsx)(Gt,{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{It as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,AS as i,Ai as a,BA as o,BS as s,CS as c,Ci as l,DS as u,Di as d,E as f,ES as ee,Ei as p,FS as te,HS as ne,IS as re,LA as m,LS as h,MS as ie,NS as ae,OS as oe,Oi as se,PS as ce,Qx as le,RS as g,SS as ue,Si as de,TS as fe,Ti as _,US as v,VS as y,WS as b,_S as x,aS as S,bS as C,cS as w,dS as T,eS as E,fS as D,gS as O,hS as k,iS as A,jS as j,kS as M,ki as N,lS as P,mS as F,nS as I,oS as L,pS as R,rS as z,sS as B,tS as pe,uS as me,vS as he,wS as ge,wi as _e,xS as ve,yS as V,zA as H,zS as U}from"./dist-C6Mg6d5Y.js";import{t as W}from"./button-NWqGTLKg.js";import{A as ye,C as be,S as xe,b as Se,et as G,p as Ce,tt as K,w as q,x as we}from"./index-DkxYxN0F.js";import{t as Te}from"./DataTableShell-MMI0rbUm.js";var J=t(e(),1),Y=n();function Ee(){let e=o(f.integrations.status.status,{}),t=H(f.admin.setIntegrationConfig),[n,l]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&l(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:b()});let d=n,p=(e,t,n)=>l({...d,[e]:{...d[e],[t]:n}}),m=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,Y.jsx)(`strong`,{children:ne()}),` `,y()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(G,{variant:`secondary`,children:s()}):(0,Y.jsx)(G,{variant:`outline`,children:U()}):(0,Y.jsx)(G,{variant:`outline`,children:g()}),note:re(),children:[(0,Y.jsx)(Z,{label:ce(),children:(0,Y.jsx)(K,{value:d.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>p(`langfuse`,`host`,e.target.value),onBlur:()=>m(`langfuse`,{host:d.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:i(),checked:d.langfuse.enabled??!0,onChange:e=>{p(`langfuse`,`enabled`,e),m(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(G,{variant:`secondary`,children:s()}):(0,Y.jsx)(G,{variant:`outline`,children:U()}):(0,Y.jsx)(G,{variant:`outline`,children:g()}),note:te(),children:[(0,Y.jsx)(Z,{label:ae(),children:(0,Y.jsx)(K,{value:d.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>p(`opik`,`baseUrl`,e.target.value),onBlur:()=>m(`opik`,{baseUrl:d.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:ie(),children:(0,Y.jsx)(K,{value:d.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||j(),onChange:e=>p(`opik`,`workspace`,e.target.value),onBlur:()=>m(`opik`,{workspace:d.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:i(),checked:d.opik.enabled??!0,onChange:e=>{p(`opik`,`enabled`,e),m(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(G,{variant:`secondary`,children:s()}):(0,Y.jsx)(G,{variant:`outline`,children:U()}):(0,Y.jsx)(G,{variant:`outline`,children:a()}),note:N(),children:[(0,Y.jsx)(Z,{label:se(),children:(0,Y.jsx)(K,{value:d.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>p(`otlp`,`endpoint`,e.target.value),onBlur:()=>m(`otlp`,{endpoint:d.otlp.endpoint??``})})}),(0,Y.jsx)(De,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:i(),checked:d.otlp.enabled??!0,onChange:e=>{p(`otlp`,`enabled`,e),m(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:M(),status:(0,Y.jsx)(G,{variant:`outline`,children:h()}),note:oe(),children:[(0,Y.jsx)(Z,{label:u(),children:(0,Y.jsx)($,{value:d.tts.auto??`off`,options:[[`off`,ee()],[`always`,fe()],[`inbound`,ge()],[`tagged`,c()]],onChange:e=>{p(`tts`,`auto`,e),m(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:ue(),children:(0,Y.jsx)($,{value:d.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,ve()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{p(`tts`,`provider`,e),m(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:C(),children:(0,Y.jsx)(K,{value:d.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>p(`tts`,`model`,e.target.value),onBlur:()=>m(`tts`,{model:d.tts.model??``})})}),(0,Y.jsx)(Z,{label:V(),children:(0,Y.jsx)(K,{value:d.tts.voice??``,placeholder:he(),onChange:e=>p(`tts`,`voice`,e.target.value),onBlur:()=>m(`tts`,{voice:d.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:x(),status:(0,Y.jsx)(G,{variant:`outline`,children:h()}),note:e.secrets.openai?O():k(),children:[(0,Y.jsx)(Q,{label:F(),checked:d.talk.enabled??!1,onChange:e=>{p(`talk`,`enabled`,e),m(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:R(),children:(0,Y.jsx)($,{value:d.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{p(`talk`,`realtimeProvider`,e),m(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:D(),children:(0,Y.jsx)(K,{value:d.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>p(`talk`,`realtimeModel`,e.target.value),onBlur:()=>m(`talk`,{realtimeModel:d.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:V(),children:(0,Y.jsx)(K,{value:d.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>p(`talk`,`voice`,e.target.value),onBlur:()=>m(`talk`,{voice:d.talk.voice??``})})}),(0,Y.jsx)(Z,{label:T(),children:(0,Y.jsx)($,{value:d.talk.transport??`webrtc`,options:[[`webrtc`,me()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{p(`talk`,`transport`,e),m(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:P(),children:(0,Y.jsx)(K,{value:d.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>p(`talk`,`speechLocale`,e.target.value),onBlur:()=>m(`talk`,{speechLocale:d.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:w(),checked:d.talk.interruptOnSpeech??!0,onChange:e=>{p(`talk`,`interruptOnSpeech`,e),m(`talk`,{interruptOnSpeech:e})}})]}),(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:B()}),(0,Y.jsx)(G,{variant:`outline`,children:L()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[S(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(Te,{title:A(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:z(),columns:[{header:I(),cell:e=>(0,Y.jsx)(G,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:pe(),cell:e=>e.lastAt>0?ye(e.lastAt):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:E(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:r(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:le(),cell:e=>e.lastError??`—`,sort:e=>e.lastError??null}]})]})}function X({title:e,status:t,note:n,children:r}){return(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,Y.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`label`,{className:`oc-int__field`,children:[(0,Y.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function Q({label:e,checked:t,onChange:n}){return(0,Y.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,Y.jsx)(Ce,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(Se,{value:e,onValueChange:n,children:[(0,Y.jsx)(be,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(q,{})}),(0,Y.jsx)(we,{children:t.map(([e,t])=>(0,Y.jsx)(xe,{value:e,children:t},e))})]})}function De({headersSet:e}){let t=m(f.integrations.otlpSecret.setOtlpHeaders),n=H(f.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1),u=async()=>{c(!0),o(null);try{await t({headersJson:r}),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{c(!1)}};return(0,Y.jsxs)(Z,{label:d(),children:[(0,Y.jsx)(K,{value:r,placeholder:e?p():_(),onChange:e=>i(e.target.value)}),(0,Y.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,Y.jsx)(W,{size:`sm`,disabled:s||r.trim().length===0,onClick:()=>void u(),children:_e()}),e?(0,Y.jsx)(W,{variant:`ghost`,size:`sm`,disabled:s,onClick:()=>void n({}),children:l()}):null]}),a?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:de()})]})}export{Ee as IntegrationsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BA as r,Bf as i,DC as a,E as o,EC as s,Gf as c,Hf as l,Jf as u,Kf as d,OC as f,Qf as p,Uf as m,Vf as h,Wf as g,Xf as _,Yf as v,Zf as y,ew as b,kC as x,qf as S,vC as C,yC as w,zf as T}from"./dist-C6Mg6d5Y.js";import{Ft as E,It as ee,a as te,n as ne,r as re,ut as D}from"./index-DkxYxN0F.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-Og1f_0lq.js";import{n as N,t as P}from"./TimeRangePicker-CiPB_fhH.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=r(o.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=r(o.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:x()}),(0,I.jsx)(j,{children:a()})]}),(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),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[C(),` p50 `,R(s.cP50),` `,f()]}),(0,I.jsxs)(`span`,{children:[w(),` p50 `,R(s.aP50),` `,f()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":x(),children:[(0,I.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:p(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:y(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:_(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:v(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:u(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:S(),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=ee({from:`/settings/kpi`}),t=E({from:`/settings/kpi`}),n=re(e.from,e.to,ne,`now`),i=e=>void t({search:t=>({...t,...te(e)})}),{from:a,to:s}=N(n),{rowLimit:l,buckets:u}=K(a,s),f=r(o.kpi.listKpis,{limit:l,filter:{from:a,to:s}}),p=(0,F.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>u&&e.set(t,n.slice(n.length-u));return e},[f,u]),h=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[d(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:c()})]}),(0,I.jsx)(J,{value:n,onChange:i})]});return f===void 0?(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]}):f.length===0?(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]}):(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(p.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:p.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:l({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:h()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:i({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{$D as r,AD as i,BA as a,BD as o,CA as s,DD as c,E as l,EA as u,ED as d,FD as f,GD as p,HD as m,ID as ee,JD as te,KD as h,LD as g,MD as ne,ND as _,OD as re,PD as ie,QD as ae,RD as v,SA as oe,TD as se,UD as ce,VD as le,WD as ue,XD as de,YD as fe,ZD as y,_A as b,aO as x,bA as S,eO as C,gA as w,hA as T,iO as E,jA as D,jD as O,kD as k,mA as A,nO as j,nb as M,pA as N,qD as P,rO as F,tO as I,vA as L,wD as R,xA as z,yA as B,zA as V,zD as pe}from"./dist-C6Mg6d5Y.js";import{t as H}from"./button-NWqGTLKg.js";import{C as me,M as he,P as ge,S as U,b as _e,p as W,tt as G,ut as K,w as ve,x as ye}from"./index-DkxYxN0F.js";import{t as be}from"./localePickerView-C2RmOS86.js";var q=t(e(),1),J=[{id:`messages`,label:()=>x()},{id:`composer`,label:()=>E()},{id:`sidebar`,label:()=>F()},{id:`other`,label:()=>j()}],Y={showSource:{category:`messages`,label:()=>I(),help:()=>C()},showReport:{category:`messages`,label:()=>r(),help:()=>ae()},copyAssistant:{category:`messages`,label:()=>y()},copyUser:{category:`messages`,label:()=>de()},showDelete:{category:`messages`,label:()=>fe()},showTools:{category:`messages`,label:()=>te(),help:()=>P()},voiceInput:{category:`composer`,label:()=>h(),help:()=>p()},showUsage:{category:`composer`,label:()=>ue(),help:()=>ce()},showChatAge:{category:`sidebar`,label:()=>m(),help:()=>le()},showChatProvider:{category:`sidebar`,label:()=>o(),help:()=>pe()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function xe(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var Se=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`,`showUsage`],Ce={voiceInput:`voiceInput`};function we(e){return Se.includes(e)}function Z(e){return e===`admin`}function Q(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Te(e){return e===`on`?!0:e===`off`?!1:null}function Ee(e){return we(e)?Ce[e]:void 0}var $=n(),De={voiceInput:()=>re()};function Oe({prefKey:e,ui:t}){let n=V(l.admin.setUiPrefDefault),r=V(l.admin.setFeatureEnabled),i=Ee(e),a=i?De[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ne()}),(0,$.jsxs)(_e,{value:Q(t.defaults[e]),onValueChange:t=>void n({key:e,value:Te(t)}),children:[(0,$.jsx)(me,{size:`sm`,className:`w-36`,children:(0,$.jsx)(ve,{})}),(0,$.jsxs)(ye,{children:[(0,$.jsx)(U,{value:`on`,children:d()}),(0,$.jsx)(U,{value:`off`,children:se()}),(0,$.jsx)(U,{value:`inherit`,children:R()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(W,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":O()}),O()]}):null]}),a?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function ke(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),o=a(l.me.getMe,{host:K}),s=o?.ui,u=Z(o?.role)&&n,d=V(l.me.setUiPref).withOptimisticUpdate(he),p=(0,q.useMemo)(()=>s?xe(Object.keys(s.effective),e):[],[s,e]);return s?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(o?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":_()}),_()]}):null,u?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:i()}),(0,$.jsx)(`p`,{children:k()}),(0,$.jsx)(`p`,{children:c()})]}):null,(0,$.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:v(),"aria-label":v(),className:`mb-2`}),p.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:g()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:p.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=s.locked[e],a=s.effective[e],o=s.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${o&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:ee()}):o?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:f()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&o?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void d({key:e,value:null}),children:ie()}):null,(0,$.jsx)(W,{checked:a,disabled:i,onCheckedChange:t=>void d({key:e,value:t===!0}),"aria-label":n})]}),u?(0,$.jsx)(Oe,{prefKey:e,ui:s}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:D()})}function Ae(){let e=a(l.me.getMe,{host:K}),t=V(l.me.setLocale),n=V(l.me.setMyName),r=ge(),i=e?.locale??`default`,o=e?.name??``,[c,d]=(0,q.useState)(null),f=c??o,p=f.trim()!==o.trim();async function m(){try{await n({name:f}),d(null),r.success(B())}catch(e){r.error(L(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:s()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(G,{className:`max-w-xs`,value:f,maxLength:120,placeholder:z(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,$.jsx)(H,{size:`sm`,disabled:!p,onClick:()=>void m(),children:M()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:S()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:b()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:w()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[be().map(e=>(0,$.jsx)(H,{variant:i===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,$.jsx)(H,{variant:i==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:u()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:T()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:A()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:N()})]}),(0,$.jsx)(ke,{})]})]})}export{Ae as PreferencesTab};
@@ -0,0 +1,4 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,At as i,BA as a,Cm as o,Dm as s,E as c,Em as l,Fm as u,Im as d,Mt as f,Nt as p,O as m,Om as h,Ot as g,Sm as _,Tm as v,_m as y,bm as b,dm as x,dr as S,fm as C,fr as ee,gm as w,hm as T,jt as E,k as te,kt as ne,lm as re,mm as ie,mr as ae,pm as oe,pr as D,um as O,ur as k,vm as A,wm as j,xm as M,ym as N,zA as P}from"./dist-C6Mg6d5Y.js";import{d as F,f as I,i as L,l as R,n as z,r as B,t as V,u as H}from"./FieldLabel-Bq4HjU7s.js";import{t as U}from"./button-NWqGTLKg.js";import{C as W,P as G,S as K,b as q,p as se,ut as ce,w as J,x as Y}from"./index-DkxYxN0F.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:o,help:_},documentary_fetch:{label:M,help:b},inbound_files:{label:N,help:A},history_summary:{label:ae,help:D},file_curation:{label:p,help:f}},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:x,references:O,files:re,previous_summary:ee,new_messages:S,max_chars:k,file_name:E,budget_chars:i,feedback:ne,content:g};function pe(){let e=a(c.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:w()})});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)(z,{label:h(),help:s()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:y()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(J,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=P(c.admin.upsertInstanceConfig),n=G(),i=a(c.me.getMe,{host:ce}),o=e.config??{},s=X(e.config?.contentLocale,i?.defaultLocale??void 0),[l,f]=(0,Q.useState)(()=>L(o,s));(0,Q.useEffect)(()=>{f(L(o,s))},[s,e._id]);let[p,h]=(0,Q.useState)(!1),g=l.promptInjections,_=(e,t)=>f({...l,promptInjections:{...g,[e]:{...g[e],...t}}});async function v(){h(!0);try{await t({instanceId:e._id,config:B(l,o,s)})}catch(e){n.error(u(),e)}finally{h(!1)}}async function y(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(u(),e)}}let b=e.config?.contentLocale??`default`,x=Z[X(void 0,i?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:r()}),(0,$.jsxs)(q,{value:b,onValueChange:e=>void y(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(J,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(K,{value:`default`,children:m({locale:x})}),le().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:te()})]}),H.map(e=>(0,$.jsx)(he,{injKey:e,def:R[e],i18n:ue[e],row:g[e]??{enabled:!0,template:R[e].defaultTemplate[s]},contentLocale:s,onChange:t=>_(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void v(),disabled:p,children:d()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),c=r.template.trim()!==t.defaultTemplate[i],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),f=F(e,r,i),p=f?I(f,d):``;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)(se,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(z,{label:n.label(),help:n.help()})]}):(0,$.jsx)(z,{label:n.label(),help:n.help()}),c&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:v()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:j()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(V,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?ie():T()}),c&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:l()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:oe()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:C()})})]})}export{pe as PromptInjectionsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,BA as ee,E as i,F_ as a,G_ as o,I_ as s,J_ as c,K_ as l,L_ as u,M_ as te,N_ as ne,P_ as d,Q_ as f,R_ as p,X_ as m,Y_ as h,Z_ as g,_v as _,av as v,bv as y,cv as b,dv as x,ev as re,fv as S,gv as C,hv as w,iv as ie,j_ as T,lv as E,mv as D,nv as O,ov as k,pv as A,q_ as j,rn as M,rv as N,sv as P,tv as F,uv as I,vv as L,yv as R,zA as z,z_ as ae}from"./dist-C6Mg6d5Y.js";import{t as B}from"./button-NWqGTLKg.js";import{F as V,P as H,Tt as U,et as W,p as G,tt as K,u as q}from"./index-DkxYxN0F.js";import{t as J}from"./roleDescriptions-BHmXwdXm.js";var Y=t(e(),1),X=n(),Z=[{group:()=>y(),keys:[{key:`traces.read`,label:()=>w()},{key:`traces.read.content`,label:()=>D(),phi:!0},{key:`traces.write`,label:()=>A()}]},{group:()=>R(),keys:[{key:`kpi.read`,label:()=>w()},{key:`kpi.write`,label:()=>A()}]},{group:()=>L(),keys:[{key:`openclaw.query`,label:()=>S()},{key:`anomalies.read`,label:()=>x()},{key:`anomalies.report`,label:()=>I()}]},{group:()=>_(),keys:[{key:`chats.read`,label:()=>w()},{key:`selfheal`,label:()=>b()},{key:`feedback.respond`,label:()=>M()}]},{group:()=>C(),keys:[{key:`admin.manage`,label:()=>E()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=ee(i.apiKeys.listRoles,{}),t=z(i.apiKeys.createRole),n=z(i.apiKeys.ensureRolesSeeded),_=z(i.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(i.apiKeys.listRoles,{});r&&e.setQuery(i.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),y=V(),b=H(),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)($),[E,D]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{b.error(k(),e)})},[n,b]);let A=e??[];async function M(e,t){if(Q(e.permissions)||E.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await y({title:v({name:e.name}),description:ie(),confirmLabel:N()}))){D(t=>new Set(t).add(e._id));try{await _({roleId:e._id,permissions:n})}catch(e){b.error(O(),e)}finally{D(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function I(){try{await t({key:C.key,name:C.name,description:C.description||void 0,permissions:[]}),w($),S(!1)}catch(e){b.error(F(),e)}}let L=e===void 0,R=!L&&A.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[re(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,r(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,f()]}),(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:g()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{w($),S(!0)},children:m()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(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:j()}),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:A.map(e=>{let t=Q(e.permissions),n=E.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)(W,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(U,{}),` `,l()]}):(0,X.jsx)(W,{variant:`secondary`,children:o()})]}),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?ae():n?p():r,onCheckedChange:()=>void M(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(q,{open:x,onOpenChange:S,title:u(),description:s(),canSubmit:!!(C.key&&C.name),onSubmit:I,submitLabel:a(),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:d()}),(0,X.jsx)(K,{value:C.key,placeholder:ne(),onChange:e=>w({...C,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,X.jsx)(K,{value:C.name,onChange:e=>w({...C,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:T()}),(0,X.jsx)(K,{value:C.description,onChange:e=>w({...C,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{$E as r,AE as i,BA as a,BE as ee,CD as te,CE as o,DE as ne,E as s,EE as c,FE as re,GE as ie,HE as ae,IE as oe,JE as se,KE as ce,LA as le,LE as ue,ME as de,NE as fe,OE as pe,PE as me,QE as he,RE as ge,SD as _e,SE as l,TE as u,UE as ve,VE as ye,WE as be,XE as xe,YE as Se,ZE as Ce,_D as we,_E as Te,aD as Ee,aE as De,bD as Oe,bE as d,cD as ke,cE as f,dD as Ae,dE as p,eD as je,fD as Me,fE as m,gD as Ne,gE as h,hD as Pe,hE as g,iD as Fe,iE as _,jE as Ie,kE as Le,lD as Re,lE as v,mD as ze,mE as y,nD as Be,oD as Ve,oE as b,pD as He,pE as x,qE as Ue,rD as We,rE as S,sD as Ge,sE as C,tD as Ke,uD as qe,uE as w,vD as T,vE as E,wE as D,xD as Je,xE as O,yD as Ye,yE as k,zA as A,zE as Xe}from"./dist-C6Mg6d5Y.js";import{n as j}from"./dist-DAR1w68Y.js";import{i as Ze}from"./dist-DJ0yfLRs.js";import{t as M}from"./button-NWqGTLKg.js";import{A as N,C as P,F as Qe,Ft as $e,It as et,P as tt,Pt as nt,S as F,at as I,b as L,et as R,it as z,jt as B,k as V,nt as H,ot as U,rt,st as W,tt as it,u as at,w as G,x as K}from"./index-DkxYxN0F.js";import{t as ot}from"./FilterBar-Cj_JY0E6.js";import{t as st}from"./DataTableShell-MMI0rbUm.js";import{t as ct}from"./roleDescriptions-BHmXwdXm.js";var q=t(e(),1),J=n(),lt=[{value:`never`,label:()=>v(),days:null},{value:`30`,label:()=>f(),days:30},{value:`90`,label:()=>C(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=et({from:`/settings/serviceAccounts`}),t=$e({from:`/settings/serviceAccounts`}),n=e.q??``,o=e.status??X,[c,l]=(0,q.useState)(X),u=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Te=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),De=a(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:c===X?void 0:c,disabled:o===X?void 0:o===`disabled`}}),d=a(s.apiKeys.listKeys,{}),f=a(s.apiKeys.listRoles,{}),p=A(s.apiKeys.createServiceAccount),m=A(s.apiKeys.updateServiceAccount),h=A(s.apiKeys.deleteServiceAccount),g=le(s.apiKeys.mintApiKey),_=A(s.apiKeys.revokeApiKey),v=Qe(),y=tt(),b=n!==``||c!==X||o!==X;function x(){l(X),t({search:{},replace:!0})}let[S,C]=(0,q.useState)(!1),[w,E]=(0,q.useState)(Z),[D,O]=(0,q.useState)(null),[k,j]=(0,q.useState)(new Set),[N,I]=(0,q.useState)(null),z=(0,q.useRef)(!1),[B,V]=(0,q.useState)(new Set),[H,U]=(0,q.useState)({}),[rt,W]=(0,q.useState)(null),Y=(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 Q(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await m({serviceAccountId:D,name:w.name,roleKey:w.roleKey,description:w.description}),y.success(ye())):await p({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),E(Z),O(null),C(!1)}catch(e){y.error(D?ae():ve(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function mt(e){if(z.current)return;z.current=!0;let t=H[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;I(e._id);try{let t=await g({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(ee(),e)}finally{z.current=!1,I(null)}}async function $(e){if(await v({title:Xe(),description:(0,J.jsxs)(J.Fragment,{children:[ge(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,ue(),` `,(0,J.jsx)(`strong`,{children:oe()}),` `,re()]}),confirmWord:e.name,confirmLabel:me(),destructive:!0}))try{await h({serviceAccountId:e._id}),y.success(fe(),e.name)}catch(e){y.error(de(),e)}}async function ht(e){if(await v({title:Ie(),description:(0,J.jsxs)(J.Fragment,{children:[i(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Le()]}),confirmLabel:pe(),destructive:!0})&&!B.has(e._id)){V(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){y.error(ne(),e)}finally{V(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:te()}),(0,J.jsxs)(ot,{q:n,onQChange:u,searchPlaceholder:_e(),onReset:x,canReset:b,children:[(0,J.jsxs)(L,{value:c,onValueChange:l,children:[(0,J.jsx)(P,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:Je()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(F,{value:X,children:Oe()}),(f??[]).map(e=>(0,J.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(L,{value:o,onValueChange:Te,children:[(0,J.jsx)(P,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(F,{value:X,children:Ye()}),(0,J.jsx)(F,{value:`active`,children:T()}),(0,J.jsx)(F,{value:`disabled`,children:we()})]})]})]}),(0,J.jsx)(st,{title:Ne(),rows:De,addLabel:Pe(),onAdd:()=>{E(Z),O(null),C(!0)},emptyHint:ze(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:B}),rowActions:e=>[{label:qe(),onSelect:()=>pt(e)},{label:He(),onSelect:()=>void mt(e)},{label:k.has(e._id)?Me():Ae(),onSelect:()=>Q(e._id)},{label:Re(),variant:`destructive`,onSelect:()=>void $(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?ke():Ge(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,J.jsx)(Ze,{}):(0,J.jsx)(nt,{})})},{header:Ve(),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:Ee(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(R,{variant:`secondary`,children:e.roleKey})},{header:Fe(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(R,{variant:`destructive`,children:we()}):(0,J.jsx)(R,{variant:`outline`,children:T()})},{header:We(),cell:e=>(0,J.jsxs)(L,{value:H[e._id]??`never`,onValueChange:t=>U(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(P,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:lt.map(e=>(0,J.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:Be(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?Ke():je({count:t})})}}]}),(0,J.jsx)(at,{open:S,onOpenChange:e=>{C(e),e||O(null)},title:D?r():xe(),description:D?he():Se(),canSubmit:!!(w.name&&w.roleKey),onSubmit:ft,submitLabel:D?Ce():se(),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:Ue()}),(0,J.jsx)(it,{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:ce()}),(0,J.jsxs)(L,{value:w.roleKey||void 0,onValueChange:e=>E({...w,roleKey:e}),children:[(0,J.jsx)(P,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:ie()})}),(0,J.jsx)(K,{children:(f??[]).map(e=>(0,J.jsxs)(F,{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)(it,{value:w.description,onChange:e=>E({...w,description:e.target.value})})]})]})}),(0,J.jsx)(dt,{minted:rt,onClose:()=>W(null)})]})}function ut({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:[c(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:D()}),(0,J.jsx)(`th`,{children:o()}),(0,J.jsx)(`th`,{children:l()}),(0,J.jsx)(`th`,{children:O()}),(0,J.jsx)(`th`,{children:d()}),(0,J.jsx)(`th`,{children:k()}),(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)(R,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:N(t.createdAt)}),(0,J.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:mt(t.expiresAt)}),(0,J.jsx)(`td`,{children:$(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?E():Te()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(H,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(rt,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(U,{children:[(0,J.jsx)(W,{children:h()}),(0,J.jsx)(z,{children:g({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:y()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":x(),children:[n?(0,J.jsx)(j,{}):(0,J.jsx)(B,{}),n?m():p()]})]}),(0,J.jsx)(I,{children:(0,J.jsx)(M,{onClick:()=>{r(!1),t()},children:w()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?b():N(e)}function mt(e){return e===null?`—`:V(e)}function $(e){return e.disabled?(0,J.jsx)(R,{variant:`destructive`,children:De()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(R,{variant:`outline`,children:_()}):(0,J.jsx)(R,{variant:`outline`,children:S()})}export{Q as ServiceAccountsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$r as r,Ar as i,BA as a,Br as o,Cr as s,Dr as c,E as l,Er as u,Fr as d,Gr as f,Hr as p,Ir as m,Jr as h,Kr as g,Lr as _,Mr as v,Nr as y,Or as b,Pr as x,Qr as S,Rr as C,Sr as w,Tr as T,Ur as E,Vr as D,Wr as O,Xr as k,Yr as A,Zr as j,br as M,ei as N,jr as P,kr as F,ni as I,qr as L,ri as ee,ti as R,wr as z,xr as B,yr as V,zA as H,zr as U}from"./dist-C6Mg6d5Y.js";import{t as W}from"./button-NWqGTLKg.js";import{A as G,F as K}from"./index-DkxYxN0F.js";import{t as q}from"./DataTableShell-MMI0rbUm.js";var J=t(e(),1),Y=n(),X={hung:()=>o(),wrong_result:()=>U(),error:()=>C(),other:()=>_()},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=H(l.subAgentReports.respondToReport),[r,a]=(0,J.useState)(e.thread),[o,f]=(0,J.useState)(``),[p,h]=(0,J.useState)(!1);async function g(){let t=o.trim();if(!(!t||p)){h(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{h(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,m({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:d()}),(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:x()}),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`?y():v()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:P()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:i(),value:o,maxLength:2e3,rows:3,onChange:e=>f(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void g(),disabled:!o.trim()||p,children:p?b():F()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[c({count:t.children.length}),t.childrenTruncated?` ${u()}`:``,t.textTruncated?` ${T()}`:``]}),(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?` · ${z()}`:``]}),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:s()}),(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:w()}),(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=a(l.subAgentReports.listForAdmin,{}),t=H(l.subAgentReports.readReport),n=H(l.subAgentReports.deleteReport),i=K(),[o,s]=(0,J.useState)(null),[c,u]=(0,J.useState)({});async function d(e){if(o===e._id){s(null);return}if(!c[e._id]){let n=await t({reportId:e._id});u(t=>({...t,[e._id]:n}))}s(e._id)}async function m(e){await i({title:B(),description:M(),confirmLabel:V(),destructive:!0})&&(await n({reportId:e._id}),o===e._id&&s(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[R(),` `,(0,Y.jsx)(`strong`,{children:N()}),` `,r()]}),(0,Y.jsx)(q,{title:ee(),rows:e,emptyHint:I(),isExpanded:e=>o===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Y.jsx)($,{data:c[e._id]}):null,columns:[{header:S(),cell:e=>G(e.at),sort:e=>e.at},{header:j(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:k(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:A(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${g({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:h(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:L(),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:O()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:o===e._id?p():E(),onSelect:()=>void d(e)},{label:D(),onSelect:()=>void m(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,AO as i,BA as a,BO as o,CO as s,Ck as c,D as l,DA as u,DO as d,Dk as f,E as p,EO as m,Ek as h,FO as g,GO as _,HO as v,IO as y,JO as ee,KO as te,LA as ne,LO as re,MO as ie,NO as ae,OA as oe,OO as se,Ok as ce,PO as le,QO as ue,RO as de,SO as fe,Sk as pe,TO as me,Tk as he,UO as ge,VO as _e,WO as ve,XO as ye,YO as be,ZO as xe,_O as Se,_k as Ce,_r as b,ak as we,bO as Te,bk as Ee,cO as De,ck as Oe,dO as ke,dk as Ae,ek as je,fO as Me,fk as Ne,gO as Pe,gk as Fe,gr as Ie,hO as Le,hk as Re,hr as ze,ik as Be,jO as Ve,kA as He,kO as Ue,lO as We,lk as Ge,mO as x,mk as Ke,n as qe,nk as Je,oO as Ye,ok as Xe,pO as Ze,pk as Qe,qO as $e,rk as et,sO as tt,sk as nt,tk as rt,uO as S,uk as it,vO as at,vk as C,vr as w,wO as ot,wk as st,xO as ct,xk as lt,yO as ut,yk as dt,zA as T,zO as ft}from"./dist-C6Mg6d5Y.js";import{n as E}from"./dist-DAR1w68Y.js";import{t as D}from"./x-Citg8_PC.js";import{t as O}from"./button-NWqGTLKg.js";import{$ as pt,At as mt,C as k,J as ht,Q as A,S as j,X as M,Y as gt,Z as _t,b as N,ct as vt,et as P,kt as F,lt as yt,p as I,tt as L,ut as R,w as z,x as B}from"./index-DkxYxN0F.js";import{t as bt}from"./localePickerView-C2RmOS86.js";import{a as xt,i as St,n as Ct,o as wt,r as Tt,t as Et}from"./card-Og1f_0lq.js";import{a as Dt,i as V,n as Ot,o as H,r as U,t as kt}from"./table-D0CDjuoL.js";import{t as At}from"./TimeRangePicker-CiPB_fhH.js";import{t as jt}from"./FilterBar-Cj_JY0E6.js";import{t as Mt}from"./AdvancedFilter-WSiPBy4U.js";var W=l(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),G=t(e(),1),Nt=.1,Pt=[248,248,248],Ft=[24,24,24];function It(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Lt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function K(e,t,n){return Lt(e,t,n)>=Nt}function Rt(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function zt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Bt=12*1024*1024,Vt=480,Ht=160,Ut=.92;async function Wt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(Ue());if(e.size>Bt)throw Error(se());let{source:n,width:r,height:i,cleanup:a}=await Gt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Vt/r,Ht/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(m());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=It(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(m());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);K(e.data,d.width,d.height)?Rt(e.data,t.variantFor===`dark`?Pt:Ft):zt(e.data),p.putImageData(e,0,0)}let h=K(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),g=await J(f,`image/webp`,Ut)??await J(f,`image/png`);if(!g)throw Error(me());return{blob:g,hasAlpha:h}}finally{a()}}async function Gt(e){if(e.type===`image/svg+xml`)return q(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return q(e)}async function q(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(d())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function J(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Y=n();function Kt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var X=`__all__`,Z={kind:`relative`,from:`now-24h`,to:`now`},qt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Y.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Jt(e){return e===`light`?He():e===`dark`?oe():u()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,Y.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,Y.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Zt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,Y.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:qe(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Y.jsx)(E,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Y.jsx)(Xt,{tokens:r,mode:i}):(0,Y.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Y.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Y.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Y.jsx)(O,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":w(),title:w(),children:(0,Y.jsx)(mt,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=a(p.charts.listMyCharts),r=T(p.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:Ee()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:dt()})]}),(0,Y.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Y.jsx)(Zt,{selected:e===null,title:C(),subtitle:Ce(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?Fe():n.via===`owner`?Re():Ke({group:n.via.group});return(0,Y.jsx)(Zt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Kt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Qe()}):null]})}function $t(){let e=T(p.charts.importChart),[t,n]=(0,G.useState)(``),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(_())}}}async function m(){if(s(null),l(!1),t.trim()===``){s(ge());return}let r;try{r=JSON.parse(i)}catch{s(_());return}d(!0);try{await e({name:t.trim(),tokens:r}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,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:r()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ue()})]}),(0,Y.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:xe()}),(0,Y.jsx)(L,{value:t,onChange:e=>n(e.target.value),placeholder:ye(),maxLength:60})]}),(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:be()}),(0,Y.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:ee(),rows:8,spellCheck:!1})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Y.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Y.jsx)(W,{className:`size-4`}),$e(),(0,Y.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,Y.jsx)(O,{size:`sm`,disabled:u,onClick:()=>void m(),children:te()})]}),o?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,Y.jsx)(`p`,{className:`oc-chart-import__ok`,children:ve()}):null]})]})}function en({chart:e}){let t=ne(p.charts.setChartLogo),n=T(p.charts.removeChartLogo),[r,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,i){if(e.chartId!==void 0){s(null),a(!0);try{let{blob:a,hasAlpha:o}=await Wt(r,i?{variantFor:i}:{}),s=await a.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),a(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),a(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}function m({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?y():g()}),(0,Y.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Y.jsx)(`img`,{src:t,alt:``}):null}),(0,Y.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Y.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Y.jsx)(W,{className:`size-4`}),t?ae():le(),(0,Y.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:Ve()}):null,t?(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:ie()}):null]})}return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:re()}),(0,Y.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Y.jsx)(m,{mode:`light`}),(0,Y.jsx)(m,{mode:`dark`})]}),r?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:i()}):null,o?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function tn({chart:e}){let t=a(p.me.getMe,{host:R}),n=T(p.charts.addChartDomain),r=T(p.charts.removeChartDomain),[i,o]=(0,G.useState)(``),[c,l]=(0,G.useState)(null),[u,d]=(0,G.useState)(!1);if(t?.role!==`admin`)return null;let f=e.domains??[];async function m(){let t=i.trim();if(t!==``){l(null),d(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){l(e instanceof Error?e.message:String(e))}finally{d(!1)}}}async function h(t){l(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ot()}),(0,Y.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Y.jsx)(`div`,{className:`oc-chart-avail__groups`,children:f.length===0?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:Te()}):f.map(e=>(0,Y.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Y.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ut({domain:e}),onClick:()=>void h(e),children:(0,Y.jsx)(D,{className:`size-3`})})]},e))}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(L,{value:i,onChange:e=>o(e.target.value),placeholder:fe(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&m()}}),(0,Y.jsx)(O,{variant:`outline`,size:`sm`,disabled:u,onClick:()=>void m(),children:ct()})]}),(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:s()}),c?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:c}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=T(p.charts.updateChart),n=T(p.charts.deleteChart),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(e.name),[s,c]=(0,G.useState)(()=>$(e.tokens)),[l,u]=(0,G.useState)(e.tokens.bpm??0),[d,f]=(0,G.useState)(null),[m,h]=(0,G.useState)(!1);function g(){o(e.name),c($(e.tokens)),u(e.tokens.bpm??0),f(null),i(!0)}async function v(){if(e.chartId===void 0)return;f(null);let n;try{n=JSON.parse(s)}catch{f(_());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}h(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){f(e instanceof Error?e.message:String(e))}finally{h(!1)}}async function y(){if(e.chartId!==void 0&&window.confirm(x()))try{await n({chartId:e.chartId})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`outline`,size:`sm`,onClick:g,children:ft()}),(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void y(),children:de()})]})})]}),r?(0,Y.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:Pe()}),(0,Y.jsx)(L,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,Y.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:b()}),(0,Y.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Y.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:l,onChange:e=>u(Number(e.target.value)),"aria-label":b()}),(0,Y.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?Ie():`${l} BPM`})]}),(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:ze()})]}),(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:Le()}),(0,Y.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),d?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:d}):null,(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{size:`sm`,disabled:m,onClick:()=>void v(),children:at()}),(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:Se()})]})]}):null,(0,Y.jsx)(en,{chart:e}),(0,Y.jsx)(tn,{chart:e})]})}function rn(){let e=a(p.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:v()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),e!==void 0&&t.length===0?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:o()}):(0,Y.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Y.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=T(p.charts.addChartToGroupPool),r=T(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,Y.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Y.jsx)(P,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?we():e.kind===`custom`&&e.scope===`personal`?S():Xe()}),e.isGlobalDefault?(0,Y.jsx)(P,{variant:`default`,children:Be()}):null]}),(0,Y.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Je()}),(a??[]).map(e=>(0,Y.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Y.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":je({group:e.name}),onClick:()=>void l(e.groupId),children:(0,Y.jsx)(D,{className:`size-3`})})]},e.groupId)),s.length>0?(0,Y.jsxs)(N,{value:``,onValueChange:e=>void c(e),children:[(0,Y.jsx)(k,{size:`sm`,className:`w-56`,children:(0,Y.jsx)(z,{placeholder:rt()})}),(0,Y.jsx)(B,{children:s.map(e=>(0,Y.jsx)(j,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:et()}):null]})]})}function on({chart:e}){let t=T(p.charts.promoteChartToCommon),n=T(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(x()))try{await n({chartId:e.chartId})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Y.jsx)(P,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?We():S()}),e.ownerLabel?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:ke({owner:e.ownerLabel})}):null]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Y.jsx)(O,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:De()}):null,(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:tt()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=T(p.admin.setDefaultThemeMode),i=T(p.admin.setDefaultLocale),o=T(p.charts.setDefaultChart),s=a(p.charts.listChartsAdmin),c=a(p.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,Y.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:pe()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:lt()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:Ne()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:C()}),yt.map(e=>(0,Y.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Y.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:it()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Ge()})]}),(0,Y.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Y.jsx)(an,{chart:e,groups:c??[]},e.key))})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:Oe()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:nt()})]}),(0,Y.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Y.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Y.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Y.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Y.jsx)(tn,{chart:e})]},e.key))})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:Ze()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Me()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Ye()}):(0,Y.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Y.jsx)(on,{chart:e},e.key))})})()]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:ce()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:f()})]}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Y.jsx)(O,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Jt(e)},e))})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:h()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:bt().map(e=>(0,Y.jsx)(O,{variant:u===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:st()})]})]})}function cn(){let e=a(p.me.getMe,{host:R}),t=vt(e?.resolvedThemeMode);return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Y.jsx)(Qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Y.jsx)($t,{}),(0,Y.jsx)(rn,{}),e?.role===`admin`?(0,Y.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,G.useState)(!0),[n,r]=(0,G.useState)(`per-user`),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(X),[l,u]=(0,G.useState)(X),[d,f]=(0,G.useState)(Z),p=i!==``||o!==X||l!==X;function m(){a(``),s(X),u(X),f(Z)}return(0,Y.jsxs)(`div`,{className:`oc-show`,children:[(0,Y.jsx)(cn,{}),(0,Y.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Y.jsx)(`summary`,{className:`oc-show__title`,children:c()}),(0,Y.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{children:`Default`}),(0,Y.jsx)(O,{variant:`secondary`,children:`Secondary`}),(0,Y.jsx)(O,{variant:`outline`,children:`Outline`}),(0,Y.jsx)(O,{variant:`ghost`,children:`Ghost`}),(0,Y.jsx)(O,{variant:`destructive`,children:`Destructive`}),(0,Y.jsx)(O,{variant:`link`,children:`Link`})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{size:`sm`,children:`Small`}),(0,Y.jsx)(O,{children:`Default`}),(0,Y.jsx)(O,{size:`lg`,children:`Large`}),(0,Y.jsx)(O,{size:`icon`,"aria-label":`more`,children:(0,Y.jsx)(F,{})}),(0,Y.jsx)(O,{disabled:!0,children:`Disabled`})]})]}),(0,Y.jsx)(Q,{title:`Badges`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(P,{children:`Default`}),(0,Y.jsx)(P,{variant:`secondary`,children:`Secondary`}),(0,Y.jsx)(P,{variant:`outline`,children:`Outline`}),(0,Y.jsx)(P,{variant:`destructive`,children:`Destructive`})]})}),(0,Y.jsx)(Q,{title:`Inputs & selection`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Y.jsx)(L,{placeholder:`Text input…`}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsxs)(N,{value:n,onValueChange:r,children:[(0,Y.jsx)(k,{className:`w-56`,children:(0,Y.jsx)(z,{placeholder:`Select…`})}),(0,Y.jsxs)(B,{children:[(0,Y.jsx)(j,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Y.jsx)(j,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Y.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Y.jsx)(I,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Y.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Y.jsxs)(jt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:d,onTimeRangeChange:f,onReset:m,canReset:p,children:[(0,Y.jsxs)(N,{value:o,onValueChange:s,children:[(0,Y.jsx)(k,{size:`sm`,children:(0,Y.jsx)(z,{})}),(0,Y.jsxs)(B,{children:[(0,Y.jsx)(j,{value:X,children:`Toutes directions`}),(0,Y.jsx)(j,{value:`inbound`,children:`inbound`}),(0,Y.jsx)(j,{value:`outbound`,children:`outbound`}),(0,Y.jsx)(j,{value:`internal`,children:`internal`})]})]}),(0,Y.jsxs)(N,{value:l,onValueChange:u,children:[(0,Y.jsx)(k,{size:`sm`,children:(0,Y.jsx)(z,{})}),(0,Y.jsxs)(B,{children:[(0,Y.jsx)(j,{value:X,children:`Toutes sévérités`}),(0,Y.jsx)(j,{value:`info`,children:`info`}),(0,Y.jsx)(j,{value:`warn`,children:`warn`}),(0,Y.jsx)(j,{value:`critical`,children:`critical`})]})]})]}),(0,Y.jsx)(Mt,{fields:qt,onChange:()=>{}}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Y.jsx)(At,{value:d,onChange:f})]})]})}),(0,Y.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Y.jsxs)(ht,{children:[(0,Y.jsx)(pt,{asChild:!0,children:(0,Y.jsx)(O,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Y.jsx)(F,{})})}),(0,Y.jsxs)(gt,{align:`start`,children:[(0,Y.jsx)(_t,{children:`Actions`}),(0,Y.jsx)(A,{}),(0,Y.jsx)(M,{children:`Edit`}),(0,Y.jsx)(M,{children:`Duplicate`}),(0,Y.jsx)(A,{}),(0,Y.jsx)(M,{variant:`destructive`,children:`Delete`})]})]})}),(0,Y.jsx)(Q,{title:`Card`,children:(0,Y.jsxs)(Et,{className:`w-80`,children:[(0,Y.jsxs)(xt,{children:[(0,Y.jsx)(wt,{children:`Instance`}),(0,Y.jsx)(Tt,{children:`Non-secret metadata only.`})]}),(0,Y.jsx)(Ct,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Y.jsxs)(St,{className:`gap-2`,children:[(0,Y.jsx)(O,{size:`sm`,children:`Save`}),(0,Y.jsx)(O,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Y.jsx)(Q,{title:`Table`,children:(0,Y.jsxs)(kt,{children:[(0,Y.jsx)(Dt,{children:(0,Y.jsxs)(H,{children:[(0,Y.jsx)(V,{className:`w-8`,children:(0,Y.jsx)(I,{"aria-label":`select all`})}),(0,Y.jsx)(V,{children:`Name`}),(0,Y.jsx)(V,{children:`Mode`}),(0,Y.jsx)(V,{className:`text-right`,children:`Status`}),(0,Y.jsx)(V,{className:`w-8`})]})}),(0,Y.jsx)(Ot,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Y.jsxs)(H,{children:[(0,Y.jsx)(U,{children:(0,Y.jsx)(I,{"aria-label":`select ${e.n}`})}),(0,Y.jsx)(U,{className:`font-medium`,children:e.n}),(0,Y.jsx)(U,{children:(0,Y.jsx)(P,{variant:`secondary`,children:e.m})}),(0,Y.jsx)(U,{className:`text-right`,children:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Y.jsx)(E,{className:`size-3.5`}),` `,e.s]})}),(0,Y.jsx)(U,{children:(0,Y.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Y.jsx)(F,{})})})]},e.n))})]})}),(0,Y.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Y.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Y.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Y.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Y.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Y.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Y.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Y.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Y.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Y.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Y.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,Qf as i,Xf as a,Zf as o,_t as s,ap as c,bt as l,cp as u,ep as d,gt as f,ht as p,ip as m,mt as h,np as g,op as _,rp as v,sp as y,tp as b,vt as x,yt as S}from"./dist-Cjlv3ZK-.js";import{t as C}from"./button-Bv-PK2-Y.js";import{A as w,Mt as T,St as E,dt as D,ft as O,mt as k,pt as A,tt as j}from"./index-BWV7nAxJ.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:u(),from:`now-5m`},{label:y(),from:`now-15m`},{label:_(),from:`now-30m`},{label:c(),from:`now-1h`},{label:m(),from:`now-3h`},{label:v(),from:`now-6h`},{label:g(),from:`now-12h`},{label:b(),from:`now-24h`},{label:d(),from:`now-2d`},{label:r(),from:`now-7d`},{label:i(),from:`now-30d`},{label:o(),from:`now-90d`},{label:a(),from:`now-520w`}];function L(e){return w(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,r]=(0,M.useState)(!1),[i,a]=(0,M.useState)(``),o=F(e),[c,u]=(0,M.useState)(()=>z(o.from)),[d,m]=(0,M.useState)(()=>z(o.to));function g(t){if(t){let t=F(e);u(z(t.from)),m(z(t.to)),a(``)}r(t)}function _(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function v(){let e=B(c),n=B(d);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let y=(0,M.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),b=B(c)!==null&&B(d)!==null;return(0,H.jsxs)(A,{open:n,onOpenChange:g,children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(T,{}),R(e)]})}),(0,H.jsx)(O,{children:(0,H.jsx)(D,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:l()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:S()}),(0,H.jsx)(j,{type:`datetime-local`,value:c,onChange:e=>u(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,H.jsx)(j,{type:`datetime-local`,value:d,onChange:e=>m(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!b,onClick:v,children:s()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(E,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(j,{value:i,onChange:e=>a(e.target.value),placeholder:f(),"aria-label":p()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:y.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:h()}):y.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>_(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,_t as i,ap as a,bt as o,cp as s,dp as c,ep as l,gt as u,ht as d,ip as f,lp as p,mt as m,np as h,op as g,rp as _,sp as v,tp as y,up as b,vt as x,yt as S}from"./dist-C6Mg6d5Y.js";import{t as C}from"./button-NWqGTLKg.js";import{A as w,Mt as T,St as E,dt as D,ft as O,mt as k,pt as A,tt as j}from"./index-DkxYxN0F.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:c(),from:`now-5m`},{label:b(),from:`now-15m`},{label:p(),from:`now-30m`},{label:s(),from:`now-1h`},{label:v(),from:`now-3h`},{label:g(),from:`now-6h`},{label:a(),from:`now-12h`},{label:f(),from:`now-24h`},{label:_(),from:`now-2d`},{label:h(),from:`now-7d`},{label:y(),from:`now-30d`},{label:l(),from:`now-90d`},{label:r(),from:`now-520w`}];function L(e){return w(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,r]=(0,M.useState)(!1),[a,s]=(0,M.useState)(``),c=F(e),[l,f]=(0,M.useState)(()=>z(c.from)),[p,h]=(0,M.useState)(()=>z(c.to));function g(t){if(t){let t=F(e);f(z(t.from)),h(z(t.to)),s(``)}r(t)}function _(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function v(){let e=B(l),n=B(p);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let y=(0,M.useMemo)(()=>{let e=a.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[a]),b=B(l)!==null&&B(p)!==null;return(0,H.jsxs)(A,{open:n,onOpenChange:g,children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(T,{}),R(e)]})}),(0,H.jsx)(O,{children:(0,H.jsx)(D,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:o()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:S()}),(0,H.jsx)(j,{type:`datetime-local`,value:l,onChange:e=>f(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,H.jsx)(j,{type:`datetime-local`,value:p,onChange:e=>h(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!b,onClick:v,children:i()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(E,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(j,{value:a,onChange:e=>s(e.target.value),placeholder:u(),"aria-label":d()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:y.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:m()}):y.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>_(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};