@lacneu/atrium 0.91.1 → 0.91.2

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 (82) hide show
  1. package/dist/assets/{AccessTab-Cwu9fJwI.js → AccessTab-G2mgrnR5.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-DWYTua7e.js → AdvancedFilter-CyevWjzl.js} +1 -1
  3. package/dist/assets/AgentFilesTab-Bquyszow.js +3 -0
  4. package/dist/assets/AnomaliesTab-w3RGpEVA.js +1 -0
  5. package/dist/assets/AuditTab-BfaA3aPE.js +1 -0
  6. package/dist/assets/BridgeTab-CbhPweRj.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-BT8kt4oY.js +1 -0
  8. package/dist/assets/{DataTableShell-Dc3I5mkG.js → DataTableShell-C0SV7OUi.js} +1 -1
  9. package/dist/assets/{DetailChips-Cj0X9b5z.js → DetailChips-BeKOuUKo.js} +1 -1
  10. package/dist/assets/FeedbacksTab-Dhs0vcUt.js +1 -0
  11. package/dist/assets/{FieldLabel-BVUMb8MI.js → FieldLabel-vvQixe9u.js} +1 -1
  12. package/dist/assets/FilesTab-B60GzpLb.js +1 -0
  13. package/dist/assets/{FilterBar-Bfu-khK5.js → FilterBar-DTlL2mzQ.js} +1 -1
  14. package/dist/assets/GroupsTab-BekRX1wU.js +1 -0
  15. package/dist/assets/InstancesTab-B20hNMKz.js +1 -0
  16. package/dist/assets/IntegrationsTab-D53Gcl_R.js +1 -0
  17. package/dist/assets/KpiTab-Zg5ZHkfj.js +1 -0
  18. package/dist/assets/PreferencesTab-BfDU42yI.js +1 -0
  19. package/dist/assets/ProjectPage-zU6z6KS1.js +1 -0
  20. package/dist/assets/PromptInjectionsTab-CYApL0aB.js +4 -0
  21. package/dist/assets/RolesTab-Gutlgj_5.js +1 -0
  22. package/dist/assets/ScheduledTab-CMKobd5y.js +1 -0
  23. package/dist/assets/ServiceAccountsTab-Cf4EU2kL.js +1 -0
  24. package/dist/assets/{SubAgentReportsTab-DjKyJxXi.js → SubAgentReportsTab-BHRuU4mA.js} +1 -1
  25. package/dist/assets/ThemeShowroom-C5GcO6SU.js +1 -0
  26. package/dist/assets/{TimeRangePicker-BqClp5BN.js → TimeRangePicker-9-aQ6g1P.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-yZPA1ePa.js → TimezoneCombobox-DHBtL_j_.js} +1 -1
  28. package/dist/assets/TracesTab-COdbBLX_.js +1 -0
  29. package/dist/assets/TrashPage-Cpra3mll.js +1 -0
  30. package/dist/assets/{TrashTab-C5EAGQ-A.js → TrashTab-Ba7c3pwl.js} +1 -1
  31. package/dist/assets/UsersTab-k2pTMms6.js +1 -0
  32. package/dist/assets/VoiceTab-dVm89Owr.js +1 -0
  33. package/dist/assets/api-751U81xd.js +44 -0
  34. package/dist/assets/{button-DDPt-po9.js → button-Dwru_Lf_.js} +1 -1
  35. package/dist/assets/{card-K4Zt5gfO.js → card-s0ZpJ9CV.js} +1 -1
  36. package/dist/assets/chevrons-up-down-DznzeuSP.js +1 -0
  37. package/dist/assets/{compatView-CVibrgBK.js → compatView-Cyi5F9Ss.js} +1 -1
  38. package/dist/assets/dispatchErrorInfo-J5CG79Uk.js +1 -0
  39. package/dist/assets/{dist-Cwenjp6w.js → dist-BonvIBSy.js} +1 -1
  40. package/dist/assets/{dist-CRdE-dec.js → dist-CKSAyosJ.js} +1 -1
  41. package/dist/assets/{dist-BblNQdHV.js → dist-CaC4Zo1Q.js} +1 -1
  42. package/dist/assets/{dist-821wRD_K.js → dist-DLQaZf47.js} +1 -1
  43. package/dist/assets/{highlighted-body-OFNGDK62-rit1TAaB.js → highlighted-body-OFNGDK62-DpJYuYNn.js} +1 -1
  44. package/dist/assets/index-oxINmoDf.js +446 -0
  45. package/dist/assets/{list-9tuUpKq3.js → list-ClmCB0j4.js} +1 -1
  46. package/dist/assets/mermaid-GHXKKRXX-C-Gj2Yhf.js +1 -0
  47. package/dist/assets/{pdf-BZkOsg6N.js → pdf-NJvkbSbt.js} +1 -1
  48. package/dist/assets/roleDescriptions-ex6WKrl0.js +1 -0
  49. package/dist/assets/{table-CnU0GqDN.js → table-BZJ_ifXB.js} +1 -1
  50. package/dist/assets/{use_paginated_query-DHl8KBoi.js → use_paginated_query-CknaCvRB.js} +1 -1
  51. package/dist/assets/x-C9PzBTHZ.js +1 -0
  52. package/dist/index.html +8 -8
  53. package/package.json +1 -1
  54. package/dist/assets/AgentFilesTab-DaYXJcuZ.js +0 -3
  55. package/dist/assets/AnomaliesTab-RKY5LYNV.js +0 -1
  56. package/dist/assets/AuditTab-CqLksOpr.js +0 -1
  57. package/dist/assets/BridgeTab-1RNCxXv2.js +0 -1
  58. package/dist/assets/ChatDefaultsTab-BuS1Ihhq.js +0 -1
  59. package/dist/assets/FeedbacksTab-CmhVA188.js +0 -1
  60. package/dist/assets/FilesTab-Bs-qAb6x.js +0 -1
  61. package/dist/assets/GroupsTab-BblkD-Mw.js +0 -1
  62. package/dist/assets/InstancesTab-CykKru2n.js +0 -1
  63. package/dist/assets/IntegrationsTab-BGvWPcJJ.js +0 -1
  64. package/dist/assets/KpiTab-0-fYoy76.js +0 -1
  65. package/dist/assets/PreferencesTab-B7rx5jxG.js +0 -1
  66. package/dist/assets/ProjectPage-DeOofCgG.js +0 -1
  67. package/dist/assets/PromptInjectionsTab-iKx77mc6.js +0 -4
  68. package/dist/assets/RolesTab-CdpxcL32.js +0 -1
  69. package/dist/assets/ScheduledTab-mr_m7UIj.js +0 -1
  70. package/dist/assets/ServiceAccountsTab-Do5kRXXv.js +0 -1
  71. package/dist/assets/ThemeShowroom-wAQ75k0V.js +0 -1
  72. package/dist/assets/TracesTab-n_5fNBHX.js +0 -1
  73. package/dist/assets/TrashPage-DKaJKpYI.js +0 -1
  74. package/dist/assets/UsersTab-DIGrBmUm.js +0 -1
  75. package/dist/assets/VoiceTab-CaHc9iZY.js +0 -1
  76. package/dist/assets/api-IF2KQFNF.js +0 -44
  77. package/dist/assets/chevrons-up-down-8nG-pF3_.js +0 -1
  78. package/dist/assets/dispatchErrorInfo-CO5iC4yd.js +0 -1
  79. package/dist/assets/index-DaLXKABQ.js +0 -446
  80. package/dist/assets/mermaid-GHXKKRXX-BOZxTT7y.js +0 -1
  81. package/dist/assets/roleDescriptions-DBJFh3-K.js +0 -1
  82. package/dist/assets/x-F4mR_Xu3.js +0 -1
