@lacneu/atrium 0.30.0 → 0.31.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 (68) hide show
  1. package/dist/assets/AccessTab-BsdUHkzK.js +1 -0
  2. package/dist/assets/{AdvancedFilter-BM-NsfWQ.js → AdvancedFilter-D7DLZYme.js} +1 -1
  3. package/dist/assets/AgentFilesTab-DIarAi1f.js +3 -0
  4. package/dist/assets/AnomaliesTab-DuiB7-Hb.js +1 -0
  5. package/dist/assets/{AuditTab-7UfsE_38.js → AuditTab-JztKqFCo.js} +1 -1
  6. package/dist/assets/BridgeTab-Cq5iNQOa.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-uzoXYwFc.js +1 -0
  8. package/dist/assets/{DataTableShell-DBDIF654.js → DataTableShell-5lSbOyB_.js} +1 -1
  9. package/dist/assets/{DetailChips-eDCHm7fV.js → DetailChips-DxHzS0pZ.js} +1 -1
  10. package/dist/assets/FeedbacksTab-fwt5C5Db.js +1 -0
  11. package/dist/assets/{FieldLabel-BxCSPKLD.js → FieldLabel-C4ocliYM.js} +1 -1
  12. package/dist/assets/FilesTab-DJ28a030.js +1 -0
  13. package/dist/assets/{FilterBar-egrudkw6.js → FilterBar-2yRvM8KI.js} +1 -1
  14. package/dist/assets/GroupsTab-B9MxdzYT.js +1 -0
  15. package/dist/assets/InstancesTab-CLRtI5-3.js +1 -0
  16. package/dist/assets/IntegrationsTab-Dex6qIRe.js +1 -0
  17. package/dist/assets/{KpiTab-BW9nVj-Y.js → KpiTab-Bho9N3hr.js} +1 -1
  18. package/dist/assets/PreferencesTab-DXQYcjrW.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-DeikEkRG.js +3 -0
  20. package/dist/assets/RolesTab-_zD3lV_5.js +1 -0
  21. package/dist/assets/ServiceAccountsTab--einclAf.js +1 -0
  22. package/dist/assets/SubAgentReportsTab-CRtVt4vg.js +1 -0
  23. package/dist/assets/ThemeShowroom-CfDj2cuT.js +1 -0
  24. package/dist/assets/{TimeRangePicker-CjeAiSdk.js → TimeRangePicker-DIRVKRqd.js} +1 -1
  25. package/dist/assets/TracesTab-DNq9Qj5A.js +1 -0
  26. package/dist/assets/UsersTab-uocEkZlF.js +1 -0
  27. package/dist/assets/{button-CcNQBW08.js → button-BK4ZG4Jz.js} +1 -1
  28. package/dist/assets/{card-B9JuMxhP.js → card-BVpALAaI.js} +1 -1
  29. package/dist/assets/chevrons-up-down-CgCxGbNZ.js +1 -0
  30. package/dist/assets/{compatView-aBtPNegs.js → compatView-CjP1FDes.js} +1 -1
  31. package/dist/assets/dispatchErrorInfo-oHT_3ckv.js +1 -0
  32. package/dist/assets/{dist-BhnVOFIn.js → dist-73SeNc8s.js} +1 -1
  33. package/dist/assets/{dist-GFH_mzhb.js → dist-BuHHfQDg.js} +1 -1
  34. package/dist/assets/{dist-CNxV6qRL.js → dist-CsRbXSKk.js} +1 -1
  35. package/dist/assets/{dist-BOukL7gG.js → dist-DDPZzNhc.js} +1 -1
  36. package/dist/assets/{highlighted-body-OFNGDK62-CcH-KtiT.js → highlighted-body-OFNGDK62-xoPNl7hV.js} +1 -1
  37. package/dist/assets/index-Ca5_rTHj.js +229 -0
  38. package/dist/assets/mermaid-GHXKKRXX-B7eIuXQl.js +1 -0
  39. package/dist/assets/roleDescriptions-UrTqz_co.js +1 -0
  40. package/dist/assets/{table-DAtXjw2C.js → table-WXK9Ux9R.js} +1 -1
  41. package/dist/assets/{tabs-BHYINAjr.js → tabs-BWd0h4Tg.js} +1 -1
  42. package/dist/assets/x-Bw9Ep8PY.js +1 -0
  43. package/dist/index.html +7 -7
  44. package/package.json +1 -1
  45. package/dist/assets/AccessTab-CUrhYOD-.js +0 -1
  46. package/dist/assets/AgentFilesTab-Dq4y_9nj.js +0 -3
  47. package/dist/assets/AnomaliesTab-C40acUCU.js +0 -1
  48. package/dist/assets/BridgeTab-CjidRXGN.js +0 -1
  49. package/dist/assets/ChatDefaultsTab-Bl4jU1yW.js +0 -1
  50. package/dist/assets/FeedbacksTab-B40TFMxk.js +0 -1
  51. package/dist/assets/FilesTab-go4v_nAG.js +0 -1
  52. package/dist/assets/GroupsTab-DPMLiMCc.js +0 -1
  53. package/dist/assets/InstancesTab-KzujA3gD.js +0 -1
  54. package/dist/assets/IntegrationsTab-y61Q2VDy.js +0 -1
  55. package/dist/assets/PreferencesTab-CNpy4JQu.js +0 -1
  56. package/dist/assets/PromptInjectionsTab-CWC7LSmE.js +0 -3
  57. package/dist/assets/RolesTab-DyDQiA_c.js +0 -1
  58. package/dist/assets/ServiceAccountsTab-B6F-47Gm.js +0 -1
  59. package/dist/assets/SubAgentReportsTab-NTWhdI69.js +0 -1
  60. package/dist/assets/ThemeShowroom-B7Z2ffNQ.js +0 -1
  61. package/dist/assets/TracesTab-CFkotfAj.js +0 -1
  62. package/dist/assets/UsersTab-BUX8VYmD.js +0 -1
  63. package/dist/assets/chevrons-up-down-ar6Ygzeq.js +0 -1
  64. package/dist/assets/dispatchErrorInfo-MZJyPS1B.js +0 -1
  65. package/dist/assets/index-HZd91gw7.js +0 -229
  66. package/dist/assets/mermaid-GHXKKRXX-D7Hy3m87.js +0 -1
  67. package/dist/assets/roleDescriptions-CxEPrkAY.js +0 -1
  68. package/dist/assets/x-C81gK-RB.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BO as r,as as i,cs as a,ds as o,fs as s,hs as c,is as l,ls as u,ms as d,ns as f,os as p,pO as m,ps as h,qO as g,rs as _,ss as v,ts as y,us as b}from"./dist-DDPZzNhc.js";import{C as x,S,X as C,b as w,x as T,y as E}from"./index-Ca5_rTHj.js";var D=t(e(),1);function O(e){return e===`user`?i():e===`all`?l():_({group:e.group})}function k(e){return e===`common`?f():e===`owner`?y():_({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=g(r.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=g(r.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":d(),children:(0,A.jsx)(x,{placeholder:d()})}),(0,A.jsx)(w,{children:(e??[]).map(e=>(0,A.jsx)(T,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(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:s()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(C,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:o()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:b()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(C,{variant:`default`,children:p()}):null,(0,A.jsx)(C,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(C,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:u()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(C,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:a()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_l as r,gl as i,hl as a,ml as o,pl as s,vl as c,yl as l}from"./dist-BOukL7gG.js";import{i as u}from"./dist-GFH_mzhb.js";import{t as d}from"./x-C81gK-RB.js";import{t as f}from"./button-CcNQBW08.js";import{C as p,S as m,Z as h,b as g,bt as _,x as v,y}from"./index-HZd91gw7.js";import{r as b}from"./TimeRangePicker-CjeAiSdk.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:l()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let l=(0,x.useRef)(t),w=!!(l.current&&l.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(l.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),c(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(y,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:i()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(y,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(h,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:a()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(_,{}),s()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cl as r,El as i,Sl as a,Tl as o,bl as s,wl as c,xl as l}from"./dist-DDPZzNhc.js";import{i as u}from"./dist-BuHHfQDg.js";import{t as d}from"./x-Bw9Ep8PY.js";import{t as f}from"./button-BK4ZG4Jz.js";import{C as p,S as m,Z as h,b as g,bt as _,x as v,y}from"./index-Ca5_rTHj.js";import{r as b}from"./TimeRangePicker-DIRVKRqd.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:i()},{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 i=(0,x.useRef)(t),w=!!(i.current&&i.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(i.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),o(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children: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)(y,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:r()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(y,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(h,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:a()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(_,{}),s()]})]}):null]})}export{D as t};
@@ -0,0 +1,3 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ai as r,BO as i,Bi as a,Ci as o,Di as s,Ei as c,Fi as l,Gi as ee,Hi as te,Ii as u,Ji as d,Ki as ne,Li as f,Mi as p,Na as m,Ni as h,Oi as g,Pi as _,Ri as re,Si as v,Ti as y,Ui as b,Vi as x,WO as S,Wi as ie,Xi as C,Yi as w,hO as ae,iC as oe,ja as se,ji as T,ki as E,pO as D,qO as O,qi as ce,wi as k,xi as A,zi as j}from"./dist-DDPZzNhc.js";import{t as M}from"./button-BK4ZG4Jz.js";import{$ as N,A as P,B as F,C as I,F as le,I as ue,L as de,N as fe,P as pe,Q as me,R as he,S as L,X as R,b as z,et as ge,mt as B,nt as _e,ot as V,rt as ve,v as H,x as U,y as W,z as ye}from"./index-Ca5_rTHj.js";import{i as G}from"./compatView-CjP1FDes.js";/* empty css */var K=t(e(),1),q=2e4,J=6e4;function Y(e){return typeof e!=`number`||e<=0?0:Math.round(e/q*100)}function X(e){return e<=0?0:Math.round(e/J*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function be(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var xe=3;function Se(e,t){let n=new Map;for(let t of e.split(`
2
+ `))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
3
+ `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<xe&&a.push(e)):t>0&&(i+=t,o.length<xe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function Ce(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function we(){let e=O(i.me.getMe,{host:V}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=O(i.admin.listInstances,e!==void 0&&t?{}:`skip`),[o,s]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!r||r.length===0||(!o||!r.some(e=>e.name===o))&&s(r[0].name)},[t,r,o]);let c=O(i.agents.listAgentsForInstance,t&&o?{instanceName:o}:`skip`),l=O(i.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return o===null||c===void 0?r!==void 0&&r.length===0?[]:void 0:c.agents.map(e=>({instanceName:o,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,o,c,r,l]),[f,p]=(0,K.useState)(null);(0,K.useEffect)(()=>{!u||u.length===0||(!f||!u.some(e=>$(e)===f))&&p($(u[0]))},[u,f]);let m=u?.find(e=>$(e)===f)??null,h=S(i.agentFiles.listAgentFiles),[g,_]=(0,K.useState)({status:`idle`}),v=m?.instanceName??null,y=m?.agentId??null,oe=O(i.compat.forInstance,n&&v!==null?{instanceName:v}:`skip`),T=n&&v!==null?H(oe,`agentFiles`):null,E=T===null?!1:T===`loading`?null:T.blocked,k=(0,K.useCallback)(async()=>{if(!(v===null||y===null)){_({status:`loading`});try{_({status:`done`,files:(await h({instanceName:v,agentId:y})).files})}catch{_({status:`error`})}}},[h,v,y]);(0,K.useEffect)(()=>{E===!1&&k()},[k,E]);let[A,N]=(0,K.useState)(null),P=ae(),F=(0,K.useMemo)(()=>new Intl.NumberFormat(P,{maximumFractionDigits:0}),[P]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(W,{value:o??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":w(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:(r??[]).map(e=>(0,Q.jsx)(U,{value:e.name,children:e.name},e.name))})]}):null,u.length>0?(0,Q.jsxs)(W,{value:f??``,onValueChange:e=>p(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":d(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:u.map(e=>(0,Q.jsx)(U,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ce()})]}),m===null?null:T===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):T!==null&&T.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(B,{size:14,"aria-hidden":!0}),` `,G(T.gatewayVersion)]}):g.status===`loading`||g.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):g.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ee(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void k(),children:se()})]}):g.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:g.files.map(e=>{let n=Y(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(R,{variant:`outline`,children:ie()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:b({size:Z(e.size,P)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:te({pct:F.format(n)})}),r?(0,Q.jsx)(B,{size:14,className:`oc-afiles__warn`,"aria-label":x()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(M,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>N(e),children:t?j():re()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:a({used:Z(be(g.files),P),total:Z(J,P),pct:F.format(X(be(g.files)))})})]}),A&&m?(0,Q.jsx)(Te,{instanceName:m.instanceName,agentId:m.agentId,name:A.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void k()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:a,onClose:ee,onSaved:te}){let d=S(i.agentFiles.getAgentFile),ne=S(i.agentFiles.setAgentFile),re=P(),[b,x]=(0,K.useState)(null),[ie,C]=(0,K.useState)(!1),[w,O]=(0,K.useState)(``),[ce,j]=(0,K.useState)(!1),[I,L]=(0,K.useState)(!1),[R,z]=(0,K.useState)(!1),[B,V]=(0,K.useState)(!1),H=(0,K.useCallback)(async r=>{C(!1);try{let i=await d({instanceName:e,agentId:t,name:n});x({content:i.content,updatedAtMs:i.updatedAtMs}),r||O(i.content),z(!1)}catch{C(!0)}},[d,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(b!==null){L(!0),V(!1);try{await ne({instanceName:e,agentId:t,name:n,content:w,baseUpdatedAtMs:b.updatedAtMs??void 0}),re.success(T({name:n})),te(),await H(!1)}catch(e){Ce(e)?z(!0):V(!0)}finally{L(!1)}}}let W=b!==null&&w!==b.content,G=(0,K.useMemo)(()=>b===null?null:Se(b.content,w),[b,w]),J=w.length>q,Y=ae(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(me,{open:!0,onOpenChange:e=>!e&&ee(),children:(0,Q.jsxs)(N,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(ve,{children:f({name:n})}),(0,Q.jsxs)(ge,{children:[u({agent:t,instance:e}),a?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,l()]})]})]}),ie?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[E(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:se()})]}):b===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:w,readOnly:!a,spellCheck:!1,onChange:e=>O(e.target.value),"aria-label":f({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:_()}),R?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[g(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:s()})]}):null,B?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:r()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:h({count:X.format(w.length),max:X.format(q)})}),a?(0,Q.jsx)(M,{size:`sm`,disabled:!W||I||R,onClick:()=>j(!0),children:I?m():p()}):null]})]}),(0,Q.jsx)(fe,{open:ce,onOpenChange:j,children:(0,Q.jsxs)(ue,{children:[(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(F,{children:c({name:n})}),(0,Q.jsx)(de,{children:y({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:k({added:G.added,removed:G.removed})}),G.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:o()}),G.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,G.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:v()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(he,{children:[(0,Q.jsx)(le,{children:oe()}),(0,Q.jsx)(pe,{onClick:()=>void U(),children:A()})]})]})})]})})}export{we as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,Am as i,BO as a,Bm as ee,Dm as o,Fm as s,Gm as c,Hm as l,Im as te,Jm as u,KO as d,Km as f,Lm as p,Mm as m,Nm as h,Om as g,Pm as ne,Qm as re,Rm as ie,Um as ae,Vm as oe,Wm as _,Xm as se,Ym as ce,Zm as le,ah as ue,ch as de,dh as fe,eh as pe,fh as me,hh as v,ih as he,jm as ge,km as y,lh as b,mh as x,nh as S,oh as C,ph as w,qO as T,qm as E,rh as D,sh as O,th as k,uh as A,zm as j}from"./dist-DDPZzNhc.js";import{A as M,C as N,Mt as P,S as F,X as I,a as L,b as R,j as _e,jt as z,ot as ve,r as ye,x as B,y as V}from"./index-Ca5_rTHj.js";import{n as be}from"./TimeRangePicker-DIRVKRqd.js";import{t as xe}from"./FilterBar-2yRvM8KI.js";import{t as Se}from"./DataTableShell-5lSbOyB_.js";import{t as H}from"./dispatchErrorInfo-oHT_3ckv.js";var U=t(e(),1),W=n(),G=`__all__`,Ce=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function we(e){return e===`open`?v():e===`acknowledged`?x():w()}var Te=[`info`,`warn`,`critical`],Ee=[`detector`,`agent`,`user`],De={kind:`relative`,from:`now-30d`,to:`now`},Oe=200,K=`all`;function q(){let e=P({from:`/settings/anomalies`}),t=z({from:`/settings/anomalies`}),n=e.q??``,i=e.status===K?G:e.status,o=e.severity??G,g=e.kind??G,[v,y]=(0,U.useState)(G),x=ye(e.from,e.to),{from:w,to:H}=be(x),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,status:e===G?K:e})}),Y=e=>void t({search:t=>({...t,severity:e===G?void 0:e})}),Ne=e=>void t({search:t=>({...t,kind:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,...L(e)})}),Pe=_e(),Z=M(),Q=d(a.anomalies.resolveAnomaly),Fe=(T(a.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=T(a.anomalies.listAnomalies,{limit:Oe,filter:{q:n||void 0,from:w,to:H,anomalyStatus:i===G?void 0:i,severity:o===G?void 0:o,source:v===G?void 0:v,kind:g===G?void 0:g}}),Ie=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||i!==`open`||o!==G||v!==G||g!==G||x.kind!==`relative`||x.from!==De.from;function Re(){y(G),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:me(),description:(0,W.jsxs)(W.Fragment,{children:[fe(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,A(),` `,(0,W.jsx)(`strong`,{children:b()}),`.`,` `,de()]}),confirmLabel:O()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(C(),e.kind)}catch(e){Z.error(ue(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(he(),e.kind)}catch(e){Z.error(D(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,W.jsx)(`strong`,{children:k()}),` `,pe(),` `,(0,W.jsx)(`strong`,{children:r()}),` `,re(),` `,(0,W.jsx)(`strong`,{children:le()}),` `,se(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:ce()})]}),(0,W.jsxs)(xe,{q:n,onQChange:q,searchPlaceholder:u(),timeRange:x,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,W.jsxs)(V,{value:i,onValueChange:J,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:E()}),Ce.map(e=>(0,W.jsx)(B,{value:e.value,children:we(e.value)},e.value))]})]}),(0,W.jsxs)(V,{value:o,onValueChange:Y,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:f()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:c()}),Te.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:v,onValueChange:y,children:[(0,W.jsx)(F,{size:`sm`,className:`w-32`,children:(0,W.jsx)(N,{placeholder:_()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:ae()}),Ee.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:g,onValueChange:Ne,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:l()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:oe()}),Ie.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Se,{title:ee(),rows:$,emptyHint:i===`open`?j():ie(),rowActions:e=>Fe&&e.status===`open`?[{label:p(),onSelect:()=>void ze(e)},{label:te(),onSelect:()=>void Be(e)}]:[],columns:[{header:s(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:l(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:f(),cell:e=>(0,W.jsx)(Ae,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ne(),cell:e=>(0,W.jsx)(je,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:_(),cell:e=>(0,W.jsx)(I,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:h(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:m(),cell:e=>(0,W.jsx)(ke,{row:e}),sort:e=>e.evidence??null},{header:ge(),cell:e=>e.correlationId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:Me(e.correlationId)}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function J(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Y(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function ke({row:e}){let t=z();if(e.kind===`subagent.failure`){let n=Y(e);return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,i()]}):null]})}let n=J(e);if(!n.dominantCode)return(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=H(n.dominantCode),a=n.sampleCorrelationId;return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,W.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,W.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),a?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:a,limit:100}}),children:[`↗ `,i()]}):null]})}function Ae({severity:e}){return(0,W.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function je({status:e}){return e===`open`?(0,W.jsx)(I,{variant:`destructive`,children:y()}):e===`acknowledged`?(0,W.jsx)(I,{variant:`secondary`,children:g()}):(0,W.jsx)(I,{variant:`outline`,children:o()})}function Me(e){return e.length>8?e.slice(0,8):e}export{q as AnomaliesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,BO as i,NO as a,ag as o,cg as s,dg as c,eg as l,fg as u,ig as ee,lg as d,ng as f,og as p,pg as m,rg as h,sg as g,tg as _,ug as v}from"./dist-BOukL7gG.js";import{C as y,Mt as b,S as x,a as S,b as C,i as w,jt as T,o as E,r as D,t as O,x as k,y as A}from"./index-HZd91gw7.js";import{n as j}from"./TimeRangePicker-CjeAiSdk.js";import{t as M}from"./FilterBar-egrudkw6.js";import{t as N}from"./AdvancedFilter-BM-NsfWQ.js";import{t as P}from"./DataTableShell-DBDIF654.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:O,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=b({from:`/settings/audit`}),t=T({from:`/settings/audit`}),n=e.q??``,O=e.action??R,B=e.impersonated??R,V=e.resource??R,H=D(e.from,e.to),U=(0,F.useMemo)(()=>E(e.adv),[e.adv]),{from:W,to:G}=j(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...S(e)})}),Z=e=>void t({search:t=>({...t,adv:w(e)}),replace:!0}),Q=i(a.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:O===R?void 0:O,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||O!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:u()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:c(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(A,{value:O,onValueChange:q,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:v()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:d()}),$.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]}),(0,I.jsxs)(A,{value:B,onValueChange:J,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:s()}),(0,I.jsx)(k,{value:`yes`,children:g()}),(0,I.jsx)(k,{value:`no`,children:p()})]})]}),(0,I.jsxs)(A,{value:V,onValueChange:Y,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:o()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:ee()}),te.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:h(),rows:Q,emptyHint:f(),columns:[{header:_(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:v(),cell:e=>e.action,sort:e=>e.action},{header:l(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:r(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:o(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BO as r,_g as i,bg as a,cg as o,dg as s,fg as c,gg as l,hg as u,lg as ee,mg as d,og as f,pg as p,qO as m,sg as h,ug as g,vg as _,yg as v}from"./dist-DDPZzNhc.js";import{C as y,Mt as b,S as x,a as S,b as C,i as w,jt as T,o as E,r as D,t as O,x as k,y as A}from"./index-Ca5_rTHj.js";import{n as j}from"./TimeRangePicker-DIRVKRqd.js";import{t as M}from"./FilterBar-2yRvM8KI.js";import{t as N}from"./AdvancedFilter-D7DLZYme.js";import{t as P}from"./DataTableShell-5lSbOyB_.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:O,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=b({from:`/settings/audit`}),t=T({from:`/settings/audit`}),n=e.q??``,O=e.action??R,B=e.impersonated??R,V=e.resource??R,H=D(e.from,e.to),U=(0,F.useMemo)(()=>E(e.adv),[e.adv]),{from:W,to:G}=j(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...S(e)})}),Z=e=>void t({search:t=>({...t,adv:w(e)}),replace:!0}),Q=m(r.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:O===R?void 0:O,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||O!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[a(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:v()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:_(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(A,{value:O,onValueChange:q,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:i()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:l()}),$.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]}),(0,I.jsxs)(A,{value:B,onValueChange:J,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:u()}),(0,I.jsx)(k,{value:`yes`,children:d()}),(0,I.jsx)(k,{value:`no`,children:p()})]})]}),(0,I.jsxs)(A,{value:V,onValueChange:Y,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:c()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:s()}),te.map(e=>(0,I.jsx)(k,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:g(),rows:Q,emptyHint:ee(),columns:[{header:o(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:i(),cell:e=>e.action,sort:e=>e.action},{header:h(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:f(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:c(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$r as r,$u as i,Ad as a,BO as o,Bd as s,Cd as c,Cf as l,Dd as u,Df as d,Ed as f,Fd as p,Gd as m,Hd as ee,Id as h,Jr as g,KO as te,Kd as ne,Ld as re,Md as _,Nd as ie,Od as v,Of as y,Pd as ae,Qr as b,Qu as x,Rd as oe,Sd as se,Sf as ce,Td as S,Tf as le,Ud as ue,Ur as de,VO as fe,Vd as pe,WO as me,Wd as he,Xr as ge,Yr as _e,Zr as ve,_d as ye,ad as be,ai as xe,bd as Se,bf as Ce,cd as we,dd as Te,ed as C,ei as Ee,fd as w,gd as De,hd as Oe,hf as ke,id as Ae,ii as je,jd as Me,kd as Ne,ld as Pe,md as Fe,mf as Ie,nd as Le,ni as Re,od as ze,oi as Be,pd as Ve,qO as T,qr as He,rd as Ue,ri as We,sd as Ge,td as Ke,ti as E,ud as qe,vd as Je,vf as Ye,wd as Xe,wf as Ze,xd as Qe,xf as $e,yd as et,yf as tt,zd as nt}from"./dist-DDPZzNhc.js";import{i as D,r as rt}from"./dist-BuHHfQDg.js";import{t as it}from"./chevrons-up-down-CgCxGbNZ.js";import{i as at,n as O,o as ot,r as st,s as ct}from"./FieldLabel-C4ocliYM.js";import{t as k}from"./button-BK4ZG4Jz.js";import{$ as lt,A as ut,At as A,C as j,H as dt,Q as ft,S as M,St as pt,U as mt,V as ht,X as N,Z as P,_ as gt,_t,b as F,et as vt,jt as yt,kt as I,mt as L,nt as bt,ot as xt,rt as St,x as R,y as z}from"./index-Ca5_rTHj.js";import{a as Ct,i as B,n as wt,o as V,r as H,t as Tt}from"./table-WXK9Ux9R.js";import{t as Et}from"./FilterBar-2yRvM8KI.js";import{a as U,n as Dt,o as W,r as Ot,s as kt,t as At}from"./compatView-CjP1FDes.js";import{t as G}from"./dispatchErrorInfo-oHT_3ckv.js";var jt=fe(`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`}]]),Mt=fe(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=t(e(),1);function Nt(e){return e.filter(e=>e.state===`error`)}function Pt(e){return e.reachable&&Nt(e.targets).length===0}function Ft(e){return e.state===`error`&&e.lastErrorCode!==null}function It(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function Lt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Rt(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Lt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function zt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,Bt={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function Vt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Ht(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 X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Ut(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Wt(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return W(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function Gt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Ut(t.key,e),a=Ut(t.key,r);return i&&a?0:i?1:a?-1:n*Wt(t.key,e,r)})}function Kt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function qt(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)=>X(e.label,t.label))}function Jt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>W(e,t)??X(e,t))}var Z=n();function Yt({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(Bt),[i,a]=(0,K.useState)(null),o=(0,K.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,K.useMemo)(()=>Kt(o),[o]),c=(0,K.useMemo)(()=>qt(o),[o]),l=(0,K.useMemo)(()=>Jt(o),[o]),u=(0,K.useMemo)(()=>Gt(Ht(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:De()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Et,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Ve(),onReset:()=>r(Bt),canReset:Vt(n),children:[(0,Z.jsxs)(z,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:Te()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(R,{value:J,children:w()}),s.map(e=>(0,Z.jsx)(R,{value:e,children:Zt(e)},e))]})]}),(0,Z.jsxs)(z,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(j,{placeholder:qe()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(R,{value:J,children:w()}),c.map(e=>(0,Z.jsx)(R,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(z,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:Pe()})}),(0,Z.jsxs)(F,{children:[(0,Z.jsx)(R,{value:J,children:w()}),l.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))]})]})]}),u.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:we()}):(0,Z.jsxs)(Tt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ct,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(Q,{label:Ge(),sortKey:`target`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:ze(),sortKey:`state`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:be(),sortKey:`instance`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Ae(),sortKey:`host`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Ue(),sortKey:`version`,sort:i,onSort:d}),(0,Z.jsx)(B,{children:Le()}),(0,Z.jsx)(Q,{label:Ke(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Z.jsx)(wt,{children:u.map(e=>(0,Z.jsx)(Xt,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(rt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(it,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Xt({r:e}){let t=Ft(e)?G(e.lastErrorCode):null,n=It(e)?G(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(K.Fragment,{children:[(0,Z.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(H,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(Qt,{state:e.state})}),(0,Z.jsx)(H,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(H,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:Oe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(H,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(H,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Fe({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Zt(e){return e===`connected`?C():e===`error`?i():x()}function Qt({state:e}){return e===`connected`?(0,Z.jsx)(N,{variant:`secondary`,children:C()}):e===`error`?(0,Z.jsx)(N,{variant:`destructive`,children:i()}):(0,Z.jsx)(N,{variant:`outline`,children:x()})}function $t(){return T(o.bridgeHealth.getBridgeHealth,{})}function en(){let e=$t(),t=T(o.compat.getBridgeCompat,{}),n=T(o.me.getMe,{host:xt})?.role===`admin`,r=T(o.admin.listInstances,n?{}:`skip`),i=yt(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),s=Rt(e?e.targets:[],t?t.targets:[],r??[]),c=t?.compat??null,l=t===void 0?`loading`:t===null?`nodata`:`ready`,u=c!==null&&Dt(c,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(tn,{health:e,compat:t,onSeeAnomalies:a}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:_()}),s.map(e=>(0,Z.jsx)(nn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:c,compatStatus:l,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null},e.key)),u?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):null]})}function tn({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,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:U(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:je(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,We({build:t.buildVersion??`?`})]}):null,` · `,Re(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?E():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Xe()});let o=Nt(e.targets),s=!e.reachable,l=Pt(e),u=l?`ok`:`error`,d=new Date(e.checkedAt).toLocaleString(`fr-FR`),f=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l?(0,Z.jsx)(I,{size:22}):s?(0,Z.jsx)(Mt,{size:22}):(0,Z.jsx)(L,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l?c():s?se():Qe({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(jt,{size:12,"aria-hidden":!0}),` `,Se({time:d})]}),f?(0,Z.jsx)(`span`,{children:et({time:f})}):null,a]}),s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Je()})]})}function nn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?kt(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:At(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,K.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(_t,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:zt(e)}),f?(0,Z.jsx)(N,{variant:f===`beyond`?`destructive`:`secondary`,children:Ot(f)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Be()}),(0,Z.jsx)(an,{support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(rn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),ye({count:t.length})]}),p?(0,Z.jsx)(Yt,{connections:t,displayByInstance:c}):null]})}function rn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Me(),i.length>0?(0,Z.jsx)(N,{variant:`destructive`,children:Ne({count:i.length})}):(0,Z.jsx)(N,{variant:`secondary`,children:a()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[v({version:e.vendoredVersion}),r?` · `+u({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),f({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function an({support:e,compatStatus:t,compatReachable:n,manifest:i,instanceRows:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}),i===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:b()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:ve({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:E()}),e?(0,Z.jsx)(cn,{versions:e.validatedVersions}):null]}),a.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:a.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:U(e.version)}),(0,Z.jsx)(N,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Ot(e.state)})]},e.instanceName))})]})}function on({instance:e,onClose:t}){return(0,Z.jsx)(ft,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(lt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(bt,{children:[(0,Z.jsx)(St,{children:y({instance:e.displayName??e.name})}),(0,Z.jsx)(vt,{children:d()})]}),(0,Z.jsx)(sn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(I,{"aria-hidden":!0}):(0,Z.jsx)(L,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?h():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,p()]}):null}function sn({instance:e,onClose:t}){let n=te(o.admin.upsertInstanceConfig),r=me(o.bridge.validateMediaPaths),i=ut(),[a,c]=(0,K.useState)(()=>at(e.config??{})),[u,d]=(0,K.useState)(!1),[f,p]=(0,K.useState)(!1),[h,g]=(0,K.useState)(null),_=a.inboundMediaMode===`shared-fs`,v=a.mediaMode===`shared-fs`,y=_||v;async function b(){p(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:a.inboundMediaMode,mediaMode:a.mediaMode}))}catch(e){i.error(s(),e)}finally{p(!1)}}async function x(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:st(a,r)}),t()}catch(e){i.error(Ce(),e)}finally{d(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:le(),help:tt()}),(0,Z.jsxs)(z,{value:a.mediaMode,onValueChange:e=>c({...a,mediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(F,{children:ct.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:Ze(),help:Ye()}),(0,Z.jsxs)(z,{value:a.inboundMediaMode,onValueChange:e=>c({...a,inboundMediaMode:e}),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(F,{children:ot.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:l(),help:ke()}),(0,Z.jsx)(P,{type:`number`,min:1,max:4096,className:`w-full`,value:a.mediaMaxMb,onChange:e=>c({...a,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ne(),help:m()}),(0,Z.jsx)(P,{className:`w-full`,spellCheck:!1,value:a.inboundAgentMount,onChange:e=>c({...a,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:he(),help:ue()}),(0,Z.jsx)(P,{className:`w-full`,spellCheck:!1,value:a.outboundAgentMount,onChange:e=>c({...a,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(gt,{checked:a.rehydration,onCheckedChange:e=>c({...a,rehydration:e===!0})}),(0,Z.jsx)(O,{label:ce(),help:Ie()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(L,{"aria-hidden":!0}),ie({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:oe(),result:h.inbound}),(0,Z.jsx)($,{label:re(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:nt()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(L,{"aria-hidden":!0}),ae()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:f,children:[f?(0,Z.jsx)(pt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?pe():ee()]}),(0,Z.jsx)(k,{size:`sm`,onClick:()=>void x(),disabled:u,children:$e()})]})]})})}function cn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(ht,{children:[(0,Z.jsx)(mt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?ge():_e({count:e.length}),(0,Z.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(dt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:g()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(N,{variant:`secondary`,children:e},e))})]})]})}export{en as BridgeTab,on as InstanceConfigDialog};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BO as r,Da as i,Ea as a,Ef as o,H as s,KO as c,Na as l,U as u,V as d,WO as f,Yi as p,_i as m,ci as h,di as g,fi as _,gi as v,hi as y,iC as b,ja as ee,li as x,mi as te,pO as S,pi as C,qO as w,si as ne,ui as re,vi as ie,yi as ae}from"./dist-DDPZzNhc.js";import{t as T}from"./button-BK4ZG4Jz.js";import{A as E,B as oe,C as se,F as ce,I as le,L as ue,N as de,P as fe,R as pe,S as me,Z as D,b as he,g as ge,h as O,mt as k,v as A,x as j,y as M,z as N}from"./index-Ca5_rTHj.js";import{i as P}from"./compatView-CjP1FDes.js";/* empty css */var F=t(e(),1),I=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function L(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var R=n();function _e({instance:e}){let t=c(r.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[i,a]=(0,F.useState)(n===null?``:String(n)),[o,f]=(0,F.useState)(`idle`);(0,F.useEffect)(()=>{a(n===null?``:String(n)),f(`idle`)},[e._id,n]);let p=i.trim(),m=p===``?null:/^\d+$/.test(p)?Number.parseInt(p,10):NaN,h=m===null||Number.isInteger(m)&&m>=1e3&&m<=2e5,v=(m??null)!==n;async function y(){f(`saving`);try{let n={...e.config??{}};m===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=m,await t({instanceId:e._id,config:n}),f(`done`)}catch{f(`error`)}}return(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,R.jsx)(D,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:i,onChange:e=>a(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!h}),(0,R.jsx)(T,{size:`sm`,disabled:!v||!h||o===`saving`,onClick:()=>void y(),children:o===`saving`?l():C()})]}),h?null:(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d()}),o===`done`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:_()}):null,o===`error`?(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}):null,(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:s()})]})}function z(){let e=f(r.agentFiles.getChatDefaults),t=f(r.agentFiles.setChatDefaults),n=E(),[s,c]=(0,F.useState)({status:`loading`}),[u,d]=(0,F.useState)({thinkingDefault:null,fastModeDefault:null}),[D,z]=(0,F.useState)(!1),[B,V]=(0,F.useState)(!1),H=w(r.admin.listInstances,{}),[U,W]=(0,F.useState)(null);(0,F.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,ve=H!==void 0&&H.length===0,ye=w(r.compat.forInstance,U?{instanceName:U}:`skip`),K=U?A(ye,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,F.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,F.useRef)(0),X=(0,F.useCallback)(async()=>{let t=++Y.current;c({status:`loading`});try{let n=L(await e(J));if(Y.current!==t)return;c({status:`done`,current:n}),d(n)}catch{if(Y.current!==t)return;c({status:`error`})}},[e,J]);(0,F.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=s.status===`done`?s.current:null,Q=Z!==null&&u.thinkingDefault!==null&&u.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&u.fastModeDefault!==null&&u.fastModeDefault!==Z.fastModeDefault,be=Q||$;async function xe(){V(!0);try{await t({...J,...Q?{thinkingDefault:u.thinkingDefault}:{},...$?{fastModeDefault:u.fastModeDefault}:{}}),n.success(_()),await X()}catch(e){n.error(g(),e)}finally{V(!1)}}let Se=(0,F.useMemo)(()=>I.map(e=>({id:e,label:ge(e)})),[]),Ce=(0,F.useMemo)(()=>[{id:`fast`,label:i()},{id:`standard`,label:a()}],[]);return(0,R.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}),G&&U?(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()}),(0,R.jsxs)(M,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,R.jsx)(me,{size:`sm`,"aria-label":p(),children:(0,R.jsx)(se,{})}),(0,R.jsx)(he,{children:(H??[]).map(e=>(0,R.jsx)(j,{value:e.name,children:e.name},e.name))})]})]}):null,ve?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:o()}):K===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):K.blocked?(0,R.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,R.jsx)(k,{size:14,"aria-hidden":!0}),` `,P(K.gatewayVersion)]}):s.status===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):s.status===`error`?(0,R.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[te(),` `,(0,R.jsx)(T,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:ee()})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:ie()}),(0,R.jsx)(O,{options:Se,value:u.thinkingDefault,onChange:e=>d({...u,thinkingDefault:e}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:m()})]}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:v()}),(0,R.jsx)(O,{options:Ce,value:u.fastModeDefault===null?null:u.fastModeDefault?`fast`:`standard`,onChange:e=>d({...u,fastModeDefault:e===`fast`}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]}),(0,R.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,R.jsx)(T,{size:`sm`,disabled:!be||B,onClick:()=>z(!0),children:B?l():C()})}),(0,R.jsx)(`p`,{className:`oc-cdefaults__note`,children:re()})]}),(()=>{let e=H?.find(e=>e.name===(U??H[0]?.name));return e?(0,R.jsx)(_e,{instance:e}):null})(),(0,R.jsx)(de,{open:D,onOpenChange:z,children:(0,R.jsxs)(le,{children:[(0,R.jsxs)(N,{children:[(0,R.jsx)(oe,{children:x()}),(0,R.jsx)(ue,{children:h()})]}),(0,R.jsxs)(pe,{children:[(0,R.jsx)(ce,{children:b()}),(0,R.jsx)(fe,{onClick:()=>void xe(),children:ne()})]})]})})]})}export{z as ChatDefaultsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ac as r,Dc as i,Ec as a,Oc as o,Tc as s,jc as c,kc as l}from"./dist-BOukL7gG.js";import{i as u,r as d}from"./dist-GFH_mzhb.js";import{t as f}from"./chevrons-up-down-ar6Ygzeq.js";import{t as p}from"./button-CcNQBW08.js";import{G as m,J as h,K as g,Tt as _,W as v,Y as y,_ as b,bt as x,ht as S}from"./index-HZd91gw7.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-DAtXjw2C.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=c(),bulkActions:F,emptyHint:I=r(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(S,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(b,{"aria-label":o(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":s({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(b,{"aria-label":i(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(y,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(_,{})})}),(0,M.jsx)(m,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Fc as r,Ic as i,Lc as a,Mc as o,Nc as s,Pc as c,Rc as l}from"./dist-DDPZzNhc.js";import{i as u,r as d}from"./dist-BuHHfQDg.js";import{t as f}from"./chevrons-up-down-CgCxGbNZ.js";import{t as p}from"./button-BK4ZG4Jz.js";import{G as m,J as h,K as g,Tt as _,W as v,Y as y,_ as b,bt as x,ht as S}from"./index-Ca5_rTHj.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-WXK9Ux9R.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=l(),bulkActions:F,emptyHint:I=a(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(S,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(b,{"aria-label":r(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":o({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],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":c(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(y,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(_,{})})}),(0,M.jsx)(m,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{X as t}from"./index-HZd91gw7.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{X as t}from"./index-Ca5_rTHj.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{$v as r,Ay as i,BO as a,Bv as o,Cy as s,Dy as c,Ey as l,Fv as u,Fy as d,Gv as f,Hv as p,Iv as m,Iy as h,Jv as ee,KO as g,Kv as _,Lv as te,My as v,Ny as ne,Oy as re,Py as ie,Qv as y,Rv as b,Sy as x,Ty as S,Uv as C,Vv as w,Wv as T,Xv as E,Yv as D,Zv as O,_y as k,ay as A,by as j,c as M,cy as N,dy as P,ey as F,fy as I,gy as L,hy as R,iy as z,jy as B,ky as V,ly as H,my as ae,ny as U,o as W,oy as G,py as K,qO as q,qv as J,ry as oe,sy as se,ty as ce,uy as le,vy as ue,wy as de,xy as fe,yy as Y,zv as pe}from"./dist-DDPZzNhc.js";import{t as me}from"./button-BK4ZG4Jz.js";import{j as he}from"./index-Ca5_rTHj.js";import{t as ge}from"./DataTableShell-5lSbOyB_.js";var X=t(e(),1),Z=n(),_e={altered_words:()=>h(),incorrect:()=>d(),incoherence:()=>ie(),formatting:()=>ne(),latency:()=>v(),api_error:()=>B(),other:()=>i()},Q=e=>_e[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:re()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:c()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:V()})}function ve({data:e,closeReason:t}){let n=e.snapshot,r=g(a.feedback.respondToFeedback),[i,o]=(0,X.useState)(e.thread),[c,u]=(0,X.useState)(``),[d,f]=(0,X.useState)(!1);async function p(){let t=c.trim();if(!(!t||d)){f(!0);try{await r({feedbackId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{f(!1)}}}let m=[];try{m=n.contextJson?JSON.parse(n.contextJson):[]}catch{m=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${l()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:S()}),(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:w()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:de()}),i.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?s():e.authorRole===`agent`?e.authorLabel??M():x()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:fe()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:j(),value:c,maxLength:2e3,rows:3,onChange:e=>u(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(me,{size:`sm`,onClick:()=>void p(),disabled:!c.trim()||d,children:d?Y():ue()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:k()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||L()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:R()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||L()})]}):null,n.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,m.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K({count:n.contextCount??m.length,truncated:n.contextTruncated?I():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:m.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:P()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?N({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[se(),` `,n.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,G()]})]}):null,n.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function ye(){let e=q(a.feedback.listForAdmin,{}),t=g(a.feedback.readSnapshot),n=g(a.feedback.deleteFeedback),i=he(),[s,c]=(0,X.useState)(null),[l,d]=(0,X.useState)({});async function h(e){if(s===e._id){c(null);return}if(!l[e._id]){let n=await t({feedbackId:e._id});d(t=>({...t,[e._id]:n}))}c(e._id)}async function v(e){await i({title:te(),description:m(),confirmLabel:u(),destructive:!0})&&(await n({feedbackId:e._id}),s===e._id&&c(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[A(),` `,(0,Z.jsx)(`strong`,{children:z()}),` `,oe()]}),(0,Z.jsx)(ge,{title:U(),rows:e,emptyHint:ce(),isExpanded:e=>s===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Z.jsx)(ve,{data:l[e._id],closeReason:e.userCloseReason}):null,columns:[{header:F(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:r(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:y(),cell:e=>e.messageRole===`user`?O():E(),sort:e=>e.messageRole},{header:D(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${ee({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:_(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:f(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:T()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:C()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:W()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:p()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:s===e._id?o():pe(),onSelect:()=>void h(e)},{label:b(),onSelect:()=>void v(e),variant:`destructive`}]})]})}export{ye as FeedbacksTab};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{PO as t,qO as n}from"./dist-BOukL7gG.js";import{c as r,l as i,s as a,u as o}from"./index-HZd91gw7.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:`[LIVRAISON]
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{VO as t,ek as n}from"./dist-DDPZzNhc.js";import{c as r,l as i,s as a,u as o}from"./index-Ca5_rTHj.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:`[LIVRAISON]
2
2
  Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
3
3
  {references}`,disabledTemplate:`{references}`},inbound_files:{key:`inbound_files`,appliedIn:`bridge`,togglable:!0,placeholders:[`files`],defaultTemplate:`[FICHIERS REÇUS]
4
4
  {files}`},history_summary:{key:`history_summary`,appliedIn:`convex`,togglable:!0,placeholders:[`previous_summary`,`new_messages`,`max_chars`],defaultTemplate:`[SYNTHÈSE DE CONVERSATION]
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AD as r,BD as ee,BO as i,CD as a,DD as o,ED as s,FD as c,GD as te,HD as l,ID as ne,KO as re,LD as u,MD as d,ND as f,OD as p,PD as m,RD as ie,SD as ae,TD as oe,UD as se,VD as h,WD as ce,_D as le,bD as ue,d as de,dD as fe,f as g,fD as pe,gD as me,hD as he,hO as ge,iC as _e,jD as _,kD as v,mD as ve,pD as ye,pO as be,qO as y,uD as b,vD as x,wD as S,xD as C,yD as w,zD as T}from"./dist-DDPZzNhc.js";import{t as E}from"./button-BK4ZG4Jz.js";import{A as D,B as O,C as k,Et as A,F as j,G as M,I as N,K as P,L as xe,N as Se,P as Ce,R as we,S as F,Tt as Te,W as Ee,X as I,Y as De,_ as Oe,b as L,ht as ke,x as R,y as z,yt as Ae,z as je}from"./index-Ca5_rTHj.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-WXK9Ux9R.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return m();case`audio`:return f();case`video`:return d();case`pdf`:return _();case`document`:return r();case`archive`:return v();default:return p()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[d,f]=(0,U.useState)(G),[p,m]=(0,U.useState)(G),[_,v]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=re(i.files.softDelete),Y=D();function Ie(){t(G),r(G),f(G),m(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(le())}catch(e){Y.error(me(),e)}}let X=y(i.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:d===G?void 0:d,category:p===G?void 0:p,includeAutoGenerated:_||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(ge(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:be()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||d!==G||p!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(z,{value:e,onValueChange:t,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":ce(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:se()}),(0,W.jsx)(R,{value:`inbound`,children:l()}),(0,W.jsx)(R,{value:`outbound`,children:h()})]})]}),(0,W.jsxs)(z,{value:n,onValueChange:r,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":ee(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:T()}),Q.chats.map(e=>(0,W.jsx)(R,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(z,{value:d,onValueChange:f,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":ie(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:u()}),Q.instances.map(e=>(0,W.jsx)(R,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(z,{value:p,onValueChange:m,children:[(0,W.jsx)(F,{size:`sm`,"aria-label":ne(),children:(0,W.jsx)(k,{})}),(0,W.jsxs)(L,{children:[(0,W.jsx)(R,{value:G,children:c()}),Q.categories.map(e=>(0,W.jsx)(R,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(Oe,{checked:_,onCheckedChange:e=>v(e===!0),"aria-label":g()}),(0,W.jsx)(`span`,{children:g()})]}),$?(0,W.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(Ae,{size:14,"aria-hidden":!0}),ue()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?fe():pe()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:o()}),(0,W.jsx)(B,{children:s()}),(0,W.jsx)(B,{children:oe()}),(0,W.jsx)(B,{children:S()}),(0,W.jsx)(B,{children:a()}),(0,W.jsx)(B,{className:`text-right`,children:ae()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(I,{variant:`outline`,style:{marginLeft:6},children:de()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(I,{variant:`secondary`,children:e.direction===`inbound`?l():h()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Ee,{children:[(0,W.jsx)(De,{asChild:!0,children:(0,W.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":w(),children:(0,W.jsx)(Te,{size:16})})}),(0,W.jsxs)(M,{align:`end`,children:[e.url?(0,W.jsx)(P,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(A,{size:14}),C()]})}):(0,W.jsxs)(P,{disabled:!0,children:[(0,W.jsx)(A,{size:14}),ye()]}),(0,W.jsxs)(P,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(ke,{size:14}),x()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:b({cap:Be})}):null]}),(0,W.jsx)(Se,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(N,{children:[(0,W.jsxs)(je,{children:[(0,W.jsx)(O,{children:he()}),(0,W.jsx)(xe,{children:ve()})]}),(0,W.jsxs)(we,{children:[(0,W.jsx)(j,{children:_e()}),(0,W.jsx)(Ce,{onClick:()=>void Le(),children:x()})]})]})})]})}export{q as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Mc as r,Nc as i}from"./dist-BOukL7gG.js";import{t as a}from"./button-CcNQBW08.js";import{Z as o,vt as s,yt as c}from"./index-HZd91gw7.js";import{t as l}from"./TimeRangePicker-CjeAiSdk.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(o,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(c,{}),r()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bc as r,zc as i}from"./dist-DDPZzNhc.js";import{t as a}from"./button-BK4ZG4Jz.js";import{Z as o,vt as s,yt as c}from"./index-Ca5_rTHj.js";import{t as l}from"./TimeRangePicker-DIRVKRqd.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(o,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(c,{}),i()]})]})}export{p as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,$o as i,Ao as a,BO as o,Bo as s,Co as c,Do as l,Eo as u,Fo as d,Ga as f,Go as p,Ho as m,Io as h,Ja as g,Jo as _,KO as v,Ka as y,Ko as b,Lo as x,Mo as S,No as C,Oo as w,Po as ee,Qa as T,Qo as te,Ro as ne,So as E,To as D,Uo as O,VO as k,Vo as A,Wo as j,Xa as M,Xo as re,Ya as N,Yo as P,Za as F,Zo as I,_o as L,ao as R,bo as z,co as B,do as V,eo as ie,es as ae,fo as oe,go as H,ho as se,io as ce,jo as le,ko as ue,lo as de,mo as fe,no as pe,oo as me,po as he,qO as U,qa as ge,qo as _e,ro as ve,so as ye,to as be,uo as xe,vo as Se,wo as Ce,xo as we,yo as Te,zo as Ee}from"./dist-DDPZzNhc.js";import{t as De}from"./x-Bw9Ep8PY.js";import{i as W,n as G,r as Oe,t as ke}from"./tabs-BWd0h4Tg.js";import{t as K}from"./button-BK4ZG4Jz.js";import{$ as Ae,A as q,At as je,C as Me,Q as Ne,S as Pe,X as J,Z as Y,_ as X,_t as Z,b as Fe,et as Ie,gt as Le,j as Re,m as ze,nt as Be,ot as Ve,rt as He,x as Ue,y as We}from"./index-Ca5_rTHj.js";import{t as Ge}from"./FilterBar-2yRvM8KI.js";import{t as Ke}from"./DataTableShell-5lSbOyB_.js";import{t as qe}from"./DetailChips-DxHzS0pZ.js";var Je=k(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ye=k(`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`}]]),Xe=k(`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=k(`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 we();case`user`:return z();case`pending`:return Te();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=U(o.groups.listGroups,{}),t=U(o.me.getMe,{host:Ve})?.role===`admin`,n=v(o.groups.createGroup),r=v(o.groups.updateGroup),a=v(o.groups.deleteGroup),c=Re(),l=q(),[u,f]=(0,Q.useState)(!1),[y,S]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(it),[E,D]=(0,Q.useState)(null),[k,M]=(0,Q.useState)(``),N=(0,Q.useMemo)(()=>{if(!e)return e;let t=k.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,k]);function F(){S(null),T(it),f(!0)}function L(e){S(e),T({name:e.name,description:e.description??``}),f(!0)}async function R(){try{y?await r({groupId:y._id,name:w.name,description:w.description}):await n({name:w.name,description:w.description||void 0}),T(it),S(null),f(!1)}catch(e){l.error(g(),e)}}async function z(e){if(await c({title:d({name:e.name}),description:ee(),confirmWord:e.name,confirmLabel:C(),cancelLabel:A(),destructive:!0}))try{await a({groupId:e._id})}catch(e){l.error(ge(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),(0,$.jsx)(Ge,{q:k,onQChange:M,onReset:()=>M(``),canReset:k!==``,searchPlaceholder:b()}),(0,$.jsx)(Ke,{title:ae(),rows:N,addLabel:te(),onAdd:t?F:void 0,emptyHint:I(),columns:[{header:re(),cell:e=>e.name,sort:e=>e.name},{header:P(),cell:e=>(0,$.jsx)(qe,{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)(Xe,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:_(),cell:e=>(0,$.jsx)(qe,{icon:(0,$.jsx)(Z,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:_e(),cell:e=>(0,$.jsx)(qe,{icon:(0,$.jsx)(Ye,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(Le,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:p(),onSelect:()=>D({groupId:e._id,name:e.name})},...t?[{label:j(),onSelect:()=>L(e)},{label:O(),variant:`destructive`,onSelect:()=>void z(e)}]:[]]}),(0,$.jsx)(ze,{open:u,onOpenChange:f,title:y?Ee():s(),description:ne(),canSubmit:!!w.name.trim(),onSubmit:R,submitLabel:m(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,$.jsx)(Y,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:h()}),(0,$.jsx)(Y,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:E?.groupId??null,groupName:E?.name??``,open:E!==null,onOpenChange:e=>{e||D(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(K,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Je,{size:14,"aria-hidden":!0}),Ce()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":E({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(K,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[c(),(0,$.jsx)(je,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let s=U(o.groups.getGroup,n&&e?{groupId:e}:`skip`),c=U(o.groups.listAssignableInstances,n?{}:`skip`),d=U(o.groups.listAssignableUsers,n?{}:`skip`),f=v(o.groups.addMember),p=v(o.groups.removeMember),m=v(o.groups.bulkSetMembers),h=v(o.groups.setGroupManager),g=q(),[_,b]=(0,Q.useState)(``),[x,C]=(0,Q.useState)(``),[ee,te]=(0,Q.useState)(`members`),[ne,E]=(0,Q.useState)(1),[O,k]=(0,Q.useState)(new Set),A=(0,Q.useRef)(null),j=(0,Q.useMemo)(()=>new Set((s?.members??[]).map(e=>e.userId)),[s]),re=(0,Q.useMemo)(()=>new Set((s?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[s]),N=s?.viewerIsAdmin===!0,P=(0,Q.useMemo)(()=>new Set((s?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[s]);(0,Q.useEffect)(()=>{b(``),C(``),te(`members`),E(1),A.current=null},[n,e]),(0,Q.useEffect)(()=>{E(1)},[_]),(0,Q.useEffect)(()=>{n&&s&&e&&A.current!==e&&(A.current=e,k(new Set((s.members??[]).map(e=>e.userId))))},[n,s,e]);let I=(0,Q.useMemo)(()=>d?Qe(d,_,O):[],[d,_,O]);async function L(t,n){if(e)try{n?await p({groupId:e,userId:t}):await f({groupId:e,userId:t})}catch(e){g.error(y(),e)}}async function R(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){g.error(M(),e)}}let z=nt(I,e=>j.has(e.userId)),B=I.filter(e=>j.has(e.userId)).length,V=rt(I,ne,ot);async function ie(){if(!e||I.length===0)return;let t=I.map(e=>e.userId);try{await m({groupId:e,userIds:t,member:z!==`all`})}catch(e){g.error(y(),e)}}return(0,$.jsx)(Ne,{open:n,onOpenChange:i,children:(0,$.jsxs)(Ae,{className:`oc-access`,children:[(0,$.jsxs)(Be,{children:[(0,$.jsx)(He,{children:S({name:t})}),(0,$.jsx)(Ie,{children:le()})]}),(0,$.jsxs)(ke,{value:ee,onValueChange:te,className:`oc-access__tabs`,children:[(0,$.jsxs)(Oe,{className:`w-full`,children:[(0,$.jsxs)(W,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),a(),s?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,$.jsxs)(W,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Z,{size:13,"aria-hidden":!0}),w(),s?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:P.size}):null]}),(0,$.jsxs)(W,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ye,{size:13,"aria-hidden":!0}),ye(),s?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:s.chartCount}):null]})]}),(0,$.jsx)(G,{value:`members`,children:d===void 0||s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:H()}):d.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{value:_,onChange:e=>b(e.target.value),placeholder:ue(),className:`oc-access__search`}),I.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:u()}):(0,$.jsxs)($.Fragment,{children:[I.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(X,{checked:z===`all`?!0:z===`some`?`indeterminate`:!1,onCheckedChange:()=>void ie(),"aria-label":D()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:D()}),(0,$.jsxs)(J,{variant:`outline`,className:`oc-access__count`,children:[B,` / `,I.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:V.pageItems.map(e=>{let t=j.has(e.userId),n=et(e),i=re.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(X,{checked:t,onCheckedChange:()=>void L(e.userId,t),"aria-label":Se({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)(J,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&N?(0,$.jsx)(K,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${i?` oc-access__mgr--on`:``}`,"aria-pressed":i,"aria-label":i?F():T(),title:i?F():T(),onClick:()=>void R(e.userId,i),children:(0,$.jsx)(Xe,{size:15,"aria-hidden":!0})}):t&&i?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":r(),title:r(),children:(0,$.jsx)(Xe,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:V.page,pageCount:V.pageCount,onPage:E})]})]})}),(0,$.jsx)(G,{value:`agents`,children:c===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:H()}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:he()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Y,{value:x,onChange:e=>C(e.target.value),placeholder:l(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:P,query:x},`${e}-${t._id}`))})]})}),(0,$.jsx)(G,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=U(o.groups.listAssignableAgents,{instanceName:t}),s=v(o.groups.assignAgentToGroup),c=v(o.groups.removeAgentFromGroup),l=v(o.groups.bulkSetGroupAgents),u=q(),[d,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}`)),y=rt(m,d,ot);async function b(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(f(),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(f(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(Z,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(J,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__stale`,children:xe()}):null]}),a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:se()}):m.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:h?V():oe()}):(0,$.jsxs)($.Fragment,{children:[g.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(X,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":D()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:D()})]}):null,y.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)(X,{checked:i,disabled:a&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":L({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":B(),title:B(),children:(0,$.jsx)(Le,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:de()}):null]},e.agentId)}),(0,$.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=U(o.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=v(o.charts.assignChartToGroup),r=v(o.charts.removeChartFromGroup),i=v(o.charts.setGroupDefaultChart),a=v(o.charts.addChartToGroupPool),s=v(o.charts.removeChartFromGroupPool),c=q();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:H()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:me()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(N(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){c.error(N(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(N(),e)}}async function h(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(N(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(X,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":pe({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":be(),title:be(),children:(0,$.jsx)(Le,{size:14,fill:`currentColor`})}):(0,$.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:ie()}):null,d?(0,$.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":ve({name:e.name}),title:ve({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,$.jsx)(De,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,$.jsxs)(We,{value:``,onValueChange:e=>void m(e),children:[(0,$.jsx)(Pe,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Me,{placeholder:ce()})}),(0,$.jsx)(Fe,{children:u.map(e=>(0,$.jsx)(Ue,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:R()}):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{$_ as r,$g as i,A_ as a,Ag as o,BO as s,B_ as c,Bg as l,C_ as u,Cg as d,D_ as f,Dg as p,E_ as m,Eg as h,F_ as g,Fg as _,G_ as v,Gg as y,H_ as b,Hg as x,I_ as S,Ig as C,JC as w,J_ as T,Jg as E,KO as D,K_ as O,Kg as ee,L_ as te,Lg as ne,M_ as re,Mg as ie,N_ as ae,Ng as oe,O_ as se,Og as ce,P_ as le,Pg as ue,Q_ as de,Qg as fe,R_ as pe,Rg as me,S_ as he,Sg as k,T_ as ge,Tg as _e,U_ as ve,Ug as ye,V_ as be,Vg as xe,WO as A,W_ as Se,Wg as Ce,X_ as we,Xg as Te,Y_ as Ee,Yg as De,Z_ as Oe,Zg as ke,__ as j,_f as Ae,a_ as je,at as Me,av as Ne,b_ as Pe,c_ as Fe,d_ as Ie,e_ as Le,ev as Re,f_ as ze,g_ as Be,gf as Ve,h_ as He,i_ as Ue,it as We,iv as Ge,j_ as Ke,jg as qe,k_ as Je,kg as Ye,l_ as Xe,m_ as Ze,n_ as Qe,nv as $e,o_ as et,ov as tt,p_ as M,qC as N,qO as P,q_ as nt,qg as rt,r_ as it,rv as at,s_ as ot,sv as st,t_ as ct,tv as lt,u_ as ut,v_ as dt,w_ as ft,wg as pt,x_ as mt,xg as ht,y_ as gt,z_ as _t,zg as vt}from"./dist-DDPZzNhc.js";import{a as yt,c as bt}from"./FieldLabel-C4ocliYM.js";import{t as F}from"./button-BK4ZG4Jz.js";import{$ as xt,A as I,C as L,H as St,Q as R,S as z,U as Ct,V as wt,X as B,Z as V,_ as H,b as U,et as W,j as Tt,m as Et,nt as G,rt as K,x as q,y as J}from"./index-Ca5_rTHj.js";import{t as Dt}from"./DataTableShell-5lSbOyB_.js";import{InstanceConfigDialog as Ot}from"./BridgeTab-Cq5iNQOa.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`],kt=new Set(X),At=`conversational`;function jt(e){let t=new Set((e??[]).filter(e=>kt.has(e)));return t.size===0?[At]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:yt},Mt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Pt(){let e=P(s.admin.listInstances,{}),t=P(s.agents.listAllInstanceAgents,{}),n=D(s.admin.upsertInstance),i=D(s.admin.deleteInstance),o=I(),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(Q),[p,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(null),[y,x]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(null);async function E(){try{await n({instanceId:C??void 0,name:d.name,gatewayUrl:d.gatewayUrl,bridgeUrl:d.bridgeUrl||void 0,displayName:d.displayName||void 0,kind:d.kind,gatewayVersion:d.gatewayVersion||void 0,gatewayHttpUrl:d.gatewayHttpUrl||void 0,streamTransport:d.streamTransport}),f(Q),w(null),u(!1)}catch(e){o.error(Ne(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ge(),(0,Z.jsx)(`strong`,{children:at()}),$e()]}),(0,Z.jsx)(Dt,{title:lt(),rows:e,addLabel:Re(),onAdd:()=>{w(null),f(Q),u(!0)},emptyHint:r(),columns:[{header:de(),cell:e=>e.name,sort:e=>e.name},{header:Oe(),cell:e=>(0,Z.jsx)(B,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:we(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Ee(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:st(),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)(B,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?k():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:v(),onSelect:()=>{w(e._id),f(Nt(e)),u(!0)}},{label:tt(),onSelect:()=>m(e.name)},{label:a(),onSelect:()=>x(e)},{label:T(),onSelect:()=>_(e)},{label:nt(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:nt(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(Et,{open:l,onOpenChange:u,title:C?Se():O(),description:b(),canSubmit:!!(d.name&&d.gatewayUrl),onSubmit:E,submitLabel:be(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:c(),children:[(0,Z.jsx)(V,{value:d.name,disabled:C!==null,onChange:e=>f({...d,name:e.target.value})}),C?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ve()}):null]}),(0,Z.jsx)($,{label:_t(),children:(0,Z.jsxs)(J,{value:d.kind,onValueChange:e=>f({...d,kind:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(L,{})}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(q,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(q,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:pe(),children:(0,Z.jsx)(V,{value:d.gatewayUrl,onChange:e=>f({...d,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:te(),children:(0,Z.jsx)(V,{value:d.bridgeUrl,placeholder:S(),onChange:e=>f({...d,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:g(),children:(0,Z.jsx)(V,{value:d.displayName,onChange:e=>f({...d,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:Ae(),children:[(0,Z.jsxs)(J,{value:d.streamTransport,onValueChange:e=>f({...d,streamTransport:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(L,{})}),(0,Z.jsx)(U,{children:bt.map(e=>(0,Z.jsx)(q,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ve()})]}),(0,Z.jsx)($,{label:le(),children:(0,Z.jsx)(V,{value:d.gatewayVersion,placeholder:ae(),onChange:e=>f({...d,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:re(),children:(0,Z.jsx)(V,{value:d.gatewayHttpUrl,placeholder:Ke(),onChange:e=>f({...d,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wt,{instanceName:p,open:p!==null,onOpenChange:e=>{e||m(null)}}),h?(0,Z.jsx)(Ot,{instance:h,onClose:()=>_(null)},h._id):null,y?(0,Z.jsx)(Ft,{instance:y,onClose:()=>x(null)},y._id):null]})}function Ft({instance:e,onClose:t}){let n=P(s.instanceSecrets.listInstanceSecretStatus,{}),r=Mt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(R,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(xt,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{children:Je({instance:e.displayName??e.name})}),(0,Z.jsx)(W,{children:se()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Rt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Lt,{instance:e})}),(0,Z.jsx)(It,{instance:e})]})})}function It({instance:e}){let t=A(s.instanceSync.forceInstanceSync),n=I(),[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(Fe());break;case`no_agents`:n.success(et());break;case`no_bridge_url`:n.error(je());break;case`deploy_misconfigured`:n.error(Ue());break;case`unauthorized`:n.error(Qe());break;case`not_served`:n.error(ct());break;default:n.error(it());break}}catch(e){n.error(ot(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Le()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?Xe():ut()})})]})}function Lt({instance:e}){let t=P(s.bridgeAuth.listBridgeAuthStatus,{}),n=A(s.bridgeAuth.mintBridgeSecret),r=D(s.bridgeAuth.revokeBridgeSecret),a=I(),[o,c]=(0,Y.useState)(!1),[l,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(!1),m=(t??[]).find(t=>t.instanceId===e._id),h=m!==void 0;async function g(){if(!o){c(!0);try{d((await n({instanceId:e._id})).plaintext),p(!1)}catch(e){a.error(rt(),e)}finally{c(!1)}}}async function _(){if(!o){c(!0);try{await r({instanceId:e._id}),d(null),a.success(E())}catch(e){a.error(rt(),e)}finally{c(!1)}}}async function v(){if(l)try{await navigator.clipboard.writeText(l),p(!0)}catch{}}return(0,Z.jsxs)($,{label:i(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(B,{variant:h?`outline`:`secondary`,children:h?`${ft()} · ${m.prefix}…${m.lastFour}`:u()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void g(),disabled:o,children:h?Te():ke()}),h?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void _(),disabled:o,children:De()}):null]})]}),l?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ee()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:l}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:f?w():N()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{d(null),p(!1)},children:y()})]}):null]})}function Rt({instanceId:e,field:t,updatedAt:n}){let r=A(s.instanceSecrets.setInstanceSecret),i=D(s.instanceSecrets.clearInstanceSecret),a=A(s.deviceIdentity.generateDeviceIdentity),o=I(),[c,l]=(0,Y.useState)(``),[d,p]=(0,Y.useState)(!1),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(!1),b=n!==null,x=t===`deviceIdentity`,S=t===`token`?f():t===`deviceIdentity`?m():ge();async function C(){if(!(!c.trim()||d)){p(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),g(null),v(!1),o.success(dt())}catch(e){o.error(j(),e)}finally{p(!1)}}}async function T(){if(!d){p(!0);try{await i({instanceId:e,field:t}),g(null),v(!1),o.success(Be())}catch(e){o.error(j(),e)}finally{p(!1)}}}async function E(){if(!d){p(!0);try{g(await a({instanceId:e})),v(!1),o.success(M())}catch(e){o.error(Ie(),e)}finally{p(!1)}}}let O=h?`openclaw devices approve ${h.id}`:``;async function ee(){if(O)try{await navigator.clipboard.writeText(O),v(!0)}catch{}}return(0,Z.jsxs)($,{label:S,children:[x?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(B,{variant:b?`outline`:`secondary`,children:b?ft():u()}),(0,Z.jsx)(V,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:b?mt():he(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void C(),disabled:d||c.trim().length===0,children:Pe()}),x?(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void E(),disabled:d,children:He()}):null,b?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void T(),disabled:d,children:gt()}):null]})]}),h?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:M()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:O}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void ee(),children:_?w():N()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{g(null),v(!1)},children:y()})]}):null]})}var zt={conversational:ne,documentary:_,summarizer:Me},Bt={conversational:C,documentary:ue,summarizer:We},Vt=e=>(zt[e]??(()=>e))(),Ht=e=>(Bt[e]??(()=>``))();function Ut({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:xe()}),t.map(e=>(0,Z.jsx)(B,{variant:`secondary`,className:`oc-agenttype__chip`,title:Ht(e),children:Vt(e)},e)),(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Ct,{asChild:!0,children:(0,Z.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:l()})}),(0,Z.jsxs)(St,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:vt()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:me()}),(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)(H,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Vt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Ht(r)})]})]},r)})})]})]})]})}function Wt({instanceName:e,open:t,onOpenChange:n}){let r=P(s.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=D(s.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(s.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(s.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=D(s.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(s.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(s.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),c=D(s.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(s.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jt(r);e.setQuery(s.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),l=D(s.agents.removeInstanceAgent),u=Tt(),f=I();async function m(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){f.error(x(),e)}}async function g(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){f.error(x(),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(x(),e)}}async function v(t,n){if(e&&await u({title:qe({name:n}),description:o(),confirmLabel:Ye(),destructive:!0}))try{await l({instanceName:e,agentId:t}),f.success(ce())}catch(e){f.error(x(),e)}}return(0,Z.jsx)(R,{open:t,onOpenChange:n,children:(0,Z.jsxs)(xt,{className:`oc-access`,children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{children:Ce({name:e??``})}),(0,Z.jsx)(W,{children:ye()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:p()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?h():r.discovery.lastPollOk?_e():pt({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:d()}):(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)(H,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void m(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)(B,{variant:`outline`,className:`oc-access__gone`,children:ht()}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(e.agentId,i),children:ie()})]}):n?(0,Z.jsx)(B,{variant:`default`,children:k()}):(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void g(e.agentId),children:oe()})]}),e.enabled?(0,Z.jsx)(Ut,{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{Pt as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,BO as i,By as a,Cb as o,Cn as s,Db as c,Eb as l,En as u,Gy as d,Hy as ee,Jy as te,KO as f,Ky as p,Ly as ne,Ob as re,Qy as m,Ry as h,Sb as g,Sn as _,Tb as v,Tn as y,Uy as ie,Vy as ae,WO as b,Wy as oe,Xy as se,Yy as ce,Zy as le,_b as ue,ab as x,bb as S,bn as C,cb as w,db as T,eb as E,fb as D,gb as O,hb as k,ib as A,kb as j,lb as M,mb as N,nb as P,ob as F,pb as I,qO as L,qy as R,rb as z,sb as B,tb as V,ub as H,vb as U,vn as de,wb as W,wn as fe,xb as pe,xn as me,yb as he,yn as ge,zy as _e}from"./dist-DDPZzNhc.js";import{t as G}from"./button-BK4ZG4Jz.js";import{C as ve,S as ye,X as K,Z as q,_ as be,b as xe,x as Se,y as Ce}from"./index-Ca5_rTHj.js";import{t as we}from"./DataTableShell-5lSbOyB_.js";var J=t(e(),1),Y=n();function Te(){let e=L(i.integrations.status.status,{}),t=f(i.admin.setIntegrationConfig),[n,s]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&s(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:j()});let _=n,b=(e,t,n)=>s({..._,[e]:{..._[e],[t]:n}}),C=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[re(),` `,(0,Y.jsx)(`strong`,{children:c()}),` `,l()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:v()}):(0,Y.jsx)(K,{variant:`outline`,children:W()}):(0,Y.jsx)(K,{variant:`outline`,children:o()}),note:pe(),children:[(0,Y.jsx)(Z,{label:he(),children:(0,Y.jsx)(q,{value:_.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>b(`langfuse`,`host`,e.target.value),onBlur:()=>C(`langfuse`,{host:_.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:k(),checked:_.langfuse.enabled??!0,onChange:e=>{b(`langfuse`,`enabled`,e),C(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:v()}):(0,Y.jsx)(K,{variant:`outline`,children:W()}):(0,Y.jsx)(K,{variant:`outline`,children:o()}),note:S(),children:[(0,Y.jsx)(Z,{label:U(),children:(0,Y.jsx)(q,{value:_.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>b(`opik`,`baseUrl`,e.target.value),onBlur:()=>C(`opik`,{baseUrl:_.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:ue(),children:(0,Y.jsx)(q,{value:_.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||O(),onChange:e=>b(`opik`,`workspace`,e.target.value),onBlur:()=>C(`opik`,{workspace:_.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:k(),checked:_.opik.enabled??!0,onChange:e=>{b(`opik`,`enabled`,e),C(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:v()}):(0,Y.jsx)(K,{variant:`outline`,children:W()}):(0,Y.jsx)(K,{variant:`outline`,children:u()}),note:y(),children:[(0,Y.jsx)(Z,{label:fe(),children:(0,Y.jsx)(q,{value:_.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>b(`otlp`,`endpoint`,e.target.value),onBlur:()=>C(`otlp`,{endpoint:_.otlp.endpoint??``})})}),(0,Y.jsx)(Ee,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:k(),checked:_.otlp.enabled??!0,onChange:e=>{b(`otlp`,`enabled`,e),C(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:N(),status:(0,Y.jsx)(K,{variant:`outline`,children:g()}),note:I(),children:[(0,Y.jsx)(Z,{label:D(),children:(0,Y.jsx)($,{value:_.tts.auto??`off`,options:[[`off`,T()],[`always`,H()],[`inbound`,M()],[`tagged`,w()]],onChange:e=>{b(`tts`,`auto`,e),C(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:B(),children:(0,Y.jsx)($,{value:_.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,F()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{b(`tts`,`provider`,e),C(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:x(),children:(0,Y.jsx)(q,{value:_.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>b(`tts`,`model`,e.target.value),onBlur:()=>C(`tts`,{model:_.tts.model??``})})}),(0,Y.jsx)(Z,{label:A(),children:(0,Y.jsx)(q,{value:_.tts.voice??``,placeholder:z(),onChange:e=>b(`tts`,`voice`,e.target.value),onBlur:()=>C(`tts`,{voice:_.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:P(),status:(0,Y.jsx)(K,{variant:`outline`,children:g()}),note:e.secrets.openai?V():E(),children:[(0,Y.jsx)(Q,{label:r(),checked:_.talk.enabled??!1,onChange:e=>{b(`talk`,`enabled`,e),C(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:m(),children:(0,Y.jsx)($,{value:_.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{b(`talk`,`realtimeProvider`,e),C(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:le(),children:(0,Y.jsx)(q,{value:_.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>b(`talk`,`realtimeModel`,e.target.value),onBlur:()=>C(`talk`,{realtimeModel:_.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:A(),children:(0,Y.jsx)(q,{value:_.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>b(`talk`,`voice`,e.target.value),onBlur:()=>C(`talk`,{voice:_.talk.voice??``})})}),(0,Y.jsx)(Z,{label:se(),children:(0,Y.jsx)($,{value:_.talk.transport??`webrtc`,options:[[`webrtc`,ce()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{b(`talk`,`transport`,e),C(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:te(),children:(0,Y.jsx)(q,{value:_.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>b(`talk`,`speechLocale`,e.target.value),onBlur:()=>C(`talk`,{speechLocale:_.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:R(),checked:_.talk.interruptOnSpeech??!0,onChange:e=>{b(`talk`,`interruptOnSpeech`,e),C(`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:p()}),(0,Y.jsx)(K,{variant:`outline`,children:d()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[oe(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(we,{title:ie(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:ee(),columns:[{header:ae(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:a(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:_e(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:h(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:ne(),cell:e=>e.lastError??`—`,sort:e=>e.lastError??null}]})]})}function X({title:e,status:t,note:n,children:r}){return(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,Y.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`label`,{className:`oc-int__field`,children:[(0,Y.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function Q({label:e,checked:t,onChange:n}){return(0,Y.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,Y.jsx)(be,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(Ce,{value:e,onValueChange:n,children:[(0,Y.jsx)(ye,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(ve,{})}),(0,Y.jsx)(xe,{children:t.map(([e,t])=>(0,Y.jsx)(Se,{value:e,children:t},e))})]})}function Ee({headersSet:e}){let t=b(i.integrations.otlpSecret.setOtlpHeaders),n=f(i.integrations.otlpSecret.clearOtlpHeaders),[r,a]=(0,J.useState)(``),[o,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),d=async()=>{u(!0),c(null);try{await t({headersJson:r}),a(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,Y.jsxs)(Z,{label:s(),children:[(0,Y.jsx)(q,{value:r,placeholder:e?_():me(),onChange:e=>a(e.target.value)}),(0,Y.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:l||r.trim().length===0,onClick:()=>void d(),children:C()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>void n({}),children:ge()}):null]}),o?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:de()})]})}export{Te as IntegrationsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Au as r,BO as i,Cu as a,Du as o,Eu as s,Mx as c,NO as l,Ou as u,Su as d,Tu as f,Xb as p,Zb as m,ax as h,bu as g,ix as _,ju as v,ku as y,ox as b,sx as x,vu as S,wu as C,xu as w,yu as T}from"./dist-BOukL7gG.js";import{Mt as E,a as D,jt as ee,n as te,ot as ne,r as re}from"./index-HZd91gw7.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-B9JuMxhP.js";import{n as N,t as P}from"./TimeRangePicker-CjeAiSdk.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=i(l.me.getMe,{host:ne})?.permissions?.includes(`traces.read`)??!1,t=i(l.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:c()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:x()}),(0,I.jsx)(j,{children:h()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(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:[p(),` p50 `,R(s.cP50),` `,b()]}),(0,I.jsxs)(`span`,{children:[m(),` p50 `,R(s.aP50),` `,b()]})]}),(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:v(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:r(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:y(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:u(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:o(),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=E({from:`/settings/kpi`}),t=ee({from:`/settings/kpi`}),n=re(e.from,e.to,te,`now`),r=e=>void t({search:t=>({...t,...D(e)})}),{from:o,to:s}=N(n),{rowLimit:c,buckets:u}=K(o,s),p=i(l.kpi.listKpis,{limit:c,filter:{from:o,to:s}}),m=(0,F.useMemo)(()=>{let e=new Map;for(let t of p??[]){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},[p,u]),h=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:C()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return p===void 0?(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]}):p.length===0?(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:d()})]}):(0,I.jsxs)(I.Fragment,{children:[h,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(m.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:m.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:w({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:g()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:T({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":S({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Au as r,BO as i,Du as a,Eu as o,Fu as s,Iu as c,Lu as l,Mu as u,Nu as d,Ou as f,Pu as p,Ru as m,Tu as h,dx as g,fx as _,ix as v,ju as y,ku as b,mx as x,px as S,qO as C,rx as w,zx as T}from"./dist-DDPZzNhc.js";import{Mt as E,a as D,jt as ee,n as te,ot as ne,r as re}from"./index-Ca5_rTHj.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-BVpALAaI.js";import{n as N,t as P}from"./TimeRangePicker-DIRVKRqd.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=C(i.me.getMe,{host:ne})?.permissions?.includes(`traces.read`)??!1,t=C(i.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:T()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:x()}),(0,I.jsx)(j,{children:_()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(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:[w(),` p50 `,R(s.cP50),` `,S()]}),(0,I.jsxs)(`span`,{children:[v(),` p50 `,R(s.aP50),` `,S()]})]}),(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:m(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:l(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:c(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:s(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:p(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:d(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=E({from:`/settings/kpi`}),t=ee({from:`/settings/kpi`}),n=re(e.from,e.to,te,`now`),a=e=>void t({search:t=>({...t,...D(e)})}),{from:o,to:s}=N(n),{rowLimit:c,buckets:l}=K(o,s),d=C(i.kpi.listKpis,{limit:c,filter:{from:o,to:s}}),f=(0,F.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>l&&e.set(t,n.slice(n.length-l));return e},[d,l]),p=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[u(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:y()})]}),(0,I.jsx)(J,{value:n,onChange:a})]});return d===void 0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:r()})]}):d.length===0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:b()})]}):(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(f.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:f.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:f({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:a()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:o({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":h({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,AT as i,BO as a,CT as o,DT as s,ET as c,FT as l,IT as u,JD as ee,KO as d,LT as f,MT as p,NT as m,OT as h,PT as g,QD as te,RT as ne,ST as re,TT as ie,V_ as ae,XD as oe,YD as se,ZD as ce,_T as le,aO as ue,bT as _,cO as de,cT as v,dT as y,eO as b,fT as x,gT as S,hT as C,iO as w,jT as T,kT as E,lT as D,mT as O,nO as k,oT as A,pO as j,pT as M,qD as N,qO as P,rO as F,sT as I,tO as L,uT as R,vT as z,wT as B,xT as V,yT as fe,zT as pe}from"./dist-DDPZzNhc.js";import{t as H}from"./button-BK4ZG4Jz.js";import{A as me,C as he,O as ge,S as _e,Z as U,_ as W,b as ve,ot as G,x as K,y as ye}from"./index-Ca5_rTHj.js";var q=t(e(),1),J=[{id:`messages`,label:()=>pe()},{id:`composer`,label:()=>ne()},{id:`sidebar`,label:()=>f()},{id:`other`,label:()=>u()}],Y={showSource:{category:`messages`,label:()=>l(),help:()=>g()},showReport:{category:`messages`,label:()=>m(),help:()=>p()},copyAssistant:{category:`messages`,label:()=>T()},copyUser:{category:`messages`,label:()=>i()},showDelete:{category:`messages`,label:()=>E()},showTools:{category:`messages`,label:()=>h(),help:()=>s()},voiceInput:{category:`composer`,label:()=>c(),help:()=>ie()},showChatAge:{category:`sidebar`,label:()=>B(),help:()=>o()},showChatProvider:{category:`sidebar`,label:()=>re(),help:()=>V()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function be(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],Se={voiceInput:`voiceInput`};function Ce(e){return xe.includes(e)}function Z(e){return e===`admin`}function we(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Q(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Ce(e)?Se[e]:void 0}var $=n(),Ee={voiceInput:()=>R()};function De({prefKey:e,ui:t}){let n=d(a.admin.setUiPrefDefault),r=d(a.admin.setFeatureEnabled),i=Te(e),o=i?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:O()}),(0,$.jsxs)(ye,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(_e,{size:`sm`,className:`w-36`,children:(0,$.jsx)(he,{})}),(0,$.jsxs)(ve,{children:[(0,$.jsx)(K,{value:`on`,children:v()}),(0,$.jsx)(K,{value:`off`,children:I()}),(0,$.jsx)(K,{value:`inherit`,children:A()})]})]}),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":M()}),M()]}):null]}),o?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=P(a.me.getMe,{host:G}),o=i?.ui,s=Z(i?.role)&&n,c=d(a.me.setUiPref).withOptimisticUpdate(ge),l=(0,q.useMemo)(()=>o?be(Object.keys(o.effective),e):[],[o,e]);return o?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":C()}),C()]}):null,s?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:x()}),(0,$.jsx)(`p`,{children:y()}),(0,$.jsx)(`p`,{children:D()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:_(),"aria-label":_(),className:`mb-2`}),l.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:fe()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],l=o.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${l&&!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:z()}):l?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:le()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:S()}):null,(0,$.jsx)(W,{checked:a,disabled:i,onCheckedChange:t=>void c({key:e,value:t===!0}),"aria-label":n})]}),s?(0,$.jsx)(De,{prefKey:e,ui:o}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:j()})}function ke(){let e=P(a.me.getMe,{host:G}),t=d(a.me.setLocale),n=d(a.me.setMyName),i=me(),o=e?.locale??`default`,s=e?.name??``,[c,l]=(0,q.useState)(null),u=c??s,f=u.trim()!==s.trim();async function p(){try{await n({name:u}),l(null),i.success(L())}catch(e){i.error(b(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:ue()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:w()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{className:`max-w-xs`,value:u,maxLength:120,placeholder:F(),onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),p())}}),(0,$.jsx)(H,{size:`sm`,disabled:!f,onClick:()=>void p(),children:ae()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:k()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:r()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:o===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?ee():e===`en`?N():de()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ce()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:oe()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:se()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
@@ -0,0 +1,3 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,BO as i,Jd as a,KO as o,Qd as s,Xd as c,Yd as l,Zd as u,af as d,bf as f,cf as p,ct as m,df as h,ef as ee,ff as g,if as _,lf as v,lt as y,nf as b,of as x,ot as S,pf as C,qO as w,rf as T,sf as E,st as D,tf as O,uf as k,ut as A,xf as j}from"./dist-DDPZzNhc.js";import{d as M,f as N,i as P,l as F,n as I,r as L,t as R,u as z}from"./FieldLabel-C4ocliYM.js";import{t as B}from"./button-BK4ZG4Jz.js";import{A as V,C as H,S as U,_ as W,b as G,x as K,y as q}from"./index-Ca5_rTHj.js";/* empty css */var J=t(e(),1),Y=n(),X={media_delivery:{label:p,help:E},documentary_fetch:{label:x,help:d},inbound_files:{label:_,help:T},history_summary:{label:A,help:y}},Z={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
+ - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
+ Assistant : Comparaison en cours.`,max_chars:`6000`},Q={outboundDir:c,references:l,files:a,previous_summary:m,new_messages:D,max_chars:S};function $(){let e=w(i.admin.listInstances,{}),[t,n]=(0,J.useState)(null);if(e===void 0)return(0,Y.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,Y.jsx)(`div`,{className:`oc-injtab`,children:(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:O()})});let r=e.find(e=>e._id===t)??e[0];return(0,Y.jsxs)(`div`,{className:`oc-injtab`,children:[(0,Y.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,Y.jsx)(I,{label:C(),help:g()}),(0,Y.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Y.jsx)(`span`,{children:b()}),(0,Y.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,Y.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(G,{children:e.map(e=>(0,Y.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,Y.jsx)(te,{instance:r},r._id)]})}function te({instance:e}){let t=o(i.admin.upsertInstanceConfig),n=V(),r=e.config??{},[a,s]=(0,J.useState)(()=>P(r)),[c,l]=(0,J.useState)(!1),u=a.promptInjections,d=(e,t)=>s({...a,promptInjections:{...u,[e]:{...u[e],...t}}});async function p(){l(!0);try{await t({instanceId:e._id,config:L(a,r)})}catch(e){n.error(f(),e)}finally{l(!1)}}return(0,Y.jsxs)(`div`,{className:`oc-injtab__body`,children:[z.map(e=>(0,Y.jsx)(ne,{injKey:e,def:F[e],i18n:X[e],row:u[e]??{enabled:!0,template:F[e].defaultTemplate},onChange:t=>d(e,t)},e)),(0,Y.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,Y.jsx)(B,{size:`sm`,onClick:()=>void p(),disabled:c,children:j()})})]})}function ne({injKey:e,def:t,i18n:n,row:i,onChange:a}){let[o,c]=(0,J.useState)(!1),l=i.template.trim()!==t.defaultTemplate,d=t.togglable&&!i.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,Z[e]??`{${e}}`])),p=M(e,i),m=p?N(p,f):``;return(0,Y.jsxs)(`section`,{className:`oc-injcard`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,Y.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Y.jsx)(W,{checked:i.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,Y.jsx)(I,{label:n.label(),help:n.help()})]}):(0,Y.jsx)(I,{label:n.label(),help:n.help()}),l&&(0,Y.jsx)(`span`,{className:`oc-injection__badge`,children:k()})]}),(0,Y.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:d,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,Y.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:v()}),t.placeholders.map(e=>(0,Y.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Y.jsx)(`code`,{children:`{${e}}`}),(0,Y.jsx)(R,{text:(Q[e]??(()=>e))()})]},e))]}),(0,Y.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:o?r():ee()}),l&&(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate}),children:h()})]})]}),o&&(0,Y.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:s()})]}):(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:u()})})]})}export{$ as PromptInjectionsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Ah as i,BO as a,Bh as ee,Ch as te,Fh as o,Gh as s,Hh as c,Ih as l,Jh as u,KO as d,Kh as f,Lh as ne,Mh as p,Nh as m,Ph as h,Qh as g,Rh as _,Sh as v,Uh as y,Vh as b,Wh as re,Xh as x,Yh as S,Zh as C,_h as ie,a as w,ag as T,bh as E,eg as D,gh as O,ig as k,jh as A,ng as j,qO as M,qh as N,rg as P,tg as F,vh as I,wh as L,xh as R,yh as ae,zh as z}from"./dist-DDPZzNhc.js";import{t as B}from"./button-BK4ZG4Jz.js";import{A as V,X as H,Z as U,_ as W,j as G,m as K,xt as q}from"./index-Ca5_rTHj.js";import{t as J}from"./roleDescriptions-UrTqz_co.js";var Y=t(e(),1),X=n(),Z=[{group:()=>T(),keys:[{key:`traces.read`,label:()=>D()},{key:`traces.read.content`,label:()=>r(),phi:!0},{key:`traces.write`,label:()=>g()}]},{group:()=>k(),keys:[{key:`kpi.read`,label:()=>D()},{key:`kpi.write`,label:()=>g()}]},{group:()=>P(),keys:[{key:`openclaw.query`,label:()=>C()},{key:`anomalies.read`,label:()=>x()},{key:`anomalies.report`,label:()=>S()}]},{group:()=>j(),keys:[{key:`chats.read`,label:()=>D()},{key:`selfheal`,label:()=>N()},{key:`feedback.respond`,label:()=>w()}]},{group:()=>F(),keys:[{key:`admin.manage`,label:()=>u()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=M(a.apiKeys.listRoles,{}),t=d(a.apiKeys.createRole),n=d(a.apiKeys.ensureRolesSeeded),r=d(a.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(a.apiKeys.listRoles,{});r&&e.setQuery(a.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),u=G(),g=V(),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)($),[T,D]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{g.error(s(),e)})},[n,g]);let k=e??[];async function j(e,t){if(Q(e.permissions)||T.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await u({title:re({name:e.name}),description:y(),confirmLabel:c()}))){D(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){g.error(b(),e)}finally{D(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function N(){try{await t({key:C.key,name:C.name,description:C.description||void 0,permissions:[]}),w($),S(!1)}catch(e){g.error(ee(),e)}}let P=e===void 0,F=!P&&k.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[z(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,_(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,ne()]}),(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:l()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{w($),S(!0)},children:o()})})]}),P?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):F?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:p()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?f({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:k.map(e=>{let t=Q(e.permissions),n=T.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)(H,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(q,{}),` `,A()]}):(0,X.jsx)(H,{variant:`secondary`,children:i()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(W,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?L():n?te():r,onCheckedChange:()=>void j(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(K,{open:x,onOpenChange:S,title:v(),description:R(),canSubmit:!!(C.key&&C.name),onSubmit:N,submitLabel:E(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ae()}),(0,X.jsx)(U,{value:C.key,placeholder:I(),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:ie()}),(0,X.jsx)(U,{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:O()}),(0,X.jsx)(U,{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{$C as r,$w as i,Aw as ee,BC as a,BO as o,Bw as te,Cw as ne,Dw as re,Ew as ie,Fw as ae,GC as s,Gw as oe,HC as c,Hw as se,Iw as ce,JC as l,Jw as le,KC as u,KO as d,Kw as ue,Lw as de,Mw as fe,Nw as pe,Ow as me,Pw as he,QC as f,Qw as ge,Rw as _e,Sw as ve,Tw as ye,UC as p,Uw as be,VC as xe,Vw as Se,WC as Ce,WO as we,Ww as Te,XC as Ee,Xw as De,YC as m,Yw as Oe,ZC as h,Zw as ke,_w as Ae,aT as je,aw as g,bw as Me,cw as _,dw as Ne,eT as v,ew as y,fw as Pe,gw as Fe,hw as Ie,iT as Le,iw as b,jw as Re,kw as ze,lw as Be,mw as Ve,nT as He,nw as x,ow as S,pw as Ue,qC as C,qO as w,qw as We,rT as Ge,rw as T,sw as E,tT as Ke,tw as D,uw as qe,vw as Je,ww as Ye,xw as Xe,yw as Ze,zC as O,zw as Qe}from"./dist-DDPZzNhc.js";import{n as k}from"./dist-73SeNc8s.js";import{i as $e}from"./dist-BuHHfQDg.js";import{t as A}from"./button-BK4ZG4Jz.js";import{$ as j,A as et,At as tt,C as M,Dt as N,Mt as nt,Q as P,S as F,X as I,Z as L,b as R,et as z,j as rt,jt as it,m as at,nt as B,rt as V,tt as H,x as U,y as W}from"./index-Ca5_rTHj.js";import{t as ot}from"./FilterBar-2yRvM8KI.js";import{t as st}from"./DataTableShell-5lSbOyB_.js";import{t as ct}from"./roleDescriptions-UrTqz_co.js";var G=t(e(),1),K=n(),lt=[{value:`never`,label:()=>s(),days:null},{value:`30`,label:()=>Ce(),days:30},{value:`90`,label:()=>p(),days:90}],q=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=nt({from:`/settings/serviceAccounts`}),t=it({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??J,[a,s]=(0,G.useState)(J),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),u=w(o.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===J?void 0:a,disabled:r===J?void 0:r===`disabled`}}),f=w(o.apiKeys.listKeys,{}),p=w(o.apiKeys.listRoles,{}),xe=d(o.apiKeys.createServiceAccount),Ce=d(o.apiKeys.updateServiceAccount),Ee=d(o.apiKeys.deleteServiceAccount),m=we(o.apiKeys.mintApiKey),h=d(o.apiKeys.revokeApiKey),g=rt(),_=et(),y=n!==``||a!==J||r!==J;function b(){s(J),t({search:{},replace:!0})}let[x,S]=(0,G.useState)(!1),[C,T]=(0,G.useState)(Y),[E,D]=(0,G.useState)(null),[O,k]=(0,G.useState)(new Set),[j,N]=(0,G.useState)(null),P=(0,G.useRef)(!1),[z,B]=(0,G.useState)(new Set),[V,H]=(0,G.useState)({}),[q,X]=(0,G.useState)(null),Z=(0,G.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[f]);function Q(e){k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{E?(await Ce({serviceAccountId:E,name:C.name,roleKey:C.roleKey,description:C.description}),_.success(ne())):await xe({name:C.name,roleKey:C.roleKey,description:C.description||void 0}),T(Y),D(null),S(!1)}catch(e){_.error(E?Ye():ye(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),D(e._id),S(!0)}async function $(e){if(P.current)return;P.current=!0;let t=V[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;N(e._id);try{let t=await m({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){_.error(ve(),e)}finally{P.current=!1,N(null)}}async function mt(e){if(await g({title:Xe(),description:(0,K.jsxs)(K.Fragment,{children:[Me(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Ze(),` `,(0,K.jsx)(`strong`,{children:Je()}),` `,Ae()]}),confirmWord:e.name,confirmLabel:Fe(),destructive:!0}))try{await Ee({serviceAccountId:e._id}),_.success(Ie(),e.name)}catch(e){_.error(Ve(),e)}}async function ht(e){if(await g({title:Ue(),description:(0,K.jsxs)(K.Fragment,{children:[Pe(),` `,(0,K.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Ne()]}),confirmLabel:qe(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await h({keyId:e._id})}catch(e){_.error(Be(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:je()}),(0,K.jsxs)(ot,{q:n,onQChange:c,searchPlaceholder:Le(),onReset:b,canReset:y,children:[(0,K.jsxs)(W,{value:a,onValueChange:s,children:[(0,K.jsx)(F,{size:`sm`,className:`w-40`,children:(0,K.jsx)(M,{placeholder:Ge()})}),(0,K.jsxs)(R,{children:[(0,K.jsx)(U,{value:J,children:He()}),(p??[]).map(e=>(0,K.jsx)(U,{value:e.key,children:e.key},e._id))]})]}),(0,K.jsxs)(W,{value:r,onValueChange:l,children:[(0,K.jsx)(F,{size:`sm`,className:`w-36`,children:(0,K.jsx)(M,{})}),(0,K.jsxs)(R,{children:[(0,K.jsx)(U,{value:J,children:Ke()}),(0,K.jsx)(U,{value:`active`,children:v()}),(0,K.jsx)(U,{value:`disabled`,children:i()})]})]})]}),(0,K.jsx)(st,{title:ge(),rows:u,addLabel:ke(),onAdd:()=>{T(Y),D(null),S(!0)},emptyHint:De(),isExpanded:e=>O.has(e._id),renderExpanded:e=>(0,K.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:ue(),onSelect:()=>pt(e)},{label:Oe(),onSelect:()=>void $(e)},{label:O.has(e._id)?le():We(),onSelect:()=>Q(e._id)},{label:oe(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,K.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":O.has(e._id)?Te():be(),onClick:()=>Q(e._id),children:O.has(e._id)?(0,K.jsx)($e,{}):(0,K.jsx)(tt,{})})},{header:se(),sort:e=>e.name,cell:e=>(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`span`,{children:e.name}),e.description?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Se(),sort:e=>e.roleKey,cell:e=>(0,K.jsx)(I,{variant:`secondary`,children:e.roleKey})},{header:te(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,K.jsx)(I,{variant:`destructive`,children:i()}):(0,K.jsx)(I,{variant:`outline`,children:v()})},{header:Qe(),cell:e=>(0,K.jsxs)(W,{value:V[e._id]??`never`,onValueChange:t=>H(n=>({...n,[e._id]:t})),children:[(0,K.jsx)(F,{size:`sm`,className:`w-32`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(R,{children:lt.map(e=>(0,K.jsx)(U,{value:e.value,children:e.label()},e.value))})]})},{header:_e(),sort:e=>(Z.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Z.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,K.jsx)(`span`,{className:`oc-sa__keycount`,children:j===e._id?de():ce({count:t})})}}]}),(0,K.jsx)(at,{open:x,onOpenChange:e=>{S(e),e||D(null)},title:E?ae():fe(),description:E?he():Re(),canSubmit:!!(C.name&&C.roleKey),onSubmit:ft,submitLabel:E?pe():ee(),children:(0,K.jsxs)(`div`,{className:`oc-form`,children:[(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:ze()}),(0,K.jsx)(L,{value:C.name,onChange:e=>T({...C,name:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:me()}),(0,K.jsxs)(W,{value:C.roleKey||void 0,onValueChange:e=>T({...C,roleKey:e}),children:[(0,K.jsx)(F,{className:`w-full`,children:(0,K.jsx)(M,{placeholder:re()})}),(0,K.jsx)(R,{children:(p??[]).map(e=>(0,K.jsxs)(U,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(p??[]).find(e=>e.key===C.roleKey),t=e?ct(e):null;return t?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:ie()}),(0,K.jsx)(L,{value:C.description,onChange:e=>T({...C,description:e.target.value})})]})]})}),(0,K.jsx)(dt,{minted:q,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:i}){return(0,K.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,K.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[_(),` `,(0,K.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):(0,K.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{children:S()}),(0,K.jsx)(`th`,{children:g()}),(0,K.jsx)(`th`,{children:b()}),(0,K.jsx)(`th`,{children:T()}),(0,K.jsx)(`th`,{children:x()}),(0,K.jsx)(`th`,{children:D()}),(0,K.jsx)(`th`,{})]})}),(0,K.jsx)(`tbody`,{children:t.map(t=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{children:(0,K.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,K.jsx)(`td`,{children:(0,K.jsx)(I,{variant:`secondary`,children:e.roleKey})}),(0,K.jsx)(`td`,{children:Z(t.createdAt)}),(0,K.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,K.jsx)(`td`,{children:pt(t.expiresAt)}),(0,K.jsx)(`td`,{children:$(t)}),(0,K.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,K.jsx)(A,{variant:`destructive`,size:`sm`,disabled:i.has(t._id),onClick:()=>n(t),children:i.has(t._id)?y():r()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,G.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,K.jsx)(P,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,K.jsxs)(j,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,K.jsxs)(B,{children:[(0,K.jsx)(V,{children:f()}),(0,K.jsx)(z,{children:h({name:e.accountName})})]}),(0,K.jsx)(`div`,{className:`oc-sa__minted-warning`,children:Ee()}),(0,K.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,K.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,K.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":m(),children:[n?(0,K.jsx)(k,{}):(0,K.jsx)(N,{}),n?l():C()]})]}),(0,K.jsx)(H,{children:(0,K.jsx)(A,{onClick:()=>{r(!1),t()},children:u()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>q}function ft(e){return e===null?c():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,K.jsx)(I,{variant:`destructive`,children:xe()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,K.jsx)(I,{variant:`outline`,children:a()}):(0,K.jsx)(I,{variant:`outline`,children:O()})}export{X as ServiceAccountsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$t as r,At as i,BO as a,Bt as o,Ct as s,Dt as c,Et as l,Ft as u,Gt as d,Ht as f,It as p,Jt as m,KO as h,Kt as g,Lt as _,Mt as v,Nt as y,Ot as b,Pt as x,Qt as S,Rt as C,St as w,Tt as T,Ut as E,Vt as D,Wt as O,Xt as k,Yt as A,Zt as j,_t as M,bt as N,gt as P,ht as F,jt as I,kt as ee,qO as L,qt as R,vt as z,wt as B,xt as V,yt as H,zt as U}from"./dist-DDPZzNhc.js";import{t as W}from"./button-BK4ZG4Jz.js";import{j as G}from"./index-Ca5_rTHj.js";import{t as K}from"./DataTableShell-5lSbOyB_.js";var q=t(e(),1),J=n(),Y={hung:()=>p(),wrong_result:()=>u(),error:()=>x(),other:()=>y()},X=e=>(e&&Y[e]?.())??e??`—`;function Z(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function Q({data:e}){let t=e.snapshot,n=h(a.subAgentReports.respondToReport),[r,o]=(0,q.useState)(e.thread),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(!1);async function m(){let t=u.trim();if(!(!t||f)){p(!0);try{await n({reportId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),d(``)}finally{p(!1)}}}return(0,J.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,J.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,J.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[X(e.category),` · `,v({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I()}),(0,J.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:i()}),r.length>0?(0,J.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,J.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,J.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?ee():b()}),(0,J.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,J.jsx)(`p`,{className:`oc-fbadmin__meta`,children:c()}),(0,J.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:l(),value:u,maxLength:2e3,rows:3,onChange:e=>d(e.target.value.slice(0,2e3))}),(0,J.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,J.jsx)(W,{size:`sm`,onClick:()=>void m(),disabled:!u.trim()||f,children:f?B():T()})})]}),(0,J.jsxs)(`section`,{children:[(0,J.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[s({count:t.children.length}),t.childrenTruncated?` ${w()}`:``,t.textTruncated?` ${V()}`:``]}),(0,J.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,J.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,J.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Z(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${N()}`:``]}),e.errorMessage?(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H()}),(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,J.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 $(){let e=L(a.subAgentReports.listForAdmin,{}),t=h(a.subAgentReports.readReport),n=h(a.subAgentReports.deleteReport),i=G(),[s,c]=(0,q.useState)(null),[l,u]=(0,q.useState)({});async function p(e){if(s===e._id){c(null);return}if(!l[e._id]){let n=await t({reportId:e._id});u(t=>({...t,[e._id]:n}))}c(e._id)}async function v(e){await i({title:M(),description:P(),confirmLabel:F(),destructive:!0})&&(await n({reportId:e._id}),s===e._id&&c(null))}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[j(),` `,(0,J.jsx)(`strong`,{children:k()}),` `,A()]}),(0,J.jsx)(K,{title:r(),rows:e,emptyHint:S(),isExpanded:e=>s===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,J.jsx)(Q,{data:l[e._id]}):null,columns:[{header:m(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:R(),cell:e=>X(e.category),sort:e=>X(e.category)},{header:g(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:d(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${f({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:O(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:E(),cell:e=>e.answered?(0,J.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:D()}):(0,J.jsx)(`span`,{className:`oc-fbadmin__pill`,children:o()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:s===e._id?C():U(),onSelect:()=>void p(e)},{label:_(),onSelect:()=>void v(e),variant:`destructive`}]})]})}export{$ as SubAgentReportsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$T as i,AE as a,BE as o,BO as s,BT as c,CE as l,DE as u,EE as d,FE as f,GE as p,GT as m,HE as h,HT as g,IE as _,JD as v,JE as ee,JT as y,KE as te,KO as b,KT as ne,LE as re,ME as ie,NE as ae,OE as oe,PE as se,QE as x,QT as ce,RE as le,SE as ue,TE as S,UE as de,UT as fe,VE as pe,VO as me,VT as he,WE as ge,WO as _e,WT as C,XE as ve,XT as ye,YE as be,YT as xe,ZE as Se,ZT as Ce,_E as we,aD as Te,aE as Ee,bE as De,cD as Oe,cE as ke,dE as Ae,dO as je,dt as Me,eD as Ne,eE as Pe,fE as Fe,ft as Ie,gE as Le,hE as Re,iD as ze,iE as Be,jE as Ve,kE as He,lE as Ue,lO as We,mE as Ge,mt as w,n as Ke,nD as qe,nE as Je,oD as Ye,oE as T,pE as Xe,pt as E,qD as Ze,qE as Qe,qO as D,qT as $e,rD as et,rE as tt,sD as nt,sE as rt,tD as it,tE as at,uE as ot,uO as st,vE as ct,wE as lt,xE as ut,yE as dt,zE as ft}from"./dist-DDPZzNhc.js";import{n as O}from"./dist-73SeNc8s.js";import{t as pt}from"./x-Bw9Ep8PY.js";import{t as k}from"./button-BK4ZG4Jz.js";import{C as A,Et as mt,G as ht,J as j,K as M,S as N,Tt as P,W as gt,X as F,Y as _t,Z as I,_ as L,at as vt,b as R,it as yt,ot as z,q as bt,x as B,y as V}from"./index-Ca5_rTHj.js";import{a as xt,i as St,n as Ct,o as wt,r as Tt,t as Et}from"./card-BVpALAaI.js";import{a as Dt,i as H,n as Ot,o as U,r as W,t as kt}from"./table-WXK9Ux9R.js";import{t as At}from"./TimeRangePicker-DIRVKRqd.js";import{t as jt}from"./FilterBar-2yRvM8KI.js";import{t as Mt}from"./AdvancedFilter-D7DLZYme.js";var G=me(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),K=t(e(),1),Nt=.1,Pt=[248,248,248],Ft=[24,24,24];function It(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Lt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function q(e,t,n){return Lt(e,t,n)>=Nt}function Rt(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function zt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Bt=12*1024*1024,Vt=480,Ht=160,Ut=.92;async function Wt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(Ue());if(e.size>Bt)throw Error(ke());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(T());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(T());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);q(e.data,d.width,d.height)?Rt(e.data,t.variantFor===`dark`?Pt:Ft):zt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Ut)??await Y(f,`image/png`);if(!h)throw Error(Ee());return{blob:h,hasAlpha:m}}finally{a()}}async function Gt(e){if(e.type===`image/svg+xml`)return J(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return J(e)}async function J(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(rt())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Kt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Q={kind:`relative`,from:`now-24h`,to:`now`},qt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Jt(e){return e===`light`?je():e===`dark`?st():We()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Zt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Ke(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(O,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Xt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":w(),title:w(),children:(0,X.jsx)(mt,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=D(s.charts.listMyCharts),i=b(s.charts.setMyChart);async function a(e){try{await i({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ne()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:r()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:x(),subtitle:Se(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?ve():n.via===`owner`?be():ee({group:n.via.group});return(0,X.jsx)(Zt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(n.key),onExport:()=>Kt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Qe()}):null]})}function $t(){let e=b(s.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[o,c]=(0,K.useState)(null),[f,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(!1);async function g(e){let t=e.target.files?.[0];if(e.target.value=``,t){c(null),p(!1);try{i(await t.text())}catch{c(S())}}}async function _(){if(c(null),p(!1),t.trim()===``){c(l());return}let a;try{a=JSON.parse(r)}catch{c(S());return}h(!0);try{await e({name:t.trim(),tokens:a}),p(!0),n(``),i(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{h(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ae()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ve()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:a(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:He()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:oe(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),u(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void g(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:m,onClick:()=>void _(),children:d()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,f?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:lt()}):null]})]})}function en({chart:e}){let t=_e(s.charts.setChartLogo),n=b(s.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Wt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function 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){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Le():Re()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?Xe():Ge(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:Ae()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:Fe()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:we()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ot()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=D(s.me.getMe,{host:z}),n=b(s.charts.addChartDomain),r=b(s.charts.removeChartDomain),[a,o]=(0,K.useState)(``),[c,l]=(0,K.useState)(null),[u,d]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let f=e.domains??[];async function p(){let t=a.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 m(t){l(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Be()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:f.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Pe()}):f.map(e=>(0,X.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":i({domain:e}),onClick:()=>void m(e),children:(0,X.jsx)(pt,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{value:a,onChange:e=>o(e.target.value),placeholder:Je(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:u,onClick:()=>void p(),children:at()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:tt()}),c?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:c}):null]})]})}function nn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function rn({chart:e}){let t=b(s.charts.updateChart),n=b(s.charts.deleteChart),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(e.name),[c,l]=(0,K.useState)(()=>nn(e.tokens)),[u,d]=(0,K.useState)(e.tokens.bpm??0),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(!1);function g(){o(e.name),l(nn(e.tokens)),d(e.tokens.bpm??0),p(null),i(!0)}async function _(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(c)}catch{p(S());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}h(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(y()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:g,children:dt()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:ct()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ye()}),(0,X.jsx)(I,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:E()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>d(Number(e.target.value)),"aria-label":E()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?Ie():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Me()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:xe()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:m,onClick:()=>void _(),children:ce()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:Ce()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function an(){let e=D(s.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ue()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ut()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:De()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(rn,{chart:e},e.key))})]})}function on({chart:e,groups:t}){let n=b(s.charts.addChartToGroupPool),r=b(s.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,c=new Set((a??[]).map(e=>e.groupId)),l=t.filter(e=>!c.has(e._id));async function u(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function d(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(F,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?ft():e.kind===`custom`&&e.scope===`personal`?C():o()}),e.isGlobalDefault?(0,X.jsx)(F,{variant:`default`,children:le()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:_()}),(a??[]).map(e=>(0,X.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":se({group:e.name}),onClick:()=>void d(e.groupId),children:(0,X.jsx)(pt,{className:`size-3`})})]},e.groupId)),l.length>0?(0,X.jsxs)(V,{value:``,onValueChange:e=>void u(e),children:[(0,X.jsx)(N,{size:`sm`,className:`w-56`,children:(0,X.jsx)(A,{placeholder:f()})}),(0,X.jsx)(R,{children:l.map(e=>(0,X.jsx)(B,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:re()}):null]})]})}function sn({chart:e}){let t=b(s.charts.promoteChartToCommon),n=b(s.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(y()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(F,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?fe():C()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:m({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:g()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:he()})]})]})}function cn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=b(s.admin.setDefaultThemeMode),i=b(s.admin.setDefaultLocale),a=b(s.charts.setDefaultChart),o=D(s.charts.listChartsAdmin),l=D(s.groups.listGroups,{}),u=e??`system`,d=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:qe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:it()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:p()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:x()}),vt.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ge()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(on,{chart:e,groups:l??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:h()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(tn,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:$e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(sn,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:nt()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Jt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ye()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Te()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,X.jsx)(k,{variant:d===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?v():Ze()},e))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ze()})]})]})}function ln(){let e=D(s.me.getMe,{host:z}),t=yt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)($t,{}),(0,X.jsx)(an,{}),e?.role===`admin`?(0,X.jsx)(cn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function un(){let[e,t]=(0,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.useState)(Q),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Q)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(ln,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:et()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(P,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)($,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(F,{children:`Default`}),(0,X.jsx)(F,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(F,{variant:`outline`,children:`Outline`}),(0,X.jsx)(F,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)($,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(I,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(V,{value:n,onValueChange:r,children:[(0,X.jsx)(N,{className:`w-56`,children:(0,X.jsx)(A,{placeholder:`Select…`})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(B,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(L,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(jt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(V,{value:o,onValueChange:s,children:[(0,X.jsx)(N,{size:`sm`,children:(0,X.jsx)(A,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:Z,children:`Toutes directions`}),(0,X.jsx)(B,{value:`inbound`,children:`inbound`}),(0,X.jsx)(B,{value:`outbound`,children:`outbound`}),(0,X.jsx)(B,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(V,{value:c,onValueChange:l,children:[(0,X.jsx)(N,{size:`sm`,children:(0,X.jsx)(A,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(B,{value:`info`,children:`info`}),(0,X.jsx)(B,{value:`warn`,children:`warn`}),(0,X.jsx)(B,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(Mt,{fields:qt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(At,{value:u,onChange:d})]})]})}),(0,X.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(gt,{children:[(0,X.jsx)(_t,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(P,{})})}),(0,X.jsxs)(ht,{align:`start`,children:[(0,X.jsx)(bt,{children:`Actions`}),(0,X.jsx)(j,{}),(0,X.jsx)(M,{children:`Edit`}),(0,X.jsx)(M,{children:`Duplicate`}),(0,X.jsx)(j,{}),(0,X.jsx)(M,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Et,{className:`w-80`,children:[(0,X.jsxs)(xt,{children:[(0,X.jsx)(wt,{children:`Instance`}),(0,X.jsx)(Tt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(Ct,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(St,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(kt,{children:[(0,X.jsx)(Dt,{children:(0,X.jsxs)(U,{children:[(0,X.jsx)(H,{className:`w-8`,children:(0,X.jsx)(L,{"aria-label":`select all`})}),(0,X.jsx)(H,{children:`Name`}),(0,X.jsx)(H,{children:`Mode`}),(0,X.jsx)(H,{className:`text-right`,children:`Status`}),(0,X.jsx)(H,{className:`w-8`})]})}),(0,X.jsx)(Ot,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{children:(0,X.jsx)(L,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(F,{variant:`secondary`,children:e.m})}),(0,X.jsx)(W,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(O,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(P,{})})})]},e.n))})]})}),(0,X.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{un as ThemeShowroom};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bu as r,Fu as i,Hu as a,Iu as o,Lu as s,Mu as c,Nu as l,Pu as u,Ru as d,Uu as f,Vu as p,Wu as m,zu as h}from"./dist-BOukL7gG.js";import{t as g}from"./button-CcNQBW08.js";import{Ot as _,Z as v,ct as y,lt as b,st as x,ut as S,vt as C}from"./index-HZd91gw7.js";var w=t(e(),1),T={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function E(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=T[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function D(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:E(e.from,t)??t-T.h,to:E(e.to,t)??t}}var O=[{label:m(),from:`now-5m`},{label:f(),from:`now-15m`},{label:a(),from:`now-30m`},{label:p(),from:`now-1h`},{label:r(),from:`now-3h`},{label:h(),from:`now-6h`},{label:d(),from:`now-12h`},{label:s(),from:`now-24h`},{label:o(),from:`now-2d`},{label:i(),from:`now-7d`},{label:u(),from:`now-30d`},{label:l(),from:`now-90d`},{label:c(),from:`now-520w`}];function k(e){return new Date(e).toLocaleString(`fr-FR`,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function A(e){if(e.kind===`relative`){let t=O.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${k(e.from)} → ${k(e.to)}`}function j(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function M(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function N(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var P=n();function F(e){let[t,n]=(0,w.useState)(0);return(0,w.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,w.useMemo)(()=>{let{from:t,to:n}=D(e);return e.kind===`absolute`?{from:t,to:n}:{from:I(t),to:I(n)}},[e,t])}function I(e){return Math.floor(e/6e4)*6e4}function L({value:e,onChange:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(``),o=D(e),[s,c]=(0,w.useState)(()=>j(o.from)),[l,u]=(0,w.useState)(()=>j(o.to));function d(t){if(t){let t=D(e);c(j(t.from)),u(j(t.to)),a(``)}r(t)}function f(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function p(){let e=M(s),n=M(l);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let m=(0,w.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?O:O.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),h=M(s)!==null&&M(l)!==null;return(0,P.jsxs)(b,{open:n,onOpenChange:d,children:[(0,P.jsx)(S,{asChild:!0,children:(0,P.jsxs)(g,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,P.jsx)(_,{}),A(e)]})}),(0,P.jsx)(y,{children:(0,P.jsx)(x,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,P.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,P.jsx)(`div`,{className:`oc-timerange__section-title`,children:`Plage absolue`}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`De`}),(0,P.jsx)(v,{type:`datetime-local`,value:s,onChange:e=>c(e.target.value)})]}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`À`}),(0,P.jsx)(v,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,P.jsx)(g,{size:`sm`,className:`oc-timerange__apply`,disabled:!h,onClick:p,children:`Appliquer`})]}),(0,P.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,P.jsx)(C,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,P.jsx)(v,{value:i,onChange:e=>a(e.target.value),placeholder:`Rechercher une plage`,"aria-label":`Rechercher une plage relative`})]}),(0,P.jsx)(`ul`,{className:`oc-timerange__list`,children:m.length===0?(0,P.jsx)(`li`,{className:`oc-timerange__empty`,children:`Aucune plage.`}):m.map(t=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>f(t.from),children:t.label})},t.from))})]})]})})})]})}export{F as n,N as r,L as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bu as r,Gu as i,Hu as a,Ju as o,Ku as s,Uu as c,Vu as l,Wu as u,Xu as d,Yu as f,Zu as p,qu as m,zu as h}from"./dist-DDPZzNhc.js";import{t as g}from"./button-BK4ZG4Jz.js";import{Ot as _,Z as v,ct as y,lt as b,st as x,ut as S,vt as C}from"./index-Ca5_rTHj.js";var w=t(e(),1),T={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function E(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=T[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function D(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:E(e.from,t)??t-T.h,to:E(e.to,t)??t}}var O=[{label:p(),from:`now-5m`},{label:d(),from:`now-15m`},{label:f(),from:`now-30m`},{label:o(),from:`now-1h`},{label:m(),from:`now-3h`},{label:s(),from:`now-6h`},{label:i(),from:`now-12h`},{label:u(),from:`now-24h`},{label:c(),from:`now-2d`},{label:a(),from:`now-7d`},{label:l(),from:`now-30d`},{label:r(),from:`now-90d`},{label:h(),from:`now-520w`}];function k(e){return new Date(e).toLocaleString(`fr-FR`,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function A(e){if(e.kind===`relative`){let t=O.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${k(e.from)} → ${k(e.to)}`}function j(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function M(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function N(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var P=n();function F(e){let[t,n]=(0,w.useState)(0);return(0,w.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,w.useMemo)(()=>{let{from:t,to:n}=D(e);return e.kind===`absolute`?{from:t,to:n}:{from:I(t),to:I(n)}},[e,t])}function I(e){return Math.floor(e/6e4)*6e4}function L({value:e,onChange:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(``),o=D(e),[s,c]=(0,w.useState)(()=>j(o.from)),[l,u]=(0,w.useState)(()=>j(o.to));function d(t){if(t){let t=D(e);c(j(t.from)),u(j(t.to)),a(``)}r(t)}function f(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function p(){let e=M(s),n=M(l);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let m=(0,w.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?O:O.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),h=M(s)!==null&&M(l)!==null;return(0,P.jsxs)(b,{open:n,onOpenChange:d,children:[(0,P.jsx)(S,{asChild:!0,children:(0,P.jsxs)(g,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,P.jsx)(_,{}),A(e)]})}),(0,P.jsx)(y,{children:(0,P.jsx)(x,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,P.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,P.jsx)(`div`,{className:`oc-timerange__section-title`,children:`Plage absolue`}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`De`}),(0,P.jsx)(v,{type:`datetime-local`,value:s,onChange:e=>c(e.target.value)})]}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`À`}),(0,P.jsx)(v,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,P.jsx)(g,{size:`sm`,className:`oc-timerange__apply`,disabled:!h,onClick:p,children:`Appliquer`})]}),(0,P.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,P.jsx)(C,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,P.jsx)(v,{value:i,onChange:e=>a(e.target.value),placeholder:`Rechercher une plage`,"aria-label":`Rechercher une plage relative`})]}),(0,P.jsx)(`ul`,{className:`oc-timerange__list`,children:m.length===0?(0,P.jsx)(`li`,{className:`oc-timerange__empty`,children:`Aucune plage.`}):m.map(t=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>f(t.from),children:t.label})},t.from))})]})]})})})]})}export{F as n,N as r,L as t};