@lacneu/atrium 0.16.0 → 0.17.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 (77) hide show
  1. package/dist/assets/AccessTab-Cu7T4bOw.js +1 -0
  2. package/dist/assets/AdvancedFilter-DCf2LyZV.js +1 -0
  3. package/dist/assets/AgentFilesTab-inRb2Jsz.js +3 -0
  4. package/dist/assets/AnomaliesTab-SnbLGhTC.js +1 -0
  5. package/dist/assets/AuditTab-rkbk0LN7.js +1 -0
  6. package/dist/assets/BridgeTab-hatWqupL.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-C0k3Gv6Q.js +1 -0
  8. package/dist/assets/{DataTableShell-67hI2aZh.js → DataTableShell-DZ-SHPgB.js} +1 -1
  9. package/dist/assets/{DetailChips-CTU-lZny.js → DetailChips-DsV2pOpk.js} +1 -1
  10. package/dist/assets/FeedbacksTab-GrdACZMD.js +1 -0
  11. package/dist/assets/{FieldLabel-D8l7ss4W.js → FieldLabel-CViQ_orB.js} +2 -2
  12. package/dist/assets/FilesTab-C69xSAc-.js +1 -0
  13. package/dist/assets/{FilterBar-DZBiB1MF.js → FilterBar-BHeRG2h_.js} +1 -1
  14. package/dist/assets/GroupsTab-DmGfQ46W.js +1 -0
  15. package/dist/assets/InstancesTab-CuuqllLK.js +1 -0
  16. package/dist/assets/IntegrationsTab-xeD-lE9t.js +1 -0
  17. package/dist/assets/KpiTab-J64rks81.js +1 -0
  18. package/dist/assets/PreferencesTab-Cyot60gb.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-D4mdSgd0.js +2 -0
  20. package/dist/assets/RolesTab-95KPXgZ6.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-KeF2bwOL.js +1 -0
  22. package/dist/assets/SubAgentReportsTab-DcOJ_YAY.js +1 -0
  23. package/dist/assets/ThemeShowroom-BN8Ba_qV.js +1 -0
  24. package/dist/assets/TimeRangePicker-CE9ZtSJB.js +1 -0
  25. package/dist/assets/TracesTab-BBJSnCzn.js +1 -0
  26. package/dist/assets/UsersTab-WHMYTXGC.js +1 -0
  27. package/dist/assets/{button-HRR8tdJ2.js → button-BEV3ua5Q.js} +1 -1
  28. package/dist/assets/{card-DdObfJrM.js → card-9-MMSY9k.js} +1 -1
  29. package/dist/assets/chevrons-up-down-fiDUJkHc.js +1 -0
  30. package/dist/assets/{compatView-Ihz_y_lK.js → compatView-B6JFLIFa.js} +1 -1
  31. package/dist/assets/dispatchErrorInfo-DewOwv3Y.js +1 -0
  32. package/dist/assets/{dist-DErYNbMW.js → dist-CS7nJlvC.js} +1 -1
  33. package/dist/assets/dist-CpYevWu9.js +5 -0
  34. package/dist/assets/dist-DaCTW3Ac.js +44 -0
  35. package/dist/assets/dist-jSH66_ji.js +1 -0
  36. package/dist/assets/{highlighted-body-OFNGDK62-rg7WOukZ.js → highlighted-body-OFNGDK62-DB9WgLl6.js} +1 -1
  37. package/dist/assets/index-CwMQjTTm.css +2 -0
  38. package/dist/assets/index-D4GXPU2x.js +227 -0
  39. package/dist/assets/mermaid-GHXKKRXX-DlOslc7G.js +1 -0
  40. package/dist/assets/roleDescriptions-DWfpUHJS.js +1 -0
  41. package/dist/assets/{table-fGxqLVNE.js → table-B34f3Klh.js} +1 -1
  42. package/dist/assets/{tabs-Bh17c652.js → tabs-BliLi2ac.js} +1 -1
  43. package/dist/assets/x-CE-91um7.js +1 -0
  44. package/dist/index.html +8 -8
  45. package/package.json +1 -1
  46. package/dist/assets/AccessTab-CQwLWARe.js +0 -1
  47. package/dist/assets/AdvancedFilter-Dsn2CdBY.js +0 -1
  48. package/dist/assets/AgentFilesTab-Cnvrgsf0.js +0 -3
  49. package/dist/assets/AnomaliesTab-Dc0ZBmMT.js +0 -1
  50. package/dist/assets/AuditTab-Bi5vISLS.js +0 -1
  51. package/dist/assets/BridgeTab-H12vdjQc.js +0 -1
  52. package/dist/assets/ChatDefaultsTab-rV2R20Ad.js +0 -1
  53. package/dist/assets/FeedbacksTab-CLE-RiFB.js +0 -1
  54. package/dist/assets/FilesTab-DlWojbFd.js +0 -1
  55. package/dist/assets/GroupsTab-CdmZ136v.js +0 -1
  56. package/dist/assets/InstancesTab-BcQzLsnJ.js +0 -1
  57. package/dist/assets/IntegrationsTab-DFEnr5e6.js +0 -1
  58. package/dist/assets/KpiTab-BNADRVU3.js +0 -1
  59. package/dist/assets/PreferencesTab-CJUrE633.js +0 -1
  60. package/dist/assets/PromptInjectionsTab-C0cMSQ8x.js +0 -2
  61. package/dist/assets/RolesTab-Bwgnt5Nh.js +0 -1
  62. package/dist/assets/ServiceAccountsTab-C-KmfNqX.js +0 -1
  63. package/dist/assets/SubAgentReportsTab-DP-c7pwV.js +0 -1
  64. package/dist/assets/ThemeShowroom-ioH8EI6M.js +0 -1
  65. package/dist/assets/TimeRangePicker-BJ_SDnZN.js +0 -1
  66. package/dist/assets/TracesTab-CfxNJ_IN.js +0 -1
  67. package/dist/assets/UsersTab-C9upk4jg.js +0 -1
  68. package/dist/assets/chevrons-up-down-DLfMeWLX.js +0 -1
  69. package/dist/assets/dispatchErrorInfo-CiUDlf_q.js +0 -1
  70. package/dist/assets/dist-CKhDstdM.js +0 -44
  71. package/dist/assets/dist-CkXWG_t8.js +0 -1
  72. package/dist/assets/dist-DdcF2Plv.js +0 -5
  73. package/dist/assets/index-DR0RpyTI.js +0 -226
  74. package/dist/assets/index-GVGG9WDP.css +0 -2
  75. package/dist/assets/mermaid-GHXKKRXX-CHQslKq1.js +0 -1
  76. package/dist/assets/roleDescriptions-B8pJ6mkq.js +0 -1
  77. package/dist/assets/x-Dnhgu6fy.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ba as r,DE as i,Fa as a,Ga as o,Ha as s,Ia as c,Ka as l,La as u,Na as d,Pa as f,Ra as p,Ua as m,Va as h,Wa as g,eD as _,qa as v,sD as y,za as b}from"./dist-DaCTW3Ac.js";import{C as x,S,X as C,b as w,x as T,y as E}from"./index-D4GXPU2x.js";var D=t(e(),1);function O(e){return e===`user`?u():e===`all`?c():a({group:e.group})}function k(e){return e===`common`?f():e===`owner`?d():a({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=y(_.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=y(_.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":l(),children:(0,A.jsx)(x,{placeholder:l()})}),(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:o()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:g()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:a.user.label}),(0,A.jsx)(C,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:m()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.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:s()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(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:h()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(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:r()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.permissions.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$s as r,Qs as i,ec as a,ic as o,nc as s,rc as c,tc as l}from"./dist-DaCTW3Ac.js";import{i as u}from"./dist-jSH66_ji.js";import{t as d}from"./x-CE-91um7.js";import{t as f}from"./button-BEV3ua5Q.js";import{C as p,S as m,Z as h,b as g,bt as _,x as v,y}from"./index-D4GXPU2x.js";import{r as b}from"./TimeRangePicker-CE9ZtSJB.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:o()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let o=(0,x.useRef)(t),w=!!(o.current&&o.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(o.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),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:s()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(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:l()})}),(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":r(),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)(_,{}),i()]})]}):null]})}export{D as t};
@@ -0,0 +1,3 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ar as r,Cr as i,DE as a,Dr as o,Er as ee,Or as te,Sr as ne,Tr as s,_r as c,ar as l,br as re,cr as u,di as d,dr as f,eD as p,fr as m,gr as h,hr as g,iD as _,ir as v,kE as ie,kr as ae,li as oe,lr as y,mr as b,nr as x,or as S,pr as C,rr as se,sD as w,sr as T,tr as E,ur as D,vr as O,wr as k,xr as ce,yr as A,yx as j}from"./dist-DaCTW3Ac.js";import{t as M}from"./button-BEV3ua5Q.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-D4GXPU2x.js";import{i as G}from"./compatView-B6JFLIFa.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=w(p.me.getMe,{host:V}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),c=w(p.admin.listInstances,e!==void 0&&t?{}:`skip`),[l,u]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!c||c.length===0||(!l||!c.some(e=>e.name===l))&&u(c[0].name)},[t,c,l]);let d=w(p.agents.listAgentsForInstance,t&&l?{instanceName:l}:`skip`),f=w(p.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),m=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return l===null||d===void 0?c!==void 0&&c.length===0?[]:void 0:d.agents.map(e=>({instanceName:l,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(f!==void 0)return f.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,l,d,c,f]),[h,g]=(0,K.useState)(null);(0,K.useEffect)(()=>{!m||m.length===0||(!h||!m.some(e=>$(e)===h))&&g($(m[0]))},[m,h]);let v=m?.find(e=>$(e)===h)??null,y=_(p.agentFiles.listAgentFiles),[b,x]=(0,K.useState)({status:`idle`}),S=v?.instanceName??null,C=v?.agentId??null,se=w(p.compat.forInstance,n&&S!==null?{instanceName:S}:`skip`),T=n&&S!==null?H(se,`agentFiles`):null,E=T===null?!1:T===`loading`?null:T.blocked,D=(0,K.useCallback)(async()=>{if(!(S===null||C===null)){x({status:`loading`});try{x({status:`done`,files:(await y({instanceName:S,agentId:C})).files})}catch{x({status:`error`})}}},[y,S,C]);(0,K.useEffect)(()=>{E===!1&&D()},[D,E]);let[j,N]=(0,K.useState)(null),P=ie(),F=(0,K.useMemo)(()=>new Intl.NumberFormat(P,{maximumFractionDigits:0}),[P]);return e===void 0||m===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(c?.length??0)>1?(0,Q.jsxs)(W,{value:l??``,onValueChange:e=>u(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":ae(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:(c??[]).map(e=>(0,Q.jsx)(U,{value:e.name,children:e.name},e.name))})]}):null,m.length>0?(0,Q.jsxs)(W,{value:h??``,onValueChange:e=>g(e),children:[(0,Q.jsx)(L,{size:`sm`,"aria-label":te(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(z,{children:m.map(e=>(0,Q.jsx)(U,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}),v===null?null:T===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):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)]}):b.status===`loading`||b.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):b.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[s(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:oe()})]}):b.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:b.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:k()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:i({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:ne({pct:F.format(n)})}),r?(0,Q.jsx)(B,{size:14,className:`oc-afiles__warn`,"aria-label":ce()}):(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?A():O()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:re({used:Z(be(b.files),P),total:Z(J,P),pct:F.format(X(be(b.files)))})})]}),j&&v?(0,Q.jsx)(Te,{instanceName:v.instanceName,agentId:v.agentId,name:j.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void D()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:o}){let ee=_(p.agentFiles.getAgentFile),te=_(p.agentFiles.setAgentFile),ne=P(),[s,re]=(0,K.useState)(null),[ae,w]=(0,K.useState)(!1),[O,k]=(0,K.useState)(``),[ce,A]=(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=>{w(!1);try{let i=await ee({instanceName:e,agentId:t,name:n});re({content:i.content,updatedAtMs:i.updatedAtMs}),r||k(i.content),z(!1)}catch{w(!0)}},[ee,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(s!==null){L(!0),V(!1);try{await te({instanceName:e,agentId:t,name:n,content:O,baseUpdatedAtMs:s.updatedAtMs??void 0}),ne.success(f({name:n})),o(),await H(!1)}catch(e){Ce(e)?z(!0):V(!0)}finally{L(!1)}}}let W=s!==null&&O!==s.content,G=(0,K.useMemo)(()=>s===null?null:Se(s.content,O),[s,O]),J=O.length>q,Y=ie(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(me,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(N,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(ve,{children:c({name:n})}),(0,Q.jsxs)(ge,{children:[h({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,g()]})]})]}),ae?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[y(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:oe()})]}):s===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:O,readOnly:!r,spellCheck:!1,onChange:e=>k(e.target.value),"aria-label":c({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:b()}),R?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[u(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:T()})]}):null,B?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:D()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:C({count:X.format(O.length),max:X.format(q)})}),r?(0,Q.jsx)(M,{size:`sm`,disabled:!W||I||R,onClick:()=>A(!0),children:I?d():m()}):null]})]}),(0,Q.jsx)(fe,{open:ce,onOpenChange:A,children:(0,Q.jsxs)(ue,{children:[(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(F,{children:S({name:n})}),(0,Q.jsx)(de,{children:l({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:v({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:se()}),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:x()}),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:j()}),(0,Q.jsx)(pe,{onClick:()=>void U(),children:E()})]})]})})]})})}export{we as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,Ap as i,Cp as ee,Dp as te,Ep as a,Jf as o,Kf as s,Mp as c,Np as l,Op as ne,Pp as u,Qf as d,Sp as f,Tp as p,Xf as m,Yf as h,Zf as g,_p as re,ap as ie,bp as ae,cp as oe,dp as _,eD as v,ep as se,fp as ce,gp as le,hp as ue,ip as de,jp as fe,kp as pe,lp as y,mp as me,np as he,oD as ge,op as b,pp as x,qf as S,rp as C,sD as w,sp as T,tp as E,up as D,vp as O,wp as k,xp as A,yp as j}from"./dist-DaCTW3Ac.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-D4GXPU2x.js";import{n as be}from"./TimeRangePicker-CE9ZtSJB.js";import{t as xe}from"./FilterBar-BHeRG2h_.js";import{t as Se}from"./DataTableShell-DZ-SHPgB.js";import{t as H}from"./dispatchErrorInfo-DewOwv3Y.js";var U=t(e(),1),W=n(),G=`__all__`,Ce=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function we(e){return e===`open`?u():e===`acknowledged`?l():c()}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??``,o=e.status===K?G:e.status,s=e.severity??G,c=e.kind??G,[l,u]=(0,U.useState)(G),h=ye(e.from,e.to),{from:S,to:H}=be(h),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=ge(v.anomalies.resolveAnomaly),Fe=(w(v.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=w(v.anomalies.listAnomalies,{limit:Oe,filter:{q:n||void 0,from:S,to:H,anomalyStatus:o===G?void 0:o,severity:s===G?void 0:s,source:l===G?void 0:l,kind:c===G?void 0:c}}),Ie=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||o!==`open`||s!==G||l!==G||c!==G||h.kind!==`relative`||h.from!==De.from;function Re(){u(G),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:fe(),description:(0,W.jsxs)(W.Fragment,{children:[i(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,pe(),` `,(0,W.jsx)(`strong`,{children:ne()}),`.`,` `,te()]}),confirmLabel:a()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(p(),e.kind)}catch(e){Z.error(k(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(ee(),e.kind)}catch(e){Z.error(f(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[A(),` `,(0,W.jsx)(`strong`,{children:ae()}),` `,j(),` `,(0,W.jsx)(`strong`,{children:O()}),` `,re(),` `,(0,W.jsx)(`strong`,{children:le()}),` `,ue(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:me()})]}),(0,W.jsxs)(xe,{q:n,onQChange:q,searchPlaceholder:x(),timeRange:h,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,W.jsxs)(V,{value:o,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:ce()}),Ce.map(e=>(0,W.jsx)(B,{value:e.value,children:we(e.value)},e.value))]})]}),(0,W.jsxs)(V,{value:s,onValueChange:Y,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:_()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:D()}),Te.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:l,onValueChange:u,children:[(0,W.jsx)(F,{size:`sm`,className:`w-32`,children:(0,W.jsx)(N,{placeholder:y()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:oe()}),Ee.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:c,onValueChange:Ne,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:T()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:b()}),Ie.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Se,{title:ie(),rows:$,emptyHint:o===`open`?de():C(),rowActions:e=>Fe&&e.status===`open`?[{label:he(),onSelect:()=>void ze(e)},{label:E(),onSelect:()=>void Be(e)}]:[],columns:[{header:se(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:T(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:_(),cell:e=>(0,W.jsx)(Ae,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:r(),cell:e=>(0,W.jsx)(je,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:y(),cell:e=>(0,W.jsx)(I,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:d(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:g(),cell:e=>(0,W.jsx)(ke,{row:e}),sort:e=>e.evidence??null},{header:m(),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:[`↗ `,h()]}):null]})}let n=J(e);if(!n.dominantCode)return(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=H(n.dominantCode),i=n.sampleCorrelationId;return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,W.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,W.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,h()]}):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:o()}):e===`acknowledged`?(0,W.jsx)(I,{variant:`secondary`,children:S()}):(0,W.jsx)(I,{variant:`outline`,children:s()})}function Me(e){return e.length>8?e.slice(0,8):e}export{q as AnomaliesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Am as r,Dm as i,Em as a,Fm as o,Im as s,Lm as c,Mm as l,Nm as u,Om as ee,Pm as d,Rm as f,Tm as p,eD as m,jm as h,km as g,sD as _,zm as v}from"./dist-DaCTW3Ac.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-D4GXPU2x.js";import{n as j}from"./TimeRangePicker-CE9ZtSJB.js";import{t as M}from"./FilterBar-BHeRG2h_.js";import{t as N}from"./AdvancedFilter-DCf2LyZV.js";import{t as P}from"./DataTableShell-DZ-SHPgB.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.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:[v(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:f()})]}),(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:s()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:o()}),$.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:d()}),(0,I.jsx)(k,{value:`yes`,children:u()}),(0,I.jsx)(k,{value:`no`,children:l()})]})]}),(0,I.jsxs)(A,{value:V,onValueChange:Y,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:h()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:r()}),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:i(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:s(),cell:e=>e.action,sort:e=>e.action},{header:a(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:p(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:h(),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{$l as r,Al as i,An as a,Bl as o,Bn as s,Bu as c,Dl as l,El as u,Fl as d,Fn as f,Fu as p,Gl as m,Gu as ee,Hl as h,Hu as te,Il as g,In as _,Jl as v,Ju as y,Kl as b,Ll as ne,Ln as re,Ml as ie,Mn as ae,Nl as oe,Nn as se,Ol as ce,Pl as le,Pn as ue,Pu as de,Ql as fe,Rl as x,Rn as pe,Ru as me,Tl as S,Tn as he,Ul as ge,Uu as _e,Vl as ve,Vu as ye,Wl as be,Wu as xe,Xl as Se,Yl as Ce,Zl as C,au as we,cu as Te,du as Ee,eD as w,eu as De,fu as Oe,iD as ke,iu as Ae,jl as je,jn as Me,kl as Ne,kn as Pe,lu as Fe,nu as Ie,oD as Le,ou as Re,ql as ze,qu as Be,ru as Ve,sD as T,su as He,tD as Ue,tu as We,uu as Ge,wl as E,zl as Ke,zn as qe,zu as Je}from"./dist-DaCTW3Ac.js";import{i as D,r as Ye}from"./dist-jSH66_ji.js";import{t as Xe}from"./chevrons-up-down-fiDUJkHc.js";import{i as Ze,n as O,o as Qe,r as $e,s as et}from"./FieldLabel-CViQ_orB.js";import{t as k}from"./button-BEV3ua5Q.js";import{$ as tt,A as nt,At as rt,C as A,H as it,Q as at,S as j,St as ot,U as st,V as ct,X as M,Z as N,_ as lt,_t as ut,b as P,et as dt,jt as ft,kt as F,mt as I,nt as pt,ot as mt,rt as ht,x as L,y as R}from"./index-D4GXPU2x.js";import{a as gt,i as z,n as _t,o as B,r as V,t as vt}from"./table-B34f3Klh.js";import{t as yt}from"./FilterBar-BHeRG2h_.js";import{a as H,n as bt,o as U,r as W,s as xt,t as St}from"./compatView-B6JFLIFa.js";import{t as G}from"./dispatchErrorInfo-DewOwv3Y.js";var Ct=Ue(`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`}]]),wt=Ue(`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 q(e){return e.filter(e=>e.state===`error`)}function Tt(e){return e.reachable&&q(e.targets).length===0}function Et(e){return e.state===`error`&&e.lastErrorCode!==null}function Dt(e){return!!e.lastDownstreamRejectCode}function J(e){return e.kind??`openclaw`}function Ot(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function kt(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,J(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(J(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Ot(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>J(e)===r)}))}function At(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,jt={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function Mt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Nt(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Pt(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Ft(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return U(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function It(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Pt(t.key,e),a=Pt(t.key,r);return i&&a?0:i?1:a?-1:n*Ft(t.key,e,r)})}function Lt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function Rt(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function zt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>U(e,t)??Z(e,t))}var Q=n();function Bt({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(jt),[a,o]=(0,K.useState)(null),s=(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]),c=(0,K.useMemo)(()=>Lt(s),[s]),u=(0,K.useMemo)(()=>Rt(s),[s]),f=(0,K.useMemo)(()=>zt(s),[s]),p=(0,K.useMemo)(()=>It(Nt(s,n),a),[s,n,a]);function m(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(yt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Ke(),onReset:()=>r(jt),canReset:Mt(n),children:[(0,Q.jsxs)(R,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(A,{placeholder:ne()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(L,{value:Y,children:x()}),c.map(e=>(0,Q.jsx)(L,{value:e,children:Ht(e)},e))]})]}),(0,Q.jsxs)(R,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(A,{placeholder:g()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(L,{value:Y,children:x()}),u.map(e=>(0,Q.jsx)(L,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(R,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(A,{placeholder:d()})}),(0,Q.jsxs)(P,{children:[(0,Q.jsx)(L,{value:Y,children:x()}),f.map(e=>(0,Q.jsx)(L,{value:e,children:e},e))]})]})]}),p.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:le()}):(0,Q.jsxs)(vt,{className:`oc-conn__table`,children:[(0,Q.jsx)(gt,{children:(0,Q.jsxs)(B,{children:[(0,Q.jsx)($,{label:oe(),sortKey:`target`,sort:a,onSort:m}),(0,Q.jsx)($,{label:ie(),sortKey:`state`,sort:a,onSort:m}),(0,Q.jsx)($,{label:je(),sortKey:`instance`,sort:a,onSort:m}),(0,Q.jsx)($,{label:i(),sortKey:`host`,sort:a,onSort:m}),(0,Q.jsx)($,{label:Ne(),sortKey:`version`,sort:a,onSort:m}),(0,Q.jsx)(z,{children:ce()}),(0,Q.jsx)($,{label:l(),sortKey:`lastOk`,sort:a,onSort:m})]})}),(0,Q.jsx)(_t,{children:p.map(e=>(0,Q.jsx)(Vt,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(z,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(Ye,{size:13,"aria-hidden":!0}):(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Xe,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Vt({r:e}){let t=Et(e)?G(e.lastErrorCode):null,n=Dt(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(B,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(V,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(V,{children:(0,Q.jsx)(Ut,{state:e.state})}),(0,Q.jsx)(V,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(V,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(V,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(V,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:ve({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(V,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(B,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(V,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[o({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Ht(e){return e===`connected`?u():e===`error`?S():E()}function Ut({state:e}){return e===`connected`?(0,Q.jsx)(M,{variant:`secondary`,children:u()}):e===`error`?(0,Q.jsx)(M,{variant:`destructive`,children:S()}):(0,Q.jsx)(M,{variant:`outline`,children:E()})}function Wt(){return T(w.bridgeHealth.getBridgeHealth,{})}function Gt(){let e=Wt(),t=T(w.compat.getBridgeCompat,{}),n=T(w.me.getMe,{host:mt})?.role===`admin`,r=T(w.admin.listInstances,n?{}:`skip`),i=ft(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=kt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&bt(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Kt,{health:e,compat:t,onSeeAnomalies:a}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:fe()}),o.map(e=>(0,Q.jsx)(qt,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0},e.key)),l?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:he()}):null]})}function Kt({health:e,compat:t,onSeeAnomalies:n}){let r=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(t.bridgeVersion)}),` · `,pe(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?re():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Se()});let i=q(e.targets),a=!e.reachable,o=Tt(e),s=o?`ok`:`error`,c=new Date(e.checkedAt).toLocaleString(`fr-FR`),l=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${s}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:o?(0,Q.jsx)(F,{size:22}):a?(0,Q.jsx)(wt,{size:22}):(0,Q.jsx)(I,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:o?Ce():a?v():ze({count:i.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Ct,{size:12,"aria-hidden":!0}),` `,b({time:c})]}),l?(0,Q.jsx)(`span`,{children:m({time:l})}):null,r]}),a?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:be()})]})}function qt({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a}){let o=r?xt(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:St(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(ut,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:At(e)}),f?(0,Q.jsx)(M,{variant:f===`beyond`?`destructive`:`secondary`,children:W(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:s()}),(0,Q.jsx)(Jt,{support:o,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(rt,{size:13,"aria-hidden":!0}),ge({count:t.length})]}),p?(0,Q.jsx)(Bt,{connections:t,displayByInstance:c}):null]})}function Jt({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:ue()}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:se({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:re()}),e?(0,Q.jsx)(Qt,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(e.version)}),(0,Q.jsx)(M,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:W(e.state)})]},e.instanceName))})]})}function Yt({instance:e,onClose:t}){return(0,Q.jsx)(at,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(tt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(pt,{children:[(0,Q.jsx)(ht,{children:y({instance:e.displayName??e.name})}),(0,Q.jsx)(dt,{children:Be()})]}),(0,Q.jsx)(Zt,{instance:e,onClose:t})]})})}function Xt({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(F,{"aria-hidden":!0}):(0,Q.jsx)(I,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Ie():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,We()]}):null}function Zt({instance:e,onClose:t}){let n=Le(w.admin.upsertInstanceConfig),i=ke(w.bridge.validateMediaPaths),a=nt(),[o,s]=(0,K.useState)(()=>Ze(e.config??{})),[l,u]=(0,K.useState)(!1),[d,f]=(0,K.useState)(!1),[m,h]=(0,K.useState)(null),g=o.inboundMediaMode===`shared-fs`,_=o.mediaMode===`shared-fs`,v=g||_;async function y(){f(!0),h(null);try{h(await i({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){a.error(Re(),e)}finally{f(!1)}}async function b(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:$e(o,r)}),t()}catch(e){a.error(c(),e)}finally{u(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:ee(),help:Je()}),(0,Q.jsxs)(R,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(A,{})}),(0,Q.jsx)(P,{children:et.map(e=>(0,Q.jsx)(L,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:xe(),help:me()}),(0,Q.jsxs)(R,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(A,{})}),(0,Q.jsx)(P,{children:Qe.map(e=>(0,Q.jsx)(L,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:_e(),help:p()}),(0,Q.jsx)(N,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:Oe(),help:Ee()}),(0,Q.jsx)(N,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:Ge(),help:Fe()}),(0,Q.jsx)(N,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(lt,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Q.jsx)(O,{label:te(),help:de()})]}),v&&m!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(I,{"aria-hidden":!0}),r({reason:m.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Xt,{label:Ae(),result:m.inbound}),(0,Q.jsx)(Xt,{label:Ve(),result:m.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:we()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(I,{"aria-hidden":!0}),De()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Q.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:d,children:[d?(0,Q.jsx)(ot,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?He():Te()]}),(0,Q.jsx)(k,{size:`sm`,onClick:()=>void b(),disabled:l,children:ye()})]})]})})}function Qt({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(ct,{children:[(0,Q.jsx)(st,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?ae():Me({count:e.length}),(0,Q.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(it,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:a()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(M,{variant:`secondary`,children:e},e))})]})]})}export{Gt as BridgeTab,Yt as InstanceConfigDialog};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$n as r,DE as i,Gn as a,Hn as o,Jn as s,Kn as ee,Ku as te,Qn as ne,Un as re,Vn as ie,Wn as ae,Xn as oe,Yn as se,Zn as ce,ai as c,di as l,eD as u,iD as d,ii as f,kr as p,li as le,qn as m,sD as h,yx as g}from"./dist-DaCTW3Ac.js";import{t as _}from"./button-BEV3ua5Q.js";import{A as ue,B as de,C as fe,F as pe,I as me,L as he,N as v,P as y,R as b,S as x,b as S,g as C,h as w,mt as T,v as E,x as D,y as O,z as k}from"./index-D4GXPU2x.js";import{i as A}from"./compatView-B6JFLIFa.js";/* empty css */var j=t(e(),1),M=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function N(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var P=n();function F(){let e=d(u.agentFiles.getChatDefaults),t=d(u.agentFiles.setChatDefaults),n=ue(),[F,I]=(0,j.useState)({status:`loading`}),[L,R]=(0,j.useState)({thinkingDefault:null,fastModeDefault:null}),[ge,z]=(0,j.useState)(!1),[B,V]=(0,j.useState)(!1),H=h(u.admin.listInstances,{}),[U,W]=(0,j.useState)(null);(0,j.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,_e=H!==void 0&&H.length===0,ve=h(u.compat.forInstance,U?{instanceName:U}:`skip`),K=U?E(ve,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,j.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,j.useRef)(0),X=(0,j.useCallback)(async()=>{let t=++Y.current;I({status:`loading`});try{let n=N(await e(J));if(Y.current!==t)return;I({status:`done`,current:n}),R(n)}catch{if(Y.current!==t)return;I({status:`error`})}},[e,J]);(0,j.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=F.status===`done`?F.current:null,Q=Z!==null&&L.thinkingDefault!==null&&L.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&L.fastModeDefault!==null&&L.fastModeDefault!==Z.fastModeDefault,ye=Q||$;async function be(){V(!0);try{await t({...J,...Q?{thinkingDefault:L.thinkingDefault}:{},...$?{fastModeDefault:L.fastModeDefault}:{}}),n.success(ee()),await X()}catch(e){n.error(a(),e)}finally{V(!1)}}let xe=(0,j.useMemo)(()=>M.map(e=>({id:e,label:C(e)})),[]),Se=(0,j.useMemo)(()=>[{id:`fast`,label:c()},{id:`standard`,label:f()}],[]);return(0,P.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:r()}),G&&U?(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()}),(0,P.jsxs)(O,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,P.jsx)(x,{size:`sm`,"aria-label":p(),children:(0,P.jsx)(fe,{})}),(0,P.jsx)(S,{children:(H??[]).map(e=>(0,P.jsx)(D,{value:e.name,children:e.name},e.name))})]})]}):null,_e?(0,P.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:te()}):K===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):K.blocked?(0,P.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,P.jsx)(T,{size:14,"aria-hidden":!0}),` `,A(K.gatewayVersion)]}):F.status===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):F.status===`error`?(0,P.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[s(),` `,(0,P.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:le()})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:ne()}),(0,P.jsx)(w,{options:xe,value:L.thinkingDefault,onChange:e=>R({...L,thinkingDefault:e}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:ce()})]}),(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:oe()}),(0,P.jsx)(w,{options:Se,value:L.fastModeDefault===null?null:L.fastModeDefault?`fast`:`standard`,onChange:e=>R({...L,fastModeDefault:e===`fast`}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:se()})]}),(0,P.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,P.jsx)(_,{size:`sm`,disabled:!ye||B,onClick:()=>z(!0),children:B?l():m()})}),(0,P.jsx)(`p`,{className:`oc-cdefaults__note`,children:ae()})]}),(0,P.jsx)(v,{open:ge,onOpenChange:z,children:(0,P.jsxs)(me,{children:[(0,P.jsxs)(k,{children:[(0,P.jsx)(de,{children:re()}),(0,P.jsx)(he,{children:o()})]}),(0,P.jsxs)(b,{children:[(0,P.jsx)(pe,{children:g()}),(0,P.jsx)(y,{onClick:()=>void be(),children:ie()})]})]})})]})}export{F as ChatDefaultsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Co as r,Do as i,Eo as a,So as o,To as s,wo as c,xo as l}from"./dist-CKhDstdM.js";import{i as u,r as d}from"./dist-CkXWG_t8.js";import{t as f}from"./chevrons-up-down-DLfMeWLX.js";import{t as p}from"./button-HRR8tdJ2.js";import{G as m,J as h,K as g,W as _,Y as v,bt as y,ht as b,wt as x,x as S}from"./index-DR0RpyTI.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-fGxqLVNE.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=i(),bulkActions:F,emptyHint:I=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)(b,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(y,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):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)(S,{"aria-label":c(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":l({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],i=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(S,{"aria-label":r(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(_,{children:[(0,M.jsx)(v,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(x,{})})}),(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]}),i&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{ds as r,fs as i,gs as a,hs as o,ms as s,ps as c,us as l}from"./dist-DaCTW3Ac.js";import{i as u,r as d}from"./dist-jSH66_ji.js";import{t as f}from"./chevrons-up-down-fiDUJkHc.js";import{t as p}from"./button-BEV3ua5Q.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-D4GXPU2x.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-B34f3Klh.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=a(),bulkActions:F,emptyHint:I=o(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(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:s()}):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":c(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":l({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],a=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":r(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(_,{})})}),(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]}),a&&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-DR0RpyTI.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-D4GXPU2x.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{$_ as r,A_ as i,B_ as a,C_ as o,D_ as s,E_ as c,F_ as l,G_ as u,H_ as ee,I_ as te,J_ as d,K_ as f,L_ as p,M_ as m,N_ as h,O_ as g,P_ as _,Q_ as v,R_ as ne,S_ as y,T_ as re,U_ as ie,V_ as b,W_ as x,X_ as S,Y_ as C,Z_ as w,__ as T,a_ as E,b_ as D,c_ as O,d_ as k,eD as A,e_ as j,ev as M,f_ as N,g_ as P,h_ as F,i_ as I,j_ as L,k_ as R,l_ as z,m_ as ae,n_ as B,oD as V,o_ as H,p_ as U,q_ as W,r_ as G,sD as K,s_ as q,t_ as J,tv as oe,u_ as se,v_ as ce,w_ as le,x_ as ue,y_ as de,z_ as fe}from"./dist-DaCTW3Ac.js";import{t as pe}from"./button-BEV3ua5Q.js";import{j as me}from"./index-D4GXPU2x.js";import{t as he}from"./DataTableShell-DZ-SHPgB.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>oe(),incorrect:()=>M(),incoherence:()=>r(),formatting:()=>v(),latency:()=>w(),api_error:()=>S(),other:()=>C()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:W()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:f()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:d()})}function ge({data:e,closeReason:t}){let n=e.snapshot,r=V(A.feedback.respondToFeedback),[o,d]=(0,Y.useState)(e.thread),[f,v]=(0,Y.useState)(``),[y,S]=(0,Y.useState)(!1);async function C(){let t=f.trim();if(!(!t||y)){S(!0);try{await r({feedbackId:e._id,text:t}),d(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),v(``)}finally{S(!1)}}}let w=[];try{w=n.contextJson?JSON.parse(n.contextJson):[]}catch{w=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${u()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),o.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,X.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?ee():b()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:a()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:fe(),value:f,maxLength:2e3,rows:3,onChange:e=>v(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(pe,{size:`sm`,onClick:()=>void C(),disabled:!f.trim()||y,children:y?ne():p()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:te()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||l()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||l()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:h()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,w.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:m({count:n.contextCount??w.length,truncated:n.contextTruncated?L():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:w.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:i()}),(0,X.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:R()}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?s({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[c(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,re()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=K(A.feedback.listForAdmin,{}),t=V(A.feedback.readSnapshot),n=V(A.feedback.deleteFeedback),r=me(),[i,a]=(0,Y.useState)(null),[s,c]=(0,Y.useState)({});async function l(e){if(i===e._id){a(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});c(t=>({...t,[e._id]:n}))}a(e._id)}async function u(e){await r({title:B(),description:J(),confirmLabel:j(),destructive:!0})&&(await n({feedbackId:e._id}),i===e._id&&a(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[le(),` `,(0,X.jsx)(`strong`,{children:o()}),` `,y()]}),(0,X.jsx)(he,{title:ue(),rows:e,emptyHint:D(),isExpanded:e=>i===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,X.jsx)(ge,{data:s[e._id],closeReason:e.userCloseReason}):null,columns:[{header:de(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:ce(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:T(),cell:e=>e.messageRole===`user`?P():F(),sort:e=>e.messageRole},{header:ae(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${U({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:N(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:k(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:se(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:z()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:O()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:q()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:i===e._id?E():I(),onSelect:()=>void l(e)},{label:G(),onSelect:()=>void u(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{dE as t,wE as n}from"./dist-CKhDstdM.js";import{c as r,l as i,s as a,u as o}from"./index-DR0RpyTI.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{mD as t,tD as n}from"./dist-DaCTW3Ac.js";import{c as r,l as i,s as a,u as o}from"./index-D4GXPU2x.js";var s=n(`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
- {files}`}},l=Object.keys(c);function u(e,t){return t.enabled?t.template:c[e].disabledTemplate??``}function d(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:r})}var f=[`gateway-http`,`shared-fs`,`off`],p=[`inline`,`shared-fs`],m=[`reactive`,`sse`],h=`reactive`;n.object({mediaMode:n.optional(n.union(n.literal(`gateway-http`),n.literal(`shared-fs`),n.literal(`off`))),inboundMediaMode:n.optional(n.union(n.literal(`inline`),n.literal(`shared-fs`))),rehydration:n.optional(n.boolean()),mediaMaxMb:n.optional(n.number()),inboundAgentMount:n.optional(n.string()),outboundAgentMount:n.optional(n.string()),promptInjections:n.optional(n.record(n.string(),n.object({enabled:n.optional(n.boolean()),template:n.optional(n.string())})))});var g={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function _(e){let t={};for(let n of l){let r=e?.[n];t[n]={enabled:r?.enabled??!0,template:typeof r?.template==`string`&&r.template.length>0?r.template:c[n].defaultTemplate}}return t}function v(e){let t={};for(let n of l){let r=c[n],i=e[n];if(!i)continue;let a={};r.togglable&&i.enabled===!1&&(a.enabled=!1);let o=i.template.trim();o.length>0&&o!==r.defaultTemplate&&(a.template=o),(a.enabled!==void 0||a.template!==void 0)&&(t[n]=a)}return t}function y(e){return{mediaMode:e.mediaMode??g.mediaMode,inboundMediaMode:e.inboundMediaMode??g.inboundMediaMode,rehydration:e.rehydration??g.rehydration,mediaMaxMb:e.mediaMaxMb??g.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??g.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??g.outboundAgentMount,promptInjections:_(e.promptInjections)}}function b(e,t){let n={},r=r=>{(e[r]!==g[r]||t[r]!==void 0)&&(n[r]=e[r])};r(`mediaMode`),r(`inboundMediaMode`),r(`rehydration`),r(`mediaMaxMb`),r(`inboundAgentMount`),r(`outboundAgentMount`);let i=v(e.promptInjections);return Object.keys(i).length>0&&(n.promptInjections=i),n}var x=e();function S({text:e}){return(0,x.jsx)(i,{delayDuration:150,children:(0,x.jsxs)(a,{children:[(0,x.jsx)(o,{asChild:!0,children:(0,x.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,x.jsx)(s,{"aria-hidden":!0})})}),(0,x.jsx)(r,{className:`max-w-xs text-pretty`,children:e})]})})}function C({label:e,help:t}){return(0,x.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,x.jsx)(S,{text:t})]})}export{h as a,m as c,u as d,d as f,y as i,c as l,C as n,p as o,b as r,f as s,S as t,l as u};
4
+ {files}`}},l=Object.keys(c);function u(e,t){return t.enabled?t.template:c[e].disabledTemplate??``}function d(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:r})}var f=[`gateway-http`,`shared-fs`,`off`],p=[`inline`,`shared-fs`],m=[`reactive`,`sse`],h=`reactive`;t.object({mediaMode:t.optional(t.union(t.literal(`gateway-http`),t.literal(`shared-fs`),t.literal(`off`))),inboundMediaMode:t.optional(t.union(t.literal(`inline`),t.literal(`shared-fs`))),rehydration:t.optional(t.boolean()),mediaMaxMb:t.optional(t.number()),inboundAgentMount:t.optional(t.string()),outboundAgentMount:t.optional(t.string()),promptInjections:t.optional(t.record(t.string(),t.object({enabled:t.optional(t.boolean()),template:t.optional(t.string())})))});var g={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function _(e){let t={};for(let n of l){let r=e?.[n];t[n]={enabled:r?.enabled??!0,template:typeof r?.template==`string`&&r.template.length>0?r.template:c[n].defaultTemplate}}return t}function v(e){let t={};for(let n of l){let r=c[n],i=e[n];if(!i)continue;let a={};r.togglable&&i.enabled===!1&&(a.enabled=!1);let o=i.template.trim();o.length>0&&o!==r.defaultTemplate&&(a.template=o),(a.enabled!==void 0||a.template!==void 0)&&(t[n]=a)}return t}function y(e){return{mediaMode:e.mediaMode??g.mediaMode,inboundMediaMode:e.inboundMediaMode??g.inboundMediaMode,rehydration:e.rehydration??g.rehydration,mediaMaxMb:e.mediaMaxMb??g.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??g.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??g.outboundAgentMount,promptInjections:_(e.promptInjections)}}function b(e,t){let n={},r=r=>{(e[r]!==g[r]||t[r]!==void 0)&&(n[r]=e[r])};r(`mediaMode`),r(`inboundMediaMode`),r(`rehydration`),r(`mediaMaxMb`),r(`inboundAgentMount`),r(`outboundAgentMount`);let i=v(e.promptInjections);return Object.keys(i).length>0&&(n.promptInjections=i),n}var x=e();function S({text:e}){return(0,x.jsx)(i,{delayDuration:150,children:(0,x.jsxs)(a,{children:[(0,x.jsx)(o,{asChild:!0,children:(0,x.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,x.jsx)(s,{"aria-hidden":!0})})}),(0,x.jsx)(r,{className:`max-w-xs text-pretty`,children:e})]})})}function C({label:e,help:t}){return(0,x.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,x.jsx)(S,{text:t})]})}export{h as a,m as c,u as d,d as f,y as i,c as l,C as n,p as o,b as r,f as s,S as t,l as u};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$T as ee,AT as te,BT as r,DE as i,DT as a,ET as ne,FT as re,GT as o,HT as s,IT as c,JT as l,KT as u,LT as d,MT as f,NT as p,OT as m,PT as ie,QT as ae,RT as oe,TT as se,UT as h,VT as ce,WT as g,XT as le,YT as ue,ZT as de,aE as fe,eD as _,eE as pe,iE as me,jT as he,kE as ge,kT as _e,nE as v,oD as y,qT as b,rE as x,sD as S,tE as C,wT as w,yx as T,zT as E}from"./dist-DaCTW3Ac.js";import{t as D}from"./button-BEV3ua5Q.js";import{A as O,B as k,C as A,Et as j,F as M,G as N,I as P,K as F,L as I,N as ve,P as ye,R as be,S as L,Tt as xe,W as Se,X as Ce,Y as we,b as R,ht as Te,x as z,y as B,yt as Ee,z as De}from"./index-D4GXPU2x.js";import{a as Oe,i as V,n as ke,o as H,r as U,t as Ae}from"./table-B34f3Klh.js";var W=t(e(),1),G=n(),K=`all`;function q(e){switch(e){case`image`:return l();case`audio`:return b();case`video`:return u();case`pdf`:return o();case`document`:return g();case`archive`:return h();default:return s()}}function J(){let[e,t]=(0,W.useState)(K),[n,o]=(0,W.useState)(K),[s,l]=(0,W.useState)(K),[u,h]=(0,W.useState)(K),[g,b]=(0,W.useState)(null),J=y(_.files.softDelete),Y=O();function je(){t(K),o(K),l(K),h(K)}async function Me(){let e=g;if(b(null),e)try{await J({fileId:e.id}),Y.success(he())}catch(e){Y.error(te(),e)}}let X=S(_.files.listMine,{direction:e===K?void 0:e,chatId:n===K?void 0:n,instanceName:s===K?void 0:s,category:u===K?void 0:u}),Ne=(0,W.useMemo)(()=>new Intl.DateTimeFormat(ge(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:i()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=X,$=e!==K||n!==K||s!==K||u!==K;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}),(0,G.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,G.jsxs)(B,{value:e,onValueChange:t,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":me(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:x()}),(0,G.jsx)(z,{value:`inbound`,children:v()}),(0,G.jsx)(z,{value:`outbound`,children:C()})]})]}),(0,G.jsxs)(B,{value:n,onValueChange:o,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":pe(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:ee()}),Q.chats.map(e=>(0,G.jsx)(z,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,G.jsxs)(B,{value:s,onValueChange:l,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":ae(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:de()}),Q.instances.map(e=>(0,G.jsx)(z,{value:e,children:e},e))]})]}):null,(0,G.jsxs)(B,{value:u,onValueChange:h,children:[(0,G.jsx)(L,{size:`sm`,"aria-label":le(),children:(0,G.jsx)(A,{})}),(0,G.jsxs)(R,{children:[(0,G.jsx)(z,{value:K,children:ue()}),Q.categories.map(e=>(0,G.jsx)(z,{value:e,children:q(e)},e))]})]}),$?(0,G.jsxs)(D,{variant:`ghost`,size:`sm`,onClick:je,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,G.jsx)(Ee,{size:14,"aria-hidden":!0}),ie()]}):null]}),Z.length===0?(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:$?se():ne()}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Ae,{children:[(0,G.jsx)(Oe,{children:(0,G.jsxs)(H,{children:[(0,G.jsx)(V,{children:ce()}),(0,G.jsx)(V,{children:r()}),(0,G.jsx)(V,{children:E()}),(0,G.jsx)(V,{children:oe()}),(0,G.jsx)(V,{children:d()}),(0,G.jsx)(V,{className:`text-right`,children:c()})]})}),(0,G.jsx)(ke,{children:Z.map(e=>(0,G.jsxs)(H,{children:[(0,G.jsx)(U,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,G.jsx)(U,{title:e.mimeType,children:q(e.category)}),(0,G.jsx)(U,{children:(0,G.jsx)(Ce,{variant:`secondary`,children:e.direction===`inbound`?v():C()})}),(0,G.jsx)(U,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,G.jsx)(U,{className:`whitespace-nowrap text-muted-foreground`,children:Ne.format(e.createdAt)}),(0,G.jsx)(U,{className:`text-right`,children:(0,G.jsxs)(Se,{children:[(0,G.jsx)(we,{asChild:!0,children:(0,G.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":p(),children:(0,G.jsx)(xe,{size:16})})}),(0,G.jsxs)(N,{align:`end`,children:[e.url?(0,G.jsx)(F,{asChild:!0,children:(0,G.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,G.jsx)(j,{size:14}),re()]})}):(0,G.jsxs)(F,{disabled:!0,children:[(0,G.jsx)(j,{size:14}),a()]}),(0,G.jsxs)(F,{variant:`destructive`,onSelect:()=>b({id:e._id,filename:e.filename}),children:[(0,G.jsx)(Te,{size:14}),f()]})]})]})})]},e._id))})]}),Pe?(0,G.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:w({cap:Fe})}):null]}),(0,G.jsx)(ve,{open:g!==null,onOpenChange:e=>!e&&b(null),children:(0,G.jsxs)(P,{children:[(0,G.jsxs)(De,{children:[(0,G.jsx)(k,{children:_e()}),(0,G.jsx)(I,{children:m()})]}),(0,G.jsxs)(be,{children:[(0,G.jsx)(M,{children:T()}),(0,G.jsx)(ye,{onClick:()=>void Me(),children:f()})]})]})})]})}export{J as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Oo as r,ko as i}from"./dist-CKhDstdM.js";import{t as a}from"./TimeRangePicker-BJ_SDnZN.js";import{t as o}from"./button-HRR8tdJ2.js";import{Z as s,vt as c,yt as l}from"./index-DR0RpyTI.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)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(a,{value:m,onChange:h}):null,(0,d.jsxs)(o,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(l,{}),r()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_s as r,vs as i}from"./dist-DaCTW3Ac.js";import{t as a}from"./button-BEV3ua5Q.js";import{Z as o,vt as s,yt as c}from"./index-D4GXPU2x.js";import{t as l}from"./TimeRangePicker-CE9ZtSJB.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};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,Aa as i,Ai as a,Bi as o,Ca as s,Ci as c,Da as l,Di as u,Ea as d,Ei as f,Fi as p,Gi as m,Hi as h,Ii as g,Ji as _,Ki as v,Li as y,Ma as b,Mi as x,Ni as S,Oa as C,Oi as ee,Pi as w,Qi as T,Ri as E,Sa as D,Ta as O,Ti as te,Ui as k,Vi as A,Wi as ne,Xi as re,Yi as ie,Zi as j,_a as M,aa as ae,ba as N,ca as oe,da as se,eD as P,ea as ce,fa as le,ga as ue,ha as de,ia as fe,ja as pe,ji as me,ka as he,ki as ge,la as _e,ma as ve,na as ye,oD as F,oa as be,pa as xe,qi as Se,ra as I,sD as L,sa as Ce,tD as R,ta as we,ua as Te,va as Ee,wa as De,wi as z,xa as Oe,ya as ke,zi as Ae}from"./dist-DaCTW3Ac.js";import{t as je}from"./x-CE-91um7.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-BliLi2ac.js";import{t as H}from"./button-BEV3ua5Q.js";import{$ as Pe,A as U,At as Fe,C as Ie,Q as Le,S as Re,X as W,Z as G,_ as K,_t as q,b as ze,et as Be,gt as J,j as Ve,m as He,nt as Ue,ot as We,rt as Ge,x as Ke,y as qe}from"./index-D4GXPU2x.js";import{t as Je}from"./FilterBar-BHeRG2h_.js";import{t as Ye}from"./DataTableShell-DZ-SHPgB.js";import{t as Y}from"./DetailChips-DsV2pOpk.js";var Xe=R(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ze=R(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),X=R(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qe=R(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return r();case`user`:return T();case`pending`:return j();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=L(P.groups.listGroups,{}),t=L(P.me.getMe,{host:We})?.role===`admin`,n=F(P.groups.createGroup),r=F(P.groups.updateGroup),a=F(P.groups.deleteGroup),o=Ve(),c=U(),[u,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)($),[v,y]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(``),ee=(0,Z.useMemo)(()=>{if(!e)return e;let t=x.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,x]);function w(){h(null),_($),p(!0)}function T(e){h(e),_({name:e.name,description:e.description??``}),p(!0)}async function E(){try{m?await r({groupId:m._id,name:g.name,description:g.description}):await n({name:g.name,description:g.description||void 0}),_($),h(null),p(!1)}catch(e){c.error(f(),e)}}async function k(e){if(await o({title:xe({name:e.name}),description:le(),confirmWord:e.name,confirmLabel:se(),cancelLabel:ke(),destructive:!0}))try{await a({groupId:e._id})}catch(e){c.error(te(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),(0,Q.jsx)(Je,{q:x,onQChange:S,onReset:()=>S(``),canReset:x!==``,searchPlaceholder:De()}),(0,Q.jsx)(Ye,{title:b(),rows:ee,addLabel:i(),onAdd:t?w:void 0,emptyHint:he(),columns:[{header:C(),cell:e=>e.name,sort:e=>e.name},{header:l(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:d(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:O(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(J,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:s(),onSelect:()=>y({groupId:e._id,name:e.name})},...t?[{label:D(),onSelect:()=>T(e)},{label:Oe(),variant:`destructive`,onSelect:()=>void k(e)}]:[]]}),(0,Q.jsx)(He,{open:u,onOpenChange:p,title:m?M():Ee(),description:ue(),canSubmit:!!g.name.trim(),onSubmit:E,submitLabel:N(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:de()}),(0,Q.jsx)(G,{value:g.name,onChange:e=>_({...g,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ve()}),(0,Q.jsx)(G,{value:g.description,onChange:e=>_({...g,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:v?.groupId??null,groupName:v?.name??``,open:v!==null,onOpenChange:e=>{e||y(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Xe,{size:14,"aria-hidden":!0}),ye()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ce({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[we(),(0,Q.jsx)(Fe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=L(P.groups.getGroup,n&&e?{groupId:e}:`skip`),o=L(P.groups.listAssignableInstances,n?{}:`skip`),s=L(P.groups.listAssignableUsers,n?{}:`skip`),c=F(P.groups.addMember),l=F(P.groups.removeMember),u=F(P.groups.bulkSetMembers),d=F(P.groups.setGroupManager),f=U(),[p,h]=(0,Z.useState)(``),[g,y]=(0,Z.useState)(``),[b,x]=(0,Z.useState)(`members`),[S,C]=(0,Z.useState)(1),[w,T]=(0,Z.useState)(new Set),E=(0,Z.useRef)(null),D=(0,Z.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),O=(0,Z.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),te=i?.viewerIsAdmin===!0,k=(0,Z.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Z.useEffect)(()=>{h(``),y(``),x(`members`),C(1),E.current=null},[n,e]),(0,Z.useEffect)(()=>{C(1)},[p]),(0,Z.useEffect)(()=>{n&&i&&e&&E.current!==e&&(E.current=e,T(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let A=(0,Z.useMemo)(()=>s?$e(s,p,w):[],[s,p,w]);async function ne(t,n){if(e)try{n?await l({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){f.error(z(),e)}}async function ie(t,n){if(e)try{await d({groupId:e,userId:t,manager:!n})}catch(e){f.error(ee(),e)}}let j=rt(A,e=>D.has(e.userId)),M=A.filter(e=>D.has(e.userId)).length,N=it(A,S,ot);async function se(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await u({groupId:e,userIds:t,member:j!==`all`})}catch(e){f.error(z(),e)}}return(0,Q.jsx)(Le,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Pe,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(Ge,{children:Te({name:t})}),(0,Q.jsx)(Be,{children:_e()})]}),(0,Q.jsxs)(Ne,{value:b,onValueChange:x,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),oe(),i?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:D.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),be(),i?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),Ae(),i?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:s===void 0||i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:v()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:p,onChange:e=>h(e.target.value),placeholder:Ce(),className:`oc-access__search`}),A.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):(0,Q.jsxs)(Q.Fragment,{children:[A.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:j===`all`?!0:j===`some`?`indeterminate`:!1,onCheckedChange:()=>void se(),"aria-label":I()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:I()}),(0,Q.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[M,` / `,A.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:N.pageItems.map(e=>{let t=D.has(e.userId),n=tt(e),r=O.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:t,onCheckedChange:()=>void ne(e.userId,t),"aria-label":re({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&te?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?ge():a(),title:r?ge():a(),onClick:()=>void ie(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":me(),title:me(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:N.page,pageCount:N.pageCount,onPage:C})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:g,onChange:e=>y(e.target.value),placeholder:ae(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:g},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=L(P.groups.listAssignableAgents,{instanceName:t}),s=F(P.groups.assignAgentToGroup),l=F(P.groups.removeAgentFromGroup),u=F(P.groups.bulkSetGroupAgents),d=U(),[f,p]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{p(1)},[i]),!e)return null;let m=et(a?.agents??[],i),g=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&m.length===0)return null;let _=m.filter(e=>e.presentInLastOk!==!1),v=rt(_,e=>r.has(`${t}/${e.agentId}`)),y=it(m,f,ot);async function b(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(c(),e)}}async function x(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){d.error(c(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),g?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:h()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Se()}):m.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g?k():ne()}):(0,Q.jsxs)(Q.Fragment,{children:[_.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":I()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:I()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:i,disabled:a&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":ie({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":o(),title:o(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:A()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=L(P.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=F(P.charts.assignChartToGroup),r=F(P.charts.removeChartFromGroup),i=F(P.charts.setGroupDefaultChart),a=F(P.charts.addChartToGroupPool),o=F(P.charts.removeChartFromGroupPool),s=U();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()});let{pool:c,addable:l,canManagePool:d}=t;if(c.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:E()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(u(),e)}}async function m(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(u(),e)}}async function h(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(u(),e)}}async function v(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(u(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":w({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":S(),title:S(),children:(0,Q.jsx)(J,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void m(e.chartKey),children:x()}):null,d?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":p({name:e.name}),title:p({name:e.name}),onClick:()=>void v(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?l.length>0?(0,Q.jsxs)(qe,{value:``,onValueChange:e=>void h(e),children:[(0,Q.jsx)(Re,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ie,{placeholder:g()})}),(0,Q.jsx)(ze,{children:l.map(e=>(0,Q.jsx)(Ke,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y()}):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{$h as r,$m as i,Ah as a,Bh as o,Bm as s,Cg as c,Ch as l,Dh as u,Eg as d,Eh as f,Fh as p,Gh as m,Gm as h,Hh as g,Hm as _,Ih as v,Iu as ee,Jh as y,Jm as b,Kh as te,Km as x,Lh as ne,Lu as S,Mh as C,Nh as re,Oh as w,Ph as ie,Qh as ae,Qm as oe,Rh as se,Sg as T,Sh as E,Tg as ce,Th as le,Uh as D,Um as ue,Vh as de,Vm as fe,Wh as pe,Wm as me,Xh as he,Xm as ge,Yh as _e,Ym as ve,Zh as ye,Zm as be,_g as xe,_h as Se,ag as Ce,ah as we,bg as Te,bh as Ee,cS as De,cg as Oe,ch as ke,dg as Ae,dh as je,eD as O,eg as Me,eh as Ne,fg as Pe,fh as k,gg as Fe,gh as Ie,hg as Le,hh as Re,iD as A,ig as ze,ih as Be,jh as Ve,kh as He,lg as Ue,lh as We,mg as Ge,mh as Ke,ng as qe,nh as Je,oD as j,og as Ye,oh as Xe,pg as Ze,ph as Qe,qh as $e,qm as et,rg as tt,rh as nt,sD as M,sS as rt,sg as it,sh as N,tg as at,th as ot,ug as st,uh as P,vg as ct,vh as lt,wg as ut,wh as dt,xg as ft,xh as pt,yg as mt,yh as ht,zh as gt}from"./dist-DaCTW3Ac.js";import{a as _t,c as vt}from"./FieldLabel-CViQ_orB.js";import{t as F}from"./button-BEV3ua5Q.js";import{$ as I,A as L,C as R,H as yt,Q as z,S as B,U as bt,V as xt,X as V,Z as H,_ as U,b as W,et as G,j as St,m as Ct,nt as K,rt as q,x as J,y as wt}from"./index-D4GXPU2x.js";import{t as Tt}from"./DataTableShell-DZ-SHPgB.js";import{InstanceConfigDialog as Et}from"./BridgeTab-hatWqupL.js";var Y=t(e(),1),X=[`conversational`,`documentary`],Dt=new Set(X),Ot=`conversational`;function kt(e){let t=new Set((e??[]).filter(e=>Dt.has(e)));return t.size===0?[Ot]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:_t},At={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function jt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Mt(){let e=M(O.admin.listInstances,{}),t=M(O.agents.listAllInstanceAgents,{}),n=j(O.admin.upsertInstance),i=j(O.admin.deleteInstance),a=L(),[o,s]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(Q),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(null);async function b(){try{await n({instanceId:v??void 0,name:l.name,gatewayUrl:l.gatewayUrl,bridgeUrl:l.bridgeUrl||void 0,displayName:l.displayName||void 0,kind:l.kind,gatewayVersion:l.gatewayVersion||void 0,gatewayHttpUrl:l.gatewayHttpUrl||void 0,streamTransport:l.streamTransport}),u(Q),y(null),s(!1)}catch(e){a.error(ut(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),(0,Z.jsx)(`strong`,{children:T()}),ft()]}),(0,Z.jsx)(Tt,{title:Te(),rows:e,addLabel:mt(),onAdd:()=>{y(null),u(Q),s(!0)},emptyHint:ct(),columns:[{header:xe(),cell:e=>e.name,sort:e=>e.name},{header:Fe(),cell:e=>(0,Z.jsx)(V,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Le(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Ge(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:d(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(V,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?fe():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:st(),onSelect:()=>{y(e._id),u(jt(e)),s(!0)}},{label:ce(),onSelect:()=>p(e.name)},{label:_e(),onSelect:()=>_(e)},{label:Ze(),onSelect:()=>h(e)},{label:Pe(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:Pe(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(Ct,{open:o,onOpenChange:s,title:v?Ue():Ae(),description:it(),canSubmit:!!(l.name&&l.gatewayUrl),onSubmit:b,submitLabel:Ye(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Ce(),children:[(0,Z.jsx)(H,{value:l.name,disabled:v!==null,onChange:e=>u({...l,name:e.target.value})}),v?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Oe()}):null]}),(0,Z.jsx)($,{label:ze(),children:(0,Z.jsxs)(wt,{value:l.kind,onValueChange:e=>u({...l,kind:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(R,{})}),(0,Z.jsxs)(W,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:tt(),children:(0,Z.jsx)(H,{value:l.gatewayUrl,onChange:e=>u({...l,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:qe(),children:(0,Z.jsx)(H,{value:l.bridgeUrl,placeholder:at(),onChange:e=>u({...l,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Me(),children:(0,Z.jsx)(H,{value:l.displayName,onChange:e=>u({...l,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:S(),children:[(0,Z.jsxs)(wt,{value:l.streamTransport,onValueChange:e=>u({...l,streamTransport:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(R,{})}),(0,Z.jsx)(W,{children:vt.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ee()})]}),(0,Z.jsx)($,{label:r(),children:(0,Z.jsx)(H,{value:l.gatewayVersion,placeholder:ae(),onChange:e=>u({...l,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:ye(),children:(0,Z.jsx)(H,{value:l.gatewayHttpUrl,placeholder:he(),onChange:e=>u({...l,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Ht,{instanceName:f,open:f!==null,onOpenChange:e=>{e||p(null)}}),m?(0,Z.jsx)(Et,{instance:m,onClose:()=>h(null)},m._id):null,g?(0,Z.jsx)(Nt,{instance:g,onClose:()=>_(null)},g._id):null]})}function Nt({instance:e,onClose:t}){let n=M(O.instanceSecrets.listInstanceSecretStatus,{}),r=At[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(z,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(I,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(K,{children:[(0,Z.jsx)(q,{children:y({instance:e.displayName??e.name})}),(0,Z.jsx)(G,{children:$e()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(It,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ft,{instance:e})}),(0,Z.jsx)(Pt,{instance:e})]})})}function Pt({instance:e}){let t=A(O.instanceSync.forceInstanceSync),n=L(),[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(u());break;case`no_agents`:n.success(le());break;case`no_bridge_url`:n.error(dt());break;case`deploy_misconfigured`:n.error(l());break;case`unauthorized`:n.error(pt());break;case`not_served`:n.error(Ee());break;default:n.error(E());break}}catch(e){n.error(f(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ht()}),(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?w():He()})})]})}function Ft({instance:e}){let t=M(O.bridgeAuth.listBridgeAuthStatus,{}),n=A(O.bridgeAuth.mintBridgeSecret),r=j(O.bridgeAuth.revokeBridgeSecret),i=L(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(k(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(Qe())}catch(e){i.error(k(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:lt(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{variant:f?`outline`:`secondary`,children:f?`${D()} · ${d.prefix}…${d.lastFour}`:g()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?Re():Ie()}),f?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:Ke()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:je()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?De():rt()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:P()})]}):null]})}function It({instanceId:e,field:t,updatedAt:n}){let r=A(O.instanceSecrets.setInstanceSecret),i=j(O.instanceSecrets.clearInstanceSecret),s=A(O.deviceIdentity.generateDeviceIdentity),c=L(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[h,_]=(0,Y.useState)(null),[ee,y]=(0,Y.useState)(!1),b=n!==null,x=t===`deviceIdentity`,S=t===`token`?te():t===`deviceIdentity`?m():pe();async function w(){if(!(!l.trim()||d)){f(!0);try{await r({instanceId:e,field:t,plaintext:l}),u(``),_(null),y(!1),c.success(ne())}catch(e){c.error(v(),e)}finally{f(!1)}}}async function ae(){if(!d){f(!0);try{await i({instanceId:e,field:t}),_(null),y(!1),c.success(p())}catch(e){c.error(v(),e)}finally{f(!1)}}}async function oe(){if(!d){f(!0);try{_(await s({instanceId:e})),y(!1),c.success(C())}catch(e){c.error(a(),e)}finally{f(!1)}}}let T=h?`openclaw devices approve ${h.id}`:``;async function E(){if(T)try{await navigator.clipboard.writeText(T),y(!0)}catch{}}return(0,Z.jsxs)($,{label:S,children:[x?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{variant:b?`outline`:`secondary`,children:b?D():g()}),(0,Z.jsx)(H,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:b?o():de(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void w(),disabled:d||l.trim().length===0,children:gt()}),x?(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void oe(),disabled:d,children:ie()}):null,b?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void ae(),disabled:d,children:se()}):null]})]}),h?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:C()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:T}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:ee?De():rt()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{_(null),y(!1)},children:P()})]}):null]})}var Lt={conversational:Je,documentary:Ne},Rt={conversational:ot,documentary:i},zt=e=>(Lt[e]??(()=>e))(),Bt=e=>(Rt[e]??(()=>``))();function Vt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:Xe()}),t.map(e=>(0,Z.jsx)(V,{variant:`secondary`,className:`oc-agenttype__chip`,title:Bt(e),children:zt(e)},e)),(0,Z.jsxs)(xt,{children:[(0,Z.jsx)(bt,{asChild:!0,children:(0,Z.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:we()})}),(0,Z.jsxs)(yt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Be()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:nt()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(U,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:zt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Bt(r)})]})]},r)})})]})]})]})}function Ht({instanceName:e,open:t,onOpenChange:n}){let r=M(O.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=j(O.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(O.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(O.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=j(O.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(O.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(O.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=j(O.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(O.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=kt(r);e.setQuery(O.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=j(O.agents.removeInstanceAgent),l=St(),u=L();async function d(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(N(),e)}}async function f(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){u.error(N(),e)}}async function p(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){u.error(N(),e)}}async function m(t,n){if(e&&await l({title:ge({name:n}),description:ve(),confirmLabel:b(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(et())}catch(e){u.error(N(),e)}}return(0,Z.jsx)(z,{open:t,onOpenChange:n,children:(0,Z.jsxs)(I,{className:`oc-access`,children:[(0,Z.jsxs)(K,{children:[(0,Z.jsx)(q,{children:We({name:e??``})}),(0,Z.jsx)(G,{children:ke()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:x()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?h():r.discovery.lastPollOk?me():ue({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:_()}):(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)(U,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void d(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(V,{variant:`outline`,className:`oc-access__gone`,children:s()}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void m(e.agentId,i),children:be()})]}):n?(0,Z.jsx)(V,{variant:`default`,children:fe()}):(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void f(e.agentId),children:oe()})]}),e.enabled?(0,Z.jsx)(Vt,{agentId:e.agentId,types:a,onToggle:t=>void p(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{Mt as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Av as r,Bv as i,Cv as a,Dv as o,Ev as s,Fv as c,Gv as l,Hv as u,Iv as d,Jv as ee,Kv as te,Lv as ne,Mv as re,Nv as ie,Ov as ae,Pv as f,Rv as oe,Sv as p,Tv as se,Uv as m,Vv as h,Wv as g,_t as _,_v as v,av as y,bv as b,cv as ce,dt as x,dv as le,eD as S,ft as C,fv as w,gt as T,gv as E,ht as D,hv as O,iD as k,iv as A,jv as j,kv as M,lv as N,mt as P,mv as F,nv as I,oD as L,ov as R,pt as z,pv as B,qv as V,rv as H,sD as U,sv as W,ut as ue,uv as de,vt as fe,vv as pe,wv as me,xv as he,yv as ge,zv as _e}from"./dist-DaCTW3Ac.js";import{t as G}from"./button-BEV3ua5Q.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-D4GXPU2x.js";import{t as we}from"./DataTableShell-DZ-SHPgB.js";var J=t(e(),1),Y=n();function Te(){let e=U(S.integrations.status.status,{}),t=L(S.admin.setIntegrationConfig),[n,x]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&x(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ee()});let C=n,D=(e,t,n)=>x({...C,[e]:{...C[e],[t]:n}}),k=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[V(),` `,(0,Y.jsx)(`strong`,{children:te()}),` `,l()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:g()}):(0,Y.jsx)(K,{variant:`outline`,children:m()}):(0,Y.jsx)(K,{variant:`outline`,children:u()}),note:i(),children:[(0,Y.jsx)(Z,{label:oe(),children:(0,Y.jsx)(q,{value:C.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>D(`langfuse`,`host`,e.target.value),onBlur:()=>k(`langfuse`,{host:C.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:f(),checked:C.langfuse.enabled??!0,onChange:e=>{D(`langfuse`,`enabled`,e),k(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:g()}):(0,Y.jsx)(K,{variant:`outline`,children:m()}):(0,Y.jsx)(K,{variant:`outline`,children:u()}),note:_e(),children:[(0,Y.jsx)(Z,{label:ne(),children:(0,Y.jsx)(q,{value:C.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>D(`opik`,`baseUrl`,e.target.value),onBlur:()=>k(`opik`,{baseUrl:C.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:d(),children:(0,Y.jsx)(q,{value:C.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||c(),onChange:e=>D(`opik`,`workspace`,e.target.value),onBlur:()=>k(`opik`,{workspace:C.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:f(),checked:C.opik.enabled??!0,onChange:e=>{D(`opik`,`enabled`,e),k(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:g()}):(0,Y.jsx)(K,{variant:`outline`,children:m()}):(0,Y.jsx)(K,{variant:`outline`,children:fe()}),note:_(),children:[(0,Y.jsx)(Z,{label:T(),children:(0,Y.jsx)(q,{value:C.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>D(`otlp`,`endpoint`,e.target.value),onBlur:()=>k(`otlp`,{endpoint:C.otlp.endpoint??``})})}),(0,Y.jsx)(Ee,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:f(),checked:C.otlp.enabled??!0,onChange:e=>{D(`otlp`,`enabled`,e),k(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:ie(),status:(0,Y.jsx)(K,{variant:`outline`,children:h()}),note:re(),children:[(0,Y.jsx)(Z,{label:j(),children:(0,Y.jsx)($,{value:C.tts.auto??`off`,options:[[`off`,r()],[`always`,M()],[`inbound`,ae()],[`tagged`,o()]],onChange:e=>{D(`tts`,`auto`,e),k(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:s(),children:(0,Y.jsx)($,{value:C.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,se()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{D(`tts`,`provider`,e),k(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:me(),children:(0,Y.jsx)(q,{value:C.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>D(`tts`,`model`,e.target.value),onBlur:()=>k(`tts`,{model:C.tts.model??``})})}),(0,Y.jsx)(Z,{label:a(),children:(0,Y.jsx)(q,{value:C.tts.voice??``,placeholder:p(),onChange:e=>D(`tts`,`voice`,e.target.value),onBlur:()=>k(`tts`,{voice:C.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:he(),status:(0,Y.jsx)(K,{variant:`outline`,children:h()}),note:e.secrets.openai?b():ge(),children:[(0,Y.jsx)(Q,{label:pe(),checked:C.talk.enabled??!1,onChange:e=>{D(`talk`,`enabled`,e),k(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:v(),children:(0,Y.jsx)($,{value:C.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{D(`talk`,`realtimeProvider`,e),k(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:E(),children:(0,Y.jsx)(q,{value:C.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>D(`talk`,`realtimeModel`,e.target.value),onBlur:()=>k(`talk`,{realtimeModel:C.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:a(),children:(0,Y.jsx)(q,{value:C.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>D(`talk`,`voice`,e.target.value),onBlur:()=>k(`talk`,{voice:C.talk.voice??``})})}),(0,Y.jsx)(Z,{label:O(),children:(0,Y.jsx)($,{value:C.talk.transport??`webrtc`,options:[[`webrtc`,F()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{D(`talk`,`transport`,e),k(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:B(),children:(0,Y.jsx)(q,{value:C.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>D(`talk`,`speechLocale`,e.target.value),onBlur:()=>k(`talk`,{speechLocale:C.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:w(),checked:C.talk.interruptOnSpeech??!0,onChange:e=>{D(`talk`,`interruptOnSpeech`,e),k(`talk`,{interruptOnSpeech:e})}})]}),(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:le()}),(0,Y.jsx)(K,{variant:`outline`,children:de()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[N(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(we,{title:ce(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:W(),columns:[{header:R(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:y(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:A(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:H(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:I(),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=k(S.integrations.otlpSecret.setOtlpHeaders),n=L(S.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1),l=async()=>{c(!0),o(null);try{await t({headersJson:r}),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{c(!1)}};return(0,Y.jsxs)(Z,{label:D(),children:[(0,Y.jsx)(q,{value:r,placeholder:e?P():z(),onChange:e=>i(e.target.value)}),(0,Y.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:s||r.trim().length===0,onClick:()=>void l(),children:C()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:s,onClick:()=>void n({}),children:x()}):null]}),a?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:ue()})]})}export{Te as IntegrationsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,Dy as i,Ey as a,Oy as o,Qc as s,Zc as c,al as l,cl as u,eD as d,eb as f,el as p,il as m,ky as h,ll as g,nl as _,ol as v,rl as y,sD as b,sl as x,tl as S,ul as C,vy as w,yy as T}from"./dist-DaCTW3Ac.js";import{Mt as ee,a as te,jt as ne,n as re,ot as E,r as D}from"./index-D4GXPU2x.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-9-MMSY9k.js";import{n as N,t as P}from"./TimeRangePicker-CE9ZtSJB.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=b(d.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=b(d.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:f()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:h()}),(0,I.jsx)(j,{children:i()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(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,s=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),c=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[w(),` p50 `,R(c.cP50),` `,o()]}),(0,I.jsxs)(`span`,{children:[T(),` p50 `,R(c.aP50),` `,o()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":h(),children:[(0,I.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:C(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:g(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:u(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:x(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:v(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:l(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=ee({from:`/settings/kpi`}),t=ne({from:`/settings/kpi`}),n=D(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...te(e)})}),{from:i,to:a}=N(n),{rowLimit:o,buckets:s}=K(i,a),c=b(d.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),l=(0,F.useMemo)(()=>{let e=new Map;for(let t of c??[]){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>s&&e.set(t,n.slice(n.length-s));return e},[c,s]),u=(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:y()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return c===void 0?(0,I.jsxs)(I.Fragment,{children:[u,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:_()})]}):c.length===0?(0,I.jsxs)(I.Fragment,{children:[u,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]}):(0,I.jsxs)(I.Fragment,{children:[u,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(l.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:l.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,i=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&&i>0?` oc-kpi__value--error`:``),children:Q(i)}),(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:p({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:r()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:s({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":c({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{$C as r,AC as i,BC as a,CC as o,DC as s,DE as c,EC as l,FC as u,GC as d,HC as f,IC as ee,JC as p,KC as m,LC as h,MC as g,NC as te,OC as ne,PC as _,QC as re,RC as ie,SC as ae,SE as oe,TC as se,UC as ce,VC as le,WC as ue,XC as de,YC as v,ZC as y,_E as b,bC as x,cE as S,dE as C,eD as w,fE as T,gE as E,hE as D,jC as O,kC as k,lE as A,mE as j,oD as M,og as N,pE as P,qC as F,sD as I,sE as L,uE as R,vE as z,wC as B,xC as V,yE as fe,zC as pe}from"./dist-DaCTW3Ac.js";import{t as H}from"./button-BEV3ua5Q.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-D4GXPU2x.js";var q=t(e(),1),J=[{id:`messages`,label:()=>r()},{id:`composer`,label:()=>re()},{id:`sidebar`,label:()=>y()},{id:`other`,label:()=>de()}],Y={showSource:{category:`messages`,label:()=>v(),help:()=>p()},showReport:{category:`messages`,label:()=>F(),help:()=>m()},copyAssistant:{category:`messages`,label:()=>d()},copyUser:{category:`messages`,label:()=>ue()},showDelete:{category:`messages`,label:()=>ce()},showTools:{category:`messages`,label:()=>f(),help:()=>le()},voiceInput:{category:`composer`,label:()=>a(),help:()=>pe()},showChatAge:{category:`sidebar`,label:()=>ie(),help:()=>h()},showChatProvider:{category:`sidebar`,label:()=>ee(),help:()=>u()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function be(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],Se={voiceInput:`voiceInput`};function Ce(e){return xe.includes(e)}function Z(e){return e===`admin`}function we(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Q(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Ce(e)?Se[e]:void 0}var $=n(),Ee={voiceInput:()=>B()};function De({prefKey:e,ui:t}){let n=M(w.admin.setUiPrefDefault),r=M(w.admin.setFeatureEnabled),i=Te(e),a=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:ne()}),(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:ae()}),(0,$.jsx)(K,{value:`off`,children:V()}),(0,$.jsx)(K,{value:`inherit`,children:x()})]})]}),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":s()}),s()]}):null]}),a?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),a=I(w.me.getMe,{host:G}),s=a?.ui,u=Z(a?.role)&&n,d=M(w.me.setUiPref).withOptimisticUpdate(ge),f=(0,q.useMemo)(()=>s?be(Object.keys(s.effective),e):[],[s,e]);return s?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(a?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":k()}),k()]}):null,u?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:l()}),(0,$.jsx)(`p`,{children:se()}),(0,$.jsx)(`p`,{children:o()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:_(),"aria-label":_(),className:`mb-2`}),f.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:te()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:f.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?.(),a=s.locked[e],o=s.effective[e],c=s.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${a?` is-locked`:``}${c&&!a?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,a?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:g()}):c?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:O()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!a&&c?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void d({key:e,value:null}),children:i()}):null,(0,$.jsx)(W,{checked:o,disabled:a,onCheckedChange:t=>void d({key:e,value:t===!0}),"aria-label":n})]}),u?(0,$.jsx)(De,{prefKey:e,ui:s}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:c()})}function ke(){let e=I(w.me.getMe,{host:G}),t=M(w.me.setLocale),n=M(w.me.setMyName),r=me(),i=e?.locale??`default`,a=e?.name??``,[o,s]=(0,q.useState)(null),c=o??a,l=c.trim()!==a.trim();async function u(){try{await n({name:c}),s(null),r.success(D())}catch(e){r.error(j(),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:fe()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:z()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{className:`max-w-xs`,value:c,maxLength:120,placeholder:b(),onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&l&&(e.preventDefault(),u())}}),(0,$.jsx)(H,{size:`sm`,disabled:!l,onClick:()=>void u(),children:N()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:E()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:P()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:T()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:i===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?S():e===`en`?L():oe()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:C()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:R()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:A()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
@@ -0,0 +1,2 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Au as r,Bu as i,Cu as a,Du as o,Eu as s,Mu as c,Nu as l,Ou as u,Su as d,Tu as f,Vu as p,_u as m,bu as h,eD as g,gu as _,hu as v,ju as y,ku as b,mu as x,oD as S,sD as C,vu as w,wu as T,xu as E,yu as D}from"./dist-DaCTW3Ac.js";import{d as O,f as k,i as A,l as j,n as M,r as N,t as P,u as F}from"./FieldLabel-CViQ_orB.js";import{t as I}from"./button-BEV3ua5Q.js";import{A as L,C as R,S as z,_ as B,b as V,x as H,y as U}from"./index-D4GXPU2x.js";/* empty css */var W=t(e(),1),G=n(),K={media_delivery:{label:u,help:o},documentary_fetch:{label:s,help:f},inbound_files:{label:T,help:a}},q={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
+ - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`},J={outboundDir:_,references:v,files:x};function Y(){let e=C(g.admin.listInstances,{}),[t,n]=(0,W.useState)(null);if(e===void 0)return(0,G.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,G.jsx)(`div`,{className:`oc-injtab`,children:(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:E()})});let r=e.find(e=>e._id===t)??e[0];return(0,G.jsxs)(`div`,{className:`oc-injtab`,children:[(0,G.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,G.jsx)(M,{label:l(),help:c()}),(0,G.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,G.jsx)(`span`,{children:d()}),(0,G.jsxs)(U,{value:r._id,onValueChange:e=>n(e),children:[(0,G.jsx)(z,{size:`sm`,className:`min-w-44`,children:(0,G.jsx)(R,{})}),(0,G.jsx)(V,{children:e.map(e=>(0,G.jsx)(H,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,G.jsx)(X,{instance:r},r._id)]})}function X({instance:e}){let t=S(g.admin.upsertInstanceConfig),n=L(),r=e.config??{},[a,o]=(0,W.useState)(()=>A(r)),[s,c]=(0,W.useState)(!1),l=a.promptInjections,u=(e,t)=>o({...a,promptInjections:{...l,[e]:{...l[e],...t}}});async function d(){c(!0);try{await t({instanceId:e._id,config:N(a,r)})}catch(e){n.error(i(),e)}finally{c(!1)}}return(0,G.jsxs)(`div`,{className:`oc-injtab__body`,children:[F.map(e=>(0,G.jsx)(Z,{injKey:e,def:j[e],i18n:K[e],row:l[e]??{enabled:!0,template:j[e].defaultTemplate},onChange:t=>u(e,t)},e)),(0,G.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,G.jsx)(I,{size:`sm`,onClick:()=>void d(),disabled:s,children:p()})})]})}function Z({injKey:e,def:t,i18n:n,row:i,onChange:a}){let[o,s]=(0,W.useState)(!1),c=i.template.trim()!==t.defaultTemplate,l=t.togglable&&!i.enabled,u=Object.fromEntries(t.placeholders.map(e=>[e,q[e]??`{${e}}`])),d=O(e,i),f=d?k(d,u):``;return(0,G.jsxs)(`section`,{className:`oc-injcard`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,G.jsxs)(`label`,{className:`oc-field--row`,children:[(0,G.jsx)(B,{checked:i.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,G.jsx)(M,{label:n.label(),help:n.help()})]}):(0,G.jsx)(M,{label:n.label(),help:n.help()}),c&&(0,G.jsx)(`span`,{className:`oc-injection__badge`,children:r()})]}),(0,G.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:l,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,G.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:b()}),t.placeholders.map(e=>(0,G.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,G.jsx)(`code`,{children:`{${e}}`}),(0,G.jsx)(P,{text:(J[e]??(()=>e))()})]},e))]}),(0,G.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?D():h()}),c&&(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate}),children:y()})]})]}),o&&(0,G.jsx)(`div`,{className:`oc-injcard__preview`,children:f?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:f}),(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:w()})]}):(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:m()})})]})}export{Y as PromptInjectionsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Bp as i,Cm as a,Fp as o,Hp as s,Ip as ee,Lp as te,Qp as ne,Rp as re,Sm as c,Up as l,Vp as u,Xp as d,Yp as f,Zp as p,_m as m,am as h,bm as g,cm as _,dm as v,eD as y,em as ie,fm as b,gm as x,hm as S,im as ae,lm as C,mm as w,nm as T,oD as E,om as D,pm as O,rm as k,sD as A,sm as j,tm as M,um as N,vm as P,wm as F,xm as I,ym as L,zp as R}from"./dist-DaCTW3Ac.js";import{t as z}from"./button-BEV3ua5Q.js";import{A as B,X as V,Z as H,_ as U,j as W,m as G,xt as K}from"./index-D4GXPU2x.js";import{t as q}from"./roleDescriptions-DWfpUHJS.js";var J=t(e(),1),Y=n(),X=[{group:()=>F(),keys:[{key:`traces.read`,label:()=>L()},{key:`traces.read.content`,label:()=>P(),phi:!0},{key:`traces.write`,label:()=>m()}]},{group:()=>a(),keys:[{key:`kpi.read`,label:()=>L()},{key:`kpi.write`,label:()=>m()}]},{group:()=>c(),keys:[{key:`openclaw.query`,label:()=>x()},{key:`anomalies.read`,label:()=>S()},{key:`anomalies.report`,label:()=>w()}]},{group:()=>I(),keys:[{key:`chats.read`,label:()=>L()},{key:`selfheal`,label:()=>b()}]},{group:()=>g(),keys:[{key:`admin.manage`,label:()=>O()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=A(y.apiKeys.listRoles,{}),t=E(y.apiKeys.createRole),n=E(y.apiKeys.ensureRolesSeeded),a=E(y.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(y.apiKeys.listRoles,{});r&&e.setQuery(y.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),c=W(),m=B(),[g,b]=(0,J.useState)(!1),[x,S]=(0,J.useState)(Q),[w,O]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{m.error(N(),e)})},[n,m]);let P=e??[];async function F(e,t){if(Z(e.permissions)||w.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await c({title:C({name:e.name}),description:_(),confirmLabel:j()}))){O(t=>new Set(t).add(e._id));try{await a({roleId:e._id,permissions:n})}catch(e){m.error(D(),e)}finally{O(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function I(){try{await t({key:x.key,name:x.name,description:x.description||void 0,permissions:[]}),S(Q),b(!1)}catch(e){m.error(h(),e)}}let L=e===void 0,$=!L&&P.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[ae(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,k(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,T()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:M()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{S(Q),b(!0)},children:ie()})})]}),L?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:p()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?v({key:e.key}):e.key,children:[e.label(),e.phi?(0,Y.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,Y.jsx)(`tbody`,{children:P.map(e=>{let t=Z(e.permissions),n=w.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(V,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,d()]}):(0,Y.jsx)(V,{variant:`secondary`,children:f()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(r=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(U,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?l():n?s():r,onCheckedChange:()=>void F(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:g,onOpenChange:b,title:u(),description:i(),canSubmit:!!(x.key&&x.name),onSubmit:I,submitLabel:R(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:re()}),(0,Y.jsx)(H,{value:x.key,placeholder:te(),onChange:e=>S({...x,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:ee()}),(0,Y.jsx)(H,{value:x.name,onChange:e=>S({...x,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,Y.jsx)(H,{value:x.description,onChange:e=>S({...x,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,$x as i,AS as ee,BS as te,CS as ne,DS as re,ES as ie,FS as ae,GS as oe,HS as se,IS as ce,JS as le,KS as ue,LS as de,MS as fe,NS as pe,OS as me,PS as he,QS as ge,RS as _e,SS as a,TS as ve,US as ye,VS as be,WS as xe,XS as Se,YS as Ce,ZS as we,_C as Te,_S as o,aC as Ee,aS as s,bS as c,cC as De,cS as l,dC as Oe,dS as u,eC as ke,eD as d,eS as f,fC as Ae,fS as p,gC as je,gS as m,hC as Me,hS as h,iC as Ne,iD as Pe,iS as g,jS as Fe,kS as Ie,lC as Le,lS as Re,mC as ze,mS as _,nC as Be,nS as v,oC as Ve,oD as y,oS as b,pC as x,pS as S,qS as He,rC as Ue,rS as C,sC as We,sD as w,sS as T,tC as Ge,tS as E,uC as Ke,uS as D,vC as qe,vS as O,wS as Je,xS as k,yC as Ye,yS as A,zS as Xe}from"./dist-DaCTW3Ac.js";import{n as j}from"./dist-CS7nJlvC.js";import{i as Ze}from"./dist-jSH66_ji.js";import{t as M}from"./button-BEV3ua5Q.js";import{$ as N,A as Qe,At as $e,C as P,Dt as F,Mt as et,Q as I,S as L,X as R,Z as z,b as B,et as V,j as tt,jt as nt,m as rt,nt as H,rt as U,tt as it,x as W,y as G}from"./index-D4GXPU2x.js";import{t as at}from"./FilterBar-BHeRG2h_.js";import{t as ot}from"./DataTableShell-DZ-SHPgB.js";import{t as st}from"./roleDescriptions-DWfpUHJS.js";var K=t(e(),1),q=n(),ct=[{value:`never`,label:()=>s(),days:null},{value:`30`,label:()=>g(),days:30},{value:`90`,label:()=>C(),days:90}],lt=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=et({from:`/settings/serviceAccounts`}),t=nt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??J,[a,o]=(0,K.useState)(J),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),l=w(d.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===J?void 0:a,disabled:i===J?void 0:i===`disabled`}}),u=w(d.apiKeys.listKeys,{}),f=w(d.apiKeys.listRoles,{}),p=y(d.apiKeys.createServiceAccount),m=y(d.apiKeys.updateServiceAccount),h=y(d.apiKeys.deleteServiceAccount),g=Pe(d.apiKeys.mintApiKey),Re=y(d.apiKeys.revokeApiKey),_=tt(),v=Qe(),b=n!==``||a!==J||i!==J;function S(){o(J),t({search:{},replace:!0})}let[C,T]=(0,K.useState)(!1),[E,D]=(0,K.useState)(Y),[O,k]=(0,K.useState)(null),[A,j]=(0,K.useState)(new Set),[N,F]=(0,K.useState)(null),I=(0,K.useRef)(!1),[V,H]=(0,K.useState)(new Set),[U,it]=(0,K.useState)({}),[lt,X]=(0,K.useState)(null),Z=(0,K.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[u]);function Q(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{O?(await m({serviceAccountId:O,name:E.name,roleKey:E.roleKey,description:E.description}),v.success(de())):await p({name:E.name,roleKey:E.roleKey,description:E.description||void 0}),D(Y),k(null),T(!1)}catch(e){v.error(O?_e():Xe(),e)}}function pt(e){D({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),T(!0)}async function $(e){if(I.current)return;I.current=!0;let t=U[e._id]??`never`,n=ct.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await g({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(ce(),e)}finally{I.current=!1,F(null)}}async function mt(e){if(await _({title:ae(),description:(0,q.jsxs)(q.Fragment,{children:[he(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,pe(),` `,(0,q.jsx)(`strong`,{children:fe()}),` `,Fe()]}),confirmWord:e.name,confirmLabel:ee(),destructive:!0}))try{await h({serviceAccountId:e._id}),v.success(Ie(),e.name)}catch(e){v.error(me(),e)}}async function ht(e){if(await _({title:re(),description:(0,q.jsxs)(q.Fragment,{children:[ie(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ve()]}),confirmLabel:Je(),destructive:!0})&&!V.has(e._id)){H(t=>new Set(t).add(e._id));try{await Re({keyId:e._id})}catch(e){v.error(ne(),e)}finally{H(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()}),(0,q.jsxs)(at,{q:n,onQChange:s,searchPlaceholder:qe(),onReset:S,canReset:b,children:[(0,q.jsxs)(G,{value:a,onValueChange:o,children:[(0,q.jsx)(L,{size:`sm`,className:`w-40`,children:(0,q.jsx)(P,{placeholder:Te()})}),(0,q.jsxs)(B,{children:[(0,q.jsx)(W,{value:J,children:je()}),(f??[]).map(e=>(0,q.jsx)(W,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(G,{value:i,onValueChange:c,children:[(0,q.jsx)(L,{size:`sm`,className:`w-36`,children:(0,q.jsx)(P,{})}),(0,q.jsxs)(B,{children:[(0,q.jsx)(W,{value:J,children:Me()}),(0,q.jsx)(W,{value:`active`,children:ze()}),(0,q.jsx)(W,{value:`disabled`,children:x()})]})]})]}),(0,q.jsx)(ot,{title:Ae(),rows:l,addLabel:Oe(),onAdd:()=>{D(Y),k(null),T(!0)},emptyHint:Ke(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:V}),rowActions:e=>[{label:Ve(),onSelect:()=>pt(e)},{label:Le(),onSelect:()=>void $(e)},{label:A.has(e._id)?De():We(),onSelect:()=>Q(e._id)},{label:Ee(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?Ne():Ue(),onClick:()=>Q(e._id),children:A.has(e._id)?(0,q.jsx)(Ze,{}):(0,q.jsx)($e,{})})},{header:Be(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ge(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(R,{variant:`secondary`,children:e.roleKey})},{header:ke(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(R,{variant:`destructive`,children:x()}):(0,q.jsx)(R,{variant:`outline`,children:ze()})},{header:r(),cell:e=>(0,q.jsxs)(G,{value:U[e._id]??`never`,onValueChange:t=>it(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(L,{size:`sm`,className:`w-32`,children:(0,q.jsx)(P,{})}),(0,q.jsx)(B,{children:ct.map(e=>(0,q.jsx)(W,{value:e.value,children:e.label()},e.value))})]})},{header:ge(),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,q.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?we():Se({count:t})})}}]}),(0,q.jsx)(rt,{open:C,onOpenChange:e=>{T(e),e||k(null)},title:O?Ce():ue(),description:O?le():oe(),canSubmit:!!(E.name&&E.roleKey),onSubmit:ft,submitLabel:O?He():xe(),children:(0,q.jsxs)(`div`,{className:`oc-form`,children:[(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:ye()}),(0,q.jsx)(z,{value:E.name,onChange:e=>D({...E,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:se()}),(0,q.jsxs)(G,{value:E.roleKey||void 0,onValueChange:e=>D({...E,roleKey:e}),children:[(0,q.jsx)(L,{className:`w-full`,children:(0,q.jsx)(P,{placeholder:be()})}),(0,q.jsx)(B,{children:(f??[]).map(e=>(0,q.jsxs)(W,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===E.roleKey),t=e?st(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,q.jsx)(z,{value:E.description,onChange:e=>D({...E,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:lt,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[a(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:c()}),(0,q.jsx)(`th`,{children:A()}),(0,q.jsx)(`th`,{children:O()}),(0,q.jsx)(`th`,{children:o()}),(0,q.jsx)(`th`,{children:m()}),(0,q.jsx)(`th`,{children:h()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(R,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:Z(t.createdAt)}),(0,q.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:pt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,q.jsx)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?_():S()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(I,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(N,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(H,{children:[(0,q.jsx)(U,{children:p()}),(0,q.jsx)(V,{children:u({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:D()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":Re(),children:[n?(0,q.jsx)(j,{}):(0,q.jsx)(F,{}),n?l():T()]})]}),(0,q.jsx)(it,{children:(0,q.jsx)(M,{onClick:()=>{r(!1),t()},children:b()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>lt}function ft(e){return e===null?v():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,q.jsx)(R,{variant:`destructive`,children:E()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(R,{variant:`outline`,children:f()}):(0,q.jsx)(R,{variant:`outline`,children:i()})}export{X as ServiceAccountsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,B as i,C as a,D as o,E as s,F as c,G as l,H as u,I as d,L as f,M as p,N as m,O as h,P as g,R as _,S as v,T as y,U as b,V as x,W as S,_ as C,b as w,c as T,d as E,eD as D,f as O,g as k,h as A,j,k as M,l as N,m as P,oD as F,p as I,s as ee,sD as L,u as R,v as z,w as B,x as V,y as H,z as U}from"./dist-DaCTW3Ac.js";import{t as W}from"./button-BEV3ua5Q.js";import{j as G}from"./index-D4GXPU2x.js";import{t as K}from"./DataTableShell-DZ-SHPgB.js";var q=t(e(),1),J=n(),Y={hung:()=>h(),wrong_result:()=>o(),error:()=>s(),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=F(D.subAgentReports.respondToReport),[r,i]=(0,q.useState)(e.thread),[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(!1);async function u(){let t=o.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),i(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!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),` · `,B({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:a()}),(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:v()}),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`?V():w()}),(0,J.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,J.jsx)(`p`,{className:`oc-fbadmin__meta`,children:H()}),(0,J.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:z(),value:o,maxLength:2e3,rows:3,onChange:e=>s(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 u(),disabled:!o.trim()||c,children:c?k():C()})})]}),(0,J.jsxs)(`section`,{children:[(0,J.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[A({count:t.children.length}),t.childrenTruncated?` ${P()}`:``,t.textTruncated?` ${I()}`:``]}),(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?` · ${O()}`:``]}),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:E()}),(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:R()}),(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(D.subAgentReports.listForAdmin,{}),t=F(D.subAgentReports.readReport),n=F(D.subAgentReports.deleteReport),a=G(),[o,s]=(0,q.useState)(null),[h,v]=(0,q.useState)({});async function y(e){if(o===e._id){s(null);return}if(!h[e._id]){let n=await t({reportId:e._id});v(t=>({...t,[e._id]:n}))}s(e._id)}async function C(e){await a({title:N(),description:T(),confirmLabel:ee(),destructive:!0})&&(await n({reportId:e._id}),o===e._id&&s(null))}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[b(),` `,(0,J.jsx)(`strong`,{children:u()}),` `,x()]}),(0,J.jsx)(K,{title:l(),rows:e,emptyHint:S(),isExpanded:e=>o===e._id&&!!h[e._id],renderExpanded:e=>h[e._id]?(0,J.jsx)(Q,{data:h[e._id]}):null,columns:[{header:i(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:U(),cell:e=>X(e.category),sort:e=>X(e.category)},{header:_(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:f(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${g({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:d(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:c(),cell:e=>e.answered?(0,J.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:m()}):(0,J.jsx)(`span`,{className:`oc-fbadmin__pill`,children:p()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:o===e._id?r():j(),onSelect:()=>void y(e)},{label:M(),onSelect:()=>void C(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{$w as r,Aw as i,Bw as a,CE as o,Cw as s,Dw as c,Ew as l,Fw as u,Gw as d,Hw as f,Iw as p,Jw as m,Kw as h,Lw as g,Mw as ee,Nw as te,Ow as _,Pw as ne,Qw as re,Rw as ie,ST as ae,Sw as oe,TE as se,Tw as ce,Uw as le,Vw as ue,Ww as de,Xw as fe,Yw as pe,Zw as me,_T as he,_w as ge,a as v,aT as _e,aw as ve,bT as ye,bw as y,cE as be,cT as xe,cw as b,dT as Se,dw as Ce,eD as x,eT as we,ew as Te,fT as S,fw as Ee,gT as De,gw as Oe,hT as ke,hw as Ae,i as je,iD as Me,iT as Ne,iw as C,jw as Pe,kw as Fe,lT as Ie,lw as Le,mT as Re,mw as ze,n as Be,nT as Ve,nw as He,o as Ue,oD as w,oT as We,ow as Ge,pT as Ke,pw as qe,qw as Je,r as Ye,rT as Xe,rw as Ze,sD as T,sE as Qe,sT as $e,sw as et,tD as tt,tT as nt,tw as rt,uT as it,uw as at,vT as ot,vw as st,wE as ct,ww as lt,xT as ut,xw as dt,yT as ft,yw as pt,zw as E}from"./dist-DaCTW3Ac.js";import{n as D}from"./dist-CS7nJlvC.js";import{t as O}from"./x-CE-91um7.js";import{t as k}from"./button-BEV3ua5Q.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-D4GXPU2x.js";import{a as xt,i as St,n as Ct,o as wt,r as Tt,t as Et}from"./card-9-MMSY9k.js";import{a as Dt,i as H,n as Ot,o as U,r as W,t as kt}from"./table-B34f3Klh.js";import{t as At}from"./TimeRangePicker-CE9ZtSJB.js";import{t as jt}from"./FilterBar-BHeRG2h_.js";import{t as Mt}from"./AdvancedFilter-DCf2LyZV.js";var G=tt(`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(s());if(e.size>Bt)throw Error(oe());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(y());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(y());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(pt());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(dt())),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`?se():e===`dark`?ct():o()}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:Be(`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)(D,{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":Ue(),title:Ue(),children:(0,X.jsx)(mt,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=T(x.charts.listMyCharts),r=w(x.charts.setMyChart);async function i(e){try{await r({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:Re()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ke()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:S(),subtitle:Se(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?it():n.via===`owner`?Ie():xe({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 i(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:$e()}):null]})}function $t(){let e=w(x.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,p]=(0,K.useState)(!1);async function m(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(E())}}}async function ee(){if(s(null),l(!1),t.trim()===``){s(g());return}let a;try{a=JSON.parse(r)}catch{s(E());return}p(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{p(!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:Je()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(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:d()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:de(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:le()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:f(),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`}),ue(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void m(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:u,onClick:()=>void ee(),children:a()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:ie()}):null]})]})}function en({chart:e}){let t=Me(x.charts.setChartLogo),n=w(x.charts.removeChartLogo),[r,a]=(0,K.useState)(!1),[o,s]=(0,K.useState)(null),u=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function d(n,r,i){if(e.chartId!==void 0){s(null),a(!0);try{let{blob:a,hasAlpha:o}=await Wt(r,i?{variantFor:i}:{}),s=await a.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function f(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await d(e,n)}async function p(t){if(e.chartId!==void 0){s(null),a(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function m(e){let t=u(e===`light`?`dark`:`light`);if(t){s(null),a(!0);try{await d(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}function h({mode:e}){let t=u(e),n=u(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`?i():Fe()}),(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?c():_(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void f(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void m(e),children:ce()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void p(e),children:l()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Pe()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(h,{mode:`light`}),(0,X.jsx)(h,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:lt()}):null,o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function tn({chart:e}){let t=T(x.me.getMe,{host:z}),n=w(x.charts.addChartDomain),r=w(x.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function f(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:st()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ze()}):u.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":qe({domain:e}),onClick:()=>void f(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{value:i,onChange:e=>a(e.target.value),placeholder:Oe(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:Ae()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ge()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function nn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function rn({chart:e}){let t=w(x.charts.updateChart),n=w(x.charts.deleteChart),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(e.name),[s,c]=(0,K.useState)(()=>nn(e.tokens)),[l,u]=(0,K.useState)(e.tokens.bpm??0),[d,f]=(0,K.useState)(null),[p,m]=(0,K.useState)(!1);function h(){o(e.name),c(nn(e.tokens)),u(e.tokens.bpm??0),f(null),i(!0)}async function g(){if(e.chartId===void 0)return;f(null);let n;try{n=JSON.parse(s)}catch{f(E());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}m(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){f(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function _(){if(e.chartId!==void 0&&window.confirm(b()))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:h,children:te()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void _(),children:ee()})]})})]}),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:at()}),(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:v()}),(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:l,onChange:e=>u(Number(e.target.value)),"aria-label":v()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?je():`${l} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ye()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Le()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),d?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:d}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:p,onClick:()=>void g(),children:Ee()}),(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=T(x.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:p()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:u()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ne()}):(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=w(x.charts.addChartToGroupPool),i=w(x.charts.removeChartFromGroupPool),a=e.restrictedToGroups,o=e.poolGroups,s=new Set((o??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await i({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:a?`secondary`:`outline`,className:`oc-chart-avail__state`,children:a?r():e.kind===`custom`&&e.scope===`personal`?C():we()}),e.isGlobalDefault?(0,X.jsx)(F,{variant:`default`,children:re()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:fe()}),(o??[]).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":m({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(V,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(N,{size:`sm`,className:`w-56`,children:(0,X.jsx)(A,{placeholder:pe()})}),(0,X.jsx)(R,{children:c.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:me()}):null]})]})}function sn({chart:e}){let t=w(x.charts.promoteChartToCommon),n=w(x.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(b()))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`?Ze():C()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ve({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:He()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:rt()})]})]})}function cn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=w(x.admin.setDefaultThemeMode),i=w(x.admin.setDefaultLocale),a=w(x.charts.setDefaultChart),o=T(x.charts.listChartsAdmin),s=T(x.groups.listGroups,{}),c=e??`system`,l=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:De()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ke()})]}),(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:We()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(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:S()}),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:Ne()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(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:s??[]},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:Ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:nt()})]}),(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:et()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ge()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Te()}):(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:ae()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ut()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:c===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:ft()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,X.jsx)(k,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?be():Qe()},e))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ot()})]})]})}function ln(){let e=T(x.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:he()}),(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)(D,{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};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cl as r,Sl as i,_l as a,bl as o,dl as s,fl as c,gl as l,hl as u,ml as d,pl as f,vl as p,xl as m,yl as h}from"./dist-DaCTW3Ac.js";import{t as g}from"./button-BEV3ua5Q.js";import{Ot as _,Z as v,ct as y,lt as b,st as x,ut as S,vt as C}from"./index-D4GXPU2x.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:r(),from:`now-5m`},{label:i(),from:`now-15m`},{label:m(),from:`now-30m`},{label:o(),from:`now-1h`},{label:h(),from:`now-3h`},{label:p(),from:`now-6h`},{label:a(),from:`now-12h`},{label:l(),from:`now-24h`},{label:u(),from:`now-2d`},{label:d(),from:`now-7d`},{label:f(),from:`now-30d`},{label:c(),from:`now-90d`},{label:s(),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};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,$y as i,Ay as a,Bd as o,By as s,Cy as c,Fd as l,Fy as u,Gd as d,Gy as f,Hd as p,Hy as m,Id as h,Iy as ee,Jd as g,Jy as _,Kd as v,Ky as y,Ld as b,Ly as te,My as x,Ny as S,Pd as C,Py as w,Qd as ne,Qy as T,Rd as re,Ry as E,Sy as D,Ty as ie,Ud as ae,Uy as O,Vd as oe,Vy as k,Wd as se,Wy as ce,Xd as le,Xy as A,Yd as ue,Yy as de,Zd as fe,Zy as pe,_f as me,_y as he,af as ge,by as _e,cf as ve,df as ye,dy as be,eD as j,eb as xe,ef as Se,ff as Ce,fy as M,gf as we,gy as N,hf as Te,hy as Ee,if as De,jy as P,lf as Oe,mf as ke,my as Ae,nf as je,oD as F,of as Me,pf as Ne,py as Pe,qd as Fe,qy as Ie,rf as Le,sD as I,sf as Re,tD as L,tf as ze,uf as Be,vf as Ve,vy as He,wy as Ue,xy as We,yy as Ge,zd as Ke,zy as qe}from"./dist-DaCTW3Ac.js";import{n as Je}from"./dist-CS7nJlvC.js";import{t as Ye}from"./x-CE-91um7.js";import{i as R,n as z,r as Xe,t as Ze}from"./tabs-BliLi2ac.js";import{t as B}from"./button-BEV3ua5Q.js";import{$ as Qe,C as V,Ct as $e,Dt as et,Mt as tt,Q as nt,S as H,X as U,a as rt,b as W,et as it,i as at,jt as ot,k as st,nt as ct,o as lt,ot as ut,r as dt,rt as ft,wt as pt,x as G,y as K}from"./index-D4GXPU2x.js";import{n as mt}from"./TimeRangePicker-CE9ZtSJB.js";import{t as ht}from"./FilterBar-BHeRG2h_.js";import{t as gt}from"./AdvancedFilter-DCf2LyZV.js";import{t as _t}from"./DataTableShell-DZ-SHPgB.js";var vt=L(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),yt=L(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function bt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?u():n===`agent`?`${w()} - ${r}`:e}function xt(){let e=I(j.me.getMe,{host:ut})?.role===`admin`,t=I(j.deliveryTiming.getDeliveryStatus,{}),n=F(j.deliveryTiming.startDeliveryRecord),r=F(j.deliveryTiming.stopDeliveryRecord),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),l=t?.recording??!1,u=async()=>{c(!0);try{l?await r({}):await n({})}finally{c(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:xe()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:i()})]}),e?(0,J.jsx)(B,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void u(),children:l?pe():T()}):null]}),l?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(U,{variant:`secondary`,children:A()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:de({time:new Date(t.startedAt).toLocaleTimeString()})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?y():Ie()})}),a?(0,J.jsx)(St,{isAdmin:e}):null]})}function St({isAdmin:e}){let t=I(j.deliveryTiming.listDeliverySessions,{}),n=F(j.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:p,to:h}=mt(c),g=c.to===`now`?1/0:h,_=r.trim()!==``||a!==`all`||c!==Y,v=()=>{i(``),o(`all`),l(Y)},y=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=p&&t.startedAt<=g).map(e=>({...e,_id:e.sessionId}))},[t,r,a,p,g]),b=e=>{let t=new Set((y??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(ht,{q:r,onQChange:i,searchPlaceholder:ce(),timeRange:c,onTimeRangeChange:l,onReset:v,canReset:_,children:(0,J.jsxs)(K,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(H,{size:`sm`,className:`w-36`,children:(0,J.jsx)(V,{})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:`all`,children:O()}),(0,J.jsx)(G,{value:`active`,children:m()}),(0,J.jsx)(G,{value:`stopped`,children:k()})]})]})}),(0,J.jsx)(_t,{title:f(),rows:y,emptyHint:M(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(B,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?x():S(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(vt,{size:15,"aria-hidden":!0}):(0,J.jsx)(pt,{size:15,"aria-hidden":!0})})},{header:s(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.startedAt).toLocaleString()})},{header:qe(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.stoppedAt).toLocaleString()})},{header:E(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:te(),sort:e=>e.startedBy,cell:e=>bt(e.startedBy)},{header:ee(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(U,{variant:`secondary`,children:m()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:k()})}],rowActions:e?e=>[{label:P(),variant:`destructive`,onSelect:()=>b([e.sessionId])}]:void 0,bulkActions:e?[{label:P(),variant:`destructive`,onSelect:e=>b(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Ct,{sessionId:e.sessionId})})]})}function Ct({sessionId:e}){let t=I(j.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(wt,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(st(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function wt({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:a()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:_()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,be()]}),(0,J.jsxs)(B,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(Je,{size:13,"aria-hidden":!0}):(0,J.jsx)(et,{size:13,"aria-hidden":!0}),t?Pe():Ae()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:c()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:D()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:We()})]})}),(0,J.jsxs)(`tbody`,{children:[i(_e(),r.bridge),i(Ge(),r.A),i(He(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:he()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:N()})]})}var Tt=[50,100,200,500],Z=`all`,Q=`__all__`,Et=[`2xx`,`4xx`,`5xx`],Dt=[`user`,`service`,`system`],Ot=[`inbound`,`outbound`,`internal`],kt={kind:`relative`,from:`now-30d`,to:`now`},At=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:`latence (ms)`},{value:`principalType`,label:`principal`},{value:`direction`,label:`direction`},{value:`roleKey`,label:`rôle`},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function jt(){let e=tt({from:`/settings/traces`}),t=ot({from:`/settings/traces`}),n=e.limit,i=e.kind,a=e.statusClass??Q,s=e.principalType??Q,c=e.direction??Q,l=e.roleKey??Q,u=e.q??``,f=dt(e.from,e.to),m=(0,q.useMemo)(()=>lt(e.adv),[e.adv]),{from:h,to:ee}=mt(f),[_,y]=(0,q.useState)(null),[te,x]=(0,q.useState)(null),S=e=>void t({search:t=>({...t,limit:e})}),C=e=>void t({search:t=>({...t,kind:e})}),w=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),T=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),E=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),D=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),O=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,...rt(e)})}),ce=e=>void t({search:t=>({...t,adv:at(e)}),replace:!0}),A=I(j.observability.listEvents,{limit:n}),de=I(j.observability.listEvents,{limit:n,kind:i===Z?void 0:i,filter:{q:u||void 0,from:h,to:ee,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:c===Q?void 0:c,roleKey:l===Q?void 0:l,advanced:m.length>0?m:void 0}}),pe=(0,q.useMemo)(()=>{let e=new Set;for(let t of A??[])e.add(t.kind);return[...e].sort()},[A]),he=(0,q.useMemo)(()=>{let e=new Set;for(let t of A??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[A]),_e=u!==``||a!==Q||s!==Q||c!==Q||l!==Q||m.length>0||f.kind!==`relative`||f.from!==kt.from;function be(){t({search:{limit:100,kind:`all`},replace:!0})}let xe=_?A?.filter(e=>e.correlationId===_):de,[M,N]=(0,q.useState)(`events`);return(0,J.jsxs)(Ze,{value:M,onValueChange:e=>N(e),children:[(0,J.jsxs)(Xe,{className:`w-full`,children:[(0,J.jsxs)(R,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)($e,{size:13,"aria-hidden":!0}),ie()]}),(0,J.jsxs)(R,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(yt,{size:13,"aria-hidden":!0}),Ue()]})]}),(0,J.jsx)(z,{value:`latency`,children:(0,J.jsx)(xt,{})}),(0,J.jsxs)(z,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ve(),(0,J.jsx)(`strong`,{children:me()}),we(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:Te()})]}),(0,J.jsxs)(ht,{q:u,onQChange:w,searchPlaceholder:ke(),timeRange:f,onTimeRangeChange:k,onReset:be,canReset:_e,children:[(0,J.jsxs)(K,{value:a,onValueChange:T,children:[(0,J.jsx)(H,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{placeholder:Ne()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:Q,children:Ce()}),Et.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:s,onValueChange:E,children:[(0,J.jsx)(H,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{placeholder:ye()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:Q,children:Be()}),Dt.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:c,onValueChange:D,children:[(0,J.jsx)(H,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{placeholder:Oe()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:Q,children:ve()}),Ot.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:l,onValueChange:O,children:[(0,J.jsx)(H,{size:`sm`,className:`w-36`,children:(0,J.jsx)(V,{placeholder:Re()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:Q,children:Me()}),he.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:i,onValueChange:C,children:[(0,J.jsx)(H,{size:`sm`,className:`w-44`,children:(0,J.jsx)(V,{placeholder:ge()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:Z,children:De()}),pe.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:String(n),onValueChange:e=>S(Number(e)),children:[(0,J.jsx)(H,{size:`sm`,className:`w-28`,children:(0,J.jsx)(V,{})}),(0,J.jsx)(W,{children:Tt.map(e=>(0,J.jsx)(G,{value:String(e),children:Le({count:e})},e))})]})]}),(0,J.jsx)(gt,{fields:At,seed:m,onChange:ce}),_?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>y(null),title:je(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ze(),(0,J.jsx)(`code`,{children:$(_)})]}),(0,J.jsx)(Ye,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:Se()})]})}):null,(0,J.jsx)(_t,{title:r(),rows:xe,emptyHint:_?ne():fe(),columns:[{header:le(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:ue(),sort:e=>e.kind,cell:e=>(0,J.jsx)(U,{variant:`secondary`,children:e.kind})},{header:g(),sort:e=>Nt(e)??null,cell:e=>{let t=Nt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":Fe(),children:`✓`})}},{header:v(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(U,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:d(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(U,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:se(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(U,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ae(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:p(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${Mt(e.status)}`,children:e.status})},{header:oe(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:o(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:Ke(),onClick:()=>y(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:re(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>x(e),children:b()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Pt,{row:te,onClose:()=>x(null)})]})]})}function Mt(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Nt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Pt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(nt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(Qe,{className:`max-w-lg`,children:[(0,J.jsxs)(ct,{children:[(0,J.jsxs)(ft,{className:`oc-traces__meta-title`,children:[h(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(U,{variant:`outline`,children:l()})]}),(0,J.jsx)(it,{children:C()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{jt as TracesTab};