@@ -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 ee,BM as te,DM as i,DY as a,EM as o,EY as s,GM as c,HM as l,JM as ne,KM as re,MM as u,NM as d,OM as f,PM as p,QM as m,UM as h,VM as g,WM as _,XM as v,YM as y,ZM as ie,aN as b,bf as x,cN as S,dN as C,eN as ae,fN as w,gN as T,hN as E,iN as D,jM as O,kM as k,lN as A,mN as j,nN as M,oN as N,pN as P,qM as F,rN as I,sN as L,t as R,tN as oe,uN as z}from"./api-751U81xd.js";import{t as B}from"./button-Dwru_Lf_.js";import{$t as V,Jt as H,Mt as U,Yt as W,b as G,ct as K,qn as q}from"./index-oxINmoDf.js";import{t as J}from"./roleDescriptions-ex6WKrl0.js";var Y=t(e(),1),X=n(),Z=[{group:()=>T(),keys:[{key:`traces.read`,label:()=>C()},{key:`traces.read.content`,label:()=>z(),phi:!0},{key:`traces.write`,label:()=>A()}]},{group:()=>E(),keys:[{key:`kpi.read`,label:()=>C()},{key:`kpi.write`,label:()=>A()}]},{group:()=>j(),keys:[{key:`openclaw.query`,label:()=>S()},{key:`anomalies.read`,label:()=>L()},{key:`anomalies.report`,label:()=>N()}]},{group:()=>P(),keys:[{key:`chats.read`,label:()=>C()},{key:`selfheal`,label:()=>D()},{key:`media.repair`,label:()=>I()},{key:`feedback.respond`,label:()=>x()}]},{group:()=>w(),keys:[{key:`admin.manage`,label:()=>b()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=a(R.apiKeys.listRoles,{}),t=s(R.apiKeys.createRole),n=s(R.apiKeys.ensureRolesSeeded),b=s(R.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(R.apiKeys.listRoles,{});r&&e.setQuery(R.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),x=K(),S=W(),[C,w]=(0,Y.useState)(!1),[T,E]=(0,Y.useState)($),[D,A]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{S.error(oe(),e)})},[n,S]);let j=e??[];async function N(e,t){if(Q(e.permissions))return;if(e.builtin){await x({title:ae({name:e.name}),description:r(),confirmLabel:m()});return}if(D.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];A(t=>new Set(t).add(e._id));try{await b({roleId:e._id,permissions:n})}catch(e){S.error(ie(),e)}finally{A(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function P(){try{await t({key:T.key,name:T.name,description:T.description||void 0,permissions:[]}),E($),w(!1)}catch(e){S.error(v(),e)}}let I=e===void 0,L=!I&&j.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[y(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,ne(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,F()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:re()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{E($),w(!0)},children:c()})})]}),I?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:l()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?M({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:j.map(e=>{let t=Q(e.permissions),n=D.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(H,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(q,{}),` `,g()]}):(0,X.jsx)(H,{variant:`secondary`,children:te()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),se.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(U,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?p():n?d():r,onCheckedChange:()=>void N(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:C,onOpenChange:w,title:u(),description:O(),canSubmit:!!(T.key&&T.name),onSubmit:P,submitLabel:ee(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:k()}),(0,X.jsx)(V,{value:T.key,placeholder:f(),onChange:e=>E({...T,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:i()}),(0,X.jsx)(V,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,X.jsx)(V,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})})]})}export{ce as RolesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$G as r,$K as i,$q as a,AK as o,BK as s,Bq as c,DK as l,DY as u,E as d,EK as ee,FK as f,Gq as p,Hq as m,IK as te,JK as ne,Jq as h,KK as re,Kq as ie,LK as g,MK as ae,NK as oe,OK as se,PK as ce,QK as le,Qq as ue,RK as de,Uq as fe,VK as pe,Vq as me,Wq as he,XK as ge,Xq as _e,YK as ve,Yq as ye,ZK as be,Zq as xe,_Y as Se,_q as Ce,aK as we,bq as Te,cK as Ee,cq as De,dK as Oe,dq as ke,eJ as Ae,eK as je,eq as Me,fK as Ne,fq as Pe,gK as Fe,gq as Ie,hK as Le,iK as Re,jK as ze,kK as _,lK as Be,lq as Ve,mK as He,mq as Ue,nK as We,oK as Ge,oq as Ke,pK as qe,pq as Je,qG as Ye,qK as Xe,qq as Ze,rK as Qe,rq as $e,sK as et,sq as tt,t as v,tJ as nt,tK as rt,tq as it,uK as at,uq as ot,vq as st,wY as y,xq as ct,yY as b,yq as lt,zK as ut}from"./api-751U81xd.js";import{t as dt}from"./list-ClmCB0j4.js";import{t as x}from"./button-Dwru_Lf_.js";import{$t as ft,An as pt,Bt as mt,Ct as ht,Dt as gt,Et as _t,Gt as vt,Hn as yt,Ht as bt,In as xt,Jn as St,Jt as S,Kt as Ct,Ot as wt,Rn as Tt,Rt as Et,St as C,Tt as Dt,Ut as Ot,Vn as kt,Vt as At,Wt as jt,Yt as Mt,bt as w,cn as T,cr as E,ft as Nt,on as D,qt as Pt,sn as O,sr as k,vt as A,wn as Ft,wt as It,xt as j,yt as M,zt as Lt}from"./index-oxINmoDf.js";import{a as Rt,i as N,n as zt,o as Bt,r as P,t as Vt}from"./table-BZJ_ifXB.js";import{t as Ht}from"./FilterBar-DTlL2mzQ.js";/* empty css */import{a as Ut,c as F,i as I,l as Wt,n as Gt,o as L,r as Kt,s as qt,t as Jt,u as R}from"./TimezoneCombobox-DHBtL_j_.js";var Yt=d(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Xt=d(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),z=t(e(),1),B=n();function V(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Zt({value:e,onChange:t}){let n=Wt(e),r=(0,z.useMemo)(()=>new Date,[]),[i,a]=(0,z.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,c]=(0,z.useState)(!1),l=(0,z.useMemo)(()=>V(b()),[]),u=(0,z.useMemo)(()=>new Intl.DateTimeFormat(b(),{month:`long`,year:`numeric`}),[]),d=(0,z.useMemo)(()=>new Intl.DateTimeFormat(b(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=F(i.year,i.month),f=n?.hour??9,p=n?.minute??0,m=(e,n,r,i,a)=>t(R(e,n,r,i,a)),ne=(e,t,n)=>{a({year:e,month:t}),m(e,t,n,f,p)},h=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},re=n===null?s():d.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,B.jsxs)(D,{modal:!0,open:o,onOpenChange:c,children:[(0,B.jsx)(T,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":pe(),children:[(0,B.jsx)(Yt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,B.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:re})]})}),(0,B.jsxs)(O,{align:`start`,className:`oc-dtp__pop`,children:[(0,B.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":ut(),onClick:()=>h(-1),children:(0,B.jsx)(E,{size:15,"aria-hidden":!0})}),(0,B.jsx)(`span`,{className:`oc-dtp__month`,children:u.format(new Date(i.year,i.month,1))}),(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":de(),onClick:()=>h(1),children:(0,B.jsx)(k,{size:15,"aria-hidden":!0})})]}),(0,B.jsxs)(`div`,{className:`oc-dtp__grid`,children:[l.map((e,t)=>(0,B.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>ne(e.year,e.month,e.day),children:e.day},t)})]}),(0,B.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,B.jsxs)(A,{value:String(f),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),Number(e),p),children:[(0,B.jsx)(j,{size:`sm`,"aria-label":g(),children:(0,B.jsx)(C,{})}),(0,B.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,B.jsx)(w,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,B.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,B.jsxs)(A,{value:String(p),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),f,Number(e)),children:[(0,B.jsx)(j,{size:`sm`,"aria-label":te(),children:(0,B.jsx)(C,{})}),(0,B.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,B.jsx)(w,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function H(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Qt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function $t(e){let t=new Map;for(let n of e){let e=H(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function U(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get(Qt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function en(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function tn(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function nn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var W=3;function rn({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:s}){let c=b(),l=(0,z.useMemo)(()=>$t(e),[e]),u=(0,z.useMemo)(()=>en(c),[c]),d=(0,z.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`,year:`numeric`}),[c]),ee=(0,z.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`}),[c]),f=(0,z.useMemo)(()=>new Intl.DateTimeFormat(c,{hour:`2-digit`,minute:`2-digit`}),[c]),p=new Date,m=e=>{if(t===`year`){i({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);i({year:r.getFullYear(),month:r.getMonth()})},te=t===`year`?String(n.year):d.format(new Date(n.year,n.month,1));return(0,B.jsxs)(`div`,{className:`oc-cal`,children:[(0,B.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,B.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,"aria-label":_(),onClick:()=>m(-1),children:(0,B.jsx)(E,{})}),(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,"aria-label":se(),onClick:()=>m(1),children:(0,B.jsx)(k,{})}),(0,B.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>i({year:p.getFullYear(),month:p.getMonth()}),children:o()})]}),(0,B.jsx)(`span`,{className:`oc-cal__title`,children:te}),(0,B.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,B.jsx)(x,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:ae()}),(0,B.jsx)(x,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:ze()})]})]}),t===`month`?(0,B.jsx)(an,{cursor:n,byDay:l,weekdays:u,timeFmt:f,now:p,onEventClick:a}):(0,B.jsx)(on,{year:n.year,byDay:l,monthShortFmt:ee,now:p,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),s?(0,B.jsx)(`p`,{className:`oc-cal__footnote`,children:s}):null]})}function an({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=F(e.year,e.month);return(0,B.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,B.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Qt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,B.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,B.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,W).map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,B.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,B.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>W?(0,B.jsx)(`span`,{className:`oc-cal__more`,children:l({count:o.length-W})}):null]},n)})]})}function on({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,B.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=U(t,e,o),c=F(e,o);return(0,B.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,B.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,B.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,B.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var G={h:36e5,min:6e4,s:1e3,ms:1};function sn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*G[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function K(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function q(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=K(t[0],0,59),r=K(t[1],0,23),i=K(t[2],1,31),a=K(t[3],1,12),o=K(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var cn=new Map;function J(e){let t=cn.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return cn.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=q(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=L(e)!==`active`,c=Z(s?null:sn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(qt(e)){case`ok`:return(0,B.jsx)(S,{variant:`secondary`,children:Me()});case`error`:return(0,B.jsx)(S,{variant:`destructive`,children:le()});case`running`:return(0,B.jsx)(S,{variant:`outline`,children:be()});case`other`:return(0,B.jsx)(S,{variant:`outline`,children:e});case`none`:return(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=y(v.scheduled.listMyCrons),t=y(v.scheduled.getCronDetail),n=y(v.scheduled.listCronRuns),o=y(v.scheduled.updateCron),s=y(v.scheduled.removeCron),l=y(v.scheduled.runCronNow),d=Mt(),te=u(v.me.getMe,{host:Nt})?.timezone,[g,ae]=(0,z.useState)(null),[se,de]=(0,z.useState)(!1),[pe,ze]=(0,z.useState)(!1),[_,ut]=(0,z.useState)(null),[T,E]=(0,z.useState)(null),[D,O]=(0,z.useState)(null),[k,F]=(0,z.useState)(null),[Wt,qt]=(0,z.useState)(!1),[R,V]=(0,z.useState)(Gt),[H,Qt]=(0,z.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),$t=e=>{localStorage.setItem(`oc.sched.view`,e),Qt(e)},[U,en]=(0,z.useState)(`month`),[W,an]=(0,z.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),on=(0,z.useMemo)(()=>{let e=[];for(let t of g??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Ut(r,R)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[g,R]),G=(0,z.useMemo)(()=>U===`year`?nn(W.year):tn(W.year,W.month),[U,W]),sn=(0,z.useMemo)(()=>un(on,G.startMs,G.endMs),[on,G]),K=e=>{let t=sn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},q=(0,z.useCallback)(async()=>{de(!0),ze(!1);try{ae(await e({}))}catch{ze(!0)}finally{de(!1)}},[e]);(0,z.useEffect)(()=>{q()},[q]);let cn=(0,z.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,z.useRef)(null);(0,z.useEffect)(()=>{g!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[g]);let Y=(0,z.useMemo)(()=>new Intl.DateTimeFormat(b(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{ut(e);try{await t(),d.success(n),await q()}catch(e){d.toast({variant:`error`,title:Ue({code:dn(e)})})}finally{ut(null)}},Z=(0,z.useRef)(0),Q=(0,z.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;O({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;O({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;O(null),d.toast({variant:`error`,title:Ue({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;F({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;F(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Q.current)return;F(null),d.toast({variant:`error`,title:Ue({code:dn(e)})})}},mn=async()=>{if(k===null)return;let e={};if(k.nameDirty&&k.name.trim()===``||k.messageDirty&&k.hasMessage&&k.message.trim()===``){d.toast({variant:`error`,title:r()});return}if(k.nameDirty&&k.name.trim()!==``&&(e.name=k.name.trim()),k.scheduleDirty){if(k.scheduleKind===`cron`&&k.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:k.cronExpr.trim(),...k.tz.trim()===``?{}:{tz:k.tz.trim()}};else if(k.scheduleKind===`every`){let t=Number(k.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[k.everyUnit])})}else if(k.scheduleKind===`at`&&k.at!==``){let t=Date.parse(k.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(k.scheduleDirty&&e.schedule===void 0){d.toast({variant:`error`,title:je()});return}if(k.messageDirty&&k.hasMessage&&k.message.trim()!==``&&(e.message=k.message.trim()),Object.keys(e).length===0){F(null);return}let t=Q.current;qt(!0);try{await o({instanceName:k.instanceName,jobId:k.jobId,patch:e}),d.success(qe()),t===Q.current&&F(null),await q()}catch(e){d.toast({variant:`error`,title:Ue({code:dn(e)})})}finally{qt(!1)}},hn=g?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,B.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:nt()}),(0,B.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":f(),children:[(0,B.jsx)(x,{variant:H===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ce(),title:ce(),"aria-pressed":H===`list`,onClick:()=>$t(`list`),children:(0,B.jsx)(dt,{})}),(0,B.jsx)(x,{variant:H===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":oe(),title:oe(),"aria-pressed":H===`calendar`,onClick:()=>$t(`calendar`),children:(0,B.jsx)(Yt,{})})]}),(0,B.jsxs)(x,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:se,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,B.jsx)(xt,{size:14,"aria-hidden":!0}),Ae()]})]}),g!==null&&hn>0?(0,B.jsxs)(Ht,{q:R.q,onQChange:e=>V(t=>({...t,q:e})),searchPlaceholder:ve(),onReset:()=>V(Gt),canReset:Kt(R),children:[(0,B.jsxs)(A,{value:R.state,onValueChange:e=>V(t=>({...t,state:e})),children:[(0,B.jsx)(j,{size:`sm`,className:`w-40`,children:(0,B.jsx)(C,{})}),(0,B.jsxs)(M,{children:[(0,B.jsx)(w,{value:`all`,children:ne()}),(0,B.jsx)(w,{value:`active`,children:me()}),(0,B.jsx)(w,{value:`paused`,children:m()}),(0,B.jsx)(w,{value:`auto-disabled`,children:c()})]})]}),(0,B.jsxs)(A,{value:R.result,onValueChange:e=>V(t=>({...t,result:e})),children:[(0,B.jsx)(j,{size:`sm`,className:`w-40`,children:(0,B.jsx)(C,{})}),(0,B.jsxs)(M,{children:[(0,B.jsx)(w,{value:`all`,children:Xe()}),(0,B.jsx)(w,{value:`ok`,children:Me()}),(0,B.jsx)(w,{value:`error`,children:le()}),(0,B.jsx)(w,{value:`running`,children:be()}),(0,B.jsx)(w,{value:`none`,children:ge()})]})]})]}):null,g===null?(0,B.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":se,children:pe?a():Se()}):H===`calendar`?(0,B.jsxs)(B.Fragment,{children:[pe?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):null,g.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):(0,B.jsx)(rn,{events:sn.events,mode:U,cursor:W,onModeChange:en,onCursorChange:an,onEventClick:K,footnote:ee()})]}):(0,B.jsxs)(B.Fragment,{children:[pe?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):null,g.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):null,g.map(e=>{let t=e.jobs.filter(e=>Ut(e,R)),n=Kt(R)&&e.jobs.length>0&&t.length===0;return(0,B.jsxs)(`section`,{style:{marginBottom:20},children:[g.length>1||e.error||!e.supported?(0,B.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,B.jsx)(S,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:_e({code:e.error})}):e.jobs.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):n?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):(0,B.jsxs)(Vt,{children:[(0,B.jsx)(Rt,{children:(0,B.jsxs)(Bt,{children:[(0,B.jsx)(N,{children:h()}),(0,B.jsx)(N,{children:Ze()}),(0,B.jsx)(N,{children:ie()}),(0,B.jsx)(N,{children:p()}),(0,B.jsx)(N,{children:he()}),(0,B.jsx)(N,{children:it()}),(0,B.jsx)(N,{children:Fe()})]})}),(0,B.jsx)(zt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,a=_===r,s=e.manageSupported,u=e.kind===`openclaw`&&s;return(0,B.jsxs)(Bt,{ref:t.id!==null&&t.id===cn?J:void 0,"data-state":t.id!==null&&t.id===cn?`selected`:void 0,children:[(0,B.jsx)(P,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??fe()}),(0,B.jsx)(P,{children:(0,B.jsx)(S,{variant:`secondary`,children:t.agentId})}),(0,B.jsxs)(P,{className:`whitespace-nowrap`,children:[(0,B.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=Et(t.schedule),n=e===null?null:Lt(e);return n===null?null:(0,B.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,B.jsx)(P,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,B.jsx)(P,{children:L(t)===`auto-disabled`?(0,B.jsx)(S,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:c()}):L(t)===`active`?(0,B.jsx)(S,{variant:`secondary`,children:me()}):L(t)===`paused`?(0,B.jsx)(S,{variant:`outline`,children:m()}):(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,B.jsxs)(P,{children:[(0,B.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,B.jsx)(S,{variant:`destructive`,title:t.lastDeliveryError??ct(),children:i()}):null]}),(0,B.jsx)(P,{className:`whitespace-nowrap`,children:t.id===null?(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,B.jsx)(St,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsxs)(`span`,{className:`oc-cronactions`,children:[u?(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:lt(),"aria-label":lt(),disabled:_!==null,onClick:()=>void X(r,async()=>{let n=await l({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},Je()),children:(0,B.jsx)(Ft,{size:14,"aria-hidden":!0})}):null,u&&t.enabled!==null?(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:I(t)===`pause`?st():Ce(),"aria-label":I(t)===`pause`?st():Ce(),disabled:_!==null,onClick:()=>void X(r,()=>o({instanceName:e.instanceName,jobId:t.id,patch:{enabled:I(t)===`resume`}}),I(t)===`pause`?Pe():ke()),children:I(t)===`pause`?(0,B.jsx)(yt,{size:14,"aria-hidden":!0}):(0,B.jsx)(Tt,{size:14,"aria-hidden":!0})}):null,u?(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:Le(),"aria-label":Le(),disabled:_!==null,onClick:()=>void pn(e.instanceName,t),children:(0,B.jsx)(kt,{size:14,"aria-hidden":!0})}):null,u?(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:He(),"aria-label":He(),disabled:_!==null,onClick:()=>void ln(e.instanceName,t),children:(0,B.jsx)(Xt,{size:14,"aria-hidden":!0})}):null,s?(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:Ie(),"aria-label":Ie(),disabled:_!==null,onClick:()=>E({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,B.jsx)(pt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:xe()})]},e.instanceName)}),hn>0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:Ye()}):null]}),(0,B.jsx)(mt,{open:T!==null,onOpenChange:e=>{e||E(null)},children:(0,B.jsxs)(Ot,{children:[(0,B.jsxs)(Ct,{children:[(0,B.jsx)(Pt,{children:Ve()}),(0,B.jsx)(jt,{children:De({name:T?.name??``})})]}),(0,B.jsxs)(vt,{children:[(0,B.jsx)(bt,{children:tt()}),(0,B.jsx)(At,{onClick:()=>{let e=T;E(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>s({instanceName:e.instanceName,jobId:e.jobId}),ot())},children:Ke()})]})]})}),(0,B.jsx)(ht,{open:D!==null,onOpenChange:e=>{e||(Z.current++,O(null))},children:(0,B.jsxs)(It,{style:{maxWidth:640},children:[(0,B.jsx)(gt,{children:(0,B.jsx)(wt,{children:Ne({name:D?.name??``})})}),D?.entries===null?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):D!==null&&D.entries.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()}):D===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:D.entries.map((e,t)=>(0,B.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,B.jsx)(fn,{status:e.status}),(0,B.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,B.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[$e({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,B.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,B.jsx)(ht,{open:k!==null,onOpenChange:e=>{e||(Q.current++,F(null))},children:(0,B.jsxs)(It,{className:`oc-cronedit`,children:[(0,B.jsxs)(gt,{children:[(0,B.jsx)(wt,{children:at()}),(0,B.jsx)(Dt,{children:Be()})]}),k===null?null:k.loading?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,B.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:h()}),(0,B.jsx)(ft,{value:k.name,maxLength:200,onChange:e=>F({...k,name:e.target.value,nameDirty:!0})})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Ee()}),(0,B.jsxs)(A,{value:k.scheduleKind,onValueChange:e=>F({...k,scheduleKind:e,scheduleDirty:!0}),children:[(0,B.jsx)(j,{children:(0,B.jsx)(C,{})}),(0,B.jsxs)(M,{children:[(0,B.jsx)(w,{value:`cron`,children:et()}),(0,B.jsx)(w,{value:`every`,children:Ge()}),(0,B.jsx)(w,{value:`at`,children:we()})]})]}),k.scheduleKind===`cron`?(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(ft,{value:k.cronExpr,onChange:e=>F({...k,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,B.jsx)(Jt,{value:k.tz,onChange:e=>F({...k,tz:e,scheduleDirty:!0}),fallbackTz:te??void 0})]}):k.scheduleKind===`every`?(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(ft,{type:`number`,min:1,value:k.everyValue,onChange:e=>F({...k,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,B.jsxs)(A,{value:k.everyUnit,onValueChange:e=>F({...k,everyUnit:e,scheduleDirty:!0}),children:[(0,B.jsx)(j,{style:{maxWidth:160},children:(0,B.jsx)(C,{})}),(0,B.jsxs)(M,{children:[(0,B.jsx)(w,{value:`minutes`,children:Re()}),(0,B.jsx)(w,{value:`hours`,children:Qe()}),(0,B.jsx)(w,{value:`days`,children:We()})]})]})]}):(0,B.jsx)(Zt,{value:k.at,onChange:e=>F({...k,at:e,scheduleDirty:!0})})]}),k.hasMessage?(0,B.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Te()}),(0,B.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:k.message,onChange:e=>F({...k,message:e.target.value,messageDirty:!0})})]}):null]}),(0,B.jsxs)(_t,{children:[(0,B.jsx)(x,{variant:`ghost`,onClick:()=>F(null),children:tt()}),(0,B.jsxs)(x,{onClick:()=>void mn(),disabled:k===null||k.loading||Wt,children:[Wt?(0,B.jsx)(St,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,rt()]})]})]})})]})}export{pn as ScheduledTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$H as r,AH as i,AU as ee,BH as te,CH as a,CU as ne,DH as o,DU as re,DY as s,EH as c,EU as ie,EY as l,FH as u,GH as ae,HH as oe,IH as d,JH as se,KH as ce,LH as f,MH as p,MU as le,NH as m,NU as ue,OH as h,OU as g,PH as de,PU as fe,QH as pe,RH as me,SH as he,SU as ge,TH as _e,TU as ve,UH as ye,VH as be,WH as xe,XH as Se,YH as Ce,ZH as we,_H as _,_U as Te,aU as Ee,bH as v,bU as De,cU as Oe,dU as ke,eU as Ae,fU as je,gH as y,gU as Me,hH as b,hU as Ne,iU as Pe,jH as x,jU as Fe,kH as S,kU as C,lU as Ie,mH as w,mU as Le,nU as Re,oU as ze,pU as Be,qH as Ve,rU as He,sU as Ue,t as T,tU as We,uU as Ge,vH as E,vU as Ke,wH as D,wU as qe,wY as Je,xH as O,xU as Ye,yH as k,yU as Xe,zH as Ze}from"./api-751U81xd.js";import{r as Qe}from"./dist-DLQaZf47.js";import{t as A}from"./button-Dwru_Lf_.js";import{$t as j,At as M,Ct as N,Dt as P,Et as F,Jt as I,Ot as L,St as R,Tt as z,Yt as $e,b as et,bt as B,ct as tt,dr as nt,fr as rt,kt as V,lr as it,rr as at,sr as ot,vt as H,wt as U,xt as W,yt as G}from"./index-oxINmoDf.js";import{t as st}from"./FilterBar-DTlL2mzQ.js";import{t as ct}from"./DataTableShell-C0SV7OUi.js";import{t as lt}from"./roleDescriptions-ex6WKrl0.js";var K=t(e(),1),q=n(),J=[{value:`never`,label:()=>v(),days:null},{value:`30`,label:()=>k(),days:30},{value:`90`,label:()=>E(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=rt({from:`/settings/serviceAccounts`}),t=nt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??X,[a,o]=(0,K.useState)(X),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),d=s(T.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===X?void 0:a,disabled:i===X?void 0:i===`disabled`}}),f=s(T.apiKeys.listKeys,{}),p=s(T.apiKeys.listRoles,{}),m=l(T.apiKeys.createServiceAccount),h=l(T.apiKeys.updateServiceAccount),de=l(T.apiKeys.deleteServiceAccount),he=Je(T.apiKeys.mintApiKey),_e=l(T.apiKeys.revokeApiKey),_=tt(),v=$e(),y=n!==``||a!==X||i!==X;function b(){o(X),t({search:{},replace:!0})}let[x,S]=(0,K.useState)(!1),[w,E]=(0,K.useState)(Z),[D,O]=(0,K.useState)(null),[k,M]=(0,K.useState)(new Set),[N,P]=(0,K.useState)(null),F=(0,K.useRef)(!1),[L,z]=(0,K.useState)(new Set),[V,it]=(0,K.useState)({}),[at,U]=(0,K.useState)(null),Y=(0,K.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[f]);function Q(e){M(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await h({serviceAccountId:D,name:w.name,roleKey:w.roleKey,description:w.description}),v.success(pe())):await m({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),E(Z),O(null),S(!1)}catch(e){v.error(D?r():Ae(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),S(!0)}async function mt(e){if(F.current)return;F.current=!0;let t=V[e._id]??`never`,n=J.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;P(e._id);try{let t=await he({serviceAccountId:e._id,expiresAt:r});U({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(we(),e)}finally{F.current=!1,P(null)}}async function $(e){if(await _({title:Se(),description:(0,q.jsxs)(q.Fragment,{children:[Ce(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,se(),` `,(0,q.jsx)(`strong`,{children:Ve()}),` `,ce()]}),confirmWord:e.name,confirmLabel:ae(),destructive:!0}))try{await de({serviceAccountId:e._id}),v.success(xe(),e.name)}catch(e){v.error(ye(),e)}}async function ht(e){if(await _({title:oe(),description:(0,q.jsxs)(q.Fragment,{children:[be(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,te()]}),confirmLabel:Ze(),destructive:!0})&&!L.has(e._id)){z(t=>new Set(t).add(e._id));try{await _e({keyId:e._id})}catch(e){v.error(me(),e)}finally{z(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}),(0,q.jsxs)(st,{q:n,onQChange:c,searchPlaceholder:ue(),onReset:b,canReset:y,children:[(0,q.jsxs)(H,{value:a,onValueChange:o,children:[(0,q.jsx)(W,{size:`sm`,className:`w-40`,children:(0,q.jsx)(R,{placeholder:le()})}),(0,q.jsxs)(G,{children:[(0,q.jsx)(B,{value:X,children:Fe()}),(p??[]).map(e=>(0,q.jsx)(B,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(H,{value:i,onValueChange:u,children:[(0,q.jsx)(W,{size:`sm`,className:`w-36`,children:(0,q.jsx)(R,{})}),(0,q.jsxs)(G,{children:[(0,q.jsx)(B,{value:X,children:ee()}),(0,q.jsx)(B,{value:`active`,children:C()}),(0,q.jsx)(B,{value:`disabled`,children:g()})]})]})]}),(0,q.jsx)(ct,{title:re(),rows:d,addLabel:ie(),onAdd:()=>{E(Z),O(null),S(!0)},emptyHint:ve(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:L}),rowActions:e=>[...(e.managedBy??null)===null?[{label:Ye(),onSelect:()=>pt(e)},{label:qe(),onSelect:()=>void mt(e)}]:[],{label:k.has(e._id)?ne():ge(),onSelect:()=>Q(e._id)},...(e.managedBy??null)===null?[{label:De(),variant:`destructive`,onSelect:()=>void $(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Xe():Ke(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,q.jsx)(Qe,{}):(0,q.jsx)(ot,{})})},{header:Te(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Me(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(I,{variant:`secondary`,children:e.roleKey})},{header:Ne(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(I,{variant:`destructive`,children:g()}):(0,q.jsx)(I,{variant:`outline`,children:C()})},{header:Le(),cell:e=>(0,q.jsxs)(H,{value:V[e._id]??`never`,onValueChange:t=>it(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(W,{size:`sm`,className:`w-32`,children:(0,q.jsx)(R,{})}),(0,q.jsx)(G,{children:J.map(e=>(0,q.jsx)(B,{value:e.value,children:e.label()},e.value))})]})},{header:Be(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?je():ke({count:t})})}}]}),(0,q.jsx)(et,{open:x,onOpenChange:e=>{S(e),e||O(null)},title:D?Ge():Ue(),description:D?Ie():ze(),canSubmit:!!(w.name&&w.roleKey),onSubmit:ft,submitLabel:D?Oe():Ee(),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)(j,{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:He()}),(0,q.jsxs)(H,{value:w.roleKey||void 0,onValueChange:e=>E({...w,roleKey:e}),children:[(0,q.jsx)(W,{className:`w-full`,children:(0,q.jsx)(R,{placeholder:Re()})}),(0,q.jsx)(G,{children:(p??[]).map(e=>(0,q.jsxs)(B,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(p??[]).find(e=>e.key===w.roleKey),t=e?lt(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:We()}),(0,q.jsx)(j,{value:w.description,onChange:e=>E({...w,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:at,onClose:()=>U(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[f(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:u()}),(0,q.jsx)(`th`,{children:de()}),(0,q.jsx)(`th`,{children:m()}),(0,q.jsx)(`th`,{children:p()}),(0,q.jsx)(`th`,{children:x()}),(0,q.jsx)(`th`,{children:i()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(I,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:M(t.createdAt)}),(0,q.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:mt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,q.jsx)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?S():h()}):null})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(N,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(U,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(P,{children:[(0,q.jsx)(L,{children:o()}),(0,q.jsx)(z,{children:c({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:_e()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":D(),children:[n?(0,q.jsx)(it,{}):(0,q.jsx)(at,{}),n?a():he()]})]}),(0,q.jsx)(F,{children:(0,q.jsx)(A,{onClick:()=>{r(!1),t()},children:O()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?_():M(e)}function mt(e){return e===null?`—`:V(e)}function $(e){return e.disabled?(0,q.jsx)(I,{variant:`destructive`,children:y()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(I,{variant:`outline`,children:b()}):(0,q.jsx)(I,{variant:`outline`,children:w()})}export{Q as ServiceAccountsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Am as i,CY as a,Cm as o,Dm as s,Em as c,Jp as l,Om as u,Qp as d,SY as f,Sm as p,Tm as m,Xp as h,Yp as g,Zp as _,_m as v,am as y,bm as b,cm as x,dm as S,em as C,fm as w,gm as T,hm as E,im as D,jm as O,km as k,lm as A,mm as j,nm as M,om as N,pm as P,qp as F,rm as I,sm as L,t as R,tm as ee,um as z,vm as B,wm as V,xm as H,ym as U}from"./api-IF2KQFNF.js";import{t as W}from"./button-DDPt-po9.js";import{At as G,ct as K}from"./index-DaLXKABQ.js";import{t as q}from"./DataTableShell-Dc3I5mkG.js";var J=t(e(),1),Y=n(),X={hung:()=>j(),wrong_result:()=>P(),error:()=>w(),other:()=>S()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=f(R.subAgentReports.respondToReport),[i,a]=(0,J.useState)(e.thread),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1);async function u(){let t=o.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,z({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?L():N()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:y()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:D(),value:o,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void u(),disabled:!o.trim()||c,children:c?M():I()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[ee({count:t.children.length}),t.childrenTruncated?` ${C()}`:``,t.textTruncated?` ${r()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${d()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:h()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=a(R.subAgentReports.listForAdmin,{}),t=f(R.subAgentReports.readReport),n=f(R.subAgentReports.deleteReport),r=K(),[d,h]=(0,J.useState)(null),[_,y]=(0,J.useState)({});async function x(e){if(d===e._id){h(null);return}if(!_[e._id]){let n=await t({reportId:e._id});y(t=>({...t,[e._id]:n}))}h(e._id)}async function S(e){await r({title:g(),description:l(),confirmLabel:F(),destructive:!0})&&(await n({reportId:e._id}),d===e._id&&h(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[k(),` `,(0,Y.jsx)(`strong`,{children:u()}),` `,s()]}),(0,Y.jsx)(q,{title:O(),rows:e,emptyHint:i(),isExpanded:e=>d===e._id&&!!_[e._id],renderExpanded:e=>_[e._id]?(0,Y.jsx)($,{data:_[e._id]}):null,columns:[{header:c(),cell:e=>G(e.at),sort:e=>e.at},{header:m(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:V(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:o(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${b({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:p(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:H(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:U()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:B()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:d===e._id?T():v(),onSelect:()=>void x(e)},{label:E(),onSelect:()=>void S(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Am as i,Cm as a,DY as o,Dm as s,EY as c,Em as l,Jp as u,Om as d,Qp as f,Sm as p,Tm as m,Xp as h,Yp as g,Zp as _,_m as v,am as y,bm as b,cm as x,dm as S,em as C,fm as w,gm as T,hm as E,im as D,jm as O,km as k,lm as A,mm as j,nm as M,om as N,pm as P,qp as F,rm as I,sm as L,t as R,tm as ee,um as z,vm as B,wm as V,xm as H,ym as U}from"./api-751U81xd.js";import{t as W}from"./button-Dwru_Lf_.js";import{At as G,ct as K}from"./index-oxINmoDf.js";import{t as q}from"./DataTableShell-C0SV7OUi.js";var J=t(e(),1),Y=n(),X={hung:()=>j(),wrong_result:()=>P(),error:()=>w(),other:()=>S()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=c(R.subAgentReports.respondToReport),[i,a]=(0,J.useState)(e.thread),[o,s]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1);async function d(){let t=o.trim();if(!(!t||l)){u(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{u(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,z({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?L():N()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:y()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:D(),value:o,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void d(),disabled:!o.trim()||l,children:l?M():I()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[ee({count:t.children.length}),t.childrenTruncated?` ${C()}`:``,t.textTruncated?` ${r()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${f()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:h()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=o(R.subAgentReports.listForAdmin,{}),t=c(R.subAgentReports.readReport),n=c(R.subAgentReports.deleteReport),r=K(),[f,h]=(0,J.useState)(null),[_,y]=(0,J.useState)({});async function x(e){if(f===e._id){h(null);return}if(!_[e._id]){let n=await t({reportId:e._id});y(t=>({...t,[e._id]:n}))}h(e._id)}async function S(e){await r({title:g(),description:u(),confirmLabel:F(),destructive:!0})&&(await n({reportId:e._id}),f===e._id&&h(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[k(),` `,(0,Y.jsx)(`strong`,{children:d()}),` `,s()]}),(0,Y.jsx)(q,{title:O(),rows:e,emptyHint:i(),isExpanded:e=>f===e._id&&!!_[e._id],renderExpanded:e=>_[e._id]?(0,Y.jsx)($,{data:_[e._id]}):null,columns:[{header:l(),cell:e=>G(e.at),sort:e=>e.at},{header:m(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:V(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:a(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${b({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:p(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:H(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:U()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:B()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:f===e._id?T():v(),onSelect:()=>void x(e)},{label:E(),onSelect:()=>void S(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$W as r,AG as i,AW as a,BG as o,BW as s,CG as c,CW as l,DG as u,DW as d,DY as f,EG as p,EW as m,EY as h,FG as g,FW as _,GW as v,Gp as y,HG as b,HW as x,IG as ee,IW as te,JW as ne,KW as re,Kp as S,LG as ie,LW as ae,MG as oe,MW as se,NG as C,NW as ce,OG as le,OW as ue,PG as de,PW as fe,QW as pe,RG as me,RW as he,SG as ge,SW as _e,TG as ve,TW as w,UG as ye,UW as be,Up as xe,VG as Se,VW as T,WW as Ce,Wp as we,XW as Te,YW as Ee,ZW as De,_G as Oe,aG as ke,bG as Ae,cG as je,dG as Me,eG as Ne,fG as Pe,gG as Fe,hG as Ie,hY as Le,iG as Re,jG as ze,jW as Be,kG as Ve,kW as E,lG as He,mG as Ue,mY as We,nG as Ge,oG as D,pG as Ke,pY as qe,qW as Je,r as Ye,rG as Xe,sG as Ze,t as O,tG as Qe,uG as $e,vG as et,wG as tt,wW as nt,wY as rt,xG as it,xW as at,yG as ot,zG as st,zW as ct}from"./api-751U81xd.js";import{t as k}from"./x-C9PzBTHZ.js";import{t as A}from"./button-Dwru_Lf_.js";import{$t as j,Jt as M,Mt as N,On as P,St as F,an as lt,bt as I,dt as ut,en as dt,ft as L,in as R,lr as z,nn as B,nr as ft,rn as pt,tn as mt,tr as V,ut as ht,vt as H,xt as U,yt as W}from"./index-oxINmoDf.js";import{t as gt}from"./localePickerView-C2RmOS86.js";import{a as _t,i as vt,n as yt,o as bt,r as xt,t as St}from"./card-s0ZpJ9CV.js";import{a as Ct,i as G,n as wt,o as K,r as q,t as Tt}from"./table-BZJ_ifXB.js";import{t as Et}from"./TimeRangePicker-9-aQ6g1P.js";import{t as Dt}from"./FilterBar-DTlL2mzQ.js";import{t as Ot}from"./AdvancedFilter-CyevWjzl.js";var J=t(e(),1),kt=.1,At=[248,248,248],jt=[24,24,24];function Mt(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 Nt(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 Pt(e,t,n){return Nt(e,t,n)>=kt}function Ft(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 It(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 Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(Ce());if(e.size>Lt)throw Error(be());let{source:n,width:r,height:i,cleanup:a}=await Ht(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Rt/r,zt/i,a?1/0:1),c=Math.max(1,Math.round(r*o)),l=Math.max(1,Math.round(i*o)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)throw Error(T());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,c,l);let f=Mt(d.getImageData(0,0,c,l).data,c,l)??{x:0,y:0,width:c,height:l},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(T());if(m.drawImage(u,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);Pt(e.data,f.width,f.height)?Ft(e.data,t.variantFor===`dark`?At:jt):It(e.data),m.putImageData(e,0,0)}let h=Pt(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await Y(p,`image/webp`,Bt)??await Y(p,`image/png`);if(!g)throw Error(s());return{blob:g,hasAlpha:h}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return Ut(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 Ut(e)}async function Ut(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(x())),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 Wt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Gt={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({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 qt(e){return e===`light`?Le():e===`dark`?We():qe()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Ye(`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)(z,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{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)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":S(),title:S(),children:(0,X.jsx)(ft,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=f(O.charts.listMyCharts),r=h(O.charts.setMyChart);async function a(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:g()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:C(),subtitle:oe(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?ze():n.via===`owner`?i():Ve({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(n.key),onExport:()=>Wt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:le()}):null]})}function Qt(){let e=h(O.charts.importChart),[t,n]=(0,J.useState)(``),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1);async function d(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(D())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(Re());return}let a;try{a=JSON.parse(r)}catch{o(D());return}u(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{u(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ue()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ke()})]}),(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:Pe()}),(0,X.jsx)(j,{value:t,onChange:e=>n(e.target.value),placeholder:Me(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:$e()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:He(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(P,{className:`size-4`}),je(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,X.jsx)(A,{size:`sm`,disabled:l,onClick:()=>void f(),children:Ze()})]}),a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:ke()}):null]})]})}function $t({chart:e}){let t=rt(O.charts.setChartLogo),n=h(O.charts.removeChartLogo),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.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 Vt(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`?De():Te()}),(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)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(P,{className:`size-4`}),t?ne():Ee(),(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)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:re()}):null,t?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Je()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:pe()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(f,{mode:`light`}),(0,X.jsx)(f,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:v()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=f(O.me.getMe,{host:L}),n=h(O.charts.addChartDomain),r=h(O.charts.removeChartDomain),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.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 p(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:ct()}),(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:_()}):u.map(e=>(0,X.jsxs)(M,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":fe({domain:e}),onClick:()=>void p(e),children:(0,X.jsx)(k,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{value:i,onChange:e=>a(e.target.value),placeholder:ae(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:te()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:he()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=h(O.charts.updateChart),n=h(O.charts.deleteChart),[i,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(e.name),[l,u]=(0,J.useState)(()=>$(e.tokens)),[d,f]=(0,J.useState)(e.tokens.bpm??0),[p,m]=(0,J.useState)(null),[g,_]=(0,J.useState)(!1);function v(){c(e.name),u($(e.tokens)),f(e.tokens.bpm??0),m(null),o(!0)}async function b(){if(e.chartId===void 0)return;m(null);let n;try{n=JSON.parse(l)}catch{m(D());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;d>0?e.bpm=d:delete e.bpm}_(!0);try{await t({chartId:e.chartId,name:s.trim(),tokens:n}),o(!1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{_(!1)}}async function x(){if(e.chartId!==void 0&&window.confirm(E()))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:i?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:v,children:Ne()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void x(),children:r()})]})})]}),i?(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:Be()}),(0,X.jsx)(j,{value:s,onChange:e=>c(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:y()}),(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:d,onChange:e=>f(Number(e.target.value)),"aria-label":y()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:d===0?we():`${d} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:xe()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:a()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:l,onChange:e=>u(e.target.value),rows:10,spellCheck:!1})]}),p?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:p}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,disabled:g,onClick:()=>void b(),children:ce()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>o(!1),children:se()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=f(O.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:Xe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ge()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Qe()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=h(O.charts.addChartToGroupPool),r=h(O.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,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)(M,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Ae():e.kind===`custom`&&e.scope===`personal`?w():it()}),e.isGlobalDefault?(0,X.jsx)(M,{variant:`default`,children:ot()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Oe()}),(a??[]).map(e=>(0,X.jsxs)(M,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ie({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(k,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(H,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(U,{size:`sm`,className:`w-56`,children:(0,X.jsx)(F,{placeholder:Fe()})}),(0,X.jsx)(W,{children:s.map(e=>(0,X.jsx)(I,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:et()}):null]})]})}function an({chart:e}){let t=h(O.charts.promoteChartToCommon),n=h(O.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(E()))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)(M,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?nt():w()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:m({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:l()}):null,(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:_e()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=h(O.admin.setDefaultThemeMode),i=h(O.admin.setDefaultLocale),a=h(O.charts.setDefaultChart),s=f(O.charts.listChartsAdmin),l=f(O.groups.listGroups,{}),m=e??`system`,g=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:ie()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(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:u()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:p()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:C()}),ut.map(e=>(0,X.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:tt()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(rn,{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:c()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ge()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).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)(en,{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:ue()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:at()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(an,{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:ye()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:b()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(A,{variant:m===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(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:Se()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:gt().map(e=>(0,X.jsx)(A,{variant:g===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:st()})]})]})}function sn(){let e=f(O.me.getMe,{host:L}),t=ht(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(nn,{}),e?.role===`admin`?(0,X.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,J.useState)(!0),[n,r]=(0,J.useState)(`per-user`),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(Z),[c,l]=(0,J.useState)(Z),[u,d]=(0,J.useState)(Gt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Gt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(sn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:me()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(A,{variant:`outline`,children:`Outline`}),(0,X.jsx)(A,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(A,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(A,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,children:`Small`}),(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{size:`lg`,children:`Large`}),(0,X.jsx)(A,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(V,{})}),(0,X.jsx)(A,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(M,{children:`Default`}),(0,X.jsx)(M,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(M,{variant:`outline`,children:`Outline`}),(0,X.jsx)(M,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(j,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(H,{value:n,onValueChange:r,children:[(0,X.jsx)(U,{className:`w-56`,children:(0,X.jsx)(F,{placeholder:`Select…`})}),(0,X.jsxs)(W,{children:[(0,X.jsx)(I,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(I,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(N,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(Dt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(H,{value:o,onValueChange:s,children:[(0,X.jsx)(U,{size:`sm`,children:(0,X.jsx)(F,{})}),(0,X.jsxs)(W,{children:[(0,X.jsx)(I,{value:Z,children:`Toutes directions`}),(0,X.jsx)(I,{value:`inbound`,children:`inbound`}),(0,X.jsx)(I,{value:`outbound`,children:`outbound`}),(0,X.jsx)(I,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(H,{value:c,onValueChange:l,children:[(0,X.jsx)(U,{size:`sm`,children:(0,X.jsx)(F,{})}),(0,X.jsxs)(W,{children:[(0,X.jsx)(I,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(I,{value:`info`,children:`info`}),(0,X.jsx)(I,{value:`warn`,children:`warn`}),(0,X.jsx)(I,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(Ot,{fields:Kt,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)(Et,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(dt,{children:[(0,X.jsx)(lt,{asChild:!0,children:(0,X.jsx)(A,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(V,{})})}),(0,X.jsxs)(mt,{align:`start`,children:[(0,X.jsx)(pt,{children:`Actions`}),(0,X.jsx)(R,{}),(0,X.jsx)(B,{children:`Edit`}),(0,X.jsx)(B,{children:`Duplicate`}),(0,X.jsx)(R,{}),(0,X.jsx)(B,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(St,{className:`w-80`,children:[(0,X.jsxs)(_t,{children:[(0,X.jsx)(bt,{children:`Instance`}),(0,X.jsx)(xt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(yt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(vt,{className:`gap-2`,children:[(0,X.jsx)(A,{size:`sm`,children:`Save`}),(0,X.jsx)(A,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Tt,{children:[(0,X.jsx)(Ct,{children:(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{className:`w-8`,children:(0,X.jsx)(N,{"aria-label":`select all`})}),(0,X.jsx)(G,{children:`Name`}),(0,X.jsx)(G,{children:`Mode`}),(0,X.jsx)(G,{className:`text-right`,children:`Status`}),(0,X.jsx)(G,{className:`w-8`})]})}),(0,X.jsx)(wt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(K,{children:[(0,X.jsx)(q,{children:(0,X.jsx)(N,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(q,{className:`font-medium`,children:e.n}),(0,X.jsx)(q,{children:(0,X.jsx)(M,{variant:`secondary`,children:e.m})}),(0,X.jsx)(q,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(z,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(q,{children:(0,X.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(V,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{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{cn as ThemeShowroom};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BD as r,Cd as i,Dd as a,Ed as o,FD as s,GD as c,HD as l,ID as u,KD as d,LD as f,Od as p,PD as m,RD as h,Sd as g,Td as _,UD as v,VD as y,WD as b,wd as x,zD as S}from"./api-IF2KQFNF.js";import{t as C}from"./button-DDPt-po9.js";import{$t as w,At as T,Fn as E,dn as D,fn as O,ir as k,ln as A,un as j}from"./index-DaLXKABQ.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:d(),from:`now-5m`},{label:c(),from:`now-15m`},{label:b(),from:`now-30m`},{label:v(),from:`now-1h`},{label:l(),from:`now-3h`},{label:y(),from:`now-6h`},{label:r(),from:`now-12h`},{label:S(),from:`now-24h`},{label:h(),from:`now-2d`},{label:f(),from:`now-7d`},{label:u(),from:`now-30d`},{label:s(),from:`now-90d`},{label:m(),from:`now-520w`}];function L(e){return T(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,r]=(0,M.useState)(!1),[s,c]=(0,M.useState)(``),l=F(e),[u,d]=(0,M.useState)(()=>z(l.from)),[f,m]=(0,M.useState)(()=>z(l.to));function h(t){if(t){let t=F(e);d(z(t.from)),m(z(t.to)),c(``)}r(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function y(){let e=B(u),n=B(f);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let b=(0,M.useMemo)(()=>{let e=s.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[s]),S=B(u)!==null&&B(f)!==null;return(0,H.jsxs)(D,{open:n,onOpenChange:h,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(k,{}),R(e)]})}),(0,H.jsx)(j,{children:(0,H.jsx)(A,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:p()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,H.jsx)(w,{type:`datetime-local`,value:u,onChange:e=>d(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,H.jsx)(w,{type:`datetime-local`,value:f,onChange:e=>m(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!S,onClick:y,children:_()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(E,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(w,{value:s,onChange:e=>c(e.target.value),placeholder:x(),"aria-label":i()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:g()}):b.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>v(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BD as r,Cd as i,Dd as a,Ed as o,GD as s,HD as c,JD as l,KD as u,LD as d,Od as f,RD as p,Sd as m,Td as h,UD as g,VD as _,WD as v,YD as y,qD as b,wd as x,zD as S}from"./api-751U81xd.js";import{t as C}from"./button-Dwru_Lf_.js";import{$t as w,At as T,Fn as E,dn as D,fn as O,ir as k,ln as A,un as j}from"./index-oxINmoDf.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:y(),from:`now-5m`},{label:l(),from:`now-15m`},{label:b(),from:`now-30m`},{label:u(),from:`now-1h`},{label:s(),from:`now-3h`},{label:v(),from:`now-6h`},{label:g(),from:`now-12h`},{label:c(),from:`now-24h`},{label:_(),from:`now-2d`},{label:r(),from:`now-7d`},{label:S(),from:`now-30d`},{label:p(),from:`now-90d`},{label:d(),from:`now-520w`}];function L(e){return T(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,r]=(0,M.useState)(!1),[s,c]=(0,M.useState)(``),l=F(e),[u,d]=(0,M.useState)(()=>z(l.from)),[p,g]=(0,M.useState)(()=>z(l.to));function _(t){if(t){let t=F(e);d(z(t.from)),g(z(t.to)),c(``)}r(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function y(){let e=B(u),n=B(p);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let b=(0,M.useMemo)(()=>{let e=s.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[s]),S=B(u)!==null&&B(p)!==null;return(0,H.jsxs)(D,{open:n,onOpenChange:_,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(k,{}),R(e)]})}),(0,H.jsx)(j,{children:(0,H.jsx)(A,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:f()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,H.jsx)(w,{type:`datetime-local`,value:u,onChange:e=>d(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,H.jsx)(w,{type:`datetime-local`,value:p,onChange:e=>g(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!S,onClick:y,children:h()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(E,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(w,{value:s,onChange:e=>c(e.target.value),placeholder:x(),"aria-label":i()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:m()}):b.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>v(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BK as r,RK as i,VK as a,zK as o}from"./api-IF2KQFNF.js";import{t as s}from"./chevrons-up-down-8nG-pF3_.js";import{$t as c,cn as l,lr as u,on as d,sn as f}from"./index-DaLXKABQ.js";/* empty css */var p=t(e(),1);function m(e){if(e==null||e===``)return`none`;let t=e.trim().toLowerCase();return t===`ok`||t===`success`||t===`completed`?`ok`:t===`error`||t===`failed`||t===`failure`?`error`:t===`running`||t===`in_progress`||t===`pending`?`running`:`other`}function h(e){return e===!0?`active`:e===!1?`paused`:`unknown`}function g(e){return typeof e.autoDisabledReason==`string`&&e.autoDisabledReason!==``?`auto-disabled`:h(e.enabled)}function _(e){return g(e)===`active`?`pause`:`resume`}var v={q:``,state:`all`,result:`all`};function y(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function b(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&g(e)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function x(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function S(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function C(e,t,n=50,r){let i=e=>e.toLowerCase().replace(/[_/]+/g,` `),a=i(t.trim()),o=(a===``?e:e.filter(e=>i(e).includes(a))).slice(0,n);return r&&r!==``&&!o.includes(r)?[r,...o].slice(0,n):o}function w(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++){let n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+e);i.push({year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),inMonth:n.getMonth()===t})}return i}function T(e,t,n,r,i){let a=(e,t=2)=>String(e).padStart(t,`0`);return`${a(e,4)}-${a(t+1)}-${a(n)}T${a(r)}:${a(i)}`}function E(e){let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(t===null)return null;let[,n,r,i,a,o]=t;return{year:Number(n),month:Number(r)-1,day:Number(i),hour:Number(a),minute:Number(o)}}var D=n();function O({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>x(),[]),[g,_]=(0,p.useState)(!1),[v,y]=(0,p.useState)(``);if(h.length===0)return(0,D.jsx)(c,{value:e,onChange:e=>t(e.target.value),placeholder:m||S()||`America/Toronto`,className:n});let b=C(h,v,h.length,e||void 0),w=e===``?m||S()||i():e;return(0,D.jsxs)(d,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(l,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":a(),children:[(0,D.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,D.jsx)(s,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,D.jsxs)(f,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,D.jsx)(c,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:r(),className:`oc-tzcombo__search`}),(0,D.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:b.length===0?(0,D.jsx)(`p`,{className:`oc-tzcombo__empty`,children:o()}):b.map(n=>(0,D.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),y(``)},children:[(0,D.jsx)(u,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,D.jsx)(`span`,{children:n})]},n))})]})]})}export{b as a,w as c,_ as i,E as l,v as n,g as o,y as r,m as s,O as t,T as u};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{GK as r,HK as i,UK as a,WK as o}from"./api-751U81xd.js";import{t as s}from"./chevrons-up-down-DznzeuSP.js";import{$t as c,cn as l,lr as u,on as d,sn as f}from"./index-oxINmoDf.js";/* empty css */var p=t(e(),1);function m(e){if(e==null||e===``)return`none`;let t=e.trim().toLowerCase();return t===`ok`||t===`success`||t===`completed`?`ok`:t===`error`||t===`failed`||t===`failure`?`error`:t===`running`||t===`in_progress`||t===`pending`?`running`:`other`}function h(e){return e===!0?`active`:e===!1?`paused`:`unknown`}function g(e){return typeof e.autoDisabledReason==`string`&&e.autoDisabledReason!==``?`auto-disabled`:h(e.enabled)}function _(e){return g(e)===`active`?`pause`:`resume`}var v={q:``,state:`all`,result:`all`};function y(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function b(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&g(e)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function x(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function S(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function C(e,t,n=50,r){let i=e=>e.toLowerCase().replace(/[_/]+/g,` `),a=i(t.trim()),o=(a===``?e:e.filter(e=>i(e).includes(a))).slice(0,n);return r&&r!==``&&!o.includes(r)?[r,...o].slice(0,n):o}function w(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++){let n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+e);i.push({year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),inMonth:n.getMonth()===t})}return i}function T(e,t,n,r,i){let a=(e,t=2)=>String(e).padStart(t,`0`);return`${a(e,4)}-${a(t+1)}-${a(n)}T${a(r)}:${a(i)}`}function E(e){let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(t===null)return null;let[,n,r,i,a,o]=t;return{year:Number(n),month:Number(r)-1,day:Number(i),hour:Number(a),minute:Number(o)}}var D=n();function O({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>x(),[]),[g,_]=(0,p.useState)(!1),[v,y]=(0,p.useState)(``);if(h.length===0)return(0,D.jsx)(c,{value:e,onChange:e=>t(e.target.value),placeholder:m||S()||`America/Toronto`,className:n});let b=C(h,v,h.length,e||void 0),w=e===``?m||S()||i():e;return(0,D.jsxs)(d,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(l,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":r(),children:[(0,D.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,D.jsx)(s,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,D.jsxs)(f,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,D.jsx)(c,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:o(),className:`oc-tzcombo__search`}),(0,D.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:b.length===0?(0,D.jsx)(`p`,{className:`oc-tzcombo__empty`,children:a()}):b.map(n=>(0,D.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),y(``)},children:[(0,D.jsx)(u,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,D.jsx)(`span`,{children:n})]},n))})]})]})}export{b as a,w as c,_ as i,E as l,v as n,g as o,y as r,m as s,O as t,T as u};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,$L as i,AA as a,BA as o,BL as s,CA as c,CR as l,Cu as u,DA as d,DR as f,DY as p,E as m,EA as h,ER as g,EY as _,FA as ee,GA as v,GL as y,HA as te,HL as b,IA as ne,JA as re,JL as x,KA as ie,KL as ae,LA as oe,MA as se,NA as ce,OA as le,OR as S,PA as ue,QA as de,QL as fe,RA as pe,SA as me,SR as C,TA as he,TR as w,Tu as T,UA as E,UL as ge,VA as _e,VL as ve,WA as ye,WL as be,XA as xe,XL as Se,YA as Ce,YL as we,ZA as Te,ZL as D,_R as O,aR as k,bA as Ee,bR as A,cR as j,dR as M,ej as De,fR as N,gR as P,hR as F,iR as Oe,jA as ke,kA as Ae,lR as je,mR as Me,nj as Ne,oR as Pe,pR as Fe,qA as Ie,qL as Le,sR as Re,t as I,tj as ze,uR as Be,vR as Ve,wA as He,wR as Ue,wu as We,xA as Ge,xR as Ke,yA as qe,yR as Je,zA as Ye,zL as Xe}from"./api-751U81xd.js";import{t as Ze}from"./x-C9PzBTHZ.js";import{t as L}from"./button-Dwru_Lf_.js";import{$n as Qe,At as R,Ct as $e,Dt as et,Jt as z,Ot as tt,St as B,Tt as nt,U as rt,Yn as it,a as at,at as V,bt as H,dr as ot,er as st,fr as ct,ft as lt,i as ut,it as dt,jt as ft,lr as pt,o as mt,ot as ht,rr as gt,s as _t,st as U,vt as W,wt as vt,xt as G,yt as K}from"./index-oxINmoDf.js";import{n as yt}from"./TimeRangePicker-9-aQ6g1P.js";import{t as bt}from"./FilterBar-DTlL2mzQ.js";import{t as xt}from"./AdvancedFilter-CyevWjzl.js";import{t as St}from"./DataTableShell-C0SV7OUi.js";var Ct=m(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?je():n===`agent`?`${j()} - ${r}`:e}function Tt(){let e=p(I.me.getMe,{host:lt})?.role===`admin`,t=p(I.deliveryTiming.getDeliveryStatus,{}),n=_(I.deliveryTiming.startDeliveryRecord),r=_(I.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),c=t?.recording??!1,u=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:S()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:f()})]}),e?(0,J.jsx)(L,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void u(),children:c?w():g()}):null]}),c?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(z,{variant:`secondary`,children:Ue()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:l({time:ft(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?A():Ke()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=p(I.deliveryTiming.listDeliverySessions,{}),n=_(I.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:f,to:m}=yt(c),h=c.to===`now`?1/0:m,g=r.trim()!==``||a!==`all`||c!==Y,ee=()=>{i(``),o(`all`),l(Y)},v=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=h).map(e=>({...e,_id:e.sessionId}))},[t,r,a,f,h]),y=e=>{let t=new Set((v??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:i,searchPlaceholder:Ve(),timeRange:c,onTimeRangeChange:l,onReset:ee,canReset:g,children:(0,J.jsxs)(W,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(B,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:`all`,children:O()}),(0,J.jsx)(H,{value:`active`,children:P()}),(0,J.jsx)(H,{value:`stopped`,children:F()})]})]})}),(0,J.jsx)(St,{title:Je(),rows:v,emptyHint:s(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(L,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?Pe():Re(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(st,{size:15,"aria-hidden":!0}):(0,J.jsx)(Qe,{size:15,"aria-hidden":!0})})},{header:Me(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:R(e.startedAt)})},{header:Fe(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:R(e.stoppedAt)})},{header:N(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:M(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:Be(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(z,{variant:`secondary`,children:P()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:F()})}],rowActions:e?e=>[{label:k(),variant:`destructive`,onSelect:()=>y([e.sessionId])}]:void 0,bulkActions:e?[{label:k(),variant:`destructive`,onSelect:e=>y(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=p(I.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(rt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:C()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,Xe()]}),(0,J.jsxs)(L,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(pt,{size:13,"aria-hidden":!0}):(0,J.jsx)(gt,{size:13,"aria-hidden":!0}),t?ve():b()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:D()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Se()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:we()})]})}),(0,J.jsxs)(`tbody`,{children:[i(x(),r.bridge),i(Le(),r.A),i(ae(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:be()})]})}var kt=[50,100,200,500],Z=`all`,Q=`__all__`,At=[`2xx`,`4xx`,`5xx`],jt=[`user`,`service`,`system`],Mt=[`inbound`,`outbound`,`internal`],Nt={kind:`relative`,from:`now-30d`,to:`now`},Pt=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:T()},{value:`principalType`,label:We()},{value:`direction`,label:`direction`},{value:`roleKey`,label:u()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=ct({from:`/settings/traces`}),t=ot({from:`/settings/traces`}),n=e.limit,s=e.kind,l=e.statusClass??Q,u=e.principalType??Q,f=e.direction??Q,m=e.roleKey??Q,g=e.q??``,_=e.correlationId,y=ut(e.from,e.to),b=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:x,to:ae}=yt(y),[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(null),ge=e=>void t({search:t=>({...t,limit:e})}),ve=e=>void t({search:t=>({...t,kind:e})}),be=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Se=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),we=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),D=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),O=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,...mt(e)})}),Ee=e=>void t({search:t=>({...t,adv:at(e)}),replace:!0}),A=p(I.observability.listEvents,{limit:n}),j=p(I.observability.listEvents,{limit:n,kind:s===Z?void 0:s,..._?{correlationId:_}:{},filter:{q:g||void 0,from:x,to:ae,statusClass:l===Q?void 0:l,principalType:u===Q?void 0:u,direction:f===Q?void 0:f,roleKey:m===Q?void 0:m,advanced:b.length>0?b:void 0}}),M=(0,q.useMemo)(()=>{let e=new Set;for(let t of A??[])e.add(t.kind);return[...e].sort()},[A]),N=(0,q.useMemo)(()=>{let e=new Set;for(let t of A??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[A]),P=g!==``||l!==Q||u!==Q||f!==Q||m!==Q||b.length>0||y.kind!==`relative`||y.from!==Nt.from;function F(){t({search:{limit:100,kind:`all`},replace:!0})}let Oe=S?A?.filter(e=>e.correlationId===S):j,je=e.section,Me=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(dt,{value:je,onValueChange:e=>Me(e),children:[(0,J.jsxs)(ht,{className:`w-full`,children:[(0,J.jsxs)(U,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(it,{size:13,"aria-hidden":!0}),i()]}),(0,J.jsxs)(U,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),fe()]})]}),(0,J.jsx)(V,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(V,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ne(),(0,J.jsx)(`strong`,{children:ze()}),De(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:r()})]}),(0,J.jsxs)(bt,{q:g,onQChange:be,searchPlaceholder:de(),timeRange:y,onTimeRangeChange:k,onReset:F,canReset:P,children:[(0,J.jsxs)(W,{value:l,onValueChange:Se,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{placeholder:Te()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:xe()}),At.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(W,{value:u,onValueChange:we,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{placeholder:Ce()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:re()}),jt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(W,{value:f,onValueChange:D,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{placeholder:Ie()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:ie()}),Mt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(W,{value:m,onValueChange:O,children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(B,{placeholder:v()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:ye()}),N.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:s===Z?``:s,placeholder:E(),"aria-label":E(),onChange:e=>{let t=e.target.value.trim();ve(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:M.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(W,{value:String(n),onValueChange:e=>ge(Number(e)),children:[(0,J.jsx)(G,{size:`sm`,className:`w-28`,children:(0,J.jsx)(B,{})}),(0,J.jsx)(K,{children:kt.map(e=>(0,J.jsx)(H,{value:String(e),children:te({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:b,onChange:Ee}),S?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>C(null),title:_e(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[o(),(0,J.jsx)(`code`,{children:$(S)})]}),(0,J.jsx)(Ze,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:Ye()})]})}):null,(0,J.jsx)(St,{title:pe(),rows:Oe,emptyHint:S?oe():ne(),columns:[{header:ee(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:R(e.at)})},{header:ue(),sort:e=>e.kind,cell:e=>(0,J.jsx)(z,{variant:`secondary`,children:e.kind})},{header:ce(),sort:e=>Lt(e)??null,cell:e=>{let t=Lt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":se(),children:`✓`})}},{header:ke(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(z,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:a(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(z,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:Ae(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(z,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:le(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:d(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${It(e.status)}`,children:e.status})},{header:h(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:he(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:He(),onClick:()=>C(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:c(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>T(e),children:me()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:w,onClose:()=>T(null)})]})]})}function It(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Lt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Rt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)($e,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(vt,{className:`max-w-lg`,children:[(0,J.jsxs)(et,{children:[(0,J.jsxs)(tt,{className:`oc-traces__meta-title`,children:[Ge(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(z,{variant:`outline`,children:Ee()})]}),(0,J.jsx)(nt,{children:qe()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
@@ -0,0 +1 @@
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{$E as t,BT as n,EY as r,GT as i,HT as a,JT as o,KT as s,LT as c,RT as l,UT as u,VT as d,WT as f,YT as p,qT as m,t as h,vA as g,zT as _}from"./api-751U81xd.js";import{t as v}from"./use_paginated_query-CknaCvRB.js";import{t as y}from"./button-Dwru_Lf_.js";import{An as b,In as x,ct as S,h as C,kt as w,m as T}from"./index-oxINmoDf.js";var E=e(),D=50;function O({status:e,loadMore:t}){return e!==`CanLoadMore`&&e!==`LoadingMore`?null:(0,E.jsx)(y,{variant:`outline`,size:`sm`,className:`self-start`,disabled:e===`LoadingMore`,onClick:()=>t(50),children:c()})}function k({items:e,onRestore:n,onPurge:r}){let o=S();return(0,E.jsx)(`ul`,{className:`oc-trash__list`,children:e.map(e=>(0,E.jsxs)(`li`,{className:`oc-trash__item`,children:[(0,E.jsxs)(`div`,{className:`oc-trash__meta`,children:[(0,E.jsx)(`span`,{className:`oc-trash__title`,children:e.title||t()}),(0,E.jsxs)(`span`,{className:`oc-trash__dates`,children:[e.owner===void 0?null:(0,E.jsxs)(`span`,{className:`oc-trash__owner`,children:[e.owner,` · `]}),s({date:w(e.trashedAt)}),e.purgeAfter===null?null:` · ${i({date:T(e.purgeAfter)})}`]})]}),(0,E.jsxs)(`div`,{className:`oc-trash__actions`,children:[(0,E.jsxs)(y,{variant:`outline`,size:`sm`,onClick:()=>void n(e._id),children:[(0,E.jsx)(x,{}),` `,f()]}),(0,E.jsxs)(y,{variant:`ghost`,size:`sm`,className:`text-destructive`,onClick:async()=>{await o({title:a(),description:d(),confirmLabel:u(),destructive:!0})&&await r(e._id)},children:[(0,E.jsx)(b,{}),` `,u()]})]})]},e._id))})}function A(){let{results:e,status:t,loadMore:i}=v(h.trash.listMyTrash,{},{initialNumItems:50}),a=C(),s=r(h.trash.restoreChat),c=r(h.trash.purgeChat),u=r(h.trash.emptyTrash),d=S();return(0,E.jsx)(`div`,{className:`oc-trash`,children:(0,E.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,E.jsxs)(`header`,{className:`oc-trash__head`,children:[(0,E.jsxs)(`h1`,{className:`oc-trash__heading`,children:[(0,E.jsx)(b,{className:`size-5`,"aria-hidden":!0}),` `,p()]}),e.length>0?(0,E.jsx)(y,{variant:`destructive`,size:`sm`,onClick:async()=>{await d({title:_(),description:l(),confirmLabel:n(),destructive:!0})&&await u({})},children:n()}):null]}),(0,E.jsx)(`p`,{className:`oc-trash__hint`,children:o({days:a})}),t===`LoadingFirstPage`?(0,E.jsx)(`p`,{className:`oc-trash__hint`,children:g()}):e.length===0?(0,E.jsx)(`p`,{className:`oc-trash__empty`,children:m()}):(0,E.jsx)(k,{items:e,onRestore:e=>s({chatId:e}),onPurge:e=>c({chatId:e})}),(0,E.jsx)(O,{status:t,loadMore:i})]})})}export{D as TRASH_PAGE,k as TrashList,O as TrashLoadMore,A as TrashPage};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,CT as i,CY as a,DT as o,E as s,ET as c,MT as l,NT as u,OT as d,ST as f,SY as p,TT as m,_T as h,bT as g,gT as _,hA as v,hT as y,hY as b,kT as x,mT as S,t as C,vT as w,wT as T,xT as E,yT as D}from"./api-IF2KQFNF.js";import{t as O}from"./use_paginated_query-DHl8KBoi.js";import{t as k}from"./button-DDPt-po9.js";import{An as A,At as j,F as M,Yt as N,ct as P,h as F}from"./index-DaLXKABQ.js";import{TrashList as I,TrashLoadMore as L}from"./TrashPage-DKaJKpYI.js";var R=s(`scan-search`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m16 16-1.9-1.9`,key:`1dq9hf`}]]),z=t(e(),1);function B(e,t){let n=e.find(e=>e.status===`running`&&!e.stale)??null,r=e.find(e=>e.mode===`dryRun`&&e.status===`done`)??null,i=e.find(e=>e.mode===`apply`&&(e.status===`done`||e.status===`refused`)&&(r===null||e.startedAt>r.startedAt))??null,a=null;return n===null?r===null||i!==null?a=`no_report`:r.applicableUntil===null||r.applicableUntil<=t?a=`expired`:r.mirrorMissing>0?a=`mirror`:r.orphans.count===0&&(a=`nothing`):a=`running`,{running:n,report:r,lastApply:i,applyBlock:a}}var V=n();function H(){let e=a(C.blobSweep.listBlobSweeps,{}),t=a(C.blobQuarantine.quarantineSettings,{}),n=p(C.blobSweep.startBlobSweep),s=P(),{toast:l}=N(),[u,O]=(0,z.useState)(!1),F=b(),I=e=>M(e,F),L=B(e??[],Date.now()),H=L.report,U=async e=>{O(!0);try{await e()}catch(e){l({title:S(),description:e.message,variant:`error`})}finally{O(!1)}},W=()=>U(()=>n({mode:`dryRun`})),G=async()=>{H!==null&&await s({title:w({count:H.orphans.count}),description:h({size:I(H.orphans.bytes)}),confirmLabel:D(),destructive:!0})&&await U(()=>n({mode:`apply`,confirms:H._id}))};return(0,V.jsxs)(`section`,{className:`oc-trash__body`,"aria-labelledby":`oc-blobsweep-title`,children:[(0,V.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,V.jsx)(`h3`,{id:`oc-blobsweep-title`,className:`oc-trash__heading`,children:r()}),(0,V.jsxs)(`div`,{className:`oc-trash__actions`,children:[(0,V.jsxs)(k,{variant:`outline`,size:`sm`,disabled:u||L.running!==null,onClick:()=>void W(),children:[(0,V.jsx)(R,{}),` `,d()]}),(0,V.jsxs)(k,{variant:`ghost`,size:`sm`,className:`text-destructive`,disabled:u||L.applyBlock!==null,onClick:()=>void G(),children:[(0,V.jsx)(A,{}),` `,D()]})]})]}),(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:x({days:H?.minAgeDays??7,quarantine:t?.days??7})}),e===void 0?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:v()}):null,L.running===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:o({scanned:L.running.blobsScanned})}),e!==void 0&&H===null&&L.running===null?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:c()}):null,H===null?null:(0,V.jsxs)(`div`,{className:`oc-trash__hint`,children:[(0,V.jsx)(`p`,{children:m({date:j(H.finishedAt??H.startedAt),count:H.orphans.count,size:I(H.orphans.bytes),scanned:H.blobsScanned})}),(0,V.jsxs)(`ul`,{children:[(0,V.jsx)(`li`,{children:T({count:H.byOrigin.upload?.count??0,size:I(H.byOrigin.upload?.bytes??0)})}),(0,V.jsx)(`li`,{children:i({count:H.byOrigin.unregistered?.count??0,size:I(H.byOrigin.unregistered?.bytes??0)})})]}),H.importing>0?(0,V.jsx)(`p`,{children:f({count:H.importing})}):null,H.mirrorMissing>0?(0,V.jsx)(`p`,{className:`text-destructive`,children:E({count:H.mirrorMissing})}):null,L.applyBlock===`expired`?(0,V.jsx)(`p`,{children:g()}):null]}),L.lastApply===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:L.lastApply.status===`refused`?y({date:j(L.lastApply.finishedAt??L.lastApply.startedAt)}):_({date:j(L.lastApply.finishedAt??L.lastApply.startedAt),count:L.lastApply.deleted.count,size:I(L.lastApply.deleted.bytes)})})]})}function U(){let{results:e,status:t,loadMore:n}=O(C.trash.adminListTrash,{},{initialNumItems:50}),r=F(),i=p(C.trash.adminRestoreChat),a=p(C.trash.adminPurgeChat);return(0,V.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:u({days:r})}),t===`LoadingFirstPage`?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:v()}):e.length===0?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:l()}):(0,V.jsx)(I,{items:e,onRestore:e=>i({chatId:e}),onPurge:e=>a({chatId:e})}),(0,V.jsx)(L,{status:t,loadMore:n}),(0,V.jsx)(H,{})]})}export{U as TrashTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,CT as i,DT as a,DY as o,E as s,ET as c,EY as l,FT as u,IT as d,MT as f,NT as p,OT as m,ST as h,TT as g,_T as _,bT as v,jT as y,kT as b,t as x,vA as S,vT as C,wT as w,xT as T,yT as E,yY as D}from"./api-751U81xd.js";import{t as O}from"./use_paginated_query-CknaCvRB.js";import{t as k}from"./button-Dwru_Lf_.js";import{An as A,At as j,F as M,Yt as N,ct as P,h as F}from"./index-oxINmoDf.js";import{TrashList as I,TrashLoadMore as L}from"./TrashPage-Cpra3mll.js";var R=s(`scan-search`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m16 16-1.9-1.9`,key:`1dq9hf`}]]),z=t(e(),1);function B(e,t){let n=e.find(e=>e.status===`running`&&!e.stale)??null,r=e.find(e=>e.mode===`dryRun`&&e.status===`done`)??null,i=e.find(e=>e.mode===`apply`&&(e.status===`done`||e.status===`refused`)&&(r===null||e.startedAt>r.startedAt))??null,a=null;return n===null?r===null||i!==null?a=`no_report`:r.applicableUntil===null||r.applicableUntil<=t?a=`expired`:r.mirrorMissing>0?a=`mirror`:r.orphans.count===0&&(a=`nothing`):a=`running`,{running:n,report:r,lastApply:i,applyBlock:a}}var V=n();function H(){let e=o(x.blobSweep.listBlobSweeps,{}),t=o(x.blobQuarantine.quarantineSettings,{}),n=l(x.blobSweep.startBlobSweep),s=P(),{toast:u}=N(),[d,O]=(0,z.useState)(!1),F=D(),I=e=>M(e,F),L=B(e??[],Date.now()),H=L.report,U=async e=>{O(!0);try{await e()}catch(e){u({title:_(),description:e.message,variant:`error`})}finally{O(!1)}},W=()=>U(()=>n({mode:`dryRun`})),G=async()=>{H!==null&&await s({title:T({count:H.orphans.count}),description:v({size:I(H.orphans.bytes)}),confirmLabel:h(),destructive:!0})&&await U(()=>n({mode:`apply`,confirms:H._id}))};return(0,V.jsxs)(`section`,{className:`oc-trash__body`,"aria-labelledby":`oc-blobsweep-title`,children:[(0,V.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,V.jsx)(`h3`,{id:`oc-blobsweep-title`,className:`oc-trash__heading`,children:p()}),(0,V.jsxs)(`div`,{className:`oc-trash__actions`,children:[(0,V.jsxs)(k,{variant:`outline`,size:`sm`,disabled:d||L.running!==null,onClick:()=>void W(),children:[(0,V.jsx)(R,{}),` `,y()]}),(0,V.jsxs)(k,{variant:`ghost`,size:`sm`,className:`text-destructive`,disabled:d||L.applyBlock!==null,onClick:()=>void G(),children:[(0,V.jsx)(A,{}),` `,h()]})]})]}),(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:f({days:H?.minAgeDays??7,quarantine:t?.days??7})}),e===void 0?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:S()}):null,L.running===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:r({scanned:L.running.blobsScanned})}),e!==void 0&&H===null&&L.running===null?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:b()}):null,H===null?null:(0,V.jsxs)(`div`,{className:`oc-trash__hint`,children:[(0,V.jsx)(`p`,{children:m({date:j(H.finishedAt??H.startedAt),count:H.orphans.count,size:I(H.orphans.bytes),scanned:H.blobsScanned})}),(0,V.jsxs)(`ul`,{children:[(0,V.jsx)(`li`,{children:a({count:H.byOrigin.upload?.count??0,size:I(H.byOrigin.upload?.bytes??0)})}),(0,V.jsx)(`li`,{children:c({count:H.byOrigin.unregistered?.count??0,size:I(H.byOrigin.unregistered?.bytes??0)})})]}),H.importing>0?(0,V.jsx)(`p`,{children:g({count:H.importing})}):null,H.mirrorMissing>0?(0,V.jsx)(`p`,{className:`text-destructive`,children:w({count:H.mirrorMissing})}):null,L.applyBlock===`expired`?(0,V.jsx)(`p`,{children:i()}):null]}),L.lastApply===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:L.lastApply.status===`refused`?C({date:j(L.lastApply.finishedAt??L.lastApply.startedAt)}):E({date:j(L.lastApply.finishedAt??L.lastApply.startedAt),count:L.lastApply.deleted.count,size:I(L.lastApply.deleted.bytes)})})]})}function U(){let{results:e,status:t,loadMore:n}=O(x.trash.adminListTrash,{},{initialNumItems:50}),r=F(),i=l(x.trash.adminRestoreChat),a=l(x.trash.adminPurgeChat);return(0,V.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:d({days:r})}),t===`LoadingFirstPage`?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:S()}):e.length===0?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:u()}):(0,V.jsx)(I,{items:e,onRestore:e=>i({chatId:e}),onPurge:e=>a({chatId:e})}),(0,V.jsx)(L,{status:t,loadMore:n}),(0,V.jsx)(H,{})]})}export{U as TrashTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,AF as i,BF as a,Bk as o,DF as s,DY as c,EF as l,EY as u,FF as d,Fk as f,GF as p,HF as ee,Hk as m,IF as te,Ik as h,JF as ne,KF as re,LF as ie,Lk as g,MF as ae,Mk as _,NF as oe,Nk as v,OF as se,PF as ce,Pk as y,QF as b,RF as le,Rk as x,UF as ue,Uk as S,VF as de,Vk as C,WF as fe,XF as w,YF as T,ZF as pe,eI as E,gb as D,hb as O,jF as me,jk as k,kF as he,mb as A,qF as ge,sF as _e,t as j,zF as ve,zk as M}from"./api-751U81xd.js";import{t as N}from"./button-Dwru_Lf_.js";import{Ct as P,Dt as F,J as I,Jt as L,Mt as R,Ot as ye,Pn as z,St as B,Tt as be,Yt as V,an as xe,bt as H,c as U,ct as Se,dr as W,en as Ce,fr as we,ft as Te,jn as G,l as Ee,lt as De,nn as Oe,rn as ke,tn as Ae,u as K,vt as q,wt as je,xt as J,yt as Y}from"./index-oxINmoDf.js";import{t as Me}from"./FilterBar-DTlL2mzQ.js";import{t as Ne}from"./DataTableShell-C0SV7OUi.js";import{t as Pe}from"./DetailChips-BeKOuUKo.js";var X=t(e(),1),Z=n();function Fe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=c(j.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=c(j.agents.listUserAgents,n&&e?{profileId:e}:`skip`),s=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),l=(a??[]).find(e=>e.isDefault)??null,u=l?`${l.instanceName}/${l.agentId}`:null,d=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),f=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).filter(e=>!d.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,enabled:e.enabled,state:e.state,outOfPool:!0}))],p=new Map;for(let e of f){let t=p.get(e.instanceName)??[];t.push(e),p.set(e.instanceName,t)}return(0,Z.jsx)(P,{open:n,onOpenChange:r,children:(0,Z.jsxs)(je,{className:`oc-access`,children:[(0,Z.jsxs)(F,{children:[(0,Z.jsx)(ye,{children:S({user:t})}),(0,Z.jsx)(be,{children:m()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?C():o()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:M()}):f.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:h()}):[...p.entries()].map(([t,n])=>(0,Z.jsx)(Ie,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:u},t))})]})})}function Ie({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=u(j.agents.assignAgent),s=u(j.agents.removeAgent),c=u(j.agents.setDefaultAgent),l=V();if(!e)return null;async function d(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(x(),I(e))}}async function p(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(g(),I(e))}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(z,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(L,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),o=a===n,s=e.state===`deleted`,c=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${c?` is-disabled`:``}`,children:[(0,Z.jsx)(R,{checked:r,disabled:(s||c)&&!r,onCheckedChange:()=>void d(e.agentId,r),"aria-label":f({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,s?(0,Z.jsx)(L,{variant:`outline`,className:`oc-access__gone`,children:y()}):null,e.outOfPool?(0,Z.jsx)(L,{variant:`outline`,className:`oc-access__gone`,children:v()}):null,r?o?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":_(),title:_(),children:(0,Z.jsx)(G,{size:14,fill:`currentColor`})}):(0,Z.jsx)(N,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":k(),title:k(),disabled:c,onClick:()=>void p(e.agentId),children:(0,Z.jsx)(G,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return A();case`user`:return O();case`admin`:return D();default:return e}}function Le({granted:e,onToggle:t}){let n=new Set(e),i=U.filter(e=>n.has(K[e])).length;return(0,Z.jsxs)(Ce,{children:[(0,Z.jsx)(xe,{asChild:!0,children:(0,Z.jsx)(N,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:i===0?E():r({count:i})})}),(0,Z.jsxs)(Ae,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(ke,{children:b()}),U.map(e=>{let r=K[e];return(0,Z.jsxs)(Oe,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(R,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:Ee[e]()})]},e)})]})]})}function Re(){let e=we({from:`/settings/users`}),t=W({from:`/settings/users`}),n=e.q??``,r=e.role??Q,o=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),f=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),m=c(j.admin.listUsers,{filter:{q:n||void 0,role:r===Q?void 0:r},withAgents:!0}),h=c(j.me.getMe,{host:Te}),g=u(j.admin.setRole),_=u(j.admin.setUserPermissions),v=u(j.admin.startImpersonation),y=u(j.admin.deleteUser),b=u(j.admin.setUserName),x=Se(),S=De(),C=V(),[E,D]=(0,X.useState)(null),O=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of m??[])e.add(t.role);return[...e]},[m]),k=n!==``||r!==Q;function A(){t({search:{},replace:!0})}async function M(e){try{await g(e)}catch(e){C.error(pe(),e)}}async function N(e){try{await _(e)}catch(e){C.error(w(),e)}}async function P(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await x({title:ue(),description:ee({user:t}),confirmWord:de(),confirmLabel:a(),destructive:!0}))try{await y({profileId:e._id}),C.success(le({user:t}))}catch(e){C.error(ve(),e)}}async function F(e){let t=e.email||e.name||e.userId.slice(0,8),n=await S({title:te(),label:d({user:t}),placeholder:ce(),defaultValue:e.name??``,confirmLabel:_e()});if(n!==null)try{await b({profileId:e._id,name:n}),C.success(oe())}catch(e){C.error(ae(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Me,{q:n,onQChange:o,searchPlaceholder:T(),onReset:A,canReset:k,children:(0,Z.jsxs)(q,{value:r,onValueChange:f,children:[(0,Z.jsx)(J,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(Y,{children:[(0,Z.jsx)(H,{value:Q,children:ne()}),O.map(e=>(0,Z.jsx)(H,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Ne,{title:ge(),rows:m,emptyHint:re(),rowActions:e=>{let t=[{label:l(),onSelect:()=>D({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:ie(),onSelect:()=>void F(e)}];return e.userId!==h?.userId&&t.push({label:p(),onSelect:()=>void v({profileId:e._id})},{label:fe(),variant:`destructive`,onSelect:()=>void P(e)}),t},columns:[{header:me(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{children:t}),n?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:i(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(q,{value:e.role,onValueChange:t=>void M({profileId:e._id,role:t}),children:[(0,Z.jsx)(J,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(Y,{children:[(0,Z.jsx)(H,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(H,{value:`user`,children:$(`user`)}),(0,Z.jsx)(H,{value:`admin`,children:$(`admin`)})]})]})},{header:he(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:se()}):(0,Z.jsx)(Le,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),N({profileId:e._id,permissions:[...n]})}})},{header:s(),cell:e=>(0,Z.jsx)(Pe,{icon:(0,Z.jsx)(z,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Fe,{profileId:E?.profileId??null,userLabel:E?.label??``,open:E!==null,onOpenChange:e=>{e||D(null)}})]})}export{Re as UsersTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ac as r,Al as i,Bl as a,Cc as o,Cl as s,DY as c,Dl as ee,EY as l,El as u,Fl as d,Hl as f,Il as p,Ll as m,Ml as h,Nl as g,Ol as _,Pl as v,Qg as te,Rl as y,Sc as b,Sl as x,Tl as S,Ul as ne,Vl as re,Xg as ie,Xs as ae,_Y as C,bc as w,bl as T,cc as oe,dc as E,gc as D,hc as se,iL as O,jl as ce,kl as le,lc as ue,mc as de,pc as fe,t as k,uc as pe,wY as me,wl as A,xc as j,xl as M,xv as N,yY as P,yc as F,yl as I,zl as L}from"./api-751U81xd.js";import{t as R}from"./button-Dwru_Lf_.js";import{Cn as z,Jt as B,Mt as V,Sn as H,St as U,Tn as he,Wn as ge,_n as _e,at as W,bn as ve,bt as G,dr as ye,fr as be,ft as xe,it as Se,ot as Ce,st as K,ur as we,vn as Te,vt as q,xn as J,xt as Y,yn as Ee,yt as X}from"./index-oxINmoDf.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>p()],[`fr-FR`,()=>o()],[`en-US`,()=>b()],[`en-GB`,()=>j()],[`de-DE`,()=>w()],[`es-ES`,()=>F()]],Oe=[[`0.75`,()=>v()],[`1`,()=>g()],[`1.25`,()=>h()],[`1.5`,()=>ce()]],$=0;function ke({instance:e}){let t=l(k.admin.upsertInstanceConfig),n=e.config??{},r={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[a,o]=(0,Z.useState)(r),[s,c]=(0,Z.useState)(`idle`),[f,p]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(!1),v=me(k.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{o({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),c(`idle`)},[e._id]);let b=a.enabled!==r.enabled||a.engine!==r.engine||a.lang!==r.lang||a.rate!==r.rate||a.autoRead!==r.autoRead;async function x(){c(`saving`);try{let n={...e.config??{}};n.voiceEnabled=a.enabled,a.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,a.lang===`auto`?delete n.voiceLang:n.voiceLang=a.lang;let r=Number.parseFloat(a.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,a.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),c(`idle`)}catch{c(`error`)}}return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(B,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(V,{checked:a.enabled,onCheckedChange:e=>o({...a,enabled:e===!0}),"aria-label":y()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()}),(0,Q.jsxs)(q,{value:a.engine,onValueChange:e=>o({...a,engine:e}),disabled:!a.enabled,children:[(0,Q.jsx)(Y,{size:`sm`,"aria-label":E(),children:(0,Q.jsx)(U,{})}),(0,Q.jsxs)(X,{children:[(0,Q.jsx)(G,{value:`browser`,children:pe()}),e.kind===`hermes`?null:(0,Q.jsx)(G,{value:`gateway`,children:ue()})]})]})]}),a.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:oe()}):null,a.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,Q.jsxs)(q,{value:a.lang,onValueChange:e=>o({...a,lang:e}),disabled:!a.enabled,children:[(0,Q.jsx)(Y,{size:`sm`,"aria-label":m(),children:(0,Q.jsx)(U,{})}),(0,Q.jsx)(X,{children:De.map(([e,t])=>(0,Q.jsx)(G,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,Q.jsxs)(q,{value:a.rate,onValueChange:e=>o({...a,rate:e}),disabled:!a.enabled,children:[(0,Q.jsx)(Y,{size:`sm`,"aria-label":d(),children:(0,Q.jsx)(U,{})}),(0,Q.jsx)(X,{children:Oe.map(([e,t])=>(0,Q.jsx)(G,{value:e,children:t()},e))})]})]}),a.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(V,{checked:a.autoRead,onCheckedChange:e=>o({...a,autoRead:e===!0}),disabled:!a.enabled,"aria-label":i()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:le()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(R,{size:`sm`,disabled:!b||s===`saving`,onClick:()=>void x(),children:s===`saving`?N():te()}),(0,Q.jsx)(R,{variant:`outline`,size:`sm`,disabled:!a.enabled||f,onClick:()=>{let t=Number.parseFloat(a.rate)||1,n=++$;if(g(!1),H(),J(),a.engine!==`gateway`){ve(u(),{lang:Ee(a.lang,P()),rate:t});return}p(!0),v({instanceName:e.name,text:u()}).then(({mime:e,audioBase64:r})=>{n===$&&Te(r,e,{rate:t})}).catch(()=>{n===$&&g(!0)}).finally(()=>p(!1))},children:f?N():_()}),(0,Q.jsx)(R,{variant:`ghost`,size:`sm`,onClick:()=>{$++,p(!1),H(),J()},children:ee()})]}),s===`error`||h?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:h?ae():ie()}):null]})}function Ae({stt:e}){let t=c(k.me.getMe,{host:xe}),n=l(k.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=t?.role===`admin`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:A()}),(0,Q.jsx)(B,{variant:e?`secondary`:`outline`,children:e?T():I()}),(0,Q.jsx)(B,{variant:r?`secondary`:`destructive`,children:r?se():de()})]}),i?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(V,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":D()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:s()})]})}function je(){let e=c(k.admin.listInstances,{}),t=(0,Z.useMemo)(()=>z(),[]),n=(0,Z.useMemo)(()=>_e(),[]),{section:r}=be({from:`/settings/voice`}),i=ye({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(B,{variant:t?`secondary`:`destructive`,children:t?f():re()}),(0,Q.jsx)(B,{variant:n?`secondary`:`destructive`,children:n?a():L()})]}),(0,Q.jsxs)(Se,{value:r,onValueChange:e=>void i({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(Ce,{className:`w-full`,children:[(0,Q.jsxs)(K,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(he,{size:13,"aria-hidden":!0}),fe()]}),(0,Q.jsxs)(K,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(ge,{size:13,"aria-hidden":!0}),A()]}),(0,Q.jsxs)(K,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(we,{size:13,"aria-hidden":!0}),x()]})]}),(0,Q.jsx)(W,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(W,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsxs)(W,{value:`talk`,children:[(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsx)(`header`,{className:`oc-voice__cardhead`,children:(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:x()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:M()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=l(k.admin.upsertInstanceConfig),n=e.config??{},i=n.talkEnabled===!0,a=e.kind===`hermes`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(B,{variant:`secondary`,children:a?`Hermes`:`OpenClaw`})]}),a?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:r()}):(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(V,{checked:i,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":O()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()})]})]})}export{je as VoiceTab};