@lacneu/atrium 0.87.1 → 0.88.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/assets/AccessTab-QSLwtuuc.js +1 -0
  2. package/dist/assets/{AdvancedFilter-ksMf6bcD.js → AdvancedFilter-DfWuJNZC.js} +1 -1
  3. package/dist/assets/AgentFilesTab-uwWgtQgE.js +3 -0
  4. package/dist/assets/AnomaliesTab-BUTl2hWd.js +1 -0
  5. package/dist/assets/AuditTab-CicfFU_n.js +1 -0
  6. package/dist/assets/BridgeTab-C12c4qBe.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-D1Nj28J1.js +1 -0
  8. package/dist/assets/{DataTableShell-K5cImuMP.js → DataTableShell-D_1TXULe.js} +1 -1
  9. package/dist/assets/{DetailChips-Xge7xE-L.js → DetailChips-S9d12ANU.js} +1 -1
  10. package/dist/assets/FeedbacksTab-BrJ2q49l.js +1 -0
  11. package/dist/assets/{FieldLabel-DVWzsIR3.js → FieldLabel-DpY9Xev6.js} +1 -1
  12. package/dist/assets/FilesTab-B9W1PbQN.js +1 -0
  13. package/dist/assets/{FilterBar-DLMcpn_E.js → FilterBar-c4Vf46z3.js} +1 -1
  14. package/dist/assets/GroupsTab-DcoPyNf-.js +1 -0
  15. package/dist/assets/InstancesTab-BVeOSJ5v.js +1 -0
  16. package/dist/assets/IntegrationsTab-CGITUOLA.js +1 -0
  17. package/dist/assets/{KpiTab-1Hx_0Uao.js → KpiTab-BK_BrK-j.js} +1 -1
  18. package/dist/assets/PreferencesTab-jlp6OzO_.js +1 -0
  19. package/dist/assets/ProjectPage-Qg8uaPYR.js +1 -0
  20. package/dist/assets/PromptInjectionsTab-B3OWlGa0.js +4 -0
  21. package/dist/assets/RolesTab-BSvuojBC.js +1 -0
  22. package/dist/assets/ScheduledTab-DBkiXWYU.js +1 -0
  23. package/dist/assets/ServiceAccountsTab-DGOPe59N.js +1 -0
  24. package/dist/assets/SubAgentReportsTab-DYIXDbFr.js +1 -0
  25. package/dist/assets/ThemeShowroom-BqqT9eCK.js +1 -0
  26. package/dist/assets/{TimeRangePicker-BIobKXvm.js → TimeRangePicker-FT0sN61o.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-C_pawxor.js → TimezoneCombobox-0qEgkKvV.js} +1 -1
  28. package/dist/assets/TracesTab-pddQ9h_F.js +1 -0
  29. package/dist/assets/UsersTab-B-oeu5Px.js +1 -0
  30. package/dist/assets/VoiceTab-DKgyz5nJ.js +1 -0
  31. package/dist/assets/api-pyd1BsFz.js +44 -0
  32. package/dist/assets/{button-C7mIcWuE.js → button-CSHWa9fF.js} +1 -1
  33. package/dist/assets/{card-D96d_4Et.js → card-DOI4qcUP.js} +1 -1
  34. package/dist/assets/chevrons-up-down-CVE2gmuK.js +1 -0
  35. package/dist/assets/{compatView-D2UZENK3.js → compatView-WF4iD3or.js} +1 -1
  36. package/dist/assets/dispatchErrorInfo-Bbo9tRSI.js +1 -0
  37. package/dist/assets/{dist-CLt4MJ3r.js → dist-BEIK-Fy2.js} +1 -1
  38. package/dist/assets/{dist-CU23SxxP.js → dist-BtoqPlB7.js} +1 -1
  39. package/dist/assets/{dist-CNXx0sNo.js → dist-DRf4t_B7.js} +1 -1
  40. package/dist/assets/{highlighted-body-OFNGDK62-CO9Mn_bf.js → highlighted-body-OFNGDK62-CjcMoipl.js} +1 -1
  41. package/dist/assets/index-0DcZwf39.css +1 -0
  42. package/dist/assets/index-D_SQS2Hc.js +327 -0
  43. package/dist/assets/{list-PsjK33SL.js → list-_AdtdHKa.js} +1 -1
  44. package/dist/assets/mermaid-GHXKKRXX-k47BfDk_.js +1 -0
  45. package/dist/assets/{pdf-jxqL4Jk_.js → pdf-CY8X_ahA.js} +1 -1
  46. package/dist/assets/roleDescriptions-CWN610yU.js +1 -0
  47. package/dist/assets/{table-CXJLU3m_.js → table-DJJzEEXc.js} +1 -1
  48. package/dist/assets/x-BAZ6f_9l.js +1 -0
  49. package/dist/index.html +8 -8
  50. package/package.json +1 -1
  51. package/dist/assets/AccessTab-BjWb2utN.js +0 -1
  52. package/dist/assets/AgentFilesTab-DAHA88Tu.js +0 -3
  53. package/dist/assets/AnomaliesTab-CVua97lJ.js +0 -1
  54. package/dist/assets/AuditTab-hTs6iFsI.js +0 -1
  55. package/dist/assets/BridgeTab-DPbj0zcY.js +0 -1
  56. package/dist/assets/ChatDefaultsTab-CdYRaOgV.js +0 -1
  57. package/dist/assets/FeedbacksTab-CvTz752R.js +0 -1
  58. package/dist/assets/FilesTab-BOw97zky.js +0 -1
  59. package/dist/assets/GroupsTab-D5ycprxr.js +0 -1
  60. package/dist/assets/InstancesTab-TaKSA8bY.js +0 -1
  61. package/dist/assets/IntegrationsTab-D59mPoaZ.js +0 -1
  62. package/dist/assets/PreferencesTab-3cXC4S1l.js +0 -1
  63. package/dist/assets/ProjectPage-nBPDSUUX.js +0 -1
  64. package/dist/assets/PromptInjectionsTab-BHhqTYDk.js +0 -4
  65. package/dist/assets/RolesTab-DWR9sNW0.js +0 -1
  66. package/dist/assets/ScheduledTab-R_UJhAFC.js +0 -1
  67. package/dist/assets/ServiceAccountsTab-CJoq437S.js +0 -1
  68. package/dist/assets/SubAgentReportsTab-DCrEW3GB.js +0 -1
  69. package/dist/assets/ThemeShowroom-BePky4K4.js +0 -1
  70. package/dist/assets/TracesTab-l-lueZac.js +0 -1
  71. package/dist/assets/UsersTab-CNvCzpBh.js +0 -1
  72. package/dist/assets/VoiceTab-LihfD0So.js +0 -1
  73. package/dist/assets/api-CnXjOprV.js +0 -44
  74. package/dist/assets/chevrons-up-down-CPB13Hhb.js +0 -1
  75. package/dist/assets/dispatchErrorInfo-Ct8igIIE.js +0 -1
  76. package/dist/assets/index-0t8eOneo.js +0 -327
  77. package/dist/assets/index-CURSwr6F.css +0 -1
  78. package/dist/assets/mermaid-GHXKKRXX-BxbNoi0T.js +0 -1
  79. package/dist/assets/roleDescriptions-Bm8ptI3N.js +0 -1
  80. package/dist/assets/x-Cd7Svlfj.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$U as r,$W as i,AU as a,BU as o,CK as s,CW as c,D as l,FU as u,GU as d,GW as f,HU as ee,IU as p,JW as te,KW as m,LU as h,MU as g,NU as _,OK as v,PU as y,QU as ne,QW as re,RU as ie,SW as ae,TW as oe,UU as b,VU as se,WU as x,WW as ce,XU as le,XW as ue,YW as de,ZH as fe,ZU as pe,ZW as me,_U as he,_W as ge,aG as _e,aU as ve,aW as ye,bU as be,bW as xe,cU as Se,dU as Ce,dW as we,eG as Te,eW as Ee,fU as De,fW as Oe,gU as ke,gW as Ae,hU as je,hW as Me,iG as Ne,iU as Pe,iW as Fe,jK as Ie,jU as Le,lU as Re,mU as ze,mW as Be,nG as Ve,nW as He,oU as Ue,pU as We,pW as Ge,qW as Ke,rG as qe,rU as Je,rW as Ye,sU as Xe,sW as Ze,t as S,tG as Qe,tW as $e,uU as et,uW as tt,vU as nt,vW as C,wW as rt,xK as it,xW as at,yU as ot,zU as st}from"./api-pyd1BsFz.js";import{t as ct}from"./list-_AdtdHKa.js";import{t as w}from"./button-CSHWa9fF.js";import{At as T,Ct as lt,Dt as ut,Et as dt,Ft as ft,Hn as E,Ht as D,On as pt,Ot as mt,Sn as ht,St as gt,Tt as _t,Ut as O,Vn as k,Wt as A,Z as vt,at as yt,bt,ct as xt,dn as St,et as j,gn as Ct,it as M,jt as wt,kt as Tt,lt as Et,nt as N,on as Dt,ot as Ot,rt as P,st as kt,tt as F,ut as At,vn as jt,wt as Mt,xn as Nt,xt as Pt}from"./index-D_SQS2Hc.js";import{a as Ft,i as I,n as It,o as Lt,r as L,t as Rt}from"./table-DJJzEEXc.js";import{t as zt}from"./FilterBar-c4Vf46z3.js";/* empty css */import{a as Bt,c as R,i as z,l as Vt,n as Ht,o as Ut,r as Wt,s as Gt,t as Kt,u as B}from"./TimezoneCombobox-0qEgkKvV.js";var qt=l(`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`}]]),Jt=l(`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`}]]),V=t(e(),1),H=n();function U(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 Yt({value:e,onChange:t}){let n=Vt(e),r=(0,V.useMemo)(()=>new Date,[]),[i,a]=(0,V.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[c,l]=(0,V.useState)(!1),u=(0,V.useMemo)(()=>U(s()),[]),f=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s(),{month:`long`,year:`numeric`}),[]),p=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s(),{dateStyle:`medium`,timeStyle:`short`}),[]),te=R(i.year,i.month),m=n?.hour??9,h=n?.minute??0,g=(e,n,r,i,a)=>t(B(e,n,r,i,a)),_=(e,t,n)=>{a({year:e,month:t}),g(e,t,n,m,h)},v=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},y=n===null?x():p.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,H.jsxs)(D,{modal:!0,open:c,onOpenChange:l,children:[(0,H.jsx)(A,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":d(),children:[(0,H.jsx)(qt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,H.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:y})]})}),(0,H.jsxs)(O,{align:`start`,className:`oc-dtp__pop`,children:[(0,H.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":b(),onClick:()=>v(-1),children:(0,H.jsx)(E,{size:15,"aria-hidden":!0})}),(0,H.jsx)(`span`,{className:`oc-dtp__month`,children:f.format(new Date(i.year,i.month,1))}),(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":ee(),onClick:()=>v(1),children:(0,H.jsx)(k,{size:15,"aria-hidden":!0})})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__grid`,children:[u.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),te.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,H.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:()=>_(e.year,e.month,e.day),children:e.day},t)})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,H.jsxs)(j,{value:String(m),onValueChange:e=>g(i.year,i.month,n?.day??r.getDate(),Number(e),h),children:[(0,H.jsx)(P,{size:`sm`,"aria-label":se(),children:(0,H.jsx)(M,{})}),(0,H.jsx)(F,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,H.jsx)(N,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,H.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,H.jsxs)(j,{value:String(h),onValueChange:e=>g(i.year,i.month,n?.day??r.getDate(),m,Number(e)),children:[(0,H.jsx)(P,{size:`sm`,"aria-label":o(),children:(0,H.jsx)(M,{})}),(0,H.jsx)(F,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,H.jsx)(N,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function W(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Xt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Zt(e){let t=new Map;for(let n of e){let e=W(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 Qt(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(Xt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function $t(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 en(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 tn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var G=3;function nn({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let c=s(),l=(0,V.useMemo)(()=>Zt(e),[e]),d=(0,V.useMemo)(()=>$t(c),[c]),f=(0,V.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`,year:`numeric`}),[c]),ee=(0,V.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`}),[c]),te=(0,V.useMemo)(()=>new Intl.DateTimeFormat(c,{hour:`2-digit`,minute:`2-digit`}),[c]),m=new Date,h=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()})},v=t===`year`?String(n.year):f.format(new Date(n.year,n.month,1));return(0,H.jsxs)(`div`,{className:`oc-cal`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,"aria-label":_(),onClick:()=>h(-1),children:(0,H.jsx)(E,{})}),(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,"aria-label":g(),onClick:()=>h(1),children:(0,H.jsx)(k,{})}),(0,H.jsx)(w,{variant:`ghost`,size:`sm`,onClick:()=>i({year:m.getFullYear(),month:m.getMonth()}),children:y()})]}),(0,H.jsx)(`span`,{className:`oc-cal__title`,children:v}),(0,H.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,H.jsx)(w,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:p()}),(0,H.jsx)(w,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:u()})]})]}),t===`month`?(0,H.jsx)(rn,{cursor:n,byDay:l,weekdays:d,timeFmt:te,now:m,onEventClick:a}):(0,H.jsx)(an,{year:n.year,byDay:l,monthShortFmt:ee,now:m,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,H.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function rn({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=R(e.year,e.month);return(0,H.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Xt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,H.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,H.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,G).map(e=>(0,H.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,H.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,H.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>G?(0,H.jsx)(`span`,{className:`oc-cal__more`,children:Le({count:o.length-G})}):null]},n)})]})}function an({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,H.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=Qt(t,e,o),c=R(e,o);return(0,H.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,H.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,H.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,H.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var on={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])*on[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=Ut(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(Gt(e)){case`ok`:return(0,H.jsx)(T,{variant:`secondary`,children:Fe()});case`error`:return(0,H.jsx)(T,{variant:`destructive`,children:He()});case`running`:return(0,H.jsx)(T,{variant:`outline`,children:$e()});case`other`:return(0,H.jsx)(T,{variant:`outline`,children:e});case`none`:return(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=v(S.scheduled.listMyCrons),t=v(S.scheduled.getCronDetail),n=v(S.scheduled.listCronRuns),o=v(S.scheduled.updateCron),l=v(S.scheduled.removeCron),u=v(S.scheduled.runCronNow),d=wt(),ee=Ie(S.me.getMe,{host:vt})?.timezone,[p,g]=(0,V.useState)(null),[_,y]=(0,V.useState)(!1),[b,se]=(0,V.useState)(!1),[x,Le]=(0,V.useState)(null),[E,D]=(0,V.useState)(null),[O,k]=(0,V.useState)(null),[A,R]=(0,V.useState)(null),[Vt,Gt]=(0,V.useState)(!1),[B,U]=(0,V.useState)(Ht),[W,Xt]=(0,V.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Zt=e=>{localStorage.setItem(`oc.sched.view`,e),Xt(e)},[Qt,$t]=(0,V.useState)(`month`),[G,rn]=(0,V.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),an=(0,V.useMemo)(()=>{let e=[];for(let t of p??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Bt(r,B)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[p,B]),on=(0,V.useMemo)(()=>Qt===`year`?tn(G.year):en(G.year,G.month),[Qt,G]),sn=(0,V.useMemo)(()=>un(an,on.startMs,on.endMs),[an,on]),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,V.useCallback)(async()=>{y(!0),se(!1);try{g(await e({}))}catch{se(!0)}finally{y(!1)}},[e]);(0,V.useEffect)(()=>{q()},[q]);let cn=(0,V.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,V.useRef)(null);(0,V.useEffect)(()=>{p!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[p]);let Y=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{Le(e);try{await t(),d.success(n),await q()}catch(e){d.toast({variant:`error`,title:C({code:dn(e)})})}finally{Le(null)}},Z=(0,V.useRef)(0),Q=(0,V.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;k({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;k({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;k(null),d.toast({variant:`error`,title:C({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;R({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;R(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;R(null),d.toast({variant:`error`,title:C({code:dn(e)})})}},mn=async()=>{if(A===null)return;let e={};if(A.nameDirty&&A.name.trim()===``||A.messageDirty&&A.hasMessage&&A.message.trim()===``){d.toast({variant:`error`,title:Je()});return}if(A.nameDirty&&A.name.trim()!==``&&(e.name=A.name.trim()),A.scheduleDirty){if(A.scheduleKind===`cron`&&A.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:A.cronExpr.trim(),...A.tz.trim()===``?{}:{tz:A.tz.trim()}};else if(A.scheduleKind===`every`){let t=Number(A.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[A.everyUnit])})}else if(A.scheduleKind===`at`&&A.at!==``){let t=Date.parse(A.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(A.scheduleDirty&&e.schedule===void 0){d.toast({variant:`error`,title:Pe()});return}if(A.messageDirty&&A.hasMessage&&A.message.trim()!==``&&(e.message=A.message.trim()),Object.keys(e).length===0){R(null);return}let t=Q.current;Gt(!0);try{await o({instanceName:A.instanceName,jobId:A.jobId,patch:e}),d.success(he()),t===Q.current&&R(null),await q()}catch(e){d.toast({variant:`error`,title:C({code:dn(e)})})}finally{Gt(!1)}},hn=p?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:_e()}),(0,H.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":st(),children:[(0,H.jsx)(w,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ie(),title:ie(),"aria-pressed":W===`list`,onClick:()=>Zt(`list`),children:(0,H.jsx)(ct,{})}),(0,H.jsx)(w,{variant:W===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":h(),title:h(),"aria-pressed":W===`calendar`,onClick:()=>Zt(`calendar`),children:(0,H.jsx)(qt,{})})]}),(0,H.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:_,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,H.jsx)(Ct,{size:14,"aria-hidden":!0}),Ne()]})]}),p!==null&&hn>0?(0,H.jsxs)(zt,{q:B.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:r(),onReset:()=>U(Ht),canReset:Wt(B),children:[(0,H.jsxs)(j,{value:B.state,onValueChange:e=>U(t=>({...t,state:e})),children:[(0,H.jsx)(P,{size:`sm`,className:`w-40`,children:(0,H.jsx)(M,{})}),(0,H.jsxs)(F,{children:[(0,H.jsx)(N,{value:`all`,children:ne()}),(0,H.jsx)(N,{value:`active`,children:f()}),(0,H.jsx)(N,{value:`paused`,children:m()}),(0,H.jsx)(N,{value:`auto-disabled`,children:ce()})]})]}),(0,H.jsxs)(j,{value:B.result,onValueChange:e=>U(t=>({...t,result:e})),children:[(0,H.jsx)(P,{size:`sm`,className:`w-40`,children:(0,H.jsx)(M,{})}),(0,H.jsxs)(F,{children:[(0,H.jsx)(N,{value:`all`,children:pe()}),(0,H.jsx)(N,{value:`ok`,children:Fe()}),(0,H.jsx)(N,{value:`error`,children:He()}),(0,H.jsx)(N,{value:`running`,children:$e()}),(0,H.jsx)(N,{value:`none`,children:Ee()})]})]})]}):null,p===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":_,children:b?qe():it()}):W===`calendar`?(0,H.jsxs)(H.Fragment,{children:[b?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):null,p.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):(0,H.jsx)(nn,{events:sn.events,mode:Qt,cursor:G,onModeChange:$t,onCursorChange:rn,onEventClick:K,footnote:a()})]}):(0,H.jsxs)(H.Fragment,{children:[b?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):null,p.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):null,p.map(e=>{let t=e.jobs.filter(e=>Bt(e,B)),n=Wt(B)&&e.jobs.length>0&&t.length===0;return(0,H.jsxs)(`section`,{style:{marginBottom:20},children:[p.length>1||e.error||!e.supported?(0,H.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,H.jsx)(T,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Te({code:e.error})}):e.jobs.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):n?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:le()}):(0,H.jsxs)(Rt,{children:[(0,H.jsx)(Ft,{children:(0,H.jsxs)(Lt,{children:[(0,H.jsx)(I,{children:re()}),(0,H.jsx)(I,{children:me()}),(0,H.jsx)(I,{children:ue()}),(0,H.jsx)(I,{children:de()}),(0,H.jsx)(I,{children:te()}),(0,H.jsx)(I,{children:ye()}),(0,H.jsx)(I,{children:be()})]})}),(0,H.jsx)(It,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=x===r,a=e.manageSupported,s=e.kind===`openclaw`&&a;return(0,H.jsxs)(Lt,{ref:t.id!==null&&t.id===cn?J:void 0,"data-state":t.id!==null&&t.id===cn?`selected`:void 0,children:[(0,H.jsx)(L,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??Ke()}),(0,H.jsx)(L,{children:(0,H.jsx)(T,{variant:`secondary`,children:t.agentId})}),(0,H.jsxs)(L,{className:`whitespace-nowrap`,children:[(0,H.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=bt(t.schedule),n=e===null?null:Pt(e);return n===null?null:(0,H.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,H.jsx)(L,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,H.jsx)(L,{children:Ut(t)===`auto-disabled`?(0,H.jsx)(T,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:ce()}):Ut(t)===`active`?(0,H.jsx)(T,{variant:`secondary`,children:f()}):Ut(t)===`paused`?(0,H.jsx)(T,{variant:`outline`,children:m()}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,H.jsxs)(L,{children:[(0,H.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,H.jsx)(T,{variant:`destructive`,title:t.lastDeliveryError??oe(),children:Ye()}):null]}),(0,H.jsx)(L,{className:`whitespace-nowrap`,children:t.id===null?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,H.jsx)(pt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,H.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:c(),"aria-label":c(),disabled:x!==null,onClick:()=>void X(r,async()=>{let n=await u({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},ge()),children:(0,H.jsx)(Dt,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:z(t)===`pause`?ae():at(),"aria-label":z(t)===`pause`?ae():at(),disabled:x!==null,onClick:()=>void X(r,()=>o({instanceName:e.instanceName,jobId:t.id,patch:{enabled:z(t)===`resume`}}),z(t)===`pause`?Ae():Me()),children:z(t)===`pause`?(0,H.jsx)(ht,{size:14,"aria-hidden":!0}):(0,H.jsx)(jt,{size:14,"aria-hidden":!0})}):null,s?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:ot(),"aria-label":ot(),disabled:x!==null,onClick:()=>void pn(e.instanceName,t),children:(0,H.jsx)(Nt,{size:14,"aria-hidden":!0})}):null,s?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:nt(),"aria-label":nt(),disabled:x!==null,onClick:()=>void ln(e.instanceName,t),children:(0,H.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,a?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:xe(),"aria-label":xe(),disabled:x!==null,onClick:()=>D({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,H.jsx)(St,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Qe()})]},e.instanceName)}),hn>0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:fe()}):null]}),(0,H.jsx)(gt,{open:E!==null,onOpenChange:e=>{e||D(null)},children:(0,H.jsxs)(_t,{children:[(0,H.jsxs)(mt,{children:[(0,H.jsx)(Tt,{children:Ge()}),(0,H.jsx)(dt,{children:Oe({name:E?.name??``})})]}),(0,H.jsxs)(ut,{children:[(0,H.jsx)(Mt,{children:we()}),(0,H.jsx)(lt,{onClick:()=>{let e=E;D(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>l({instanceName:e.instanceName,jobId:e.jobId}),Be())},children:tt()})]})]})}),(0,H.jsx)(yt,{open:O!==null,onOpenChange:e=>{e||(Z.current++,k(null))},children:(0,H.jsxs)(Ot,{style:{maxWidth:640},children:[(0,H.jsx)(Et,{children:(0,H.jsx)(At,{children:ke({name:O?.name??``})})}),O?.entries===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:it()}):O!==null&&O.entries.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:je()}):O===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:O.entries.map((e,t)=>(0,H.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,H.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,H.jsx)(fn,{status:e.status}),(0,H.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,H.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,H.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[Ze({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,H.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,H.jsx)(yt,{open:A!==null,onOpenChange:e=>{e||(Q.current++,R(null))},children:(0,H.jsxs)(Ot,{className:`oc-cronedit`,children:[(0,H.jsxs)(Et,{children:[(0,H.jsx)(At,{children:ze()}),(0,H.jsx)(kt,{children:We()})]}),A===null?null:A.loading?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:it()}):(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,H.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:re()}),(0,H.jsx)(ft,{value:A.name,maxLength:200,onChange:e=>R({...A,name:e.target.value,nameDirty:!0})})]}),(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:De()}),(0,H.jsxs)(j,{value:A.scheduleKind,onValueChange:e=>R({...A,scheduleKind:e,scheduleDirty:!0}),children:[(0,H.jsx)(P,{children:(0,H.jsx)(M,{})}),(0,H.jsxs)(F,{children:[(0,H.jsx)(N,{value:`cron`,children:Ce()}),(0,H.jsx)(N,{value:`every`,children:et()}),(0,H.jsx)(N,{value:`at`,children:Re()})]})]}),A.scheduleKind===`cron`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(ft,{value:A.cronExpr,onChange:e=>R({...A,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,H.jsx)(Kt,{value:A.tz,onChange:e=>R({...A,tz:e,scheduleDirty:!0}),fallbackTz:ee??void 0})]}):A.scheduleKind===`every`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(ft,{type:`number`,min:1,value:A.everyValue,onChange:e=>R({...A,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,H.jsxs)(j,{value:A.everyUnit,onValueChange:e=>R({...A,everyUnit:e,scheduleDirty:!0}),children:[(0,H.jsx)(P,{style:{maxWidth:160},children:(0,H.jsx)(M,{})}),(0,H.jsxs)(F,{children:[(0,H.jsx)(N,{value:`minutes`,children:Se()}),(0,H.jsx)(N,{value:`hours`,children:Xe()}),(0,H.jsx)(N,{value:`days`,children:Ue()})]})]})]}):(0,H.jsx)(Yt,{value:A.at,onChange:e=>R({...A,at:e,scheduleDirty:!0})})]}),A.hasMessage?(0,H.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:rt()}),(0,H.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:A.message,onChange:e=>R({...A,message:e.target.value,messageDirty:!0})})]}):null]}),(0,H.jsxs)(xt,{children:[(0,H.jsx)(w,{variant:`ghost`,onClick:()=>R(null),children:we()}),(0,H.jsxs)(w,{onClick:()=>void mn(),disabled:A===null||A.loading||Vt,children:[Vt?(0,H.jsx)(pt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,ve()]})]})]})})]})}export{pn as ScheduledTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$z as r,AB as i,AK as a,Az as o,Bz as s,CB as ee,Cz as c,DB as te,Dz as ne,EB as re,Ez as l,FB as ie,Fz as u,Gz as ae,Hz as oe,IB as se,Iz as d,Jz as ce,Kz as le,LB as ue,Lz as f,MB as p,Mz as m,NB as h,Nz as g,OB as de,OK as fe,Oz as pe,PB as me,Pz as he,Qz as ge,RB as _e,Rz as ve,SB as ye,Sz as _,TB as be,Tz as v,Uz as xe,Vz as y,Wz as Se,Xz as Ce,Yz as we,Zz as Te,_B as Ee,aB as De,bB as Oe,bz as b,cB as ke,dB as Ae,eB as je,fB as Me,gB as Ne,hB as Pe,iB as Fe,jB as Ie,jK as x,jz as S,kB as Le,kz as C,lB as Re,mB as ze,nB as Be,oB as Ve,pB as He,qz as Ue,rB as We,sB as Ge,t as w,tB as Ke,uB as qe,vB as Je,vz as T,wB as Ye,wz as E,xB as Xe,xz as D,yB as Ze,yz as O,zz as k}from"./api-pyd1BsFz.js";import{r as Qe}from"./dist-BtoqPlB7.js";import{t as A}from"./button-CSHWa9fF.js";import{At as j,Ft as M,Gn as $e,Kn as et,Ln as N,Un as P,Vn as tt,_ as nt,at as F,ct as I,dt as L,et as R,ft as z,it as B,jt as rt,lt as V,nt as H,ot as U,q as it,rt as W,st as at,tt as G,ut as K}from"./index-D_SQS2Hc.js";import{t as ot}from"./FilterBar-c4Vf46z3.js";import{t as st}from"./DataTableShell-D_1TXULe.js";import{t as ct}from"./roleDescriptions-CWN610yU.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>E(),days:null},{value:`30`,label:()=>c(),days:30},{value:`90`,label:()=>_(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=et({from:`/settings/serviceAccounts`}),t=$e({from:`/settings/serviceAccounts`}),n=e.q??``,o=e.status??Z,[s,c]=(0,q.useState)(Z),ne=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),u=x(w.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:s===Z?void 0:s,disabled:o===Z?void 0:o===`disabled`}}),d=x(w.apiKeys.listKeys,{}),f=x(w.apiKeys.listRoles,{}),m=a(w.apiKeys.createServiceAccount),g=a(w.apiKeys.updateServiceAccount),pe=a(w.apiKeys.deleteServiceAccount),he=fe(w.apiKeys.mintApiKey),ve=a(w.apiKeys.revokeApiKey),_=it(),v=rt(),y=n!==``||s!==Z||o!==Z;function b(){c(Z),t({search:{},replace:!0})}let[S,C]=(0,q.useState)(!1),[T,E]=(0,q.useState)(Q),[D,O]=(0,q.useState)(null),[k,N]=(0,q.useState)(new Set),[P,F]=(0,q.useState)(null),I=(0,q.useRef)(!1),[L,z]=(0,q.useState)(new Set),[V,U]=(0,q.useState)({}),[at,K]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function $(e){N(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{D?(await g({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),v.success(Be())):await m({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Q),O(null),C(!1)}catch(e){v.error(D?We():Fe(),e)}}function ft(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function pt(e){if(I.current)return;I.current=!0;let t=V[e._id]??`never`,n=Y.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await he({serviceAccountId:e._id,expiresAt:r});K({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(Ke(),e)}finally{I.current=!1,F(null)}}async function mt(e){if(await _({title:je(),description:(0,J.jsxs)(J.Fragment,{children:[r(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,ge(),` `,(0,J.jsx)(`strong`,{children:Te()}),` `,Ce()]}),confirmWord:e.name,confirmLabel:we(),destructive:!0}))try{await pe({serviceAccountId:e._id}),v.success(ce(),e.name)}catch(e){v.error(Ue(),e)}}async function ht(e){if(await _({title:le(),description:(0,J.jsxs)(J.Fragment,{children:[ae(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Se()]}),confirmLabel:xe(),destructive:!0})&&!L.has(e._id)){z(t=>new Set(t).add(e._id));try{await ve({keyId:e._id})}catch(e){v.error(oe(),e)}finally{z(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}),(0,J.jsxs)(ot,{q:n,onQChange:ne,searchPlaceholder:ue(),onReset:b,canReset:y,children:[(0,J.jsxs)(R,{value:s,onValueChange:c,children:[(0,J.jsx)(W,{size:`sm`,className:`w-40`,children:(0,J.jsx)(B,{placeholder:se()})}),(0,J.jsxs)(G,{children:[(0,J.jsx)(H,{value:Z,children:ie()}),(f??[]).map(e=>(0,J.jsx)(H,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(R,{value:o,onValueChange:l,children:[(0,J.jsx)(W,{size:`sm`,className:`w-36`,children:(0,J.jsx)(B,{})}),(0,J.jsxs)(G,{children:[(0,J.jsx)(H,{value:Z,children:me()}),(0,J.jsx)(H,{value:`active`,children:h()}),(0,J.jsx)(H,{value:`disabled`,children:p()})]})]})]}),(0,J.jsx)(st,{title:Ie(),rows:u,addLabel:i(),onAdd:()=>{E(Q),O(null),C(!0)},emptyHint:Le(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:L}),rowActions:e=>[...(e.managedBy??null)===null?[{label:be(),onSelect:()=>ft(e)},{label:de(),onSelect:()=>void pt(e)}]:[],{label:k.has(e._id)?te():re(),onSelect:()=>$(e._id)},...(e.managedBy??null)===null?[{label:Ye(),variant:`destructive`,onSelect:()=>void mt(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?ee():ye(),onClick:()=>$(e._id),children:k.has(e._id)?(0,J.jsx)(Qe,{}):(0,J.jsx)(tt,{})})},{header:Xe(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Oe(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(j,{variant:`secondary`,children:e.roleKey})},{header:Ze(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(j,{variant:`destructive`,children:p()}):(0,J.jsx)(j,{variant:`outline`,children:h()})},{header:Je(),cell:e=>(0,J.jsxs)(R,{value:V[e._id]??`never`,onValueChange:t=>U(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(W,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{})}),(0,J.jsx)(G,{children:Y.map(e=>(0,J.jsx)(H,{value:e.value,children:e.label()},e.value))})]})},{header:Ee(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:P===e._id?Ne():Pe({count:t})})}}]}),(0,J.jsx)(nt,{open:S,onOpenChange:e=>{C(e),e||O(null)},title:D?ze():Ae(),description:D?He():qe(),canSubmit:!!(T.name&&T.roleKey),onSubmit:dt,submitLabel:D?Me():Re(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:ke()}),(0,J.jsx)(M,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Ge()}),(0,J.jsxs)(R,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,J.jsx)(W,{className:`w-full`,children:(0,J.jsx)(B,{placeholder:Ve()})}),(0,J.jsx)(G,{children:(f??[]).map(e=>(0,J.jsxs)(H,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===T.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:De()}),(0,J.jsx)(M,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:at,onClose:()=>K(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[y(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:k()}),(0,J.jsx)(`th`,{children:ve()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{children:d()}),(0,J.jsx)(`th`,{children:u()}),(0,J.jsx)(`th`,{children:he()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(j,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:z(t.createdAt)}),(0,J.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:pt(t.expiresAt)}),(0,J.jsx)(`td`,{children:mt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,J.jsx)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?g():m()}):null})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(F,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(U,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(V,{children:[(0,J.jsx)(K,{children:S()}),(0,J.jsx)(at,{children:o({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:C()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":pe(),children:[n?(0,J.jsx)(P,{}):(0,J.jsx)(N,{}),n?ne():l()]})]}),(0,J.jsx)(I,{children:(0,J.jsx)(A,{onClick:()=>{r(!1),t()},children:v()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?D():z(e)}function pt(e){return e===null?`—`:L(e)}function mt(e){return e.disabled?(0,J.jsx)(j,{variant:`destructive`,children:b()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(j,{variant:`outline`,children:O()}):(0,J.jsx)(j,{variant:`outline`,children:T()})}export{$ as ServiceAccountsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AK as r,Ap as i,Bp as a,Cp as o,Dp as s,Ep as c,Fp as l,Gp as u,Hp as d,Ip as f,Lp as p,Mp as m,Np as h,Op as g,Pp as _,Rp as v,Sp as y,Tp as b,Up as x,Vp as S,Wp as C,_p as w,bp as T,cp as E,dp as D,fp as O,gp as k,hp as A,jK as j,jp as M,kp as N,lp as P,mp as F,pp as I,sp as ee,t as L,up as R,vp as z,wp as B,xp as V,yp as H,zp as U}from"./api-pyd1BsFz.js";import{t as W}from"./button-CSHWa9fF.js";import{ft as G,q as K}from"./index-D_SQS2Hc.js";import{t as q}from"./DataTableShell-D_1TXULe.js";var J=t(e(),1),Y=n(),X={hung:()=>g(),wrong_result:()=>s(),error:()=>c(),other:()=>b()},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=r(L.subAgentReports.respondToReport),[i,a]=(0,J.useState)(e.thread),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1);async function d(){let t=s.trim();if(!(!t||l)){u(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),c(``)}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),` · `,B({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:o()}),(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:y()}),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`?V():T()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:H()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:z(),value:s,maxLength:2e3,rows:3,onChange:e=>c(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:!s.trim()||l,children:l?k():w()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[A({count:t.children.length}),t.childrenTruncated?` ${F()}`:``,t.textTruncated?` ${I()}`:``]}),(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?` · ${O()}`:``]}),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:D()}),(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:R()}),(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=j(L.subAgentReports.listForAdmin,{}),t=r(L.subAgentReports.readReport),n=r(L.subAgentReports.deleteReport),o=K(),[s,c]=(0,J.useState)(null),[g,y]=(0,J.useState)({});async function b(e){if(s===e._id){c(null);return}if(!g[e._id]){let n=await t({reportId:e._id});y(t=>({...t,[e._id]:n}))}c(e._id)}async function w(e){await o({title:P(),description:E(),confirmLabel:ee(),destructive:!0})&&(await n({reportId:e._id}),s===e._id&&c(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,Y.jsx)(`strong`,{children:d()}),` `,S()]}),(0,Y.jsx)(q,{title:u(),rows:e,emptyHint:C(),isExpanded:e=>s===e._id&&!!g[e._id],renderExpanded:e=>g[e._id]?(0,Y.jsx)($,{data:g[e._id]}):null,columns:[{header:a(),cell:e=>G(e.at),sort:e=>e.at},{header:U(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:v(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:p(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${_({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:f(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:l(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:h()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:m()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:s===e._id?i():M(),onSelect:()=>void b(e)},{label:N(),onSelect:()=>void w(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{$V as r,AH as i,AK as a,AV as o,BH as s,BV as c,CH as l,DH as u,DV as d,EH as f,EV as p,FH as m,FV as h,GH as g,GV as _,HH as v,HV as y,IH as ee,IV as te,JV as ne,KH as re,KV as ie,LH as b,LV as ae,MH as oe,MV as se,NH as ce,NV as x,OH as le,OK as ue,OV as de,PH as fe,PV as pe,QV as me,RH as he,RV as ge,SH as _e,TH as ve,TV as ye,UH as be,UV as xe,VH as Se,VV as Ce,WH as we,WV as Te,XV as Ee,YV as De,ZV as Oe,_H as ke,_K as Ae,aH as je,ap as S,bH as Me,cH as Ne,dH as Pe,eH as Fe,fH as Ie,gH as Le,hH as Re,iH as ze,ip as Be,jH as Ve,jK as C,jV as He,kH as Ue,kV as w,lH as We,mH as Ge,nH as Ke,oH as qe,op as T,pH as Je,qH as Ye,qV as Xe,r as Ze,rH as Qe,rp as $e,sH as et,t as E,tH as tt,uH as D,vH as nt,vK as rt,wH as it,xH as at,yH as ot,yK as st,zH as ct,zV as lt}from"./api-pyd1BsFz.js";import{t as O}from"./x-BAZ6f_9l.js";import{t as k}from"./button-CSHWa9fF.js";import{At as A,Bt as j,Fn as M,Ft as N,In as ut,It as dt,Lt as ft,Rt as P,Un as F,Vt as pt,X as mt,Y as ht,Z as I,et as L,it as R,ln as z,mt as B,nt as V,rt as H,tt as U,zt as gt}from"./index-D_SQS2Hc.js";import{t as _t}from"./localePickerView-C2RmOS86.js";import{a as vt,i as yt,n as bt,o as xt,r as St,t as Ct}from"./card-DOI4qcUP.js";import{a as wt,i as W,n as Tt,o as G,r as K,t as Et}from"./table-DJJzEEXc.js";import{t as Dt}from"./TimeRangePicker-FT0sN61o.js";import{t as Ot}from"./FilterBar-c4Vf46z3.js";import{t as kt}from"./AdvancedFilter-DfWuJNZC.js";var q=t(e(),1),At=.1,jt=[248,248,248],Mt=[24,24,24];function Nt(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 Pt(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 J(e,t,n){return Pt(e,t,n)>=At}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(ne());if(e.size>Lt)throw Error(Xe());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),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(_());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Nt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(_());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);J(e.data,d.width,d.height)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(e.data),p.putImageData(e,0,0)}let m=J(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Bt)??await Y(f,`image/png`);if(!h)throw Error(Te());return{blob:h,hasAlpha:m}}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(ie())),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`?st():e===`dark`?rt():Ae()}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:Ze(`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)(F,{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)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":T(),title:T(),children:(0,X.jsx)(ut,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=C(E.charts.listMyCharts),r=a(E.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ct()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:b(),subtitle:ee(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?m():n.via===`owner`?fe():ce({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 i(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:oe()}):null]})}function Qt(){let e=a(E.charts.importChart),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1),[u,d]=(0,q.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(D())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(Ne());return}let a;try{a=JSON.parse(r)}catch{s(D());return}d(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:nt()}),(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:Le()}),(0,X.jsx)(N,{value:t,onChange:e=>n(e.target.value),placeholder:Re(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ge()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:Je(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(z,{className:`size-4`}),Ie(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:u,onClick:()=>void p(),children:Pe()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:We()}):null]})]})}function $t({chart:e}){let t=ue(E.charts.setChartLogo),n=a(E.charts.removeChartLogo),[i,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(null),l=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function u(n,r,i){if(e.chartId!==void 0){c(null),o(!0);try{let{blob:a,hasAlpha:o}=await Vt(r,i?{variantFor:i}:{}),s=await a.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}}async function d(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await u(e,n)}async function f(t){if(e.chartId!==void 0){c(null),o(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}}async function p(e){let t=l(e===`light`?`dark`:`light`);if(t){c(null),o(!0);try{await u(e,await(await fetch(t)).blob(),e)}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}}function m({mode:e}){let t=l(e),n=l(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`?tt():Fe()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(z,{className:`size-4`}),t?me():r(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void d(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:i,onClick:()=>void p(e),children:Ee()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:i,onClick:()=>void f(e),children:Oe()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ke()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(m,{mode:`light`}),(0,X.jsx)(m,{mode:`dark`})]}),i?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:De()}):null,s?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})}function en({chart:e}){let t=C(E.me.getMe,{host:I}),n=a(E.charts.addChartDomain),r=a(E.charts.removeChartDomain),[i,o]=(0,q.useState)(``),[s,l]=(0,q.useState)(null),[u,d]=(0,q.useState)(!1);if(t?.role!==`admin`)return null;let f=e.domains??[];async function p(){let t=i.trim();if(t!==``){l(null),d(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){l(e instanceof Error?e.message:String(e))}finally{d(!1)}}}async function m(t){l(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:xe()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:f.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:lt()}):f.map(e=>(0,X.jsxs)(A,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ge({domain:e}),onClick:()=>void m(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(N,{value:i,onChange:e=>o(e.target.value),placeholder:Ce(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:u,onClick:()=>void p(),children:c()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:y()}),s?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=a(E.charts.updateChart),n=a(E.charts.deleteChart),[r,i]=(0,q.useState)(!1),[o,s]=(0,q.useState)(e.name),[c,l]=(0,q.useState)(()=>$(e.tokens)),[u,d]=(0,q.useState)(e.tokens.bpm??0),[f,p]=(0,q.useState)(null),[m,g]=(0,q.useState)(!1);function _(){s(e.name),l($(e.tokens)),d(e.tokens.bpm??0),p(null),i(!0)}async function v(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(c)}catch{p(D());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:o.trim(),tokens:n}),i(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function y(){if(e.chartId!==void 0&&window.confirm(x()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:_,children:ze()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void y(),children:Qe()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:h()}),(0,X.jsx)(N,{value:o,onChange:e=>s(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:S()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>d(Number(e.target.value)),"aria-label":S()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?Be():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:$e()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:pe()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:m,onClick:()=>void v(),children:ae()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:te()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=C(E.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:et()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:qe()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:je()}):(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=a(E.charts.addChartToGroupPool),r=a(E.charts.removeChartFromGroupPool),i=e.restrictedToGroups,o=e.poolGroups,s=new Set((o??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function u(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function d(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(A,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?it():e.kind===`custom`&&e.scope===`personal`?w():ve()}),e.isGlobalDefault?(0,X.jsx)(A,{variant:`default`,children:l()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:at()}),(o??[]).map(e=>(0,X.jsxs)(A,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ot({group:e.name}),onClick:()=>void d(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(L,{value:``,onValueChange:e=>void u(e),children:[(0,X.jsx)(H,{size:`sm`,className:`w-56`,children:(0,X.jsx)(R,{placeholder:Me()})}),(0,X.jsx)(U,{children:c.map(e=>(0,X.jsx)(V,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:_e()}):null]})]})}function an({chart:e}){let t=a(E.charts.promoteChartToCommon),n=a(E.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(x()))try{await n({chartId:e.chartId})}catch{}}return(0,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)(A,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?de():w()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:o({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:d()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:p()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=a(E.admin.setDefaultThemeMode),o=a(E.admin.setDefaultLocale),c=a(E.charts.setDefaultChart),l=C(E.charts.listChartsAdmin),d=C(E.groups.listGroups,{}),p=e??`system`,m=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:Se()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(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:i()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void c({name:null}),children:b()}),mt.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void c({name:e.key}),children:e.name},e.key)),(l??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void c({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:Ue()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:le()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(l??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(rn,{chart:e,groups:d??[]},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:u()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:f()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(l??[]).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:se()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:He()})]}),(()=>{let e=(l??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ye()}):(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:re()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:p===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:g()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:we()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:_t().map(e=>(0,X.jsx)(k,{variant:m===e.value?`default`:`outline`,size:`sm`,onClick:()=>void o({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:be()})]})]})}function sn(){let e=C(E.me.getMe,{host:I}),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,q.useState)(!0),[n,r]=(0,q.useState)(`per-user`),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(Z),[c,l]=(0,q.useState)(Z),[u,d]=(0,q.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:v()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(M,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,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:`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)(N,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(L,{value:n,onValueChange:r,children:[(0,X.jsx)(H,{className:`w-56`,children:(0,X.jsx)(R,{placeholder:`Select…`})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(V,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(B,{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)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(L,{value:o,onValueChange:s,children:[(0,X.jsx)(H,{size:`sm`,children:(0,X.jsx)(R,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:Z,children:`Toutes directions`}),(0,X.jsx)(V,{value:`inbound`,children:`inbound`}),(0,X.jsx)(V,{value:`outbound`,children:`outbound`}),(0,X.jsx)(V,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(L,{value:c,onValueChange:l,children:[(0,X.jsx)(H,{size:`sm`,children:(0,X.jsx)(R,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(V,{value:`info`,children:`info`}),(0,X.jsx)(V,{value:`warn`,children:`warn`}),(0,X.jsx)(V,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(kt,{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)(Dt,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(dt,{children:[(0,X.jsx)(pt,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(M,{})})}),(0,X.jsxs)(ft,{align:`start`,children:[(0,X.jsx)(gt,{children:`Actions`}),(0,X.jsx)(j,{}),(0,X.jsx)(P,{children:`Edit`}),(0,X.jsx)(P,{children:`Duplicate`}),(0,X.jsx)(j,{}),(0,X.jsx)(P,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(Ct,{className:`w-80`,children:[(0,X.jsxs)(vt,{children:[(0,X.jsx)(xt,{children:`Instance`}),(0,X.jsx)(St,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(bt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(yt,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Et,{children:[(0,X.jsx)(wt,{children:(0,X.jsxs)(G,{children:[(0,X.jsx)(W,{className:`w-8`,children:(0,X.jsx)(B,{"aria-label":`select all`})}),(0,X.jsx)(W,{children:`Name`}),(0,X.jsx)(W,{children:`Mode`}),(0,X.jsx)(W,{className:`text-right`,children:`Status`}),(0,X.jsx)(W,{className:`w-8`})]})}),(0,X.jsx)(Tt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(G,{children:[(0,X.jsx)(K,{children:(0,X.jsx)(B,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(K,{className:`font-medium`,children:e.n}),(0,X.jsx)(K,{children:(0,X.jsx)(A,{variant:`secondary`,children:e.m})}),(0,X.jsx)(K,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(F,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(K,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(M,{})})})]},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{$C as r,Bl as i,Gl as a,Hl as o,Kl as s,QC as c,Ul as l,Vl as u,Wl as d,XC as f,YC as p,ZC as m,aw as h,ew as g,iw as _,nw as v,ow as y,rw as b,sw as x,tw as S}from"./api-CnXjOprV.js";import{t as C}from"./button-C7mIcWuE.js";import{Ft as w,Gt as T,Jt as E,Kt as D,Rn as O,ft as k,hn as A,qt as j}from"./index-0t8eOneo.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:x(),from:`now-5m`},{label:y(),from:`now-15m`},{label:h(),from:`now-30m`},{label:_(),from:`now-1h`},{label:b(),from:`now-3h`},{label:v(),from:`now-6h`},{label:S(),from:`now-12h`},{label:g(),from:`now-24h`},{label:r(),from:`now-2d`},{label:c(),from:`now-7d`},{label:m(),from:`now-30d`},{label:f(),from:`now-90d`},{label:p(),from:`now-520w`}];function L(e){return k(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),[c,f]=(0,M.useState)(``),p=F(e),[m,h]=(0,M.useState)(()=>z(p.from)),[g,_]=(0,M.useState)(()=>z(p.to));function v(t){if(t){let t=F(e);h(z(t.from)),_(z(t.to)),f(``)}r(t)}function y(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function b(){let e=B(m),n=B(g);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let x=(0,M.useMemo)(()=>{let e=c.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[c]),S=B(m)!==null&&B(g)!==null;return(0,H.jsxs)(j,{open:n,onOpenChange:v,children:[(0,H.jsx)(E,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(O,{}),R(e)]})}),(0,H.jsx)(D,{children:(0,H.jsx)(T,{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:s()}),(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:m,onChange:e=>h(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:d()}),(0,H.jsx)(w,{type:`datetime-local`,value:g,onChange:e=>_(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!S,onClick:b,children:l()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(A,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(w,{value:c,onChange:e=>f(e.target.value),placeholder:o(),"aria-label":u()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:x.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:i()}):x.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:()=>y(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{$w as r,Bu as i,Hu as a,Jw as o,Qw as s,Ru as c,Uu as l,Vu as u,Wu as d,Xw as f,Yw as p,Zw as m,aT as h,eT as g,iT as _,nT as v,oT as y,rT as b,tT as x,zu as S}from"./api-pyd1BsFz.js";import{t as C}from"./button-CSHWa9fF.js";import{Ft as w,Gt as T,Jt as E,Kt as D,Rn as O,ft as k,hn as A,qt as j}from"./index-D_SQS2Hc.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:h(),from:`now-15m`},{label:_(),from:`now-30m`},{label:b(),from:`now-1h`},{label:v(),from:`now-3h`},{label:x(),from:`now-6h`},{label:g(),from:`now-12h`},{label:r(),from:`now-24h`},{label:s(),from:`now-2d`},{label:m(),from:`now-7d`},{label:f(),from:`now-30d`},{label:p(),from:`now-90d`},{label:o(),from:`now-520w`}];function L(e){return k(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),[o,s]=(0,M.useState)(``),f=F(e),[p,m]=(0,M.useState)(()=>z(f.from)),[h,g]=(0,M.useState)(()=>z(f.to));function _(t){if(t){let t=F(e);m(z(t.from)),g(z(t.to)),s(``)}r(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function y(){let e=B(p),n=B(h);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let b=(0,M.useMemo)(()=>{let e=o.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[o]),x=B(p)!==null&&B(h)!==null;return(0,H.jsxs)(j,{open:n,onOpenChange:_,children:[(0,H.jsx)(E,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(O,{}),R(e)]})}),(0,H.jsx)(D,{children:(0,H.jsx)(T,{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:d()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:l()}),(0,H.jsx)(w,{type:`datetime-local`,value:p,onChange:e=>m(e.target.value)})]}),(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:h,onChange:e=>g(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!x,onClick:y,children:u()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(A,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(w,{value:o,onChange:e=>s(e.target.value),placeholder:i(),"aria-label":S()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:c()}):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{JH as r,XH as i,YH as a,ZH as o}from"./api-CnXjOprV.js";import{t as s}from"./chevrons-up-down-CPB13Hhb.js";import{Ft as c,Ht as l,Un as u,Ut as d,Wt as f}from"./index-0t8eOneo.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()||r():e;return(0,D.jsxs)(l,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(f,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":o(),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)(d,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,D.jsx)(c,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:i(),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};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{JU as r,KU as i,YU as a,qU as o}from"./api-pyd1BsFz.js";import{t as s}from"./chevrons-up-down-CVE2gmuK.js";import{Ft as c,Ht as l,Un as u,Ut as d,Wt as f}from"./index-D_SQS2Hc.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)(l,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(f,{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)(d,{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};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,$P as i,AD as a,AF as o,AK as s,BD as c,Bl as l,CF as u,D as d,DF as f,EF as p,FD as m,GD as h,GP as g,HD as ee,ID as _,JD as v,JP as te,KD as ne,KP as y,LD as re,MD as b,MF as x,ND as ie,OF as S,PD as ae,QD as oe,QP as C,RD as se,SF as w,TF as T,UD as ce,UP as E,VD as le,Vl as ue,WD as de,WP as fe,XD as pe,XP as me,YD as he,YP as D,ZD as ge,ZP as O,_F as k,aO as _e,bF as A,cF as ve,cO as ye,dF as be,dO as xe,eF as Se,eO as Ce,fF as we,fO as Te,gF as Ee,hF as De,iO as Oe,jD as j,jF as ke,jK as M,kF as Ae,lF as N,lO as je,mF as Me,nF as Ne,nO as Pe,oO as Fe,pF as Ie,pO as Le,qD as Re,qP as ze,rF as Be,rO as Ve,sO as He,t as P,tF as Ue,tO as We,uF as Ge,uO as Ke,vF as qe,wF as Je,xF as Ye,yF as F,zD as Xe,zl as Ze}from"./api-pyd1BsFz.js";import{t as Qe}from"./x-BAZ6f_9l.js";import{t as I}from"./button-CSHWa9fF.js";import{At as L,G as $e,Gn as et,K as R,Kn as tt,Ln as nt,Nn as rt,Pn as it,U as at,Un as ot,W as z,Z as st,a as ct,at as lt,et as B,ft as V,i as ut,it as H,kn as dt,lt as ft,nt as U,o as pt,ot as mt,pt as ht,rt as W,s as gt,st as _t,tt as G,ut as vt,z as yt}from"./index-D_SQS2Hc.js";import{n as bt}from"./TimeRangePicker-FT0sN61o.js";import{t as K}from"./FilterBar-c4Vf46z3.js";import{t as xt}from"./AdvancedFilter-DfWuJNZC.js";import{t as St}from"./DataTableShell-D_1TXULe.js";var Ct=d(`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`?Ie():n===`agent`?`${we()} - ${r}`:e}function Tt(){let e=M(P.me.getMe,{host:st})?.role===`admin`,t=M(P.deliveryTiming.getDeliveryStatus,{}),n=s(P.deliveryTiming.startDeliveryRecord),r=s(P.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[c,l]=(0,q.useState)(!1),u=t?.recording??!1,d=async()=>{l(!0);try{u?await r({}):await n({})}finally{l(!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:x()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ke()})]}),e?(0,J.jsx)(I,{variant:u?`destructive`:`default`,size:`sm`,disabled:c||t===void 0,onClick:()=>void d(),children:u?Ae():o()}):null]}),u?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(L,{variant:`secondary`,children:S()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:f({time:ht(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?Je():T()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=M(P.deliveryTiming.listDeliverySessions,{}),n=s(P.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[d,f]=(0,q.useState)(null),{from:p,to:m}=bt(c),h=c.to===`now`?1/0:m,g=r.trim()!==``||a!==`all`||c!==Y,ee=()=>{i(``),o(`all`),l(Y)},_=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=p&&t.startedAt<=h).map(e=>({...e,_id:e.sessionId}))},[t,r,a,p,h]),v=e=>{let t=new Set((_??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),d!==null&&r.includes(d)&&f(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(K,{q:r,onQChange:i,searchPlaceholder:w(),timeRange:c,onTimeRangeChange:l,onReset:ee,canReset:g,children:(0,J.jsxs)(B,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(W,{size:`sm`,className:`w-36`,children:(0,J.jsx)(H,{})}),(0,J.jsxs)(G,{children:[(0,J.jsx)(U,{value:`all`,children:Ye()}),(0,J.jsx)(U,{value:`active`,children:A()}),(0,J.jsx)(U,{value:`stopped`,children:F()})]})]})}),(0,J.jsx)(St,{title:u(),rows:_,emptyHint:fe(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(I,{variant:`ghost`,size:`icon`,"aria-label":d===e.sessionId?Ge():be(),onClick:()=>f(t=>t===e.sessionId?null:e.sessionId),children:d===e.sessionId?(0,J.jsx)(it,{size:15,"aria-hidden":!0}):(0,J.jsx)(rt,{size:15,"aria-hidden":!0})})},{header:qe(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:V(e.startedAt)})},{header:k(),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:V(e.stoppedAt)})},{header:Ee(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:De(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:Me(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(L,{variant:`secondary`,children:A()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:F()})}],rowActions:e?e=>[{label:N(),variant:`destructive`,onSelect:()=>v([e.sessionId])}]:void 0,bulkActions:e?[{label:N(),variant:`destructive`,onSelect:e=>v(e)}]:void 0,isExpanded:e=>e.sessionId===d,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=M(P.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(yt(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:ve()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:p()});let r=e.segments,a=(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,` `,E()]}),(0,J.jsxs)(I,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(ot,{size:13,"aria-hidden":!0}):(0,J.jsx)(nt,{size:13,"aria-hidden":!0}),t?g():y()]})]}),(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:Ue()}),(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:i()})]})}),(0,J.jsxs)(`tbody`,{children:[a(C(),r.bridge),a(O(),r.A),a(me(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:D()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:te()})]})}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:ue()},{value:`principalType`,label:l()},{value:`direction`,label:`direction`},{value:`roleKey`,label:Ze()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=tt({from:`/settings/traces`}),t=et({from:`/settings/traces`}),n=e.limit,i=e.kind,a=e.statusClass??Q,o=e.principalType??Q,s=e.direction??Q,l=e.roleKey??Q,u=e.q??``,d=e.correlationId,f=ut(e.from,e.to),p=(0,q.useMemo)(()=>gt(e.adv),[e.adv]),{from:g,to:te}=bt(f),[y,b]=(0,q.useState)(null),[x,S]=(0,q.useState)(null),C=e=>void t({search:t=>({...t,limit:e})}),w=e=>void t({search:t=>({...t,kind:e})}),T=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),E=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),ue=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),fe=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),me=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),D=e=>void t({search:t=>({...t,...pt(e)})}),O=e=>void t({search:t=>({...t,adv:ct(e)}),replace:!0}),k=M(P.observability.listEvents,{limit:n}),A=M(P.observability.listEvents,{limit:n,kind:i===Z?void 0:i,...d?{correlationId:d}:{},filter:{q:u||void 0,from:g,to:te,statusClass:a===Q?void 0:a,principalType:o===Q?void 0:o,direction:s===Q?void 0:s,roleKey:l===Q?void 0:l,advanced:p.length>0?p:void 0}}),ve=(0,q.useMemo)(()=>{let e=new Set;for(let t of k??[])e.add(t.kind);return[...e].sort()},[k]),be=(0,q.useMemo)(()=>{let e=new Set;for(let t of k??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[k]),Se=u!==``||a!==Q||o!==Q||s!==Q||l!==Q||p.length>0||f.kind!==`relative`||f.from!==Nt.from;function we(){t({search:{limit:100,kind:`all`},replace:!0})}let Ee=y?k?.filter(e=>e.correlationId===y):A,De=e.section,j=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(at,{value:De,onValueChange:e=>j(e),children:[(0,J.jsxs)($e,{className:`w-full`,children:[(0,J.jsxs)(R,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(dt,{size:13,"aria-hidden":!0}),Be()]}),(0,J.jsxs)(R,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),Ne()]})]}),(0,J.jsx)(z,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(z,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[Le(),(0,J.jsx)(`strong`,{children:Te()}),xe(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:Ke()})]}),(0,J.jsxs)(K,{q:u,onQChange:T,searchPlaceholder:je(),timeRange:f,onTimeRangeChange:D,onReset:we,canReset:Se,children:[(0,J.jsxs)(B,{value:a,onValueChange:E,children:[(0,J.jsx)(W,{size:`sm`,className:`w-32`,children:(0,J.jsx)(H,{placeholder:ye()})}),(0,J.jsxs)(G,{children:[(0,J.jsx)(U,{value:Q,children:He()}),At.map(e=>(0,J.jsx)(U,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:o,onValueChange:ue,children:[(0,J.jsx)(W,{size:`sm`,className:`w-32`,children:(0,J.jsx)(H,{placeholder:Fe()})}),(0,J.jsxs)(G,{children:[(0,J.jsx)(U,{value:Q,children:_e()}),jt.map(e=>(0,J.jsx)(U,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:s,onValueChange:fe,children:[(0,J.jsx)(W,{size:`sm`,className:`w-32`,children:(0,J.jsx)(H,{placeholder:Oe()})}),(0,J.jsxs)(G,{children:[(0,J.jsx)(U,{value:Q,children:Ve()}),Mt.map(e=>(0,J.jsx)(U,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:l,onValueChange:me,children:[(0,J.jsx)(W,{size:`sm`,className:`w-36`,children:(0,J.jsx)(H,{placeholder:Pe()})}),(0,J.jsxs)(G,{children:[(0,J.jsx)(U,{value:Q,children:We()}),be.map(e=>(0,J.jsx)(U,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:i===Z?``:i,placeholder:Ce(),"aria-label":Ce(),onChange:e=>{let t=e.target.value.trim();w(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:ve.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(B,{value:String(n),onValueChange:e=>C(Number(e)),children:[(0,J.jsx)(W,{size:`sm`,className:`w-28`,children:(0,J.jsx)(H,{})}),(0,J.jsx)(G,{children:kt.map(e=>(0,J.jsx)(U,{value:String(e),children:r({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:p,onChange:O}),y?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>b(null),title:oe(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ge(),(0,J.jsx)(`code`,{children:$(y)})]}),(0,J.jsx)(Qe,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:pe()})]})}):null,(0,J.jsx)(St,{title:he(),rows:Ee,emptyHint:y?v():Re(),columns:[{header:ne(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:V(e.at)})},{header:h(),sort:e=>e.kind,cell:e=>(0,J.jsx)(L,{variant:`secondary`,children:e.kind})},{header:de(),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":ce(),children:`✓`})}},{header:ee(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(L,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:le(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(L,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:c(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(L,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Xe(),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:se(),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:re(),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:_(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:m(),onClick:()=>b(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ae(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>S(e),children:ie()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:x,onClose:()=>S(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)(lt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(mt,{className:`max-w-lg`,children:[(0,J.jsxs)(ft,{children:[(0,J.jsxs)(vt,{className:`oc-traces__meta-title`,children:[b(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(L,{variant:`outline`,children:j()})]}),(0,J.jsx)(_t,{children:a()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$M as i,AK as a,BM as o,FM as s,GE as c,GM as l,HE as u,HM as d,IM as f,JE as p,JM as m,KE as h,KM as g,LM as ee,MM as te,NM as _,PM as ne,QE as v,QM as re,RM as ie,UE as y,UM as ae,VM as oe,WE as b,WM as se,XE as x,XM as ce,YE as S,YM as le,ZE as C,ZM as ue,aN as w,bv as T,eD as E,eN as de,fM as D,iN as O,jK as k,jM as fe,nN as pe,qE as A,qM as me,rN as j,t as M,tN as he,vv as N,yv as P,zM as ge}from"./api-pyd1BsFz.js";import{t as F}from"./button-CSHWa9fF.js";import{At as I,Gn as L,It as R,J as _e,Kn as ve,Lt as ye,Rt as be,Vt as xe,Z as Se,at as Ce,c as z,et as B,fn as V,it as H,jt as U,l as we,lt as Te,mn as W,mt as G,nt as K,ot as Ee,q as De,rt as q,st as Oe,tt as J,u as Y,ut as ke,zt as Ae}from"./index-D_SQS2Hc.js";import{t as je}from"./FilterBar-c4Vf46z3.js";import{t as Me}from"./DataTableShell-D_1TXULe.js";import{t as Ne}from"./DetailChips-S9d12ANU.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:i}){let a=k(M.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=k(M.agents.listUserAgents,n&&e?{profileId:e}:`skip`),s=new Set((o??[]).map(e=>`${e.instanceName}/${e.agentId}`)),c=(o??[]).find(e=>e.isDefault)??null,l=c?`${c.instanceName}/${c.agentId}`:null,u=new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),d=[...(a?.agents??[]).map(e=>({...e,outOfPool:!1})),...(o??[]).filter(e=>!u.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}))],f=new Map;for(let e of d){let t=f.get(e.instanceName)??[];t.push(e),f.set(e.instanceName,t)}return(0,Z.jsx)(Ce,{open:n,onOpenChange:i,children:(0,Z.jsxs)(Ee,{className:`oc-access`,children:[(0,Z.jsxs)(Te,{children:[(0,Z.jsx)(ke,{children:E({user:t})}),(0,Z.jsx)(Oe,{children:r()})]}),a?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:a.inGroup?v():C()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:a===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:x()}):d.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:A()}):[...f.entries()].map(([t,n])=>(0,Z.jsx)(Fe,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:l},t))})]})})}function Fe({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:o}){let s=a(M.agents.assignAgent),l=a(M.agents.removeAgent),d=a(M.agents.setDefaultAgent),f=U();if(!e)return null;async function m(n,r){try{r?await l({profileId:e,instanceName:t,agentId:n}):await s({profileId:e,instanceName:t,agentId:n})}catch(e){f.error(S(),e)}}async function g(n){try{await d({profileId:e,instanceName:t,agentId:n})}catch(e){f.error(p(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(W,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(I,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),a=o===n,s=e.state===`deleted`,l=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${l?` is-disabled`:``}`,children:[(0,Z.jsx)(G,{checked:r,disabled:(s||l)&&!r,onCheckedChange:()=>void m(e.agentId,r),"aria-label":h({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)(I,{variant:`outline`,className:`oc-access__gone`,children:c()}):null,e.outOfPool?(0,Z.jsx)(I,{variant:`outline`,className:`oc-access__gone`,children:b()}):null,r?a?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":y(),title:y(),children:(0,Z.jsx)(V,{size:14,fill:`currentColor`})}):(0,Z.jsx)(F,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":u(),title:u(),disabled:l,onClick:()=>void g(e.agentId),children:(0,Z.jsx)(V,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return N();case`user`:return P();case`admin`:return T();default:return e}}function Ie({granted:e,onToggle:t}){let n=new Set(e),r=z.filter(e=>n.has(Y[e])).length;return(0,Z.jsxs)(R,{children:[(0,Z.jsx)(xe,{asChild:!0,children:(0,Z.jsx)(F,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?w():O({count:r})})}),(0,Z.jsxs)(ye,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(Ae,{children:j()}),z.map(e=>{let r=Y[e];return(0,Z.jsxs)(be,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(G,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:we[e]()})]},e)})]})]})}function Le(){let e=ve({from:`/settings/users`}),t=L({from:`/settings/users`}),n=e.q??``,r=e.role??Q,c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),p=k(M.admin.listUsers,{filter:{q:n||void 0,role:r===Q?void 0:r},withAgents:!0}),h=k(M.me.getMe,{host:Se}),v=a(M.admin.setRole),y=a(M.admin.setUserPermissions),b=a(M.admin.startImpersonation),x=a(M.admin.deleteUser),S=a(M.admin.setUserName),C=De(),w=_e(),T=U(),[E,O]=(0,X.useState)(null),A=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of p??[])e.add(t.role);return[...e]},[p]),j=n!==``||r!==Q;function N(){t({search:{},replace:!0})}async function P(e){try{await v(e)}catch(e){T.error(pe(),e)}}async function F(e){try{await y(e)}catch(e){T.error(he(),e)}}async function I(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await C({title:m(),description:me({user:t}),confirmWord:g(),confirmLabel:l(),destructive:!0}))try{await x({profileId:e._id}),T.success(ae({user:t}))}catch(e){T.error(se(),e)}}async function R(e){let t=e.email||e.name||e.userId.slice(0,8),n=await w({title:oe(),label:o({user:t}),placeholder:ge(),defaultValue:e.name??``,confirmLabel:D()});if(n!==null)try{await S({profileId:e._id,name:n}),T.success(ie())}catch(e){T.error(ee(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{q:n,onQChange:c,searchPlaceholder:de(),onReset:N,canReset:j,children:(0,Z.jsxs)(B,{value:r,onValueChange:u,children:[(0,Z.jsx)(q,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(K,{value:Q,children:i()}),A.map(e=>(0,Z.jsx)(K,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:re(),rows:p,emptyHint:ue(),rowActions:e=>{let t=[{label:fe(),onSelect:()=>O({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:d(),onSelect:()=>void R(e)}];return e.userId!==h?.userId&&t.push({label:ce(),onSelect:()=>void b({profileId:e._id})},{label:le(),variant:`destructive`,onSelect:()=>void I(e)}),t},columns:[{header:f(),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:s(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(B,{value:e.role,onValueChange:t=>void P({profileId:e._id,role:t}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(K,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(K,{value:`user`,children:$(`user`)}),(0,Z.jsx)(K,{value:`admin`,children:$(`admin`)})]})]})},{header:ne(),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:_()}):(0,Z.jsx)(Ie,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),F({profileId:e._id,permissions:[...n]})}})},{header:te(),cell:e=>(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(W,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Pe,{profileId:E?.profileId??null,userLabel:E?.label??``,open:E!==null,onOpenChange:e=>{e||O(null)}})]})}export{Le as UsersTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,AK as i,As as a,Bc as o,CK as s,Ds as c,Es as ee,Fc as l,Fs as u,Gc as te,Hc as d,Ic as f,Is as p,Jc as m,Kc as h,Ks as g,Lc as _,Ls as v,M_ as y,Ms as b,OK as x,Qc as S,Rc as C,Rs as ne,Ts as re,Uc as w,Vc as T,Wc as E,Xc as ie,Yc as ae,Zc as D,al as oe,el as O,fs as se,il as ce,jK as k,js as le,ks as ue,lP as A,lg as de,nl as fe,qc as pe,rl as me,sg as he,t as j,tl as M,ws as N,xK as P,zc as F,zs as I}from"./api-pyd1BsFz.js";import{t as L}from"./button-CSHWa9fF.js";import{$t as R,At as z,G as ge,Gn as _e,K as B,Kn as ve,U as ye,W as V,Wn as be,Z as xe,an as Se,en as Ce,et as H,in as U,it as W,mt as G,nn as we,nt as K,rn as q,rt as J,sn as Y,tn as Te,tt as X,wn as Ee}from"./index-D_SQS2Hc.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>S()],[`fr-FR`,()=>I()],[`en-US`,()=>ne()],[`en-GB`,()=>v()],[`de-DE`,()=>p()],[`es-ES`,()=>u()]],Oe=[[`0.75`,()=>ie()],[`1`,()=>ae()],[`1.25`,()=>m()],[`1.5`,()=>pe()]],$=0;function ke({instance:e}){let t=i(j.admin.upsertInstanceConfig),n=e.config??{},a={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},[o,l]=(0,Z.useState)(a),[u,f]=(0,Z.useState)(`idle`),[p,m]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(!1),v=x(j.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{l({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}),f(`idle`)},[e._id]);let b=o.enabled!==a.enabled||o.engine!==a.engine||o.lang!==a.lang||o.rate!==a.rate||o.autoRead!==a.autoRead;async function S(){f(`saving`);try{let n={...e.config??{}};n.voiceEnabled=o.enabled,o.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,o.lang===`auto`?delete n.voiceLang:n.voiceLang=o.lang;let r=Number.parseFloat(o.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,o.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),f(`idle`)}catch{f(`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)(z,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(G,{checked:o.enabled,onCheckedChange:e=>l({...o,enabled:e===!0}),"aria-label":O()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:c()}),(0,Q.jsxs)(H,{value:o.engine,onValueChange:e=>l({...o,engine:e}),disabled:!o.enabled,children:[(0,Q.jsx)(J,{size:`sm`,"aria-label":c(),children:(0,Q.jsx)(W,{})}),(0,Q.jsxs)(X,{children:[(0,Q.jsx)(K,{value:`browser`,children:ee()}),e.kind===`hermes`?null:(0,Q.jsx)(K,{value:`gateway`,children:re()})]})]})]}),o.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:N()}):null,o.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,Q.jsxs)(H,{value:o.lang,onValueChange:e=>l({...o,lang:e}),disabled:!o.enabled,children:[(0,Q.jsx)(J,{size:`sm`,"aria-label":r(),children:(0,Q.jsx)(W,{})}),(0,Q.jsx)(X,{children:De.map(([e,t])=>(0,Q.jsx)(K,{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)(H,{value:o.rate,onValueChange:e=>l({...o,rate:e}),disabled:!o.enabled,children:[(0,Q.jsx)(J,{size:`sm`,"aria-label":D(),children:(0,Q.jsx)(W,{})}),(0,Q.jsx)(X,{children:Oe.map(([e,t])=>(0,Q.jsx)(K,{value:e,children:t()},e))})]})]}),o.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(G,{checked:o.autoRead,onCheckedChange:e=>l({...o,autoRead:e===!0}),disabled:!o.enabled,"aria-label":h()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:h()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:te()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(L,{size:`sm`,disabled:!b||u===`saving`,onClick:()=>void S(),children:u===`saving`?y():de()}),(0,Q.jsx)(L,{variant:`outline`,size:`sm`,disabled:!o.enabled||p,onClick:()=>{let t=Number.parseFloat(o.rate)||1,n=++$;if(_(!1),U(),q(),o.engine!==`gateway`){we(d(),{lang:Te(o.lang,s()),rate:t});return}m(!0),v({instanceName:e.name,text:d()}).then(({mime:e,audioBase64:r})=>{n===$&&Ce(r,e,{rate:t})}).catch(()=>{n===$&&_(!0)}).finally(()=>m(!1))},children:p?y():E()}),(0,Q.jsx)(L,{variant:`ghost`,size:`sm`,onClick:()=>{$++,m(!1),U(),q()},children:w()})]}),u===`error`||g?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g?se():he()}):null]})}function Ae({stt:e}){let t=k(j.me.getMe,{host:xe}),n=i(j.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,s=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:o()}),(0,Q.jsx)(z,{variant:e?`secondary`:`outline`,children:e?f():l()}),(0,Q.jsx)(z,{variant:r?`secondary`:`destructive`,children:r?le():a()})]}),s?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(G,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":b()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:F()})]})}function je(){let e=k(j.admin.listInstances,{}),t=(0,Z.useMemo)(()=>Se(),[]),n=(0,Z.useMemo)(()=>R(),[]),{section:r}=ve({from:`/settings/voice`}),i=_e({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(z,{variant:t?`secondary`:`destructive`,children:t?ce():me()}),(0,Q.jsx)(z,{variant:n?`secondary`:`destructive`,children:n?fe():M()})]}),(0,Q.jsxs)(ye,{value:r,onValueChange:e=>void i({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(ge,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),ue()]}),(0,Q.jsxs)(B,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ee,{size:13,"aria-hidden":!0}),o()]}),(0,Q.jsxs)(B,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(be,{size:13,"aria-hidden":!0}),C()]})]}),(0,Q.jsx)(V,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(V,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsxs)(V,{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:C()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:_()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=i(j.admin.upsertInstanceConfig),n=e.config??{},r=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)(z,{variant:`secondary`,children:a?`Hermes`:`OpenClaw`})]}),a?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:g()}):(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(G,{checked:r,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":A()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()})]})]})}export{je as VoiceTab};