@lacneu/atrium 0.26.1 → 0.28.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 (69) hide show
  1. package/dist/assets/{AccessTab-C_Lvzi-s.js → AccessTab-DvvDXBXb.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-DnGyDWXx.js → AdvancedFilter-BFrnFKT8.js} +1 -1
  3. package/dist/assets/AgentFilesTab-jMVGc-7o.js +3 -0
  4. package/dist/assets/AnomaliesTab-JRqIpCQ3.js +1 -0
  5. package/dist/assets/{AuditTab-CM3yKrcE.js → AuditTab-BrQtjSHt.js} +1 -1
  6. package/dist/assets/BridgeTab-CVMr5-7B.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-CRnsKi17.js +1 -0
  8. package/dist/assets/{DataTableShell-y4F1v6a9.js → DataTableShell-D3UoYiLm.js} +1 -1
  9. package/dist/assets/{DetailChips-BFrPLaU7.js → DetailChips-CEPLO74z.js} +1 -1
  10. package/dist/assets/FeedbacksTab-DtcTHukp.js +1 -0
  11. package/dist/assets/{FieldLabel-GI9NETEt.js → FieldLabel-D-Hzx5_p.js} +1 -1
  12. package/dist/assets/FilesTab-9huo9v-_.js +1 -0
  13. package/dist/assets/{FilterBar-B_mSpGb-.js → FilterBar-BwVt4XJ7.js} +1 -1
  14. package/dist/assets/GroupsTab-CtYeHOBA.js +1 -0
  15. package/dist/assets/InstancesTab-BNzkCJvr.js +1 -0
  16. package/dist/assets/IntegrationsTab-BRGKBdRH.js +1 -0
  17. package/dist/assets/KpiTab-J9KHRyfK.js +1 -0
  18. package/dist/assets/PreferencesTab-C_MSfGKP.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-twM5Wu4M.js +3 -0
  20. package/dist/assets/RolesTab-C9h6psGw.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-CxPmhPYx.js +1 -0
  22. package/dist/assets/SubAgentReportsTab-BlTwmb10.js +1 -0
  23. package/dist/assets/ThemeShowroom-DZ0Zkebx.js +1 -0
  24. package/dist/assets/{TimeRangePicker-CFCLAlKB.js → TimeRangePicker-pz6n37si.js} +1 -1
  25. package/dist/assets/TracesTab-Bn3nIxEe.js +1 -0
  26. package/dist/assets/UsersTab-C4Vr4jwt.js +1 -0
  27. package/dist/assets/{button-BOkPsnkZ.js → button-BKx-78Cz.js} +1 -1
  28. package/dist/assets/{card-D7I9UeSH.js → card-r-aJwNEo.js} +1 -1
  29. package/dist/assets/chevrons-up-down-59d1_9hJ.js +1 -0
  30. package/dist/assets/{compatView-CcKTaWCH.js → compatView-Cvvm-eZM.js} +1 -1
  31. package/dist/assets/dispatchErrorInfo-BY-uJbtG.js +1 -0
  32. package/dist/assets/{dist-CI2WPmAQ.js → dist-CEZ2NhYx.js} +1 -1
  33. package/dist/assets/{dist-Cxz8d8g5.js → dist-CLSp0oLP.js} +1 -1
  34. package/dist/assets/{dist-CRGyTqMI.js → dist-CdJRWSN2.js} +1 -1
  35. package/dist/assets/{dist-CZgL-Z5m.js → dist-DcNll3Cm.js} +1 -1
  36. package/dist/assets/{highlighted-body-OFNGDK62-D8Rm1ZUS.js → highlighted-body-OFNGDK62-BB_6m41R.js} +1 -1
  37. package/dist/assets/{index-DbRDkkXU.css → index-BARs9CRG.css} +1 -1
  38. package/dist/assets/index-BDVPDgRe.js +229 -0
  39. package/dist/assets/mermaid-GHXKKRXX-Bt2lAXSp.js +1 -0
  40. package/dist/assets/roleDescriptions-BVyzh7hN.js +1 -0
  41. package/dist/assets/{table-XSL9PnTz.js → table-v_cIgz3K.js} +1 -1
  42. package/dist/assets/{tabs-DT8VXxMj.js → tabs-ClKgxi4q.js} +1 -1
  43. package/dist/assets/x-DmVX0ZZY.js +1 -0
  44. package/dist/index.html +8 -8
  45. package/package.json +1 -1
  46. package/dist/assets/AgentFilesTab-mB_H9qhv.js +0 -3
  47. package/dist/assets/AnomaliesTab-DXWIdPjg.js +0 -1
  48. package/dist/assets/BridgeTab-Bba1_oYY.js +0 -1
  49. package/dist/assets/ChatDefaultsTab-BJWGY5p4.js +0 -1
  50. package/dist/assets/FeedbacksTab-Dypzq2xC.js +0 -1
  51. package/dist/assets/FilesTab-Bo0mLlHv.js +0 -1
  52. package/dist/assets/GroupsTab-BsdKKpSh.js +0 -1
  53. package/dist/assets/InstancesTab-AFQsddYr.js +0 -1
  54. package/dist/assets/IntegrationsTab-_AZobXTN.js +0 -1
  55. package/dist/assets/KpiTab-DS2vaP8Y.js +0 -1
  56. package/dist/assets/PreferencesTab-D5id-SH6.js +0 -1
  57. package/dist/assets/PromptInjectionsTab-DHLbMEQv.js +0 -3
  58. package/dist/assets/RolesTab-DfLWu7KJ.js +0 -1
  59. package/dist/assets/ServiceAccountsTab-BdNBgyiw.js +0 -1
  60. package/dist/assets/SubAgentReportsTab-DiGx-0oc.js +0 -1
  61. package/dist/assets/ThemeShowroom-BAS4cMDv.js +0 -1
  62. package/dist/assets/TracesTab-w5olufef.js +0 -1
  63. package/dist/assets/UsersTab-DFcSXBQJ.js +0 -1
  64. package/dist/assets/chevrons-up-down-Cg6ojBxr.js +0 -1
  65. package/dist/assets/dispatchErrorInfo-_T-F61vE.js +0 -1
  66. package/dist/assets/index-BlRMvXrJ.js +0 -227
  67. package/dist/assets/mermaid-GHXKKRXX-CS3UuvWM.js +0 -1
  68. package/dist/assets/roleDescriptions-mq0g_Z5c.js +0 -1
  69. package/dist/assets/x-BimfpZdd.js +0 -1
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bo as r,EO as i,Fo as a,Go as o,Ho as s,Io as c,Jo as l,KD as u,Ko as d,Lo as f,Po as p,Ro as m,Uo as h,Vo as g,Wo as _,qo as v,yO as y,zo as b}from"./dist-Cxz8d8g5.js";import{C as x,S,X as C,b as w,x as T,y as E}from"./index-BlRMvXrJ.js";var D=t(e(),1);function O(e){return e===`user`?m():e===`all`?f():c({group:e.group})}function k(e){return e===`common`?a():e===`owner`?p():c({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=i(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=i(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":v(),children:(0,A.jsx)(x,{placeholder:v()})}),(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:d()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:o()}),(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:_()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(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:h()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(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:b()}):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:s()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(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:g()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(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};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$o as r,Jo as i,MO as a,Qo as o,Xo as s,Yo as c,Zo as l,aO as u,as as d,es as f,is as p,ns as m,os as h,qo as g,rs as _,ss as v,ts as y,zO as b}from"./dist-CLSp0oLP.js";import{C as x,S,X as C,b as w,x as T,y as E}from"./index-BDVPDgRe.js";var D=t(e(),1);function O(e){return e===`user`?l():e===`all`?s():c({group:e.group})}function k(e){return e===`common`?i():e===`owner`?g():c({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=b(a.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=b(a.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":h(),children:(0,A.jsx)(x,{placeholder:h()})}),(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:d()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:p()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(C,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:_()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:m()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(C,{variant:`default`,children:o()}):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:y()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(C,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:f()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(C,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,al as i,el as a,il as o,nl as s,rl as c,tl as l}from"./dist-Cxz8d8g5.js";import{i as u}from"./dist-CZgL-Z5m.js";import{t as d}from"./x-BimfpZdd.js";import{t as f}from"./button-BOkPsnkZ.js";import{C as p,S as m,Z as h,b as g,bt as _,x as v,y}from"./index-BlRMvXrJ.js";import{r as b}from"./TimeRangePicker-CFCLAlKB.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:i()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let i=(0,x.useRef)(t),w=!!(i.current&&i.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(i.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),o(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(y,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:s()})}),(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:l()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(_,{}),r()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_l as r,fl as i,gl as a,hl as o,ml as s,pl as c,vl as l}from"./dist-CLSp0oLP.js";import{i as u}from"./dist-DcNll3Cm.js";import{t as d}from"./x-DmVX0ZZY.js";import{t as f}from"./button-BKx-78Cz.js";import{C as p,S as m,Z as h,b as g,bt as _,x as v,y}from"./index-BDVPDgRe.js";import{r as b}from"./TimeRangePicker-pz6n37si.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:l()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let l=(0,x.useRef)(t),w=!!(l.current&&l.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(l.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),r(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(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:o()})}),(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:s()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":c(),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{Ai as r,Bi as i,Ca as a,Ci as o,Di as s,Ei as c,Fi as ee,Hi as te,IO as l,Ii as ne,Li as re,MO as u,Mi as d,Ni as ie,Oi as f,Pi as ae,Ri as p,Si as m,Ta as h,Ti as g,Vi as _,XS as v,_i as y,aO as b,bi as x,gi as S,hi as C,ji as w,ki as T,mi as E,pi as oe,sO as se,vi as D,wi as O,xi as k,yi as A,zO as j,zi as M}from"./dist-CLSp0oLP.js";import{t as N}from"./button-BKx-78Cz.js";import{$ as P,A as F,B as I,C as L,F as ce,I as le,L as ue,N as de,P as fe,Q as pe,R as me,S as R,X as z,b as B,et as he,mt as V,nt as ge,ot as H,rt as _e,v as U,x as W,y as G,z as ve}from"./index-BDVPDgRe.js";import{i as K}from"./compatView-Cvvm-eZM.js";/* empty css */var q=t(e(),1),J=2e4,Y=6e4;function X(e){return typeof e!=`number`||e<=0?0:Math.round(e/J*100)}function Z(e){return e<=0?0:Math.round(e/Y*100)}function ye(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=j(u.me.getMe,{host:H}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),o=j(u.admin.listInstances,e!==void 0&&t?{}:`skip`),[s,c]=(0,q.useState)(null);(0,q.useEffect)(()=>{!t||!o||o.length===0||(!s||!o.some(e=>e.name===s))&&c(o[0].name)},[t,o,s]);let f=j(u.agents.listAgentsForInstance,t&&s?{instanceName:s}:`skip`),m=j(u.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),h=(0,q.useMemo)(()=>{if(e!==void 0){if(t)return s===null||f===void 0?o!==void 0&&o.length===0?[]:void 0:f.agents.map(e=>({instanceName:s,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(m!==void 0)return m.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,s,f,o,m]),[g,v]=(0,q.useState)(null);(0,q.useEffect)(()=>{!h||h.length===0||(!g||!h.some(e=>$(e)===g))&&v($(h[0]))},[h,g]);let y=h?.find(e=>$(e)===g)??null,x=l(u.agentFiles.listAgentFiles),[S,C]=(0,q.useState)({status:`idle`}),T=y?.instanceName??null,E=y?.agentId??null,oe=j(u.compat.forInstance,n&&T!==null?{instanceName:T}:`skip`),D=n&&T!==null?U(oe,`agentFiles`):null,O=D===null?!1:D===`loading`?null:D.blocked,k=(0,q.useCallback)(async()=>{if(!(T===null||E===null)){C({status:`loading`});try{C({status:`done`,files:(await x({instanceName:T,agentId:E})).files})}catch{C({status:`error`})}}},[x,T,E]);(0,q.useEffect)(()=>{O===!1&&k()},[k,O]);let[A,P]=(0,q.useState)(null),F=se(),I=(0,q.useMemo)(()=>new Intl.NumberFormat(F,{maximumFractionDigits:0}),[F]);return e===void 0||h===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(o?.length??0)>1?(0,Q.jsxs)(G,{value:s??``,onValueChange:e=>c(e),children:[(0,Q.jsx)(R,{size:`sm`,"aria-label":_(),children:(0,Q.jsx)(L,{})}),(0,Q.jsx)(B,{children:(o??[]).map(e=>(0,Q.jsx)(W,{value:e.name,children:e.name},e.name))})]}):null,h.length>0?(0,Q.jsxs)(G,{value:g??``,onValueChange:e=>v(e),children:[(0,Q.jsx)(R,{size:`sm`,"aria-label":i(),children:(0,Q.jsx)(L,{})}),(0,Q.jsx)(B,{children:h.map(e=>(0,Q.jsx)(W,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:M()})]}),y===null?null:D===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):D!==null&&D.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(V,{size:14,"aria-hidden":!0}),` `,K(D.gatewayVersion)]}):S.status===`loading`||S.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):S.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[re(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void k(),children:a()})]}):S.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:S.files.map(e=>{let n=X(e.size),i=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(z,{variant:`outline`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ee({size:ye(e.size,F)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:ae({pct:I.format(n)})}),i?(0,Q.jsx)(V,{size:14,className:`oc-afiles__warn`,"aria-label":ie()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(N,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>P(e),children:t?w():r()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:d({used:ye(be(S.files),F),total:ye(Y,F),pct:I.format(Z(be(S.files)))})})]}),A&&y?(0,Q.jsx)(Te,{instanceName:y.instanceName,agentId:y.agentId,name:A.name,isAdmin:t,onClose:()=>P(null),onSaved:()=>void k()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:ee}){let te=l(u.agentFiles.getAgentFile),ne=l(u.agentFiles.setAgentFile),re=F(),[d,ie]=(0,q.useState)(null),[ae,p]=(0,q.useState)(!1),[_,w]=(0,q.useState)(``),[j,M]=(0,q.useState)(!1),[L,R]=(0,q.useState)(!1),[z,B]=(0,q.useState)(!1),[V,H]=(0,q.useState)(!1),U=(0,q.useCallback)(async r=>{p(!1);try{let i=await te({instanceName:e,agentId:t,name:n});ie({content:i.content,updatedAtMs:i.updatedAtMs}),r||w(i.content),B(!1)}catch{p(!0)}},[te,e,t,n]);(0,q.useEffect)(()=>{U(!1)},[U]);async function W(){if(d!==null){R(!0),H(!1);try{await ne({instanceName:e,agentId:t,name:n,content:_,baseUpdatedAtMs:d.updatedAtMs??void 0}),re.success(o({name:n})),ee(),await U(!1)}catch(e){Ce(e)?B(!0):H(!0)}finally{R(!1)}}}let G=d!==null&&_!==d.content,K=(0,q.useMemo)(()=>d===null?null:Se(d.content,_),[d,_]),Y=_.length>J,X=se(),Z=(0,q.useMemo)(()=>new Intl.NumberFormat(X),[X]);return(0,Q.jsx)(pe,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(P,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(_e,{children:T({name:n})}),(0,Q.jsxs)(he,{children:[f({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,s()]})]})]}),ae?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[k(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void U(!1),children:a()})]}):d===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:_,readOnly:!r,spellCheck:!1,onChange:e=>w(e.target.value),"aria-label":T({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:c()}),z?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[x(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void U(!0),children:A()})]}):null,V?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:m()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${Y?` is-over`:``}`,children:g({count:Z.format(_.length),max:Z.format(J)})}),r?(0,Q.jsx)(N,{size:`sm`,disabled:!G||L||z,onClick:()=>M(!0),children:L?h():O()}):null]})]}),(0,Q.jsx)(de,{open:j,onOpenChange:M,children:(0,Q.jsxs)(le,{children:[(0,Q.jsxs)(ve,{children:[(0,Q.jsx)(I,{children:D({name:n})}),(0,Q.jsx)(ue,{children:y({agent:t})})]}),K?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:S({added:K.added,removed:K.removed})}),K.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:C()}),K.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,K.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:E()}),K.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(me,{children:[(0,Q.jsx)(ce,{children:v()}),(0,Q.jsx)(fe,{onClick:()=>void W(),children:oe()})]})]})})]})})}export{we as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,Am as i,Bm as a,Cm as o,Dm as ee,Em as te,Fm as ne,Gm as re,Hm as ie,Im as s,Jm as c,Km as l,Lm as u,MO as d,Mm as f,Nm as p,Om as m,Pm as h,Qm as ae,RO as oe,Rm as g,Sm as _,Tm as se,Um as ce,Vm as le,Wm as ue,Xm as de,Ym as fe,Zm as pe,ah as v,bm as y,eh as me,ih as he,jm as ge,km as b,nh as x,oh as S,qm as C,rh as w,sh as T,th as E,wm as D,xm as O,ym as k,zO as A,zm as j}from"./dist-CLSp0oLP.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-BDVPDgRe.js";import{n as be}from"./TimeRangePicker-pz6n37si.js";import{t as xe}from"./FilterBar-BwVt4XJ7.js";import{t as Se}from"./DataTableShell-D3UoYiLm.js";import{t as H}from"./dispatchErrorInfo-BY-uJbtG.js";var U=t(e(),1),W=n(),G=`__all__`,Ce=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function we(e){return e===`open`?T():e===`acknowledged`?S():v()}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??``,_=e.status===K?G:e.status,v=e.severity??G,y=e.kind??G,[S,T]=(0,U.useState)(G),O=ye(e.from,e.to),{from:k,to:H}=be(O),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=oe(d.anomalies.resolveAnomaly),Fe=(A(d.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=A(d.anomalies.listAnomalies,{limit:Oe,filter:{q:n||void 0,from:k,to:H,anomalyStatus:_===G?void 0:_,severity:v===G?void 0:v,source:S===G?void 0:S,kind:y===G?void 0:y}}),Ie=(0,U.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||_!==`open`||v!==G||S!==G||y!==G||O.kind!==`relative`||O.from!==De.from;function Re(){T(G),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:he(),description:(0,W.jsxs)(W.Fragment,{children:[w(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,x(),` `,(0,W.jsx)(`strong`,{children:E()}),`.`,` `,me()]}),confirmLabel:r()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(ae(),e.kind)}catch(e){Z.error(pe(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(de(),e.kind)}catch(e){Z.error(fe(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,W.jsx)(`strong`,{children:C()}),` `,l(),` `,(0,W.jsx)(`strong`,{children:re()}),` `,ue(),` `,(0,W.jsx)(`strong`,{children:ce()}),` `,ie(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:le()})]}),(0,W.jsxs)(xe,{q:n,onQChange:q,searchPlaceholder:a(),timeRange:O,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,W.jsxs)(V,{value:_,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:j()}),Ce.map(e=>(0,W.jsx)(B,{value:e.value,children:we(e.value)},e.value))]})]}),(0,W.jsxs)(V,{value:v,onValueChange:Y,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:g()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:u()}),Te.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:S,onValueChange:T,children:[(0,W.jsx)(F,{size:`sm`,className:`w-32`,children:(0,W.jsx)(N,{placeholder:s()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:ne()}),Ee.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:y,onValueChange:Ne,children:[(0,W.jsx)(F,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:h()})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(B,{value:G,children:p()}),Ie.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Se,{title:f(),rows:$,emptyHint:_===`open`?ge():i(),rowActions:e=>Fe&&e.status===`open`?[{label:b(),onSelect:()=>void ze(e)},{label:m(),onSelect:()=>void Be(e)}]:[],columns:[{header:ee(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:h(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:g(),cell:e=>(0,W.jsx)(Ae,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:te(),cell:e=>(0,W.jsx)(je,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:s(),cell:e=>(0,W.jsx)(I,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:se(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:D(),cell:e=>(0,W.jsx)(ke,{row:e}),sort:e=>e.evidence??null},{header:o(),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:[`↗ `,_()]}):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:[`↗ `,_()]}):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:y()}):(0,W.jsx)(I,{variant:`outline`,children:k()})}function Me(e){return e.length>8?e.slice(0,8):e}export{q as AnomaliesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Bh as i,EO as a,Gh as o,Hh as s,Jh as c,Kh as l,Qh as u,Uh as ee,Vh as d,Wh as f,Xh as p,Yh as m,Zh as h,qh as g,yO as _,zh as v}from"./dist-Cxz8d8g5.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-BlRMvXrJ.js";import{n as j}from"./TimeRangePicker-CFCLAlKB.js";import{t as M}from"./FilterBar-B_mSpGb-.js";import{t as N}from"./AdvancedFilter-DnGyDWXx.js";import{t as P}from"./DataTableShell-y4F1v6a9.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=a(_.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:O===R?void 0:O,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||O!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[r(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:u()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:h(),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:p()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:m()}),$.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:c()}),(0,I.jsx)(k,{value:`yes`,children:g()}),(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:o()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:f()}),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:ee(),rows:Q,emptyHint:s(),columns:[{header:d(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:p(),cell:e=>e.action,sort:e=>e.action},{header:i(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:v(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:o(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as ee,MO as r,Qh as i,ag as a,cg as o,dg as s,eg as c,fg as l,ig as u,lg as d,ng as f,og as p,rg as m,sg as h,tg as g,ug as _,zO as v}from"./dist-CLSp0oLP.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-BDVPDgRe.js";import{n as j}from"./TimeRangePicker-pz6n37si.js";import{t as M}from"./FilterBar-BwVt4XJ7.js";import{t as N}from"./AdvancedFilter-BFrnFKT8.js";import{t as P}from"./DataTableShell-D3UoYiLm.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=v(r.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:O===R?void 0:O,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||O!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:s()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:_(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(A,{value:O,onValueChange:q,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:d()})}),(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:h()}),(0,I.jsx)(k,{value:`yes`,children:p()}),(0,I.jsx)(k,{value:`no`,children:a()})]})]}),(0,I.jsxs)(A,{value:V,onValueChange:Y,children:[(0,I.jsx)(x,{size:`sm`,className:`w-40`,children:(0,I.jsx)(y,{placeholder:u()})}),(0,I.jsxs)(C,{children:[(0,I.jsx)(k,{value:R,children:m()}),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:f(),rows:Q,emptyHint:g(),columns:[{header:c(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:d(),cell:e=>e.action,sort:e=>e.action},{header:ee(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:i(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:u(),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{$u as r,Ad as i,Br as a,Cd as o,Dd as s,Ed as c,Fd as l,Fr as u,Gr as d,Gu as f,Hr as p,IO as m,Id as ee,Jr as h,Ju as g,Kr as _,Ku as v,Ld as te,MO as y,Md as ne,NO as b,Nd as re,Od as x,Pd as ie,Qr as S,Qu as ae,RO as oe,Rd as se,Sd as ce,Td as le,Ur as ue,Vr as de,Wr as fe,Wu as pe,Xr as me,Xu as he,Yr as ge,Yu as _e,Zr as ve,Zu as ye,_d as be,_f as xe,ad as Se,bd as Ce,bf as we,cd as Te,dd as Ee,df as De,ed as Oe,fd as ke,ff as Ae,gd as je,gf as Me,hd as Ne,hf as Pe,id as C,jd as Fe,kd as Ie,ld as Le,md as Re,mf as ze,nd as Be,od as Ve,of as He,pd as Ue,pf as We,qr as w,qu as Ge,rd as Ke,sd as qe,sf as Je,td as Ye,ud as Xe,uf as Ze,vd as Qe,wd as $e,xd as et,yd as tt,yf as nt,zO as T,zr as rt}from"./dist-CLSp0oLP.js";import{i as E,r as it}from"./dist-DcNll3Cm.js";import{t as at}from"./chevrons-up-down-59d1_9hJ.js";import{i as ot,n as D,o as st,r as ct,s as lt}from"./FieldLabel-D-Hzx5_p.js";import{t as O}from"./button-BKx-78Cz.js";import{$ as ut,A as dt,At as k,C as A,H as ft,Q as pt,S as j,St as mt,U as ht,V as gt,X as M,Z as N,_ as _t,_t as vt,b as P,et as yt,jt as bt,kt as F,mt as I,nt as xt,ot as St,rt as Ct,x as L,y as R}from"./index-BDVPDgRe.js";import{a as wt,i as z,n as Tt,o as B,r as V,t as Et}from"./table-v_cIgz3K.js";import{t as Dt}from"./FilterBar-BwVt4XJ7.js";import{a as H,n as Ot,o as U,r as W,s as kt,t as At}from"./compatView-Cvvm-eZM.js";import{t as G}from"./dispatchErrorInfo-BY-uJbtG.js";var jt=b(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Mt=b(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=t(e(),1);function Nt(e){return e.filter(e=>e.state===`error`)}function Pt(e){return e.reachable&&Nt(e.targets).length===0}function Ft(e){return e.state===`error`&&e.lastErrorCode!==null}function It(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function Lt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Rt(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Lt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function zt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,Bt={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function Vt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Ht(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Ut(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Wt(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return U(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function Gt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Ut(t.key,e),a=Ut(t.key,r);return i&&a?0:i?1:a?-1:n*Wt(t.key,e,r)})}function Kt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function qt(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function Jt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>U(e,t)??X(e,t))}var Z=n();function Yt({connections:e,displayByInstance:t}){let[n,i]=(0,K.useState)(Bt),[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)(()=>Kt(s),[s]),l=(0,K.useMemo)(()=>qt(s),[s]),u=(0,K.useMemo)(()=>Jt(s),[s]),d=(0,K.useMemo)(()=>Gt(Ht(s,n),a),[s,n,a]);function f(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Dt,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:Se(),onReset:()=>i(Bt),canReset:Vt(n),children:[(0,Z.jsxs)(R,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:Ke()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(L,{value:J,children:C()}),c.map(e=>(0,Z.jsx)(L,{value:e,children:Zt(e)},e))]})]}),(0,Z.jsxs)(R,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(A,{placeholder:Be()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(L,{value:J,children:C()}),l.map(e=>(0,Z.jsx)(L,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(R,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:Ye()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(L,{value:J,children:C()}),u.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()}):(0,Z.jsxs)(Et,{className:`oc-conn__table`,children:[(0,Z.jsx)(wt,{children:(0,Z.jsxs)(B,{children:[(0,Z.jsx)(Q,{label:r(),sortKey:`target`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:ae(),sortKey:`state`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:ye(),sortKey:`instance`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:he(),sortKey:`host`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:_e(),sortKey:`version`,sort:a,onSort:f}),(0,Z.jsx)(z,{children:g()}),(0,Z.jsx)(Q,{label:Ge(),sortKey:`lastOk`,sort:a,onSort:f})]})}),(0,Z.jsx)(Tt,{children:d.map(e=>(0,Z.jsx)(Xt,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(z,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(it,{size:13,"aria-hidden":!0}):(0,Z.jsx)(E,{size:13,"aria-hidden":!0}):(0,Z.jsx)(at,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Xt({r:e}){let t=Ft(e)?G(e.lastErrorCode):null,n=It(e)?G(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(K.Fragment,{children:[(0,Z.jsxs)(B,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(V,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(V,{children:(0,Z.jsx)(Qt,{state:e.state})}),(0,Z.jsx)(V,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(V,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(V,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(V,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:qe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(V,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(B,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(V,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ve({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Zt(e){return e===`connected`?v():e===`error`?f():pe()}function Qt({state:e}){return e===`connected`?(0,Z.jsx)(M,{variant:`secondary`,children:v()}):e===`error`?(0,Z.jsx)(M,{variant:`destructive`,children:f()}):(0,Z.jsx)(M,{variant:`outline`,children:pe()})}function $t(){return T(y.bridgeHealth.getBridgeHealth,{})}function en(){let e=$t(),t=T(y.compat.getBridgeCompat,{}),n=T(y.me.getMe,{host:St})?.role===`admin`,r=T(y.admin.listInstances,n?{}:`skip`),i=bt(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=Rt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&Ot(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(tn,{health:e,compat:t,onSeeAnomalies:a}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:$e()}),o.map(e=>(0,Z.jsx)(nn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null},e.key)),l?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):null]})}function tn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:H(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:me(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ge({build:t.buildVersion??`?`})]}):null,` · `,h(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?w():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:je()});let o=Nt(e.targets),s=!e.reachable,c=Pt(e),l=c?`ok`:`error`,u=new Date(e.checkedAt).toLocaleString(`fr-FR`),d=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${l}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c?(0,Z.jsx)(F,{size:22}):s?(0,Z.jsx)(Mt,{size:22}):(0,Z.jsx)(I,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:c?Ne():s?Re():Ue({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(jt,{size:12,"aria-hidden":!0}),` `,ke({time:u})]}),d?(0,Z.jsx)(`span`,{children:Ee({time:d})}):null,a]}),s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Xe()})]})}function nn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:At(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,K.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(vt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:zt(e)}),f?(0,Z.jsx)(M,{variant:f===`beyond`?`destructive`:`secondary`,children:W(f)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:S()}),(0,Z.jsx)(an,{support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(rn,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Z.jsx)(E,{size:13,"aria-hidden":!0}):(0,Z.jsx)(k,{size:13,"aria-hidden":!0}),Le({count:t.length})]}),p?(0,Z.jsx)(Yt,{connections:t,displayByInstance:c}):null]})}function rn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[o(),i.length>0?(0,Z.jsx)(M,{variant:`destructive`,children:et({count:i.length})}):(0,Z.jsx)(M,{variant:`secondary`,children:ce()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ce({version:e.vendoredVersion}),r?` · `+tt({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(E,{size:13,"aria-hidden":!0}):(0,Z.jsx)(k,{size:13,"aria-hidden":!0}),Qe({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function an({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:fe()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:ue({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:w()}),e?(0,Z.jsx)(cn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:rt()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:H(e.version)}),(0,Z.jsx)(M,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:W(e.state)})]},e.instanceName))})]})}function on({instance:e,onClose:t}){return(0,Z.jsx)(pt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(ut,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(xt,{children:[(0,Z.jsx)(Ct,{children:we({instance:e.displayName??e.name})}),(0,Z.jsx)(yt,{children:nt()})]}),(0,Z.jsx)(sn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(F,{"aria-hidden":!0}):(0,Z.jsx)(I,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?x():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,s()]}):null}function sn({instance:e,onClose:t}){let n=oe(y.admin.upsertInstanceConfig),r=m(y.bridge.validateMediaPaths),a=dt(),[o,s]=(0,K.useState)(()=>ot(e.config??{})),[u,d]=(0,K.useState)(!1),[f,p]=(0,K.useState)(!1),[h,g]=(0,K.useState)(null),_=o.inboundMediaMode===`shared-fs`,v=o.mediaMode===`shared-fs`,b=_||v;async function x(){p(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){a.error(ne(),e)}finally{p(!1)}}async function S(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:ct(o,r)}),t()}catch(e){a.error(Ae(),e)}finally{d(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:xe(),help:De()}),(0,Z.jsxs)(R,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(P,{children:lt.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:Me(),help:Ze()}),(0,Z.jsxs)(R,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(P,{children:st.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:Pe(),help:Je()}),(0,Z.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)})})]})]}),b&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:se(),help:te()}),(0,Z.jsx)(N,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:ee(),help:l()}),(0,Z.jsx)(N,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(_t,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Z.jsx)(D,{label:ze(),help:He()})]}),b&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(I,{"aria-hidden":!0}),le({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:i(),result:h.inbound}),(0,Z.jsx)($,{label:Ie(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(I,{"aria-hidden":!0}),c()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Z.jsxs)(O,{variant:`outline`,size:`sm`,onClick:()=>void x(),disabled:f,children:[f?(0,Z.jsx)(mt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?re():ie()]}),(0,Z.jsx)(O,{size:`sm`,onClick:()=>void S(),disabled:u,children:We()})]})]})})}function cn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(gt,{children:[(0,Z.jsx)(ht,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?p():de({count:e.length}),(0,Z.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(ft,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:a()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(M,{variant:`secondary`,children:e},e))})]})]})}export{en as BridgeTab,on as InstanceConfigDialog};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$r as r,Ca as i,F as a,IO as o,MO as s,N as c,P as l,RO as u,Ta as d,Vi as f,XS as p,aO as m,ai as h,ci as g,di as _,ei as v,ii as y,li as b,ni as ee,oi as te,ri as x,si as ne,ti as re,ui as ie,va as ae,vf as oe,ya as se,zO as S}from"./dist-CLSp0oLP.js";import{t as C}from"./button-BKx-78Cz.js";import{A as w,B as T,C as ce,F as le,I as ue,L as de,N as fe,P as pe,R as me,S as he,Z as E,b as ge,g as D,h as O,mt as k,v as A,x as j,y as M,z as N}from"./index-BDVPDgRe.js";import{i as P}from"./compatView-Cvvm-eZM.js";/* empty css */var F=t(e(),1),I=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function L(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var R=n();function _e({instance:e}){let t=u(s.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,F.useState)(n===null?``:String(n)),[o,f]=(0,F.useState)(`idle`);(0,F.useEffect)(()=>{i(n===null?``:String(n)),f(`idle`)},[e._id,n]);let p=r.trim(),m=p===``?null:/^\d+$/.test(p)?Number.parseInt(p,10):NaN,g=m===null||Number.isInteger(m)&&m>=1e3&&m<=2e5,_=(m??null)!==n;async function v(){f(`saving`);try{let n={...e.config??{}};m===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=m,await t({instanceId:e._id,config:n}),f(`done`)}catch{f(`error`)}}return(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:a()}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,R.jsx)(E,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g}),(0,R.jsx)(C,{size:`sm`,disabled:!_||!g||o===`saving`,onClick:()=>void v(),children:o===`saving`?d():h()})]}),g?null:(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:c()}),o===`done`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:y()}):null,o===`error`?(0,R.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x()}):null,(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:l()})]})}function z(){let e=o(s.agentFiles.getChatDefaults),t=o(s.agentFiles.setChatDefaults),n=w(),[a,c]=(0,F.useState)({status:`loading`}),[l,u]=(0,F.useState)({thinkingDefault:null,fastModeDefault:null}),[E,z]=(0,F.useState)(!1),[B,V]=(0,F.useState)(!1),H=S(s.admin.listInstances,{}),[U,W]=(0,F.useState)(null);(0,F.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,ve=H!==void 0&&H.length===0,ye=S(s.compat.forInstance,U?{instanceName:U}:`skip`),K=U?A(ye,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,F.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,F.useRef)(0),X=(0,F.useCallback)(async()=>{let t=++Y.current;c({status:`loading`});try{let n=L(await e(J));if(Y.current!==t)return;c({status:`done`,current:n}),u(n)}catch{if(Y.current!==t)return;c({status:`error`})}},[e,J]);(0,F.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=a.status===`done`?a.current:null,Q=Z!==null&&l.thinkingDefault!==null&&l.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&l.fastModeDefault!==null&&l.fastModeDefault!==Z.fastModeDefault,be=Q||$;async function xe(){V(!0);try{await t({...J,...Q?{thinkingDefault:l.thinkingDefault}:{},...$?{fastModeDefault:l.fastModeDefault}:{}}),n.success(y()),await X()}catch(e){n.error(x(),e)}finally{V(!1)}}let Se=(0,F.useMemo)(()=>I.map(e=>({id:e,label:D(e)})),[]),Ce=(0,F.useMemo)(()=>[{id:`fast`,label:se()},{id:`standard`,label:ae()}],[]);return(0,R.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),G&&U?(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),(0,R.jsxs)(M,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,R.jsx)(he,{size:`sm`,"aria-label":f(),children:(0,R.jsx)(ce,{})}),(0,R.jsx)(ge,{children:(H??[]).map(e=>(0,R.jsx)(j,{value:e.name,children:e.name},e.name))})]})]}):null,ve?(0,R.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:oe()}):K===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):K.blocked?(0,R.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,R.jsx)(k,{size:14,"aria-hidden":!0}),` `,P(K.gatewayVersion)]}):a.status===`loading`?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):a.status===`error`?(0,R.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[te(),` `,(0,R.jsx)(C,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:i()})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:ie()}),(0,R.jsx)(O,{options:Se,value:l.thinkingDefault,onChange:e=>u({...l,thinkingDefault:e}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:b()})]}),(0,R.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,R.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()}),(0,R.jsx)(O,{options:Ce,value:l.fastModeDefault===null?null:l.fastModeDefault?`fast`:`standard`,onChange:e=>u({...l,fastModeDefault:e===`fast`}),disabled:B}),(0,R.jsx)(`p`,{className:`oc-cdefaults__help`,children:ne()})]}),(0,R.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,R.jsx)(C,{size:`sm`,disabled:!be||B,onClick:()=>z(!0),children:B?d():h()})}),(0,R.jsx)(`p`,{className:`oc-cdefaults__note`,children:ee()})]}),(()=>{let e=H?.find(e=>e.name===(U??H[0]?.name));return e?(0,R.jsx)(_e,{instance:e}):null})(),(0,R.jsx)(fe,{open:E,onOpenChange:z,children:(0,R.jsxs)(ue,{children:[(0,R.jsxs)(N,{children:[(0,R.jsx)(T,{children:re()}),(0,R.jsx)(de,{children:v()})]}),(0,R.jsxs)(me,{children:[(0,R.jsx)(le,{children:p()}),(0,R.jsx)(pe,{onClick:()=>void xe(),children:r()})]})]})})]})}export{z as ChatDefaultsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_c as r,dc as i,fc as a,gc as o,hc as s,mc as c,pc as l}from"./dist-Cxz8d8g5.js";import{i as u,r as d}from"./dist-CZgL-Z5m.js";import{t as f}from"./chevrons-up-down-Cg6ojBxr.js";import{t as p}from"./button-BOkPsnkZ.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-BlRMvXrJ.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-XSL9PnTz.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=r(),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":i({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(b,{"aria-label":l(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(y,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(_,{})})}),(0,M.jsx)(m,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ac as r,Dc as i,Ec as a,Oc as o,Tc as s,kc as c,wc as l}from"./dist-CLSp0oLP.js";import{i as u,r as d}from"./dist-DcNll3Cm.js";import{t as f}from"./chevrons-up-down-59d1_9hJ.js";import{t as p}from"./button-BKx-78Cz.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-BDVPDgRe.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-v_cIgz3K.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=r(),bulkActions:F,emptyHint:I=c(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(S,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(x,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(b,{"aria-label":i(),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)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(b,{"aria-label":a(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(y,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(_,{})})}),(0,M.jsx)(m,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(h,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{X as t}from"./index-BlRMvXrJ.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-BDVPDgRe.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Av as i,Bv as a,Cy as o,Dv as s,Dy as c,Ey as l,Fv as u,Gv as d,Hv as f,Iv as p,Jv as ee,Kv as te,Lv as ne,MO as m,Mv as h,Nv as g,Ov as re,Oy as _,Pv as ie,Qv as v,RO as y,Rv as b,Sy as x,Ty as S,Uv as C,Vv as w,Wv as T,Xv as E,Yv as D,Zv as O,_y as k,ay as A,by as j,cy as M,dy as N,ey as P,fy as F,gy as I,hy as L,iy as R,jv as z,kv as B,ly as V,my as H,ny as ae,oy as U,py as W,qv as G,ry as K,sy as q,ty as J,uy as oe,vy as se,wy as ce,xy as le,yy as ue,zO as de,zv as fe}from"./dist-CLSp0oLP.js";import{t as pe}from"./button-BKx-78Cz.js";import{j as me}from"./index-BDVPDgRe.js";import{t as he}from"./DataTableShell-D3UoYiLm.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>_(),incorrect:()=>c(),incoherence:()=>l(),formatting:()=>S(),latency:()=>ce(),api_error:()=>o(),other:()=>x()},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:j()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:ue()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:le()})}function ge({data:e,closeReason:t}){let n=e.snapshot,i=y(m.feedback.respondToFeedback),[a,o]=(0,Y.useState)(e.thread),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1);async function d(){let t=s.trim();if(!(!t||l)){u(!0);try{await i({feedbackId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),c(``)}finally{u(!1)}}}let f=[];try{f=n.contextJson?JSON.parse(n.contextJson):[]}catch{f=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${se()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:k()}),(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:g()}),(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:I()}),a.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:a.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`?L():H()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:W()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:F(),value:s,maxLength:2e3,rows:3,onChange:e=>c(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(pe,{size:`sm`,onClick:()=>void d(),disabled:!s.trim()||l,children:l?N():oe()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||M()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:q()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||M()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,f.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A({count:n.contextCount??f.length,truncated:n.contextTruncated?R():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:f.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K()}),(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:ae()}),(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:J()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?P({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:[r(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,v()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=de(m.feedback.listForAdmin,{}),t=y(m.feedback.readSnapshot),n=y(m.feedback.deleteFeedback),r=me(),[o,c]=(0,Y.useState)(null),[l,g]=(0,Y.useState)({});async function _(e){if(o===e._id){c(null);return}if(!l[e._id]){let n=await t({feedbackId:e._id});g(t=>({...t,[e._id]:n}))}c(e._id)}async function v(e){await r({title:B(),description:re(),confirmLabel:s(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&c(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[O(),` `,(0,X.jsx)(`strong`,{children:E()}),` `,D()]}),(0,X.jsx)(he,{title:ee(),rows:e,emptyHint:G(),isExpanded:e=>o===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,X.jsx)(ge,{data:l[e._id],closeReason:e.userCloseReason}):null,columns:[{header:te(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:d(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:T(),cell:e=>e.messageRole===`user`?C():f(),sort:e=>e.messageRole},{header:w(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${a({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:fe(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:b(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:ne(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:p()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:u()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:ie()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:o===e._id?h():z(),onSelect:()=>void _(e)},{label:i(),onSelect:()=>void v(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{NO as t,bO as n}from"./dist-Cxz8d8g5.js";import{c as r,l as i,s as a,u as o}from"./index-BlRMvXrJ.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]
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{KO as t,NO as n}from"./dist-CLSp0oLP.js";import{c as r,l as i,s as a,u as o}from"./index-BDVPDgRe.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
4
  {files}`},history_summary:{key:`history_summary`,appliedIn:`convex`,togglable:!0,placeholders:[`previous_summary`,`new_messages`,`max_chars`],defaultTemplate:`[SYNTHÈSE DE CONVERSATION]
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AD as ee,CD as r,DD as te,ED as i,FD as ne,ID as a,LD as o,MD as s,MO as c,ND as l,OD as re,PD as u,RO as ie,SD as d,TD as f,XS as ae,_D as oe,aD as se,aO as ce,bD as p,cD as le,dD as ue,fD as de,gD as m,hD as h,i as g,iD as _,jD as fe,kD as pe,lD as me,mD as he,nD as ge,oD as _e,pD as ve,r as ye,rD as be,sD as xe,sO as v,uD as y,vD as b,wD as x,xD as S,yD as C,zO as w}from"./dist-CLSp0oLP.js";import{t as T}from"./button-BKx-78Cz.js";import{A as E,B as D,C as O,Et as k,F as A,G as j,I as M,K as N,L as Se,N as Ce,P as we,R as Te,S as P,Tt as Ee,W as De,X as F,Y as Oe,_ as ke,b as I,ht as Ae,x as L,y as R,yt as je,z as Me}from"./index-BDVPDgRe.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-v_cIgz3K.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return i();case`audio`:return f();case`video`:return x();case`pdf`:return r();case`document`:return d();case`archive`:return S();default:return p()}}function K(){let[e,t]=(0,H.useState)(W),[n,r]=(0,H.useState)(W),[i,d]=(0,H.useState)(W),[f,p]=(0,H.useState)(W),[x,S]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=ie(c.files.softDelete),Y=E();function Ie(){t(W),r(W),d(W),p(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(me())}catch(e){Y.error(le(),e)}}let X=w(c.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:i===W?void 0:i,category:f===W?void 0:f,includeAutoGenerated:x||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(v(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ce()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||i!==W||f!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(R,{value:e,onValueChange:t,children:[(0,U.jsx)(P,{size:`sm`,"aria-label":a(),children:(0,U.jsx)(O,{})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{value:W,children:ne()}),(0,U.jsx)(L,{value:`inbound`,children:u()}),(0,U.jsx)(L,{value:`outbound`,children:l()})]})]}),(0,U.jsxs)(R,{value:n,onValueChange:r,children:[(0,U.jsx)(P,{size:`sm`,"aria-label":s(),children:(0,U.jsx)(O,{})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{value:W,children:fe()}),Q.chats.map(e=>(0,U.jsx)(L,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(R,{value:i,onValueChange:d,children:[(0,U.jsx)(P,{size:`sm`,"aria-label":ee(),children:(0,U.jsx)(O,{})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{value:W,children:pe()}),Q.instances.map(e=>(0,U.jsx)(L,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(R,{value:f,onValueChange:p,children:[(0,U.jsx)(P,{size:`sm`,"aria-label":re(),children:(0,U.jsx)(O,{})}),(0,U.jsxs)(I,{children:[(0,U.jsx)(L,{value:W,children:te()}),Q.categories.map(e=>(0,U.jsx)(L,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(ke,{checked:x,onCheckedChange:e=>S(e===!0),"aria-label":g()}),(0,U.jsx)(`span`,{children:g()})]}),$?(0,U.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(je,{size:14,"aria-hidden":!0}),de()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?be():_()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:C()}),(0,U.jsx)(z,{children:b()}),(0,U.jsx)(z,{children:oe()}),(0,U.jsx)(z,{children:m()}),(0,U.jsx)(z,{children:h()}),(0,U.jsx)(z,{className:`text-right`,children:he()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(F,{variant:`outline`,style:{marginLeft:6},children:ye()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(F,{variant:`secondary`,children:e.direction===`inbound`?u():l()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(De,{children:[(0,U.jsx)(Oe,{asChild:!0,children:(0,U.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":ue(),children:(0,U.jsx)(Ee,{size:16})})}),(0,U.jsxs)(j,{align:`end`,children:[e.url?(0,U.jsx)(N,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(k,{size:14}),ve()]})}):(0,U.jsxs)(N,{disabled:!0,children:[(0,U.jsx)(k,{size:14}),se()]}),(0,U.jsxs)(N,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ae,{size:14}),y()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ge({cap:Be})}):null]}),(0,U.jsx)(Ce,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(M,{children:[(0,U.jsxs)(Me,{children:[(0,U.jsx)(D,{children:xe()}),(0,U.jsx)(Se,{children:_e()})]}),(0,U.jsxs)(Te,{children:[(0,U.jsx)(A,{children:ae()}),(0,U.jsx)(we,{onClick:()=>void Le(),children:y()})]})]})})]})}export{K as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{vc as r,yc as i}from"./dist-Cxz8d8g5.js";import{t as a}from"./button-BOkPsnkZ.js";import{Z as o,vt as s,yt as c}from"./index-BlRMvXrJ.js";import{t as l}from"./TimeRangePicker-CFCLAlKB.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(o,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(c,{}),r()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Mc as r,jc as i}from"./dist-CLSp0oLP.js";import{t as a}from"./button-BKx-78Cz.js";import{Z as o,vt as s,yt as c}from"./index-BDVPDgRe.js";import{t as l}from"./TimeRangePicker-pz6n37si.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(o,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(c,{}),i()]})]})}export{p as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,Ao as i,Ba as a,Bo as o,Co as s,Do as c,Eo as l,Fo as u,Ga as d,Go as f,Ha as p,Ho as m,Io as h,Ja as g,Ka as _,Ko as v,La as y,Lo as ee,MO as b,Mo as x,NO as S,No as C,Oo as te,Po as ne,Qa as w,RO as T,Ra as E,Ro as D,So as O,To as re,Ua as k,Uo as ie,Va as A,Vo as j,Wa as M,Wo as ae,Xa as N,Ya as P,Za as F,_o as I,ao as oe,bo as se,co as L,do as R,eo as z,fo as ce,go as le,ho as ue,io as de,jo as fe,ko as pe,lo as me,mo as he,no as ge,oo as _e,po as ve,qa as ye,ro as be,so as xe,to as Se,uo as Ce,vo as we,wo as Te,xo as Ee,yo as De,zO as B,za as Oe,zo as ke}from"./dist-CLSp0oLP.js";import{t as Ae}from"./x-DmVX0ZZY.js";import{i as V,n as H,r as je,t as Me}from"./tabs-ClKgxi4q.js";import{t as U}from"./button-BKx-78Cz.js";import{$ as Ne,A as W,At as Pe,C as Fe,Q as Ie,S as Le,X as G,Z as K,_ as q,_t as J,b as Re,et as ze,gt as Y,j as Be,m as Ve,nt as He,ot as Ue,rt as We,x as Ge,y as Ke}from"./index-BDVPDgRe.js";import{t as qe}from"./FilterBar-BwVt4XJ7.js";import{t as Je}from"./DataTableShell-D3UoYiLm.js";import{t as X}from"./DetailChips-CEPLO74z.js";var Ye=S(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Xe=S(`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`}]]),Ze=S(`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=S(`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 ve();case`user`:return ce();case`pending`:return R();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=B(b.groups.listGroups,{}),t=B(b.me.getMe,{host:Ue})?.role===`admin`,n=T(b.groups.createGroup),r=T(b.groups.updateGroup),s=T(b.groups.deleteGroup),d=Be(),p=W(),[g,_]=(0,Z.useState)(!1),[y,S]=(0,Z.useState)(null),[w,E]=(0,Z.useState)($),[O,k]=(0,Z.useState)(null),[A,M]=(0,Z.useState)(``),N=(0,Z.useMemo)(()=>{if(!e)return e;let t=A.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,A]);function P(){S(null),E($),_(!0)}function F(e){S(e),E({name:e.name,description:e.description??``}),_(!0)}async function I(){try{y?await r({groupId:y._id,name:w.name,description:w.description}):await n({name:w.name,description:w.description||void 0}),E($),S(null),_(!1)}catch(e){p.error(a(),e)}}async function oe(e){if(await d({title:c({name:e.name}),description:l(),confirmWord:e.name,confirmLabel:re(),cancelLabel:C(),destructive:!0}))try{await s({groupId:e._id})}catch(e){p.error(Oe(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),(0,Q.jsx)(qe,{q:A,onQChange:M,onReset:()=>M(``),canReset:A!==``,searchPlaceholder:D()}),(0,Q.jsx)(Je,{title:v(),rows:N,addLabel:ae(),onAdd:t?P:void 0,emptyHint:ie(),columns:[{header:m(),cell:e=>e.name,sort:e=>e.name},{header:j(),cell:e=>(0,Q.jsx)(X,{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)(Ze,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:o(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(J,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ke(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(Xe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(Y,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:ee(),onSelect:()=>k({groupId:e._id,name:e.name})},...t?[{label:h(),onSelect:()=>F(e)},{label:u(),variant:`destructive`,onSelect:()=>void oe(e)}]:[]]}),(0,Q.jsx)(Ve,{open:g,onOpenChange:_,title:y?fe():x(),description:i(),canSubmit:!!w.name.trim(),onSubmit:I,submitLabel:ne(),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:pe()}),(0,Q.jsx)(K,{value:w.name,onChange:e=>E({...w,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,Q.jsx)(K,{value:w.description,onChange:e=>E({...w,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:O?.groupId??null,groupName:O?.name??``,open:O!==null,onOpenChange:e=>{e||k(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)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Ye,{size:14,"aria-hidden":!0}),le()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":he({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ue(),(0,Q.jsx)(Pe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let a=B(b.groups.getGroup,n&&e?{groupId:e}:`skip`),o=B(b.groups.listAssignableInstances,n?{}:`skip`),c=B(b.groups.listAssignableUsers,n?{}:`skip`),l=T(b.groups.addMember),u=T(b.groups.removeMember),f=T(b.groups.bulkSetMembers),m=T(b.groups.setGroupManager),h=W(),[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(``),[ee,x]=(0,Z.useState)(`members`),[S,C]=(0,Z.useState)(1),[te,ne]=(0,Z.useState)(new Set),w=(0,Z.useRef)(null),D=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),re=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ie=a?.viewerIsAdmin===!0,A=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{_(``),y(``),x(`members`),C(1),w.current=null},[n,e]),(0,Z.useEffect)(()=>{C(1)},[g]),(0,Z.useEffect)(()=>{n&&a&&e&&w.current!==e&&(w.current=e,ne(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let j=(0,Z.useMemo)(()=>c?$e(c,g,te):[],[c,g,te]);async function ae(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){h.error(E(),e)}}async function N(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){h.error(p(),e)}}let P=rt(j,e=>D.has(e.userId)),F=j.filter(e=>D.has(e.userId)).length,R=it(j,S,ot);async function z(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:P!==`all`})}catch(e){h.error(E(),e)}}return(0,Q.jsx)(Ie,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Ne,{className:`oc-access`,children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(We,{children:Te({name:t})}),(0,Q.jsx)(ze,{children:s()})]}),(0,Q.jsxs)(Me,{value:ee,onValueChange:x,className:`oc-access__tabs`,children:[(0,Q.jsxs)(je,{className:`w-full`,children:[(0,Q.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),O(),a?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:D.size}):null]}),(0,Q.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),se(),a?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,Q.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Xe,{size:13,"aria-hidden":!0}),r(),a?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(H,{value:`members`,children:c===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_e()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{value:g,onChange:e=>_(e.target.value),placeholder:Ee(),className:`oc-access__search`}),j.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:we()}):(0,Q.jsxs)(Q.Fragment,{children:[j.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void z(),"aria-label":I()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:I()}),(0,Q.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,j.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:R.pageItems.map(e=>{let t=D.has(e.userId),n=tt(e),r=re.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":Ce({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)(G,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ie?(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?k():M(),title:r?k():M(),onClick:()=>void N(e.userId,r),children:(0,Q.jsx)(Ze,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":d(),title:d(),children:(0,Q.jsx)(Ze,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:R.page,pageCount:R.pageCount,onPage:C})]})]})}),(0,Q.jsx)(H,{value:`agents`,children:o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:oe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(K,{value:v,onChange:e=>y(e.target.value),placeholder:De(),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:A,query:v},`${e}-${t._id}`))})]})}),(0,Q.jsx)(H,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=B(b.groups.listAssignableAgents,{instanceName:t}),o=T(b.groups.assignAgentToGroup),s=T(b.groups.removeAgentFromGroup),c=T(b.groups.bulkSetGroupAgents),l=W(),[u,d]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{d(1)},[i]),!e)return null;let f=et(a?.agents??[],i),p=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&f.length===0)return null;let m=f.filter(e=>e.presentInLastOk!==!1),h=rt(m,e=>r.has(`${t}/${e.agentId}`)),g=it(f,u,ot);async function _(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(y(),e)}}async function v(){if(m.length===0)return;let n=m.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:h!==`all`})}catch(e){l.error(y(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),p?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:ge()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:xe()}):f.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p?be():de()}):(0,Q.jsxs)(Q.Fragment,{children:[m.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:h===`all`?!0:h===`some`?`indeterminate`:!1,onCheckedChange:()=>void v(),"aria-label":I()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:I()})]}):null,g.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)(q,{checked:i,disabled:a&&!i,onCheckedChange:()=>void _(e.agentId,i),"aria-label":me({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":z(),title:z(),children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Se()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:g.page,pageCount:g.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=B(b.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=T(b.charts.assignChartToGroup),r=T(b.charts.removeChartFromGroup),i=T(b.charts.setGroupDefaultChart),a=T(b.charts.addChartToGroupPool),o=T(b.charts.removeChartFromGroupPool),s=W();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:w()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(A(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(A(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(A(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(A(),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)(q,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":g({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":ye(),title:ye(),children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:_()}):null,u?(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":P({name:e.name}),title:P({name:e.name}),onClick:()=>void m(e.chartKey),children:(0,Q.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,Q.jsxs)(Ke,{value:``,onValueChange:e=>void p(e),children:[(0,Q.jsx)(Le,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Fe,{placeholder:N()})}),(0,Q.jsx)(Re,{children:l.map(e=>(0,Q.jsx)(Ge,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:F()}):null:null]})}export{at as GroupsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,$g as i,A_ as a,Ag as o,BC as s,B_ as c,Bg as l,C_ as u,Cg as d,D_ as f,Dg as p,E_ as m,Eg as h,F_ as g,Fg as _,G_ as ee,Gg as v,H_ as te,Hg as y,IO as b,I_ as x,Ig as S,J_ as ne,Jg as C,K_ as re,Kg as w,L_ as ie,Lg as T,MO as E,M_ as ae,Mg as oe,N_ as se,Ng as ce,O_ as le,Og as ue,P_ as de,Pg as D,Q_ as fe,Qg as pe,RO as O,R_ as me,Rg as he,S_ as ge,Sg as _e,T_ as ve,Tg as ye,U_ as be,Ug as xe,V_ as Se,Vg as Ce,W_ as we,Wg as Te,X as Ee,X_ as De,Xg as Oe,Y_ as ke,Yg as Ae,Z as je,Z_ as Me,Zg as Ne,__ as Pe,_g as Fe,a_ as Ie,b_ as Le,bg as Re,c_ as ze,cf as Be,d_ as Ve,e_ as He,f_ as Ue,g_ as k,gg as We,h_ as A,hg as Ge,i_ as Ke,j_ as qe,jg as Je,k_ as Ye,kg as Xe,l_ as j,lf as Ze,m_ as Qe,mg as M,n_ as $e,o_ as et,p_ as tt,pg as nt,q_ as rt,qg as it,r_ as at,s_ as ot,t_ as st,u_ as ct,v_ as lt,vg as ut,w_ as dt,wg as ft,x_ as pt,xg as mt,y_ as ht,yg as gt,zC as N,zO as P,z_ as F,zg as I}from"./dist-CLSp0oLP.js";import{a as _t,c as vt}from"./FieldLabel-D-Hzx5_p.js";import{t as L}from"./button-BKx-78Cz.js";import{$ as R,A as z,C as B,H as yt,Q as V,S as H,U as bt,V as xt,X as U,Z as W,_ as G,b as K,et as q,j as St,m as Ct,nt as wt,rt as Tt,x as J,y as Et}from"./index-BDVPDgRe.js";import{t as Dt}from"./DataTableShell-D3UoYiLm.js";import{InstanceConfigDialog as Ot}from"./BridgeTab-CVMr5-7B.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`],kt=new Set(X),At=`conversational`;function jt(e){let t=new Set((e??[]).filter(e=>kt.has(e)));return t.size===0?[At]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:_t},Mt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Pt(){let e=P(E.admin.listInstances,{}),t=P(E.agents.listAllInstanceAgents,{}),n=O(E.admin.upsertInstance),i=O(E.admin.deleteInstance),o=z(),[s,l]=(0,Y.useState)(!1),[d,p]=(0,Y.useState)(Q),[h,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(null),[b,S]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(null);async function T(){try{await n({instanceId:C??void 0,name:d.name,gatewayUrl:d.gatewayUrl,bridgeUrl:d.bridgeUrl||void 0,displayName:d.displayName||void 0,kind:d.kind,gatewayVersion:d.gatewayVersion||void 0,gatewayHttpUrl:d.gatewayHttpUrl||void 0,streamTransport:d.streamTransport}),p(Q),w(null),l(!1)}catch(e){o.error(Me(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[De(),(0,Z.jsx)(`strong`,{children:ke()}),ne()]}),(0,Z.jsx)(Dt,{title:rt(),rows:e,addLabel:re(),onAdd:()=>{w(null),p(Q),l(!0)},emptyHint:ee(),columns:[{header:we(),cell:e=>e.name,sort:e=>e.name},{header:be(),cell:e=>(0,Z.jsx)(U,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:te(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Se(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:r(),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)(U,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?M():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ie(),onSelect:()=>{w(e._id),p(Nt(e)),l(!0)}},{label:fe(),onSelect:()=>_(e.name)},{label:ge(),onSelect:()=>S(e)},{label:c(),onSelect:()=>y(e)},{label:F(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:F(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(Ct,{open:s,onOpenChange:l,title:C?x():me(),description:de(),canSubmit:!!(d.name&&d.gatewayUrl),onSubmit:T,submitLabel:se(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:ae(),children:[(0,Z.jsx)(W,{value:d.name,disabled:C!==null,onChange:e=>p({...d,name:e.target.value})}),C?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:g()}):null]}),(0,Z.jsx)($,{label:qe(),children:(0,Z.jsxs)(Et,{value:d.kind,onValueChange:e=>p({...d,kind:e}),children:[(0,Z.jsx)(H,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(K,{children:[(0,Z.jsx)(J,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(J,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:a(),children:(0,Z.jsx)(W,{value:d.gatewayUrl,onChange:e=>p({...d,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Ye(),children:(0,Z.jsx)(W,{value:d.bridgeUrl,placeholder:le(),onChange:e=>p({...d,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:f(),children:(0,Z.jsx)(W,{value:d.displayName,onChange:e=>p({...d,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:Ze(),children:[(0,Z.jsxs)(Et,{value:d.streamTransport,onValueChange:e=>p({...d,streamTransport:e}),children:[(0,Z.jsx)(H,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(B,{})}),(0,Z.jsx)(K,{children:vt.map(e=>(0,Z.jsx)(J,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Be()})]}),(0,Z.jsx)($,{label:m(),children:(0,Z.jsx)(W,{value:d.gatewayVersion,placeholder:ve(),onChange:e=>p({...d,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:dt(),children:(0,Z.jsx)(W,{value:d.gatewayHttpUrl,placeholder:u(),onChange:e=>p({...d,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wt,{instanceName:h,open:h!==null,onOpenChange:e=>{e||_(null)}}),v?(0,Z.jsx)(Ot,{instance:v,onClose:()=>y(null)},v._id):null,b?(0,Z.jsx)(Ft,{instance:b,onClose:()=>S(null)},b._id):null]})}function Ft({instance:e,onClose:t}){let n=P(E.instanceSecrets.listInstanceSecretStatus,{}),r=Mt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(V,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(R,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Tt,{children:pt({instance:e.displayName??e.name})}),(0,Z.jsx)(q,{children:Le()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Rt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Lt,{instance:e})}),(0,Z.jsx)(It,{instance:e})]})})}function It({instance:e}){let t=b(E.instanceSync.forceInstanceSync),n=z(),[r,a]=(0,Y.useState)(!1);async function o(){if(!r){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(He());break;case`no_agents`:n.success(pe());break;case`no_bridge_url`:n.error(Ne());break;case`deploy_misconfigured`:n.error(Oe());break;case`unauthorized`:n.error(C());break;case`not_served`:n.error(it());break;default:n.error(Ae());break}}catch(e){n.error(i(),e)}finally{a(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?st():$e()})})]})}function Lt({instance:e}){let t=P(E.bridgeAuth.listBridgeAuthStatus,{}),n=b(E.bridgeAuth.mintBridgeSecret),r=O(E.bridgeAuth.revokeBridgeSecret),i=z(),[a,o]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(!1),p=(t??[]).find(t=>t.instanceId===e._id),m=p!==void 0;async function h(){if(!a){o(!0);try{u((await n({instanceId:e._id})).plaintext),f(!1)}catch(e){i.error(I(),e)}finally{o(!1)}}}async function g(){if(!a){o(!0);try{await r({instanceId:e._id}),u(null),i.success(l())}catch(e){i.error(I(),e)}finally{o(!1)}}}async function _(){if(c)try{await navigator.clipboard.writeText(c),f(!0)}catch{}}return(0,Z.jsxs)($,{label:v(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(U,{variant:m?`outline`:`secondary`,children:m?`${k()} · ${p.prefix}…${p.lastFour}`:A()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void h(),disabled:a,children:m?y():xe()}),m?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void g(),disabled:a,children:Ce()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:he()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:d?s():N()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{u(null),f(!1)},children:T()})]}):null]})}function Rt({instanceId:e,field:t,updatedAt:n}){let r=b(E.instanceSecrets.setInstanceSecret),i=O(E.instanceSecrets.clearInstanceSecret),a=b(E.deviceIdentity.generateDeviceIdentity),o=z(),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,ee=t===`token`?ht():t===`deviceIdentity`?lt():Pe();async function v(){if(!(!c.trim()||u)){d(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),p(null),h(!1),o.success(ct())}catch(e){o.error(j(),e)}finally{d(!1)}}}async function te(){if(!u){d(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(ze())}catch(e){o.error(j(),e)}finally{d(!1)}}}async function y(){if(!u){d(!0);try{p(await a({instanceId:e})),h(!1),o.success(Ie())}catch(e){o.error(at(),e)}finally{d(!1)}}}let x=f?`openclaw devices approve ${f.id}`:``;async function S(){if(x)try{await navigator.clipboard.writeText(x),h(!0)}catch{}}return(0,Z.jsxs)($,{label:ee,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:et()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(U,{variant:g?`outline`:`secondary`,children:g?k():A()}),(0,Z.jsx)(W,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:g?tt():Qe(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void v(),disabled:u||c.trim().length===0,children:Ue()}),_?(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void y(),disabled:u,children:ot()}):null,g?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void te(),disabled:u,children:Ve()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:Ie()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:x}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void S(),children:m?s():N()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:T()})]}):null]})}var zt={conversational:Xe,documentary:p,summarizer:je},Bt={conversational:ue,documentary:h,summarizer:Ee},Vt=e=>(zt[e]??(()=>e))(),Ht=e=>(Bt[e]??(()=>``))();function Ut({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:ce()}),t.map(e=>(0,Z.jsx)(U,{variant:`secondary`,className:`oc-agenttype__chip`,title:Ht(e),children:Vt(e)},e)),(0,Z.jsxs)(xt,{children:[(0,Z.jsx)(bt,{asChild:!0,children:(0,Z.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:oe()})}),(0,Z.jsxs)(yt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Je()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:o()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(G,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Vt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Ht(r)})]})]},r)})})]})]})]})}function Wt({instanceName:e,open:t,onOpenChange:n}){let r=P(E.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=O(E.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(E.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(E.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=O(E.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(E.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(E.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=O(E.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(E.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jt(r);e.setQuery(E.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=O(E.agents.removeInstanceAgent),c=St(),l=z();async function u(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){l.error(D(),e)}}async function f(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){l.error(D(),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){l.error(D(),e)}}async function m(t,n){if(e&&await c({title:d({name:n}),description:_e(),confirmLabel:mt(),destructive:!0}))try{await s({instanceName:e,agentId:t}),l.success(Re())}catch(e){l.error(D(),e)}}return(0,Z.jsx)(V,{open:t,onOpenChange:n,children:(0,Z.jsxs)(R,{className:`oc-access`,children:[(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(Tt,{children:S({name:e??``})}),(0,Z.jsx)(q,{children:_()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:gt()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ut():r.discovery.lastPollOk?Fe():We({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ge()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(G,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void u(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)(U,{variant:`outline`,className:`oc-access__gone`,children:nt()}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void m(e.agentId,i),children:ft()})]}):n?(0,Z.jsx)(U,{variant:`default`,children:M()}):(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void f(e.agentId),children:ye()})]}),e.enabled?(0,Z.jsx)(Ut,{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{Pt as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Ay as i,By as a,Fy as o,Gy as s,Hy as c,IO as l,Iy as u,Jy as ee,Ky as te,Ly as ne,MO as d,My as re,Ny as ie,Py as ae,Qy as oe,RO as f,Ry as p,Uy as m,Vy as h,Wy as g,Xy as _,Yy as v,Zy as y,_b as b,_n as x,ab as se,bb as ce,cb as le,db as ue,dn as S,eb as C,fb as w,fn as T,gb as E,gn as D,hb as O,hn as k,ib as A,jy as j,ky as M,lb as N,mb as P,mn as F,nb as I,ob as L,pb as R,pn as z,qy as B,rb as V,sb as H,tb as U,ub as de,un as W,vb as fe,vn as pe,xb as me,yb as he,zO as ge,zy as _e}from"./dist-CLSp0oLP.js";import{t as G}from"./button-BKx-78Cz.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-BDVPDgRe.js";import{t as we}from"./DataTableShell-D3UoYiLm.js";var J=t(e(),1),Y=n();function Te(){let e=ge(d.integrations.status.status,{}),t=f(d.admin.setIntegrationConfig),[n,l]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&l(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:me()});let S=n,T=(e,t,n)=>l({...S,[e]:{...S[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:[ce(),` `,(0,Y.jsx)(`strong`,{children:he()}),` `,fe()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:b()}):(0,Y.jsx)(K,{variant:`outline`,children:E()}):(0,Y.jsx)(K,{variant:`outline`,children:O()}),note:R(),children:[(0,Y.jsx)(Z,{label:ue(),children:(0,Y.jsx)(q,{value:S.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>T(`langfuse`,`host`,e.target.value),onBlur:()=>k(`langfuse`,{host:S.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:H(),checked:S.langfuse.enabled??!0,onChange:e=>{T(`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:b()}):(0,Y.jsx)(K,{variant:`outline`,children:E()}):(0,Y.jsx)(K,{variant:`outline`,children:O()}),note:w(),children:[(0,Y.jsx)(Z,{label:de(),children:(0,Y.jsx)(q,{value:S.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>T(`opik`,`baseUrl`,e.target.value),onBlur:()=>k(`opik`,{baseUrl:S.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:N(),children:(0,Y.jsx)(q,{value:S.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||le(),onChange:e=>T(`opik`,`workspace`,e.target.value),onBlur:()=>k(`opik`,{workspace:S.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:H(),checked:S.opik.enabled??!0,onChange:e=>{T(`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:b()}):(0,Y.jsx)(K,{variant:`outline`,children:E()}):(0,Y.jsx)(K,{variant:`outline`,children:pe()}),note:x(),children:[(0,Y.jsx)(Z,{label:D(),children:(0,Y.jsx)(q,{value:S.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>T(`otlp`,`endpoint`,e.target.value),onBlur:()=>k(`otlp`,{endpoint:S.otlp.endpoint??``})})}),(0,Y.jsx)(Ee,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:H(),checked:S.otlp.enabled??!0,onChange:e=>{T(`otlp`,`enabled`,e),k(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:L(),status:(0,Y.jsx)(K,{variant:`outline`,children:P()}),note:se(),children:[(0,Y.jsx)(Z,{label:A(),children:(0,Y.jsx)($,{value:S.tts.auto??`off`,options:[[`off`,V()],[`always`,I()],[`inbound`,U()],[`tagged`,C()]],onChange:e=>{T(`tts`,`auto`,e),k(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:r(),children:(0,Y.jsx)($,{value:S.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,oe()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{T(`tts`,`provider`,e),k(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:y(),children:(0,Y.jsx)(q,{value:S.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>T(`tts`,`model`,e.target.value),onBlur:()=>k(`tts`,{model:S.tts.model??``})})}),(0,Y.jsx)(Z,{label:_(),children:(0,Y.jsx)(q,{value:S.tts.voice??``,placeholder:v(),onChange:e=>T(`tts`,`voice`,e.target.value),onBlur:()=>k(`tts`,{voice:S.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:ee(),status:(0,Y.jsx)(K,{variant:`outline`,children:P()}),note:e.secrets.openai?B():te(),children:[(0,Y.jsx)(Q,{label:s(),checked:S.talk.enabled??!1,onChange:e=>{T(`talk`,`enabled`,e),k(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:g(),children:(0,Y.jsx)($,{value:S.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{T(`talk`,`realtimeProvider`,e),k(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:m(),children:(0,Y.jsx)(q,{value:S.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>T(`talk`,`realtimeModel`,e.target.value),onBlur:()=>k(`talk`,{realtimeModel:S.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:_(),children:(0,Y.jsx)(q,{value:S.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>T(`talk`,`voice`,e.target.value),onBlur:()=>k(`talk`,{voice:S.talk.voice??``})})}),(0,Y.jsx)(Z,{label:c(),children:(0,Y.jsx)($,{value:S.talk.transport??`webrtc`,options:[[`webrtc`,h()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{T(`talk`,`transport`,e),k(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:a(),children:(0,Y.jsx)(q,{value:S.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>T(`talk`,`speechLocale`,e.target.value),onBlur:()=>k(`talk`,{speechLocale:S.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:_e(),checked:S.talk.interruptOnSpeech??!0,onChange:e=>{T(`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:p()}),(0,Y.jsx)(K,{variant:`outline`,children:ne()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[u(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(we,{title:o(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:ae(),columns:[{header:ie(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:re(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:j(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:i(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:M(),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=l(d.integrations.otlpSecret.setOtlpHeaders),n=f(d.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1),u=async()=>{c(!0),o(null);try{await t({headersJson:r}),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{c(!1)}};return(0,Y.jsxs)(Z,{label:k(),children:[(0,Y.jsx)(q,{value:r,placeholder:e?F():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 u(),children:T()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:s,onClick:()=>void n({}),children:S()}):null]}),a?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:W()})]})}export{Te as IntegrationsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Au as r,Cu as i,Du as a,Eu as o,MO as s,Ou as c,Su as l,Tu as u,Xb as d,Yb as f,_u as p,ax as m,bu as h,ix as g,jx as ee,ku as _,ox as v,rx as y,vu as b,wu as x,xu as S,yu as C,zO as w}from"./dist-CLSp0oLP.js";import{Mt as T,a as E,jt as D,n as te,ot as ne,r as re}from"./index-BDVPDgRe.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-r-aJwNEo.js";import{n as N,t as P}from"./TimeRangePicker-pz6n37si.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=w(s.me.getMe,{host:ne})?.permissions?.includes(`traces.read`)??!1,t=w(s.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:ee()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:v()}),(0,I.jsx)(j,{children:g()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[f(),` p50 `,R(s.cP50),` `,m()]}),(0,I.jsxs)(`span`,{children:[d(),` p50 `,R(s.aP50),` `,m()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":v(),children:[(0,I.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:r(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:_(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:c(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:a(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:o(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:u(),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=T({from:`/settings/kpi`}),t=D({from:`/settings/kpi`}),n=re(e.from,e.to,te,`now`),r=e=>void t({search:t=>({...t,...E(e)})}),{from:a,to:o}=N(n),{rowLimit:c,buckets:u}=K(a,o),d=w(s.kpi.listKpis,{limit:c,filter:{from:a,to:o}}),f=(0,F.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>u&&e.set(t,n.slice(n.length-u));return e},[d,u]),p=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:i()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return d===void 0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:l()})]}):d.length===0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]}):(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(f.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:f.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:h({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:C()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:b({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":p({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{$w as r,AT as i,BD as a,CT as o,DT as s,ET as c,GD as l,HD as u,JD as ee,KD as d,MO as f,N_ as te,OT as p,Qw as m,RO as h,ST as g,TT as ne,UD as re,VD as ie,WD as ae,XD as oe,YD as se,ZD as ce,_T as le,aO as ue,aT as _,bT as de,cT as fe,dT as pe,eO as v,eT as y,fT as b,gT as x,hT as S,iT as C,jT as w,kT as T,lT as E,mT as D,nT as O,oT as k,pT as A,qD as j,rT as M,sT as N,tT as P,uT as F,vT as I,wT as L,xT as R,yT as z,zD as B,zO as V}from"./dist-CLSp0oLP.js";import{t as H}from"./button-BKx-78Cz.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-BDVPDgRe.js";var q=t(e(),1),J=[{id:`messages`,label:()=>w()},{id:`composer`,label:()=>i()},{id:`sidebar`,label:()=>T()},{id:`other`,label:()=>p()}],Y={showSource:{category:`messages`,label:()=>s(),help:()=>c()},showReport:{category:`messages`,label:()=>ne(),help:()=>L()},copyAssistant:{category:`messages`,label:()=>o()},copyUser:{category:`messages`,label:()=>g()},showDelete:{category:`messages`,label:()=>R()},showTools:{category:`messages`,label:()=>de(),help:()=>z()},voiceInput:{category:`composer`,label:()=>I(),help:()=>le()},showChatAge:{category:`sidebar`,label:()=>x(),help:()=>S()},showChatProvider:{category:`sidebar`,label:()=>D(),help:()=>A()}};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:()=>O()};function De({prefKey:e,ui:t}){let n=h(f.admin.setUiPrefDefault),i=h(f.admin.setFeatureEnabled),a=Te(e),o=a?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:k()}),(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:y()}),(0,$.jsx)(K,{value:`off`,children:r()}),(0,$.jsx)(K,{value:`inherit`,children:m()})]})]}),a?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(W,{checked:t.featuresEnabled[a]===!0,onCheckedChange:e=>void i({key:a,enabled:e===!0}),"aria-label":_()}),_()]}):null]}),o?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=V(f.me.getMe,{host:G}),a=i?.ui,o=Z(i?.role)&&n,s=h(f.me.setUiPref).withOptimisticUpdate(ge),c=(0,q.useMemo)(()=>a?be(Object.keys(a.effective),e):[],[a,e]);return a?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":N()}),N()]}):null,o?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:C()}),(0,$.jsx)(`p`,{children:M()}),(0,$.jsx)(`p`,{children:P()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:b(),"aria-label":b(),className:`mb-2`}),c.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:pe()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${l&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:F()}):l?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:E()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:fe()}):null,(0,$.jsx)(W,{checked:c,disabled:i,onCheckedChange:t=>void s({key:e,value:t===!0}),"aria-label":n})]}),o?(0,$.jsx)(De,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:ue()})}function ke(){let e=V(f.me.getMe,{host:G}),t=h(f.me.setLocale),n=h(f.me.setMyName),r=me(),i=e?.locale??`default`,o=e?.name??``,[s,c]=(0,q.useState)(null),p=s??o,m=p.trim()!==o.trim();async function g(){try{await n({name:p}),c(null),r.success(j())}catch(e){r.error(d(),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:ce()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{className:`max-w-xs`,value:p,maxLength:120,placeholder:se(),onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m&&(e.preventDefault(),g())}}),(0,$.jsx)(H,{size:`sm`,disabled:!m,onClick:()=>void g(),children:te()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:l()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ae()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:i===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?a():e===`en`?B():v()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:u()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
@@ -0,0 +1,3 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$d as i,Bd as a,Gd as o,Hd as s,Jd as c,Kd as l,MO as u,Q as d,Qd as f,RO as p,Ud as ee,Vd as m,Wd as h,Xd as g,Yd as _,Zd as v,af as y,ef as b,et as x,ff as S,if as C,nf as w,nt as T,pf as E,qd as D,rf as O,tf as k,tt as A,zO as j}from"./dist-CLSp0oLP.js";import{d as M,f as N,i as P,l as F,n as I,r as L,t as R,u as z}from"./FieldLabel-D-Hzx5_p.js";import{t as B}from"./button-BKx-78Cz.js";import{A as V,C as H,S as U,_ as W,b as G,x as K,y as q}from"./index-BDVPDgRe.js";/* empty css */var J=t(e(),1),Y=n(),X={media_delivery:{label:b,help:i},documentary_fetch:{label:f,help:v},inbound_files:{label:g,help:_},history_summary:{label:T,help:A}},Z={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
+ - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
+ Assistant : Comparaison en cours.`,max_chars:`6000`},Q={outboundDir:s,references:m,files:a,previous_summary:x,new_messages:r,max_chars:d};function $(){let e=j(u.admin.listInstances,{}),[t,n]=(0,J.useState)(null);if(e===void 0)return(0,Y.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,Y.jsx)(`div`,{className:`oc-injtab`,children:(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:D()})});let r=e.find(e=>e._id===t)??e[0];return(0,Y.jsxs)(`div`,{className:`oc-injtab`,children:[(0,Y.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,Y.jsx)(I,{label:y(),help:C()}),(0,Y.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Y.jsx)(`span`,{children:c()}),(0,Y.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,Y.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(G,{children:e.map(e=>(0,Y.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,Y.jsx)(te,{instance:r},r._id)]})}function te({instance:e}){let t=p(u.admin.upsertInstanceConfig),n=V(),r=e.config??{},[i,a]=(0,J.useState)(()=>P(r)),[o,s]=(0,J.useState)(!1),c=i.promptInjections,l=(e,t)=>a({...i,promptInjections:{...c,[e]:{...c[e],...t}}});async function d(){s(!0);try{await t({instanceId:e._id,config:L(i,r)})}catch(e){n.error(S(),e)}finally{s(!1)}}return(0,Y.jsxs)(`div`,{className:`oc-injtab__body`,children:[z.map(e=>(0,Y.jsx)(ne,{injKey:e,def:F[e],i18n:X[e],row:c[e]??{enabled:!0,template:F[e].defaultTemplate},onChange:t=>l(e,t)},e)),(0,Y.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,Y.jsx)(B,{size:`sm`,onClick:()=>void d(),disabled:o,children:E()})})]})}function ne({injKey:e,def:t,i18n:n,row:r,onChange:i}){let[a,s]=(0,J.useState)(!1),c=r.template.trim()!==t.defaultTemplate,u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,Z[e]??`{${e}}`])),f=M(e,r),p=f?N(f,d):``;return(0,Y.jsxs)(`section`,{className:`oc-injcard`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,Y.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Y.jsx)(W,{checked:r.enabled,onCheckedChange:e=>i({enabled:e===!0})}),(0,Y.jsx)(I,{label:n.label(),help:n.help()})]}):(0,Y.jsx)(I,{label:n.label(),help:n.help()}),c&&(0,Y.jsx)(`span`,{className:`oc-injection__badge`,children:w()})]}),(0,Y.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>i({template:e.target.value})}),(0,Y.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,Y.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:k()}),t.placeholders.map(e=>(0,Y.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Y.jsx)(`code`,{children:`{${e}}`}),(0,Y.jsx)(R,{text:(Q[e]??(()=>e))()})]},e))]}),(0,Y.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:a?o():l()}),c&&(0,Y.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>i({template:t.defaultTemplate}),children:O()})]})]}),a&&(0,Y.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:h()})]}):(0,Y.jsx)(`span`,{className:`oc-injection__ph`,children:ee()})})]})}export{$ as PromptInjectionsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,Bh as i,Ch as a,Dh as o,Eh as s,Fh as ee,Gh as c,Hh as l,Ih as te,Jh as u,Kh as d,Lh as f,MO as p,Mh as ne,Nh as re,Oh as ie,Ph as ae,RO as m,Rh as h,Sh as g,Th as _,Uh as v,Vh as y,Wh as b,Xh as x,Yh as S,Zh as C,ch as w,dh as T,fh as E,gh as D,hh as O,jh as k,kh as A,lh as j,mh as M,ph as N,qh as P,uh as F,wh as I,zO as L,zh as R}from"./dist-CLSp0oLP.js";import{t as z}from"./button-BKx-78Cz.js";import{A as B,X as V,Z as H,_ as U,j as W,m as G,xt as K}from"./index-BDVPDgRe.js";import{t as q}from"./roleDescriptions-BVyzh7hN.js";var J=t(e(),1),Y=n(),X=[{group:()=>C(),keys:[{key:`traces.read`,label:()=>d()},{key:`traces.read.content`,label:()=>c(),phi:!0},{key:`traces.write`,label:()=>b()}]},{group:()=>x(),keys:[{key:`kpi.read`,label:()=>d()},{key:`kpi.write`,label:()=>b()}]},{group:()=>S(),keys:[{key:`openclaw.query`,label:()=>v()},{key:`anomalies.read`,label:()=>l()},{key:`anomalies.report`,label:()=>y()}]},{group:()=>u(),keys:[{key:`chats.read`,label:()=>d()},{key:`selfheal`,label:()=>R()}]},{group:()=>P(),keys:[{key:`admin.manage`,label:()=>i()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=L(p.apiKeys.listRoles,{}),t=m(p.apiKeys.createRole),n=m(p.apiKeys.ensureRolesSeeded),i=m(p.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(p.apiKeys.listRoles,{});r&&e.setQuery(p.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),c=W(),l=B(),[u,d]=(0,J.useState)(!1),[v,y]=(0,J.useState)(Q),[b,x]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{l.error(f(),e)})},[n,l]);let S=e??[];async function C(e,t){if(Z(e.permissions)||b.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:te({name:e.name}),description:ee(),confirmLabel:ae()}))){x(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){l.error(re(),e)}finally{x(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function P(){try{await t({key:v.key,name:v.name,description:v.description||void 0,permissions:[]}),y(Q),d(!1)}catch(e){l.error(ne(),e)}}let R=e===void 0,$=!R&&S.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[k(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,r(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,A()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:ie()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{y(Q),d(!0)},children:o()})})]}),R?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:I()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?h({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:S.map(e=>{let t=Z(e.permissions),n=b.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,{}),` `,a()]}):(0,Y.jsx)(V,{variant:`secondary`,children:g()})]}),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?D():n?O():r,onCheckedChange:()=>void C(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:u,onOpenChange:d,title:M(),description:N(),canSubmit:!!(v.key&&v.name),onSubmit:P,submitLabel:E(),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:T()}),(0,Y.jsx)(H,{value:v.key,placeholder:F(),onChange:e=>y({...v,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:j()}),(0,Y.jsx)(H,{value:v.name,onChange:e=>y({...v,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:w()}),(0,Y.jsx)(H,{value:v.description,onChange:e=>y({...v,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{$C as r,Aw as i,BC as a,Bw as ee,Cw as te,Dw as ne,Ew as re,FC as o,Fw as ie,GC as s,Gw as c,HC as l,Hw as ae,IC as oe,IO as se,Iw as ce,JC as u,Jw as le,KC as d,Kw as f,LC as p,Lw as ue,MC as m,MO as h,Mw as de,NC as g,Nw as fe,Ow as pe,PC as _,Pw as me,QC as v,RC as y,RO as b,Rw as he,Sw as ge,Tw as _e,UC as x,Uw as ve,VC as S,Vw as ye,WC as C,Ww as be,XC as w,Xw as xe,YC as T,Yw as Se,ZC as E,Zw as Ce,_w as we,aw as Te,bw as Ee,cw as De,dw as Oe,ew as D,fw as ke,gw as Ae,hw as je,iw as Me,jC as O,jw as Ne,kw as Pe,lw as Fe,mw as Ie,nw as Le,ow as Re,pw as ze,qC as k,qw as Be,rw as Ve,sw as He,tw as Ue,uw as We,vw as Ge,ww as Ke,xw as qe,yw as Je,zC as A,zO as j,zw as Ye}from"./dist-CLSp0oLP.js";import{n as M}from"./dist-CdJRWSN2.js";import{i as Xe}from"./dist-DcNll3Cm.js";import{t as N}from"./button-BKx-78Cz.js";import{$ as P,A as Ze,At as Qe,C as F,Dt as I,Mt as $e,Q as L,S as R,X as z,Z as B,b as V,et as H,j as et,jt as tt,m as nt,nt as U,rt as W,tt as rt,x as G,y as K}from"./index-BDVPDgRe.js";import{t as it}from"./FilterBar-BwVt4XJ7.js";import{t as at}from"./DataTableShell-D3UoYiLm.js";import{t as ot}from"./roleDescriptions-BVyzh7hN.js";var q=t(e(),1),J=n(),st=[{value:`never`,label:()=>p(),days:null},{value:`30`,label:()=>oe(),days:30},{value:`90`,label:()=>o(),days:90}],ct=720*60*60*1e3,Y=`__all__`,X={name:``,roleKey:``,description:``};function Z(){let e=$e({from:`/settings/serviceAccounts`}),t=tt({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??Y,[a,o]=(0,q.useState)(Y),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===Y?void 0:e})}),oe=j(h.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Y?void 0:a,disabled:r===Y?void 0:r===`disabled`}}),u=j(h.apiKeys.listKeys,{}),d=j(h.apiKeys.listRoles,{}),p=b(h.apiKeys.createServiceAccount),m=b(h.apiKeys.updateServiceAccount),g=b(h.apiKeys.deleteServiceAccount),_=se(h.apiKeys.mintApiKey),v=b(h.apiKeys.revokeApiKey),y=et(),x=Ze(),S=n!==``||a!==Y||r!==Y;function C(){o(Y),t({search:{},replace:!0})}let[w,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(X),[O,k]=(0,q.useState)(null),[A,M]=(0,q.useState)(new Set),[P,I]=(0,q.useState)(null),L=(0,q.useRef)(!1),[H,U]=(0,q.useState)(new Set),[W,rt]=(0,q.useState)({}),[ct,Z]=(0,q.useState)(null),Q=(0,q.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 $(e){M(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{O?(await m({serviceAccountId:O,name:E.name,roleKey:E.roleKey,description:E.description}),x.success(je())):await p({name:E.name,roleKey:E.roleKey,description:E.description||void 0}),D(X),k(null),T(!1)}catch(e){x.error(O?Ae():we(),e)}}function ft(e){D({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),T(!0)}async function pt(e){if(L.current)return;L.current=!0;let t=W[e._id]??`never`,n=st.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;I(e._id);try{let t=await _({serviceAccountId:e._id,expiresAt:r});Z({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){x.error(Ie(),e)}finally{L.current=!1,I(null)}}async function mt(e){if(await y({title:ze(),description:(0,J.jsxs)(J.Fragment,{children:[ke(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Oe(),` `,(0,J.jsx)(`strong`,{children:We()}),` `,Fe()]}),confirmWord:e.name,confirmLabel:De(),destructive:!0}))try{await g({serviceAccountId:e._id}),x.success(He(),e.name)}catch(e){x.error(Re(),e)}}async function ht(e){if(await y({title:Te(),description:(0,J.jsxs)(J.Fragment,{children:[Me(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Ve()]}),confirmLabel:Le(),destructive:!0})&&!H.has(e._id)){U(t=>new Set(t).add(e._id));try{await v({keyId:e._id})}catch(e){x.error(Ue(),e)}finally{U(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}),(0,J.jsxs)(it,{q:n,onQChange:s,searchPlaceholder:xe(),onReset:C,canReset:S,children:[(0,J.jsxs)(K,{value:a,onValueChange:o,children:[(0,J.jsx)(R,{size:`sm`,className:`w-40`,children:(0,J.jsx)(F,{placeholder:Se()})}),(0,J.jsxs)(V,{children:[(0,J.jsx)(G,{value:Y,children:le()}),(d??[]).map(e=>(0,J.jsx)(G,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(K,{value:r,onValueChange:l,children:[(0,J.jsx)(R,{size:`sm`,className:`w-36`,children:(0,J.jsx)(F,{})}),(0,J.jsxs)(V,{children:[(0,J.jsx)(G,{value:Y,children:Be()}),(0,J.jsx)(G,{value:`active`,children:f()}),(0,J.jsx)(G,{value:`disabled`,children:c()})]})]})]}),(0,J.jsx)(at,{title:be(),rows:oe,addLabel:ve(),onAdd:()=>{D(X),k(null),T(!0)},emptyHint:ae(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:Q.get(e._id)??[],onRevoke:ht,revoking:H}),rowActions:e=>[{label:he(),onSelect:()=>ft(e)},{label:ye(),onSelect:()=>void pt(e)},{label:A.has(e._id)?ee():Ye(),onSelect:()=>$(e._id)},{label:ue(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(N,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?ce():ie(),onClick:()=>$(e._id),children:A.has(e._id)?(0,J.jsx)(Xe,{}):(0,J.jsx)(Qe,{})})},{header:me(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:fe(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(z,{variant:`secondary`,children:e.roleKey})},{header:de(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(z,{variant:`destructive`,children:c()}):(0,J.jsx)(z,{variant:`outline`,children:f()})},{header:Ne(),cell:e=>(0,J.jsxs)(K,{value:W[e._id]??`never`,onValueChange:t=>rt(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(R,{size:`sm`,className:`w-32`,children:(0,J.jsx)(F,{})}),(0,J.jsx)(V,{children:st.map(e=>(0,J.jsx)(G,{value:e.value,children:e.label()},e.value))})]})},{header:i(),sort:e=>(Q.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Q.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:P===e._id?Pe():pe({count:t})})}}]}),(0,J.jsx)(nt,{open:w,onOpenChange:e=>{T(e),e||k(null)},title:O?ne():Ke(),description:O?re():te(),canSubmit:!!(E.name&&E.roleKey),onSubmit:dt,submitLabel:O?_e():ge(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:qe()}),(0,J.jsx)(B,{value:E.name,onChange:e=>D({...E,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Ee()}),(0,J.jsxs)(K,{value:E.roleKey||void 0,onValueChange:e=>D({...E,roleKey:e}),children:[(0,J.jsx)(R,{className:`w-full`,children:(0,J.jsx)(F,{placeholder:Je()})}),(0,J.jsx)(V,{children:(d??[]).map(e=>(0,J.jsxs)(G,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(d??[]).find(e=>e.key===E.roleKey),t=e?ot(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Ge()}),(0,J.jsx)(B,{value:E.description,onChange:e=>D({...E,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:ct,onClose:()=>Z(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:i}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[D(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:v()}),(0,J.jsx)(`th`,{children:E()}),(0,J.jsx)(`th`,{children:w()}),(0,J.jsx)(`th`,{children:T()}),(0,J.jsx)(`th`,{children:u()}),(0,J.jsx)(`th`,{children:k()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(z,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:Q(t.createdAt)}),(0,J.jsx)(`td`,{className:$(t.lastUsedAt)?`oc-sa__stale`:``,children:dt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:ft(t.expiresAt)}),(0,J.jsx)(`td`,{children:pt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(N,{variant:`destructive`,size:`sm`,disabled:i.has(t._id),onClick:()=>n(t),children:i.has(t._id)?d():s()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(L,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(P,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(U,{children:[(0,J.jsx)(W,{children:C()}),(0,J.jsx)(H,{children:x({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:l()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(N,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":S(),children:[n?(0,J.jsx)(M,{}):(0,J.jsx)(I,{}),n?a():A()]})]}),(0,J.jsx)(rt,{children:(0,J.jsx)(N,{onClick:()=>{r(!1),t()},children:y()})})]}):null})}function Q(e){return new Date(e).toLocaleString(`fr-FR`)}function $(e){return e===null?!1:Date.now()-e>ct}function dt(e){return e===null?_():new Date(e).toLocaleString(`fr-FR`)}function ft(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function pt(e){return e.disabled?(0,J.jsx)(z,{variant:`destructive`,children:g()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(z,{variant:`outline`,children:m()}):(0,J.jsx)(z,{variant:`outline`,children:O()})}export{Z as ServiceAccountsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{At as r,Bt as i,Ct as a,Dt as o,Et as s,Ft as c,Gt as l,Ht as u,It as d,Lt as f,MO as p,Mt as m,Nt as h,Ot as g,Pt as _,RO as v,Rt as y,St as b,Tt as x,Ut as S,Vt as C,Wt as w,_t as T,bt as E,ct as D,dt as O,ft as k,gt as A,ht as j,jt as M,kt as N,lt as P,mt as F,pt as I,st as ee,ut as L,vt as R,wt as z,xt as B,yt as V,zO as H,zt as U}from"./dist-CLSp0oLP.js";import{t as W}from"./button-BKx-78Cz.js";import{j as G}from"./index-BDVPDgRe.js";import{t as K}from"./DataTableShell-D3UoYiLm.js";var q=t(e(),1),J=n(),Y={hung:()=>g(),wrong_result:()=>o(),error:()=>s(),other:()=>x()},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=v(p.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),` · `,z({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:b()}),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`?B():E()}),(0,J.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,J.jsx)(`p`,{className:`oc-fbadmin__meta`,children:V()}),(0,J.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:R(),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?A():T()})})]}),(0,J.jsxs)(`section`,{children:[(0,J.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[j({count:t.children.length}),t.childrenTruncated?` ${F()}`:``,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?` · ${k()}`:``]}),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:O()}),(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:L()}),(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=H(p.subAgentReports.listForAdmin,{}),t=v(p.subAgentReports.readReport),n=v(p.subAgentReports.deleteReport),a=G(),[o,s]=(0,q.useState)(null),[g,b]=(0,q.useState)({});async function x(e){if(o===e._id){s(null);return}if(!g[e._id]){let n=await t({reportId:e._id});b(t=>({...t,[e._id]:n}))}s(e._id)}async function T(e){await a({title:P(),description:D(),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:[S(),` `,(0,J.jsx)(`strong`,{children:u()}),` `,C()]}),(0,J.jsx)(K,{title:l(),rows:e,emptyHint:w(),isExpanded:e=>o===e._id&&!!g[e._id],renderExpanded:e=>g[e._id]?(0,J.jsx)(Q,{data:g[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:y(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:f(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${_({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:h()}):(0,J.jsx)(`span`,{className:`oc-fbadmin__pill`,children:m()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:o===e._id?r():M(),onSelect:()=>void x(e)},{label:N(),onSelect:()=>void T(e),variant:`destructive`}]})]})}export{$ as SubAgentReportsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$T as i,AE as a,BD as o,BE as s,BT as c,CE as l,DE as u,EE as d,FE as f,FT as p,GE as m,GT as h,HE as g,HT as ee,IE as _,IO as v,IT as te,JE as ne,JT as re,KE as ie,KT as ae,LE as oe,LT as se,ME as ce,MO as y,MT as le,NE as ue,NO as de,NT as fe,OE as pe,PE as me,PT as he,QE as ge,QT as b,RE as _e,RO as x,RT as ve,SE as ye,TE as be,UE as xe,UT as Se,VE as Ce,VT as we,WE as S,WT as Te,XE as Ee,XT as De,YE as Oe,YT as ke,ZE as Ae,ZT as je,_E as C,aE as Me,at as w,bE as Ne,cE as Pe,dE as Fe,eD as Ie,eE as Le,fE as Re,gE as ze,hE as Be,iE as Ve,it as He,jE as Ue,kE as We,lE as Ge,mE as Ke,n as qe,nE as Je,nO as Ye,oE as Xe,ot as T,pE as Ze,qE as Qe,qT as $e,rE as et,rO as tt,rt as nt,sE as rt,tE as it,tO as at,uE as ot,vE as st,wE as ct,xE as lt,yE as ut,zD as dt,zE as ft,zO as E,zT as pt}from"./dist-CLSp0oLP.js";import{n as D}from"./dist-CdJRWSN2.js";import{t as O}from"./x-DmVX0ZZY.js";import{t as k}from"./button-BKx-78Cz.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-BDVPDgRe.js";import{a as xt,i as St,n as Ct,o as wt,r as Tt,t as Et}from"./card-r-aJwNEo.js";import{a as Dt,i as H,n as Ot,o as U,r as W,t as kt}from"./table-v_cIgz3K.js";import{t as At}from"./TimeRangePicker-pz6n37si.js";import{t as jt}from"./FilterBar-BwVt4XJ7.js";import{t as Mt}from"./AdvancedFilter-BFrnFKT8.js";var G=de(`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(it());if(e.size>Bt)throw Error(Le());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(b());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(b());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(je());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(i())),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`?tt():e===`dark`?Ye():at()}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:qe(`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":T(),title:T(),children:(0,X.jsx)(mt,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=E(y.charts.listMyCharts),r=x(y.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:ie()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:m()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:S(),subtitle:xe(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?g():n.via===`owner`?Ce():s({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:ft()}):null]})}function $t(){let e=x(y.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[a,o]=(0,K.useState)(null),[s,c]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(C())}}}async function p(){if(o(null),c(!1),t.trim()===``){o(Be());return}let a;try{a=JSON.parse(r)}catch{o(C());return}d(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{d(!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:be()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ct()})]}),(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:l()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:ye(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:lt()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:Ne(),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`}),ut(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:u,onClick:()=>void p(),children:st()})]}),a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:ze()}):null]})]})}function en({chart:e}){let t=v(y.charts.setChartLogo),n=x(y.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Wt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Pe():rt()}),(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?Me():Xe(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:et()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Ve()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ge()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(f,{mode:`light`}),(0,X.jsx)(f,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Je()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=E(y.me.getMe,{host:z}),n=x(y.charts.addChartDomain),r=x(y.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:De()}),(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:ae()}):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":h({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:re(),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:$e()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ke()}),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=x(y.charts.updateChart),n=x(y.charts.deleteChart),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(e.name),[s,l]=(0,K.useState)(()=>nn(e.tokens)),[u,d]=(0,K.useState)(e.tokens.bpm??0),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(!1);function g(){o(e.name),l(nn(e.tokens)),d(e.tokens.bpm??0),p(null),i(!0)}async function _(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(s)}catch{p(C());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}h(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(c()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:g,children:Fe()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:ot()})]})})]}),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:ee()}),(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:w()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>d(Number(e.target.value)),"aria-label":w()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?He():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:nt()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:we()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:m,onClick:()=>void _(),children:Te()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:Se()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function an(){let e=E(y.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:Ke()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ze()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()}):(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=x(y.charts.addChartToGroupPool),r=x(y.charts.removeChartFromGroupPool),i=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 f(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(F,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Ue():e.kind===`custom`&&e.scope===`personal`?te():ce()}),e.isGlobalDefault?(0,X.jsx)(F,{variant:`default`,children:a()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:pe()}),(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":d({group:e.name}),onClick:()=>void f(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:u()})}),(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:We()}):null]})]})}function sn({chart:e}){let t=x(y.charts.promoteChartToCommon),n=x(y.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(c()))try{await n({chartId:e.chartId})}catch{}}return(0,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`?p():te()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:se({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:fe()})]})]})}function cn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let i=x(y.admin.setDefaultThemeMode),a=x(y.admin.setDefaultLocale),s=x(y.charts.setDefaultChart),c=E(y.charts.listChartsAdmin),l=E(y.groups.listGroups,{}),u=e??`system`,d=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ne()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Qe()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:_e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void s({name:null}),children:S()}),vt.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void s({name:e.key}),children:e.name},e.key)),(c??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void s({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:_()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:f()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(on,{chart:e,groups:l??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ue()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).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:pt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(()=>{let e=(c??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:le()}):(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:Ie()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:r()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void i({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:ge()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,X.jsx)(k,{variant:d===e?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e}),children:e===`fr`?o():dt()},e))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]})]})}function ln(){let e=E(y.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:Oe()}),(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};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Au as r,Cu as i,Du as a,Eu as o,Ou as s,Su as c,Tu as l,bu as u,ku as d,vu as f,wu as p,xu as m,yu as h}from"./dist-Cxz8d8g5.js";import{t as g}from"./button-BOkPsnkZ.js";import{Ot as _,Z as v,ct as y,lt as b,st as x,ut as S,vt as C}from"./index-BlRMvXrJ.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:d(),from:`now-15m`},{label:s(),from:`now-30m`},{label:a(),from:`now-1h`},{label:o(),from:`now-3h`},{label:l(),from:`now-6h`},{label:p(),from:`now-12h`},{label:i(),from:`now-24h`},{label:c(),from:`now-2d`},{label:m(),from:`now-7d`},{label:u(),from:`now-30d`},{label:h(),from:`now-90d`},{label:f(),from:`now-520w`}];function k(e){return new Date(e).toLocaleString(`fr-FR`,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function A(e){if(e.kind===`relative`){let t=O.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${k(e.from)} → ${k(e.to)}`}function j(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function M(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function N(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var P=n();function F(e){let[t,n]=(0,w.useState)(0);return(0,w.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,w.useMemo)(()=>{let{from:t,to:n}=D(e);return e.kind===`absolute`?{from:t,to:n}:{from:I(t),to:I(n)}},[e,t])}function I(e){return Math.floor(e/6e4)*6e4}function L({value:e,onChange:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(``),o=D(e),[s,c]=(0,w.useState)(()=>j(o.from)),[l,u]=(0,w.useState)(()=>j(o.to));function d(t){if(t){let t=D(e);c(j(t.from)),u(j(t.to)),a(``)}r(t)}function f(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function p(){let e=M(s),n=M(l);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let m=(0,w.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?O:O.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),h=M(s)!==null&&M(l)!==null;return(0,P.jsxs)(b,{open:n,onOpenChange:d,children:[(0,P.jsx)(S,{asChild:!0,children:(0,P.jsxs)(g,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,P.jsx)(_,{}),A(e)]})}),(0,P.jsx)(y,{children:(0,P.jsx)(x,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,P.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,P.jsx)(`div`,{className:`oc-timerange__section-title`,children:`Plage absolue`}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`De`}),(0,P.jsx)(v,{type:`datetime-local`,value:s,onChange:e=>c(e.target.value)})]}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`À`}),(0,P.jsx)(v,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,P.jsx)(g,{size:`sm`,className:`oc-timerange__apply`,disabled:!h,onClick:p,children:`Appliquer`})]}),(0,P.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,P.jsx)(C,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,P.jsx)(v,{value:i,onChange:e=>a(e.target.value),placeholder:`Rechercher une plage`,"aria-label":`Rechercher une plage relative`})]}),(0,P.jsx)(`ul`,{className:`oc-timerange__list`,children:m.length===0?(0,P.jsx)(`li`,{className:`oc-timerange__empty`,children:`Aucune plage.`}):m.map(t=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>f(t.from),children:t.label})},t.from))})]})]})})})]})}export{F as n,N as r,L as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bu as r,Fu as i,Hu as a,Iu as o,Lu as s,Mu as c,Nu as l,Pu as u,Ru as d,Uu as f,Vu as p,ju as m,zu as h}from"./dist-CLSp0oLP.js";import{t as g}from"./button-BKx-78Cz.js";import{Ot as _,Z as v,ct as y,lt as b,st as x,ut as S,vt as C}from"./index-BDVPDgRe.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:f(),from:`now-5m`},{label:a(),from:`now-15m`},{label:p(),from:`now-30m`},{label:r(),from:`now-1h`},{label:h(),from:`now-3h`},{label:d(),from:`now-6h`},{label:s(),from:`now-12h`},{label:o(),from:`now-24h`},{label:i(),from:`now-2d`},{label:u(),from:`now-7d`},{label:l(),from:`now-30d`},{label:c(),from:`now-90d`},{label:m(),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};