@lacneu/atrium 0.84.6 → 0.84.8
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.
- package/dist/assets/{AccessTab-8bz2EDDf.js → AccessTab-DwOIkqjh.js} +1 -1
- package/dist/assets/{AdvancedFilter-BDMSRiwU.js → AdvancedFilter-DvEmlwDx.js} +1 -1
- package/dist/assets/AgentFilesTab-BdJoW_B3.js +3 -0
- package/dist/assets/AnomaliesTab-DcBUy-Iv.js +1 -0
- package/dist/assets/AuditTab-dIKTcJjh.js +1 -0
- package/dist/assets/BridgeTab-zSreXnvo.js +1 -0
- package/dist/assets/ChatDefaultsTab-DM6oDppQ.js +1 -0
- package/dist/assets/{DataTableShell-yD_nPHl_.js → DataTableShell-DxLu0zon.js} +1 -1
- package/dist/assets/{DetailChips-DVgEoxGq.js → DetailChips-DtjFz3Cl.js} +1 -1
- package/dist/assets/FeedbacksTab-Dadkmk36.js +1 -0
- package/dist/assets/{FieldLabel-DgfHtxL5.js → FieldLabel-CK8GT8Ed.js} +1 -1
- package/dist/assets/FilesTab-C9iAwEHd.js +1 -0
- package/dist/assets/{FilterBar-Dp85xc2n.js → FilterBar-9-13ggzv.js} +1 -1
- package/dist/assets/GroupsTab-Ci0S4Ogz.js +1 -0
- package/dist/assets/InstancesTab-DAJbdWAN.js +1 -0
- package/dist/assets/IntegrationsTab-Cy1MeBH4.js +1 -0
- package/dist/assets/KpiTab-BirIJa9l.js +1 -0
- package/dist/assets/PreferencesTab-CQUv8BYH.js +1 -0
- package/dist/assets/ProjectPage-DBCUAO0Q.js +1 -0
- package/dist/assets/PromptInjectionsTab-CSqvxWfZ.js +4 -0
- package/dist/assets/RolesTab-C_LMKg-r.js +1 -0
- package/dist/assets/ScheduledTab-CLTLVvmv.js +1 -0
- package/dist/assets/ServiceAccountsTab-Cey5If4a.js +1 -0
- package/dist/assets/SubAgentReportsTab-CX0Z6Ypv.js +1 -0
- package/dist/assets/ThemeShowroom-DXyP61WS.js +1 -0
- package/dist/assets/{TimeRangePicker-BlCtUw8V.js → TimeRangePicker-Ciowmz1T.js} +1 -1
- package/dist/assets/{TimezoneCombobox-B_GmUBef.js → TimezoneCombobox-BuMVLp5O.js} +1 -1
- package/dist/assets/TracesTab-NYwTT5zR.js +1 -0
- package/dist/assets/UsersTab-DHNEp3ZU.js +1 -0
- package/dist/assets/VoiceTab-C2pYNrss.js +1 -0
- package/dist/assets/{api-DS0UCfP0.js → api-B9t7A61E.js} +5 -5
- package/dist/assets/{button-wZk4ylVE.js → button-0XSqjZXP.js} +1 -1
- package/dist/assets/{card-CurFse5M.js → card-CYCPCZHb.js} +1 -1
- package/dist/assets/chevrons-up-down-B8AMH6vo.js +1 -0
- package/dist/assets/{compatView-C5M9dPiM.js → compatView-D1MumhGe.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-C8Rn3ysk.js → dispatchErrorInfo-D1xpxBzx.js} +1 -1
- package/dist/assets/{dist-C5S0CMYi.js → dist-C4d8uVQm.js} +1 -1
- package/dist/assets/{dist-5dg443OC.js → dist-Oj4yphsZ.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-B6danJ4Z.js → highlighted-body-OFNGDK62-BrVwiJIR.js} +1 -1
- package/dist/assets/index-CqHFDZOR.js +324 -0
- package/dist/assets/{list-BEBtqnHm.js → list-CyLAzYcK.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-Cc4ompYC.js +1 -0
- package/dist/assets/{pdf-D6nf3wYq.js → pdf-COwXX1vG.js} +1 -1
- package/dist/assets/roleDescriptions-I0nZMu-C.js +1 -0
- package/dist/assets/{table-DlldEKg7.js → table-CmKoxbAD.js} +1 -1
- package/dist/assets/{tabs-DJM-iyEY.js → tabs-BC9QRLg2.js} +1 -1
- package/dist/assets/x-YGyI1mI9.js +1 -0
- package/dist/index.html +6 -6
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-DQdpfF8v.js +0 -3
- package/dist/assets/AnomaliesTab-DPefNWza.js +0 -1
- package/dist/assets/AuditTab-CgfSSk0X.js +0 -1
- package/dist/assets/BridgeTab-D0ZbevIl.js +0 -1
- package/dist/assets/ChatDefaultsTab-DIhwQZ-e.js +0 -1
- package/dist/assets/FeedbacksTab-CaveJx4M.js +0 -1
- package/dist/assets/FilesTab-Dwd-4D88.js +0 -1
- package/dist/assets/GroupsTab-CYTXD0Ye.js +0 -1
- package/dist/assets/InstancesTab-CXgt6j0O.js +0 -1
- package/dist/assets/IntegrationsTab-CmZZ5qVG.js +0 -1
- package/dist/assets/KpiTab-DAPN0ZX5.js +0 -1
- package/dist/assets/PreferencesTab-a4rIWqWr.js +0 -1
- package/dist/assets/ProjectPage-C6BaHO7Z.js +0 -1
- package/dist/assets/PromptInjectionsTab-BEjRNnxi.js +0 -4
- package/dist/assets/RolesTab-RSEarqlZ.js +0 -1
- package/dist/assets/ScheduledTab-Bjs625Yx.js +0 -1
- package/dist/assets/ServiceAccountsTab-3sDRXsF1.js +0 -1
- package/dist/assets/SubAgentReportsTab-E1wAejSf.js +0 -1
- package/dist/assets/ThemeShowroom-DP3CQmeY.js +0 -1
- package/dist/assets/TracesTab-7jaPaE0x.js +0 -1
- package/dist/assets/UsersTab-qyCOb7pd.js +0 -1
- package/dist/assets/VoiceTab-3zc3qoTb.js +0 -1
- package/dist/assets/chevrons-up-down-D0x6gTDo.js +0 -1
- package/dist/assets/index-SBKa9qhz.js +0 -324
- package/dist/assets/mermaid-GHXKKRXX-B0YF1hFv.js +0 -1
- package/dist/assets/roleDescriptions-q9e87Q_C.js +0 -1
- package/dist/assets/x-DSVIpKLV.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,$L as i,AL as a,BR as o,CB as s,D as c,DL as l,EL as u,FL as d,GI as ee,GL as f,GR as p,HR as m,IL as h,JL as te,JR as g,KL as ne,KR as re,LL as ie,LR as ae,ML as oe,NL as se,OL as ce,PL as le,QI as ue,QL as de,QR as fe,RL as _,RR as pe,TL as me,UR as he,VR as ge,WL as _e,WR as ve,XL as ye,XR as be,YL as xe,YR as Se,ZI as Ce,ZL as we,ZR as Te,_R as Ee,aL as De,aR as Oe,bB as v,cL as ke,cR as Ae,dL as je,dR as Me,eL as Ne,fL as Pe,fR as y,gB as b,gR as Fe,hR as Ie,iL as Le,iR as Re,jL as ze,kL as x,lL as Be,lR as Ve,mB as He,mL as Ue,mR as We,nL as Ge,oL as Ke,oR as qe,pL as Je,qL as Ye,qR as Xe,rL as Ze,sL as Qe,sR as $e,t as S,tL as et,tR as tt,uL as nt,uR as rt,vR as it,wL as at,yR as ot,zL as st,zR as ct}from"./api-B9t7A61E.js";import{t as lt}from"./list-CyLAzYcK.js";import{t as C}from"./button-0XSqjZXP.js";import{$ as w,Bn as T,Bt as E,Ct as ut,Dn as dt,Dt as ft,Et as D,Q as O,Rt as k,St as pt,Tt as mt,Vn as A,X as j,Z as M,_n as ht,_t as gt,at as _t,bn as vt,bt as yt,dn as bt,et as N,gt as xt,hn as St,it as Ct,jt as wt,nt as Tt,on as Et,ot as Dt,q as Ot,rt as kt,tt as At,vt as jt,wt as Mt,xn as Nt,xt as Pt,yt as Ft,zt as P}from"./index-CqHFDZOR.js";import{a as It,i as F,n as Lt,o as Rt,r as I,t as zt}from"./table-CmKoxbAD.js";import{t as Bt}from"./FilterBar-9-13ggzv.js";/* empty css */import{a as Vt,c as L,i as R,l as Ht,n as Ut,o as z,r as Wt,s as Gt,t as Kt,u as B}from"./TimezoneCombobox-BuMVLp5O.js";var qt=c(`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=c(`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=Ht(e),r=(0,V.useMemo)(()=>new Date,[]),[i,a]=(0,V.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,V.useState)(!1),c=(0,V.useMemo)(()=>U(b()),[]),l=(0,V.useMemo)(()=>new Intl.DateTimeFormat(b(),{month:`long`,year:`numeric`}),[]),u=(0,V.useMemo)(()=>new Intl.DateTimeFormat(b(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=L(i.year,i.month),f=n?.hour??9,p=n?.minute??0,m=(e,n,r,i,a)=>t(B(e,n,r,i,a)),te=(e,t,n)=>{a({year:e,month:t}),m(e,t,n,f,p)},g=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},ne=n===null?_():u.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,H.jsxs)(k,{modal:!0,open:o,onOpenChange:s,children:[(0,H.jsx)(E,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":st(),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:ne})]})}),(0,H.jsxs)(P,{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":ie(),onClick:()=>g(-1),children:(0,H.jsx)(A,{size:15,"aria-hidden":!0})}),(0,H.jsx)(`span`,{className:`oc-dtp__month`,children:l.format(new Date(i.year,i.month,1))}),(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":h(),onClick:()=>g(1),children:(0,H.jsx)(T,{size:15,"aria-hidden":!0})})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,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:()=>te(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(f),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),Number(e),p),children:[(0,H.jsx)(w,{size:`sm`,"aria-label":d(),children:(0,H.jsx)(N,{})}),(0,H.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,H.jsx)(O,{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(p),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),f,Number(e)),children:[(0,H.jsx)(w,{size:`sm`,"aria-label":le(),children:(0,H.jsx)(N,{})}),(0,H.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,H.jsx)(O,{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:o,footnote:s}){let c=b(),d=(0,V.useMemo)(()=>Zt(e),[e]),ee=(0,V.useMemo)(()=>$t(c),[c]),f=(0,V.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`,year:`numeric`}),[c]),p=(0,V.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`}),[c]),m=(0,V.useMemo)(()=>new Intl.DateTimeFormat(c,{hour:`2-digit`,minute:`2-digit`}),[c]),h=new Date,te=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()})},g=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)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),onClick:()=>te(-1),children:(0,H.jsx)(A,{})}),(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":u(),onClick:()=>te(1),children:(0,H.jsx)(T,{})}),(0,H.jsx)(C,{variant:`ghost`,size:`sm`,onClick:()=>i({year:h.getFullYear(),month:h.getMonth()}),children:ce()})]}),(0,H.jsx)(`span`,{className:`oc-cal__title`,children:g}),(0,H.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,H.jsx)(C,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:a()}),(0,H.jsx)(C,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:x()})]})]}),t===`month`?(0,H.jsx)(rn,{cursor:n,byDay:d,weekdays:ee,timeFmt:m,now:h,onEventClick:o}):(0,H.jsx)(an,{year:n.year,byDay:d,monthShortFmt:p,now:h,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),s?(0,H.jsx)(`p`,{className:`oc-cal__footnote`,children:s}):null]})}function rn({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=L(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:me({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=L(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=z(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)(D,{variant:`secondary`,children:de()});case`error`:return(0,H.jsx)(D,{variant:`destructive`,children:ye()});case`running`:return(0,H.jsx)(D,{variant:`outline`,children:xe()});case`other`:return(0,H.jsx)(D,{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),a=v(S.scheduled.updateCron),c=v(S.scheduled.removeCron),l=v(S.scheduled.runCronNow),u=ft(),d=s(S.me.getMe,{host:Ot})?.timezone,[h,ie]=(0,V.useState)(null),[ce,le]=(0,V.useState)(!1),[_,me]=(0,V.useState)(!1),[x,st]=(0,V.useState)(null),[T,E]=(0,V.useState)(null),[k,A]=(0,V.useState)(null),[P,L]=(0,V.useState)(null),[Ht,Gt]=(0,V.useState)(!1),[B,U]=(0,V.useState)(Ut),[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 h??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Vt(r,B)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[h,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()=>{le(!0),me(!1);try{ie(await e({}))}catch{me(!0)}finally{le(!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)(()=>{h!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[h]);let Y=(0,V.useMemo)(()=>new Intl.DateTimeFormat(b(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{st(e);try{await t(),u.success(n),await q()}catch(e){u.toast({variant:`error`,title:y({code:dn(e)})})}finally{st(null)}},Z=(0,V.useRef)(0),Q=(0,V.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;A({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;A({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;A(null),u.toast({variant:`error`,title:y({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;L({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;L(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;L(null),u.toast({variant:`error`,title:y({code:dn(e)})})}},mn=async()=>{if(P===null)return;let e={};if(P.nameDirty&&P.name.trim()===``||P.messageDirty&&P.hasMessage&&P.message.trim()===``){u.toast({variant:`error`,title:Ce()});return}if(P.nameDirty&&P.name.trim()!==``&&(e.name=P.name.trim()),P.scheduleDirty){if(P.scheduleKind===`cron`&&P.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:P.cronExpr.trim(),...P.tz.trim()===``?{}:{tz:P.tz.trim()}};else if(P.scheduleKind===`every`){let t=Number(P.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[P.everyUnit])})}else if(P.scheduleKind===`at`&&P.at!==``){let t=Date.parse(P.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(P.scheduleDirty&&e.schedule===void 0){u.toast({variant:`error`,title:ue()});return}if(P.messageDirty&&P.hasMessage&&P.message.trim()!==``&&(e.message=P.message.trim()),Object.keys(e).length===0){L(null);return}let t=Q.current;Gt(!0);try{await a({instanceName:P.instanceName,jobId:P.jobId,patch:e}),u.success(je()),t===Q.current&&L(null),await q()}catch(e){u.toast({variant:`error`,title:y({code:dn(e)})})}finally{Gt(!1)}},hn=h?.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:fe()}),(0,H.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":se(),children:[(0,H.jsx)(C,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":oe(),title:oe(),"aria-pressed":W===`list`,onClick:()=>Zt(`list`),children:(0,H.jsx)(lt,{})}),(0,H.jsx)(C,{variant:W===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ze(),title:ze(),"aria-pressed":W===`calendar`,onClick:()=>Zt(`calendar`),children:(0,H.jsx)(qt,{})})]}),(0,H.jsxs)(C,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:ce,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,H.jsx)(St,{size:14,"aria-hidden":!0}),Te()]})]}),h!==null&&hn>0?(0,H.jsxs)(Bt,{q:B.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:Ye(),onReset:()=>U(Ut),canReset:Wt(B),children:[(0,H.jsxs)(j,{value:B.state,onValueChange:e=>U(t=>({...t,state:e})),children:[(0,H.jsx)(w,{size:`sm`,className:`w-40`,children:(0,H.jsx)(N,{})}),(0,H.jsxs)(M,{children:[(0,H.jsx)(O,{value:`all`,children:ne()}),(0,H.jsx)(O,{value:`active`,children:pe()}),(0,H.jsx)(O,{value:`paused`,children:ct()}),(0,H.jsx)(O,{value:`auto-disabled`,children:ae()})]})]}),(0,H.jsxs)(j,{value:B.result,onValueChange:e=>U(t=>({...t,result:e})),children:[(0,H.jsx)(w,{size:`sm`,className:`w-40`,children:(0,H.jsx)(N,{})}),(0,H.jsxs)(M,{children:[(0,H.jsx)(O,{value:`all`,children:f()}),(0,H.jsx)(O,{value:`ok`,children:de()}),(0,H.jsx)(O,{value:`error`,children:ye()}),(0,H.jsx)(O,{value:`running`,children:xe()}),(0,H.jsx)(O,{value:`none`,children:te()})]})]})]}):null,h===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":ce,children:_?be():He()}):W===`calendar`?(0,H.jsxs)(H.Fragment,{children:[_?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):null,h.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):(0,H.jsx)(nn,{events:sn.events,mode:Qt,cursor:G,onModeChange:$t,onCursorChange:rn,onEventClick:K,footnote:at()})]}):(0,H.jsxs)(H.Fragment,{children:[_?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):null,h.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):null,h.map(e=>{let t=e.jobs.filter(e=>Vt(e,B)),n=Wt(B)&&e.jobs.length>0&&t.length===0;return(0,H.jsxs)(`section`,{style:{marginBottom:20},children:[h.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)(D,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Xe({code:e.error})}):e.jobs.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):n?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):(0,H.jsxs)(zt,{children:[(0,H.jsx)(It,{children:(0,H.jsxs)(Rt,{children:[(0,H.jsx)(F,{children:p()}),(0,H.jsx)(F,{children:ve()}),(0,H.jsx)(F,{children:he()}),(0,H.jsx)(F,{children:m()}),(0,H.jsx)(F,{children:ge()}),(0,H.jsx)(F,{children:i()}),(0,H.jsx)(F,{children:Ue()})]})}),(0,H.jsx)(Lt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=x===r,s=e.manageSupported,c=e.kind===`openclaw`&&s;return(0,H.jsxs)(Rt,{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)(I,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??o()}),(0,H.jsx)(I,{children:(0,H.jsx)(D,{variant:`secondary`,children:t.agentId})}),(0,H.jsxs)(I,{className:`whitespace-nowrap`,children:[(0,H.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=xt(t.schedule),n=e===null?null:gt(e);return n===null?null:(0,H.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,H.jsx)(I,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,H.jsx)(I,{children:z(t)===`auto-disabled`?(0,H.jsx)(D,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:ae()}):z(t)===`active`?(0,H.jsx)(D,{variant:`secondary`,children:pe()}):z(t)===`paused`?(0,H.jsx)(D,{variant:`outline`,children:ct()}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,H.jsxs)(I,{children:[(0,H.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,H.jsx)(D,{variant:`destructive`,title:t.lastDeliveryError??ot(),children:we()}):null]}),(0,H.jsx)(I,{className:`whitespace-nowrap`,children:t.id===null?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,H.jsx)(dt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,H.jsxs)(`span`,{className:`oc-cronactions`,children:[c?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Ee(),"aria-label":Ee(),disabled:x!==null,onClick:()=>void X(r,async()=>{let n=await l({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},Me()),children:(0,H.jsx)(Et,{size:14,"aria-hidden":!0})}):null,c&&t.enabled!==null?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:R(t)===`pause`?Fe():Ie(),"aria-label":R(t)===`pause`?Fe():Ie(),disabled:x!==null,onClick:()=>void X(r,()=>a({instanceName:e.instanceName,jobId:t.id,patch:{enabled:R(t)===`resume`}}),R(t)===`pause`?rt():Ve()),children:R(t)===`pause`?(0,H.jsx)(Nt,{size:14,"aria-hidden":!0}):(0,H.jsx)(ht,{size:14,"aria-hidden":!0})}):null,c?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Je(),"aria-label":Je(),disabled:x!==null,onClick:()=>void pn(e.instanceName,t),children:(0,H.jsx)(vt,{size:14,"aria-hidden":!0})}):null,c?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Pe(),"aria-label":Pe(),disabled:x!==null,onClick:()=>void ln(e.instanceName,t),children:(0,H.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,s?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:We(),"aria-label":We(),disabled:x!==null,onClick:()=>E({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,H.jsx)(bt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]},e.instanceName)}),hn>0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:ee()}):null]}),(0,H.jsx)(jt,{open:T!==null,onOpenChange:e=>{e||E(null)},children:(0,H.jsxs)(Pt,{children:[(0,H.jsxs)(Mt,{children:[(0,H.jsx)(mt,{children:$e()}),(0,H.jsx)(pt,{children:qe({name:T?.name??``})})]}),(0,H.jsxs)(ut,{children:[(0,H.jsx)(yt,{children:Oe()}),(0,H.jsx)(Ft,{onClick:()=>{let e=T;E(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>c({instanceName:e.instanceName,jobId:e.jobId}),Ae())},children:Re()})]})]})}),(0,H.jsx)(At,{open:k!==null,onOpenChange:e=>{e||(Z.current++,A(null))},children:(0,H.jsxs)(Tt,{style:{maxWidth:640},children:[(0,H.jsx)(_t,{children:(0,H.jsx)(Dt,{children:nt({name:k?.name??``})})}),k?.entries===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):k!==null&&k.entries.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Be()}):k===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:k.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:[tt({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,H.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,H.jsx)(At,{open:P!==null,onOpenChange:e=>{e||(Q.current++,L(null))},children:(0,H.jsxs)(Tt,{className:`oc-cronedit`,children:[(0,H.jsxs)(_t,{children:[(0,H.jsx)(Dt,{children:ke()}),(0,H.jsx)(kt,{children:Qe()})]}),P===null?null:P.loading?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):(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:p()}),(0,H.jsx)(wt,{value:P.name,maxLength:200,onChange:e=>L({...P,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:Ke()}),(0,H.jsxs)(j,{value:P.scheduleKind,onValueChange:e=>L({...P,scheduleKind:e,scheduleDirty:!0}),children:[(0,H.jsx)(w,{children:(0,H.jsx)(N,{})}),(0,H.jsxs)(M,{children:[(0,H.jsx)(O,{value:`cron`,children:De()}),(0,H.jsx)(O,{value:`every`,children:Le()}),(0,H.jsx)(O,{value:`at`,children:Ze()})]})]}),P.scheduleKind===`cron`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(wt,{value:P.cronExpr,onChange:e=>L({...P,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,H.jsx)(Kt,{value:P.tz,onChange:e=>L({...P,tz:e,scheduleDirty:!0}),fallbackTz:d??void 0})]}):P.scheduleKind===`every`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(wt,{type:`number`,min:1,value:P.everyValue,onChange:e=>L({...P,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,H.jsxs)(j,{value:P.everyUnit,onValueChange:e=>L({...P,everyUnit:e,scheduleDirty:!0}),children:[(0,H.jsx)(w,{style:{maxWidth:160},children:(0,H.jsx)(N,{})}),(0,H.jsxs)(M,{children:[(0,H.jsx)(O,{value:`minutes`,children:Ge()}),(0,H.jsx)(O,{value:`hours`,children:et()}),(0,H.jsx)(O,{value:`days`,children:Ne()})]})]})]}):(0,H.jsx)(Yt,{value:P.at,onChange:e=>L({...P,at:e,scheduleDirty:!0})})]}),P.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:it()}),(0,H.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:P.message,onChange:e=>L({...P,message:e.target.value,messageDirty:!0})})]}):null]}),(0,H.jsxs)(Ct,{children:[(0,H.jsx)(C,{variant:`ghost`,onClick:()=>L(null),children:Oe()}),(0,H.jsxs)(C,{onClick:()=>void mn(),disabled:P===null||P.loading||Ht,children:[Ht?(0,H.jsx)(dt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,r()]})]})]})})]})}export{pn as ScheduledTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,AN as i,AP as ee,BN as te,CB as a,CN as o,CP as ne,DN as s,DP as c,EN as l,EP as u,FN as d,GN as re,HN as ie,IN as ae,JN as oe,KN as se,LN as ce,MN as f,MP as le,NN as p,ON as m,OP as ue,PN as h,QN as de,RN as fe,SB as g,SN as pe,SP as me,TN as he,TP as ge,UN as _e,VN as ve,WN as ye,XN as be,YN as xe,ZN as Se,_N as Ce,_P as we,aP as Te,bB as Ee,bN as _,bP as De,cP as Oe,dP as ke,eP as Ae,fN as v,fP as je,gN as y,gP as Me,hN as b,hP as Ne,iP as Pe,jN as x,jP as Fe,kN as S,kP as Ie,lP as Le,mN as C,mP as Re,nP as ze,oP as Be,pN as w,pP as Ve,qN as He,rP as Ue,sP as We,t as T,tP as Ge,uP as Ke,vN as E,vP as qe,wN as D,wP as Je,xN as O,xP as Ye,yN as k,yP as Xe,zN as Ze}from"./api-B9t7A61E.js";import{t as A}from"./button-0XSqjZXP.js";import{$ as j,Bn as Qe,Dt as $e,Et as M,Gn as et,Hn as tt,In as N,Kn as nt,Q as P,U as rt,Un as F,X as I,Z as L,_ as it,at as R,ct as z,et as B,it as V,jt as H,nt as U,ot as W,rt as at,st as G,tt as K}from"./index-CqHFDZOR.js";import{t as ot}from"./FilterBar-9-13ggzv.js";import{t as st}from"./DataTableShell-DxLu0zon.js";import{t as ct}from"./roleDescriptions-I0nZMu-C.js";var q=t(e(),1),J=n(),lt=[{value:`never`,label:()=>E(),days:null},{value:`30`,label:()=>Ce(),days:30},{value:`90`,label:()=>y(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=nt({from:`/settings/serviceAccounts`}),t=et({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??X,[o,s]=(0,q.useState)(X),l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),d=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),f=a(T.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===X?void 0:o,disabled:i===X?void 0:i===`disabled`}}),p=a(T.apiKeys.listKeys,{}),m=a(T.apiKeys.listRoles,{}),h=g(T.apiKeys.createServiceAccount),pe=g(T.apiKeys.updateServiceAccount),he=g(T.apiKeys.deleteServiceAccount),Ce=Ee(T.apiKeys.mintApiKey),_=g(T.apiKeys.revokeApiKey),v=rt(),y=$e(),b=n!==``||o!==X||i!==X;function x(){s(X),t({search:{},replace:!0})}let[S,C]=(0,q.useState)(!1),[w,E]=(0,q.useState)(Z),[D,O]=(0,q.useState)(null),[k,N]=(0,q.useState)(new Set),[F,R]=(0,q.useState)(null),z=(0,q.useRef)(!1),[V,U]=(0,q.useState)(new Set),[W,at]=(0,q.useState)({}),[G,K]=(0,q.useState)(null),Y=(0,q.useMemo)(()=>{let e=new Map;for(let t of p??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[p]);function Q(e){N(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await pe({serviceAccountId:D,name:w.name,roleKey:w.roleKey,description:w.description}),y.success(be())):await h({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),E(Z),O(null),C(!1)}catch(e){y.error(D?Se():de(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function mt(e){if(z.current)return;z.current=!0;let t=W[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;R(e._id);try{let t=await Ce({serviceAccountId:e._id,expiresAt:r});K({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(xe(),e)}finally{z.current=!1,R(null)}}async function $(e){if(await v({title:oe(),description:(0,J.jsxs)(J.Fragment,{children:[He(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,se(),` `,(0,J.jsx)(`strong`,{children:re()}),` `,ye()]}),confirmWord:e.name,confirmLabel:_e(),destructive:!0}))try{await he({serviceAccountId:e._id}),y.success(ie(),e.name)}catch(e){y.error(ve(),e)}}async function ht(e){if(await v({title:te(),description:(0,J.jsxs)(J.Fragment,{children:[Ze(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,fe()]}),confirmLabel:ce(),destructive:!0})&&!V.has(e._id)){U(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){y.error(ae(),e)}finally{U(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:le()}),(0,J.jsxs)(ot,{q:n,onQChange:l,searchPlaceholder:Fe(),onReset:x,canReset:b,children:[(0,J.jsxs)(I,{value:o,onValueChange:s,children:[(0,J.jsx)(j,{size:`sm`,className:`w-40`,children:(0,J.jsx)(B,{placeholder:ee()})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(P,{value:X,children:Ie()}),(m??[]).map(e=>(0,J.jsx)(P,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(I,{value:i,onValueChange:d,children:[(0,J.jsx)(j,{size:`sm`,className:`w-36`,children:(0,J.jsx)(B,{})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(P,{value:X,children:ue()}),(0,J.jsx)(P,{value:`active`,children:c()}),(0,J.jsx)(P,{value:`disabled`,children:u()})]})]})]}),(0,J.jsx)(st,{title:ge(),rows:f,addLabel:Je(),onAdd:()=>{E(Z),O(null),C(!0)},emptyHint:ne(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:V}),rowActions:e=>[...(e.managedBy??null)===null?[{label:Xe(),onSelect:()=>pt(e)},{label:me(),onSelect:()=>void mt(e)}]:[],{label:k.has(e._id)?Ye():De(),onSelect:()=>Q(e._id)},...(e.managedBy??null)===null?[{label:qe(),variant:`destructive`,onSelect:()=>void $(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?we():Me(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,J.jsx)(tt,{}):(0,J.jsx)(Qe,{})})},{header:Ne(),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:Re(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(M,{variant:`secondary`,children:e.roleKey})},{header:Ve(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(M,{variant:`destructive`,children:u()}):(0,J.jsx)(M,{variant:`outline`,children:c()})},{header:je(),cell:e=>(0,J.jsxs)(I,{value:W[e._id]??`never`,onValueChange:t=>at(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(j,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{})}),(0,J.jsx)(L,{children:lt.map(e=>(0,J.jsx)(P,{value:e.value,children:e.label()},e.value))})]})},{header:ke(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:F===e._id?Ke():Le({count:t})})}}]}),(0,J.jsx)(it,{open:S,onOpenChange:e=>{C(e),e||O(null)},title:D?Oe():Te(),description:D?We():Pe(),canSubmit:!!(w.name&&w.roleKey),onSubmit:ft,submitLabel:D?Be():Ue(),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:ze()}),(0,J.jsx)(H,{value:w.name,onChange:e=>E({...w,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)(I,{value:w.roleKey||void 0,onValueChange:e=>E({...w,roleKey:e}),children:[(0,J.jsx)(j,{className:`w-full`,children:(0,J.jsx)(B,{placeholder:Ae()})}),(0,J.jsx)(L,{children:(m??[]).map(e=>(0,J.jsxs)(P,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(m??[]).find(e=>e.key===w.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:r()}),(0,J.jsx)(H,{value:w.description,onChange:e=>E({...w,description:e.target.value})})]})]})}),(0,J.jsx)(dt,{minted:G,onClose:()=>K(null)})]})}function ut({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:[d(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:p()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{children:x()}),(0,J.jsx)(`th`,{children:i()}),(0,J.jsx)(`th`,{children:S()}),(0,J.jsx)(`th`,{children:m()}),(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)(M,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:z(t.createdAt)}),(0,J.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:mt(t.expiresAt)}),(0,J.jsx)(`td`,{children:$(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)?s():l()}):null})]},t._id))})]})]})}function dt({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)(K,{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)(R,{children:[(0,J.jsx)(W,{children:he()}),(0,J.jsx)(at,{children:D({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:o()}),(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)(F,{}):(0,J.jsx)(N,{}),n?O():_()]})]}),(0,J.jsx)(V,{children:(0,J.jsx)(A,{onClick:()=>{r(!1),t()},children:k()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?b():z(e)}function mt(e){return e===null?`—`:G(e)}function $(e){return e.disabled?(0,J.jsx)(M,{variant:`destructive`,children:C()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(M,{variant:`outline`,children:w()}):(0,J.jsx)(M,{variant:`outline`,children:v()})}export{Q as ServiceAccountsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,Ac as i,Bc as a,CB as o,Dc as s,Ec as c,Fc as l,Gc as u,Hc as d,Ic as f,Jc as p,Kc as m,Lc as h,Mc as g,Nc as _,Oc as v,Pc as y,Qc as b,Rc as x,SB as S,Uc as C,Vc as w,Wc as T,Xc as E,Yc as D,Zc as O,al as k,cl as A,el as j,il as M,jc as N,kc as P,ll as F,nl as I,ol as ee,qc as L,rl as R,sl as z,t as B,tl as V,ul as H,zc as U}from"./api-B9t7A61E.js";import{t as W}from"./button-0XSqjZXP.js";import{U as G,ct as K}from"./index-CqHFDZOR.js";import{t as q}from"./DataTableShell-DxLu0zon.js";var J=t(e(),1),Y=n(),X={hung:()=>L(),wrong_result:()=>m(),error:()=>u(),other:()=>T()},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=S(B.subAgentReports.respondToReport),[r,o]=(0,J.useState)(e.thread),[s,c]=(0,J.useState)(``),[u,p]=(0,J.useState)(!1);async function m(){let t=s.trim();if(!(!t||u)){p(!0);try{await n({reportId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),c(``)}finally{p(!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),` · `,C({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:d()}),(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:w()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.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`?a():U()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:x()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:h(),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 m(),disabled:!s.trim()||u,children:u?l():f()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[y({count:t.children.length}),t.childrenTruncated?` ${_()}`:``,t.textTruncated?` ${g()}`:``]}),(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?` · ${N()}`:``]}),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:i()}),(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:P()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=o(B.subAgentReports.listForAdmin,{}),t=S(B.subAgentReports.readReport),n=S(B.subAgentReports.deleteReport),i=G(),[a,l]=(0,J.useState)(null),[u,d]=(0,J.useState)({});async function f(e){if(a===e._id){l(null);return}if(!u[e._id]){let n=await t({reportId:e._id});d(t=>({...t,[e._id]:n}))}l(e._id)}async function m(e){await i({title:v(),description:s(),confirmLabel:c(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&l(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[A(),` `,(0,Y.jsx)(`strong`,{children:z()}),` `,ee()]}),(0,Y.jsx)(q,{title:H(),rows:e,emptyHint:F(),isExpanded:e=>a===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Y.jsx)($,{data:u[e._id]}):null,columns:[{header:k(),cell:e=>K(e.at),sort:e=>e.at},{header:M(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:R(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:I(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${r({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:V(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:j(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:b()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:O()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?D():E(),onSelect:()=>void f(e)},{label:p(),onSelect:()=>void m(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{$F as r,AF as i,AI as a,BF as o,BI as s,CB as c,CF as l,CI as u,Cc as d,DF as f,DI as p,EF as m,EI as h,FF as ee,FI as g,GF as _,HF as v,IF as y,II as te,JF as ne,KF as re,LF as ie,LI as ae,MF as oe,MI as se,NF as ce,NI as le,OF as ue,OI as de,PF as fe,PI as pe,QF as me,RF as he,RI as ge,SB as b,SF as _e,SI as ve,Sc as ye,TF as be,TI as xe,Tc as x,UF as Se,VF as Ce,VI as we,WF as Te,XF as Ee,YF as De,ZF as Oe,_I as ke,aI as Ae,bB as je,bF as Me,bI as Ne,cI as Pe,dB as Fe,dI as Ie,eI as Le,fB as Re,fI as ze,gI as Be,hI as Ve,iI as S,jF as He,jI as C,kF as Ue,kI as We,lI as Ge,mI as Ke,nI as qe,oI as Je,pI as Ye,qF as Xe,r as Ze,rI as Qe,sI as $e,t as w,tI as et,uB as tt,uI as nt,vI as rt,wF as it,wI as at,wc as T,xF as ot,xI as st,yF as ct,yI as lt,zF as E,zI as ut}from"./api-B9t7A61E.js";import{t as D}from"./x-YGyI1mI9.js";import{t as O}from"./button-0XSqjZXP.js";import{$ as k,Et as A,Fn as dt,Ft as ft,G as pt,It as j,K as mt,Lt as ht,Mt as gt,Nt as _t,Pn as M,Pt as N,Q as P,Un as F,X as I,Z as L,et as R,jt as z,ln as B,q as V,ut as H}from"./index-CqHFDZOR.js";import{t as vt}from"./localePickerView-C2RmOS86.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-CYCPCZHb.js";import{a as Tt,i as U,n as Et,o as W,r as G,t as Dt}from"./table-CmKoxbAD.js";import{t as Ot}from"./TimeRangePicker-Ciowmz1T.js";import{t as kt}from"./FilterBar-9-13ggzv.js";import{t as At}from"./AdvancedFilter-DvEmlwDx.js";var K=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(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 Ft(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function q(e,t,n){return Ft(e,t,n)>=jt}function It(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 Lt(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 Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(v());if(e.size>Rt)throw Error(Ce());let{source:n,width:r,height:i,cleanup:a}=await Ut(e);try{let a=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/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(E());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Pt(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(E());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);q(e.data,d.width,d.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Vt)??await Y(f,`image/png`);if(!h)throw Error(he());return{blob:h,hasAlpha:m}}finally{a()}}async function Ut(e){if(e.type===`image/svg+xml`)return J(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return J(e)}async function J(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(o())),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`?Re():e===`dark`?Fe():tt()}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)(O,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":x(),title:x(),children:(0,X.jsx)(dt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=c(w.charts.listMyCharts),r=b(w.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:le()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:se()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:C(),subtitle:a(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?We():n.via===`owner`?de():p({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:h()}):null]})}function Qt(){let e=b(w.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[a,o]=(0,K.useState)(null),[s,c]=(0,K.useState)(!1),[l,u]=(0,K.useState)(!1);async function d(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(S())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(qe());return}let a;try{a=JSON.parse(r)}catch{o(S());return}u(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{u(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ie()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:nt()}),(0,X.jsx)(z,{value:t,onChange:e=>n(e.target.value),placeholder:Ge(),maxLength:60})]}),(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:r,onChange:e=>i(e.target.value),placeholder:$e(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(B,{className:`size-4`}),Je(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,X.jsx)(O,{size:`sm`,disabled:l,onClick:()=>void f(),children:Ae()})]}),a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:Qe()}):null]})]})}function $t({chart:e}){let t=je(w.charts.setChartLogo),n=b(w.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ht(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?De():ne()}),(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)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(B,{className:`size-4`}),t?re():Xe(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,X.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:Te()}):null,t?(0,X.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:_()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ee()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(f,{mode:`light`}),(0,X.jsx)(f,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Se()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=c(w.me.getMe,{host:V}),n=b(w.charts.addChartDomain),r=b(w.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[l,u]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=i.trim();if(t!==``){s(null),u(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ie()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ce()}):d.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":oe({domain:e}),onClick:()=>void p(e),children:(0,X.jsx)(D,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(z,{value:i,onChange:e=>a(e.target.value),placeholder:ee(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,X.jsx)(O,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:fe()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:y()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=b(w.charts.updateChart),n=b(w.charts.deleteChart),[r,a]=(0,K.useState)(!1),[o,s]=(0,K.useState)(e.name),[c,l]=(0,K.useState)(()=>$(e.tokens)),[u,p]=(0,K.useState)(e.tokens.bpm??0),[m,h]=(0,K.useState)(null),[ee,g]=(0,K.useState)(!1);function _(){s(e.name),l($(e.tokens)),p(e.tokens.bpm??0),h(null),a(!0)}async function v(){if(e.chartId===void 0)return;h(null);let n;try{n=JSON.parse(c)}catch{h(S());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}),a(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function y(){if(e.chartId!==void 0&&window.confirm(f()))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)(O,{variant:`outline`,size:`sm`,onClick:_,children:me()}),(0,X.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void y(),children:Oe()})]})})]}),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:Ue()}),(0,X.jsx)(z,{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:T()}),(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=>p(Number(e.target.value)),"aria-label":T()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?d():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ye()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ue()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),m?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:m}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{size:`sm`,disabled:ee,onClick:()=>void v(),children:He()}),(0,X.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:i()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=c(w.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:Le()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:r()}):(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=b(w.charts.addChartToGroupPool),r=b(w.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(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?rt():e.kind===`custom`&&e.scope===`personal`?l():lt()}),e.isGlobalDefault?(0,X.jsx)(A,{variant:`default`,children:ke()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ve()}),(a??[]).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":Ye({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(D,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(I,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(k,{size:`sm`,className:`w-56`,children:(0,X.jsx)(R,{placeholder:Ke()})}),(0,X.jsx)(L,{children:s.map(e=>(0,X.jsx)(P,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Be()}):null]})]})}function an({chart:e}){let t=b(w.charts.promoteChartToCommon),n=b(w.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(f()))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`?_e():l()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:it({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(O,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:ot()}):null,(0,X.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Me()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=b(w.admin.setDefaultThemeMode),i=b(w.admin.setDefaultLocale),a=b(w.charts.setDefaultChart),o=c(w.charts.listChartsAdmin),l=c(w.groups.listGroups,{}),d=e??`system`,f=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:g()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(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:xe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:at()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:C()}),mt.map(e=>(0,X.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:u()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(rn,{chart:e,groups:l??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:st()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(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:m()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:be()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ct()}):(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:we()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(O,{variant:d===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:ut()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ge()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:vt().map(e=>(0,X.jsx)(O,{variant:f===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ae()})]})]})}function sn(){let e=c(w.me.getMe,{host:V}),t=pt(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,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.useState)(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:te()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{children:`Default`}),(0,X.jsx)(O,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(O,{variant:`outline`,children:`Outline`}),(0,X.jsx)(O,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(O,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(O,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{size:`sm`,children:`Small`}),(0,X.jsx)(O,{children:`Default`}),(0,X.jsx)(O,{size:`lg`,children:`Large`}),(0,X.jsx)(O,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(M,{})}),(0,X.jsx)(O,{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)(z,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(I,{value:n,onValueChange:r,children:[(0,X.jsx)(k,{className:`w-56`,children:(0,X.jsx)(R,{placeholder:`Select…`})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(P,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(P,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(H,{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)(kt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(I,{value:o,onValueChange:s,children:[(0,X.jsx)(k,{size:`sm`,children:(0,X.jsx)(R,{})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes directions`}),(0,X.jsx)(P,{value:`inbound`,children:`inbound`}),(0,X.jsx)(P,{value:`outbound`,children:`outbound`}),(0,X.jsx)(P,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(I,{value:c,onValueChange:l,children:[(0,X.jsx)(k,{size:`sm`,children:(0,X.jsx)(R,{})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(P,{value:`info`,children:`info`}),(0,X.jsx)(P,{value:`warn`,children:`warn`}),(0,X.jsx)(P,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(At,{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)(Ot,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(gt,{children:[(0,X.jsx)(ht,{asChild:!0,children:(0,X.jsx)(O,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(M,{})})}),(0,X.jsxs)(_t,{align:`start`,children:[(0,X.jsx)(ft,{children:`Actions`}),(0,X.jsx)(j,{}),(0,X.jsx)(N,{children:`Edit`}),(0,X.jsx)(N,{children:`Duplicate`}),(0,X.jsx)(j,{}),(0,X.jsx)(N,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(wt,{className:`w-80`,children:[(0,X.jsxs)(yt,{children:[(0,X.jsx)(St,{children:`Instance`}),(0,X.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(bt,{className:`gap-2`,children:[(0,X.jsx)(O,{size:`sm`,children:`Save`}),(0,X.jsx)(O,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Dt,{children:[(0,X.jsx)(Tt,{children:(0,X.jsxs)(W,{children:[(0,X.jsx)(U,{className:`w-8`,children:(0,X.jsx)(H,{"aria-label":`select all`})}),(0,X.jsx)(U,{children:`Name`}),(0,X.jsx)(U,{children:`Mode`}),(0,X.jsx)(U,{className:`text-right`,children:`Status`}),(0,X.jsx)(U,{className:`w-8`})]})}),(0,X.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(W,{children:[(0,X.jsx)(G,{children:(0,X.jsx)(H,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(G,{className:`font-medium`,children:e.n}),(0,X.jsx)(G,{children:(0,X.jsx)(A,{variant:`secondary`,children:e.m})}),(0,X.jsx)(G,{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)(G,{children:(0,X.jsx)(O,{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{$y as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,ab as i,ao as a,cb as o,co as s,db as c,eb as l,ib as u,io as d,lb as f,lo as p,nb as m,ob as h,oo as g,rb as _,ro as v,sb as y,so as b,tb as x,ub as S}from"./api-B9t7A61E.js";import{t as C}from"./button-0XSqjZXP.js";import{Ht as w,Ln as T,Ut as E,Vt as D,Wt as O,ct as k,jt as A,mn as j}from"./index-CqHFDZOR.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:c(),from:`now-5m`},{label:S(),from:`now-15m`},{label:f(),from:`now-30m`},{label:o(),from:`now-1h`},{label:y(),from:`now-3h`},{label:h(),from:`now-6h`},{label:i(),from:`now-12h`},{label:u(),from:`now-24h`},{label:_(),from:`now-2d`},{label:m(),from:`now-7d`},{label:x(),from:`now-30d`},{label:l(),from:`now-90d`},{label:r(),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),[i,o]=(0,M.useState)(``),c=F(e),[l,u]=(0,M.useState)(()=>z(c.from)),[f,m]=(0,M.useState)(()=>z(c.to));function h(t){if(t){let t=F(e);u(z(t.from)),m(z(t.to)),o(``)}r(t)}function _(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function y(){let e=B(l),n=B(f);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let x=(0,M.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),S=B(l)!==null&&B(f)!==null;return(0,H.jsxs)(E,{open:n,onOpenChange:h,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(T,{}),R(e)]})}),(0,H.jsx)(w,{children:(0,H.jsx)(D,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:p()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,H.jsx)(A,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:b()}),(0,H.jsx)(A,{type:`datetime-local`,value:f,onChange:e=>m(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!S,onClick:y,children:g()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(j,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(A,{value:i,onChange:e=>o(e.target.value),placeholder:a(),"aria-label":d()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:x.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:v()}):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:()=>_(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{BL as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BL as r,HL as i,UL as a,VL as o}from"./api-B9t7A61E.js";import{t as s}from"./chevrons-up-down-B8AMH6vo.js";import{Bt as c,Rt as l,Un as u,jt as d,zt as f}from"./index-CqHFDZOR.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)(d,{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)(c,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":a(),children:[(0,D.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,D.jsx)(s,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,D.jsxs)(f,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,D.jsx)(d,{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: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{$S as r,$k as i,AA as a,BS as o,CA as s,CB as c,D as l,DA as u,EA as d,FA as f,FS as p,GS as m,HS as h,IA as g,IS as _,JS as ee,Jk as v,KS as y,LS as b,MA as x,NA as S,OA as C,PA as w,QS as te,Qk as T,RS as ne,SA as re,SB as E,TA as ie,US as ae,VS as oe,WS as se,XS as ce,Xk as le,YS as ue,Yk as de,ZS as fe,Zk as pe,_A as me,_C as he,aA as D,aC as O,aa as k,bA as A,cC as ge,dC as _e,eA as ve,eC as ye,fA as be,fC as xe,gA as Se,gC as Ce,hA as j,hC as we,iA as M,iC as Te,ia as N,jA as Ee,kA as De,lC as Oe,mA as ke,mC as Ae,nA as je,nC as Me,oA as Ne,oC as Pe,oa as Fe,pA as P,pC as Ie,qS as Le,qk as Re,rA as ze,rC as Be,sA as Ve,sC as He,t as F,tA as Ue,tC as We,uC as Ge,vA as Ke,vC as qe,wA as I,xA as Je,yA as Ye,zS as Xe}from"./api-B9t7A61E.js";import{t as Ze}from"./x-YGyI1mI9.js";import{i as L,n as R,r as Qe,t as $e}from"./tabs-BC9QRLg2.js";import{t as z}from"./button-0XSqjZXP.js";import{$ as B,Et as V,Gn as et,H as tt,In as nt,Kn as rt,Mn as it,Nn as at,On as ot,Q as H,Un as st,X as U,Z as W,a as ct,at as lt,ct as G,et as K,i as ut,lt as dt,nt as ft,o as pt,ot as mt,q as ht,rt as gt,s as _t,tt as vt}from"./index-CqHFDZOR.js";import{n as yt}from"./TimeRangePicker-Ciowmz1T.js";import{t as bt}from"./FilterBar-9-13ggzv.js";import{t as xt}from"./AdvancedFilter-DvEmlwDx.js";import{t as St}from"./DataTableShell-DxLu0zon.js";var Ct=l(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function 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`?me():n===`agent`?`${Se()} - ${r}`:e}function Tt(){let e=c(F.me.getMe,{host:ht})?.role===`admin`,t=c(F.deliveryTiming.getDeliveryStatus,{}),n=E(F.deliveryTiming.startDeliveryRecord),r=E(F.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),l=t?.recording??!1,u=async()=>{s(!0);try{l?await r({}):await n({})}finally{s(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:g()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:f()})]}),e?(0,J.jsx)(z,{variant:l?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void u(),children:l?S():w()}):null]}),l?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(V,{variant:`secondary`,children:x()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:Ee({time:dt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?C():De()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=c(F.deliveryTiming.listDeliverySessions,{}),n=E(F.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(`all`),[l,f]=(0,q.useState)(Y),[p,m]=(0,q.useState)(null),{from:h,to:g}=yt(l),_=l.to===`now`?1/0:g,ee=r.trim()!==``||a!==`all`||l!==Y,y=()=>{i(``),o(`all`),f(Y)},b=(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>=h&&t.startedAt<=_).map(e=>({...e,_id:e.sessionId}))},[t,r,a,h,_]),x=e=>{let t=new Set((b??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),p!==null&&r.includes(p)&&m(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:i,searchPlaceholder:d(),timeRange:l,onTimeRangeChange:f,onReset:y,canReset:ee,children:(0,J.jsxs)(U,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:`all`,children:ie()}),(0,J.jsx)(H,{value:`active`,children:I()}),(0,J.jsx)(H,{value:`stopped`,children:s()})]})]})}),(0,J.jsx)(St,{title:u(),rows:b,emptyHint:v(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":p===e.sessionId?ke():j(),onClick:()=>m(t=>t===e.sessionId?null:e.sessionId),children:p===e.sessionId?(0,J.jsx)(at,{size:15,"aria-hidden":!0}):(0,J.jsx)(it,{size:15,"aria-hidden":!0})})},{header:re(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:Je(),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:G(e.stoppedAt)})},{header:A(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:Ye(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:Ke(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(V,{variant:`secondary`,children:I()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:s()})}],rowActions:e?e=>[{label:P(),variant:`destructive`,onSelect:()=>x([e.sessionId])}]:void 0,bulkActions:e?[{label:P(),variant:`destructive`,onSelect:e=>x(e)}]:void 0,isExpanded:e=>e.sessionId===p,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=c(F.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(tt(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:be()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:a()});let r=e.segments,o=(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,` `,Re()]}),(0,J.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(st,{size:13,"aria-hidden":!0}):(0,J.jsx)(nt,{size:13,"aria-hidden":!0}),t?de():le()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:D()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:M()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:ze()})]})}),(0,J.jsxs)(`tbody`,{children:[o(je(),r.bridge),o(Ue(),r.A),o(ve(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:T()})]})}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:Fe()},{value:`principalType`,label:k()},{value:`direction`,label:`direction`},{value:`roleKey`,label:N()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=rt({from:`/settings/traces`}),t=et({from:`/settings/traces`}),n=e.limit,i=e.kind,a=e.statusClass??Q,s=e.principalType??Q,l=e.direction??Q,u=e.roleKey??Q,d=e.q??``,f=e.correlationId,p=ut(e.from,e.to),g=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:_,to:v}=yt(p),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),w=e=>void t({search:t=>({...t,limit:e})}),T=e=>void t({search:t=>({...t,kind:e})}),re=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})}),ie=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),le=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),de=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),pe=e=>void t({search:t=>({...t,...pt(e)})}),me=e=>void t({search:t=>({...t,adv:ct(e)}),replace:!0}),D=c(F.observability.listEvents,{limit:n}),k=c(F.observability.listEvents,{limit:n,kind:i===Z?void 0:i,...f?{correlationId:f}:{},filter:{q:d||void 0,from:_,to:v,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:l===Q?void 0:l,roleKey:u===Q?void 0:u,advanced:g.length>0?g:void 0}}),A=(0,q.useMemo)(()=>{let e=new Set;for(let t of D??[])e.add(t.kind);return[...e].sort()},[D]),ve=(0,q.useMemo)(()=>{let e=new Set;for(let t of D??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[D]),be=d!==``||a!==Q||s!==Q||l!==Q||u!==Q||g.length>0||p.kind!==`relative`||p.from!==Nt.from;function Se(){t({search:{limit:100,kind:`all`},replace:!0})}let j=b?D?.filter(e=>e.correlationId===b):k,M=e.section,N=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)($e,{value:M,onValueChange:e=>N(e),children:[(0,J.jsxs)(Qe,{className:`w-full`,children:[(0,J.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(ot,{size:13,"aria-hidden":!0}),Ve()]}),(0,J.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),Ne()]})]}),(0,J.jsx)(R,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(R,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[qe(),(0,J.jsx)(`strong`,{children:he()}),Ce(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:we()})]}),(0,J.jsxs)(bt,{q:d,onQChange:re,searchPlaceholder:Ae(),timeRange:p,onTimeRangeChange:pe,onReset:Se,canReset:be,children:[(0,J.jsxs)(U,{value:a,onValueChange:E,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:Ie()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:xe()}),At.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:s,onValueChange:ie,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:_e()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Ge()}),jt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:l,onValueChange:le,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:Oe()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:ge()}),Mt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:u,onValueChange:de,children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{placeholder:He()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Pe()}),ve.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:i===Z?``:i,placeholder:O(),"aria-label":O(),onChange:e=>{let t=e.target.value.trim();T(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:A.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(U,{value:String(n),onValueChange:e=>w(Number(e)),children:[(0,J.jsx)(B,{size:`sm`,className:`w-28`,children:(0,J.jsx)(K,{})}),(0,J.jsx)(W,{children:kt.map(e=>(0,J.jsx)(H,{value:String(e),children:Te({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:g,onChange:me}),b?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>x(null),title:Be(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[Me(),(0,J.jsx)(`code`,{children:$(b)})]}),(0,J.jsx)(Ze,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:We()})]})}):null,(0,J.jsx)(St,{title:ye(),rows:j,emptyHint:b?r():te(),columns:[{header:fe(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:ce(),sort:e=>e.kind,cell:e=>(0,J.jsx)(V,{variant:`secondary`,children:e.kind})},{header:ue(),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":ee(),children:`✓`})}},{header:Le(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(V,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:y(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(V,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:m(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(V,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:se(),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:ae(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${It(e.status)}`,children:e.status})},{header:h(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:oe(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:o(),onClick:()=>x(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Xe(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>C(e),children:ne()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:S,onClose:()=>C(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)(vt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(ft,{className:`max-w-lg`,children:[(0,J.jsxs)(lt,{children:[(0,J.jsxs)(mt,{className:`oc-traces__meta-title`,children:[b(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(V,{variant:`outline`,children:_()})]}),(0,J.jsx)(gt,{children:p()})]}),(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{$D as r,$x as i,BD as a,CB as o,Fp as s,GD as c,HD as l,ID as u,JD as d,Jx as f,KD as p,LD as ee,Np as m,Pp as h,QD as te,Qx as g,RD as ne,SB as _,UD as v,VD as y,WD as re,XD as ie,Xx as b,YD as ae,Yx as x,ZD as oe,Zx as S,_D as se,aO as ce,aS as C,cO as w,eO as T,eS as E,iO as le,iS as D,lO as O,nO as ue,nS as k,oO as de,qD as fe,qx as A,rO as pe,rS as j,sO as me,t as M,tO as he,tS as N,uO as P,zD as ge}from"./api-B9t7A61E.js";import{t as F}from"./button-0XSqjZXP.js";import{$ as I,Dt as L,Et as R,Ft as z,Gn as _e,Kn as ve,Lt as ye,Mt as be,Nt as xe,Pt as Se,Q as B,U as Ce,W as we,X as V,Z as H,at as Te,c as U,et as W,fn as G,l as Ee,nt as De,ot as Oe,pn as K,q as ke,rt as Ae,tt as je,u as q,ut as J}from"./index-CqHFDZOR.js";import{t as Y}from"./FilterBar-9-13ggzv.js";import{t as Me}from"./DataTableShell-DxLu0zon.js";import{t as Ne}from"./DetailChips-DtjFz3Cl.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=o(M.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=o(M.agents.listUserAgents,n&&e?{profileId:e}:`skip`),s=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),c=(a??[]).find(e=>e.isDefault)??null,l=c?`${c.instanceName}/${c.agentId}`:null,u=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),d=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).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)(je,{open:n,onOpenChange:r,children:(0,Z.jsxs)(De,{className:`oc-access`,children:[(0,Z.jsxs)(Te,{children:[(0,Z.jsx)(Oe,{children:C({user:t})}),(0,Z.jsx)(Ae,{children:D()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?j():k()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:N()}):d.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:g()}):[...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:a,defaultKey:o}){let s=_(M.agents.assignAgent),c=_(M.agents.removeAgent),l=_(M.agents.setDefaultAgent),u=L();if(!e)return null;async function d(n,r){try{r?await c({profileId:e,instanceName:t,agentId:n}):await s({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(E(),e)}}async function p(n){try{await l({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(i(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(K,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=a.has(n),i=o===n,s=e.state===`deleted`,c=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${c?` is-disabled`:``}`,children:[(0,Z.jsx)(J,{checked:r,disabled:(s||c)&&!r,onCheckedChange:()=>void d(e.agentId,r),"aria-label":S({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)(R,{variant:`outline`,className:`oc-access__gone`,children:b()}):null,e.outOfPool?(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:x()}):null,r?i?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":f(),title:f(),children:(0,Z.jsx)(G,{size:14,fill:`currentColor`})}):(0,Z.jsx)(F,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":A(),title:A(),disabled:c,onClick:()=>void p(e.agentId),children:(0,Z.jsx)(G,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return m();case`user`:return h();case`admin`:return s();default:return e}}function Ie({granted:e,onToggle:t}){let n=new Set(e),r=U.filter(e=>n.has(q[e])).length;return(0,Z.jsxs)(be,{children:[(0,Z.jsx)(ye,{asChild:!0,children:(0,Z.jsx)(F,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?P():O({count:r})})}),(0,Z.jsxs)(xe,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(z,{children:w()}),U.map(e=>{let r=q[e];return(0,Z.jsxs)(Se,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(J,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:Ee[e]()})]},e)})]})]})}function Le(){let e=ve({from:`/settings/users`}),t=_e({from:`/settings/users`}),n=e.q??``,i=e.role??Q,s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),f=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),m=o(M.admin.listUsers,{filter:{q:n||void 0,role:i===Q?void 0:i},withAgents:!0}),h=o(M.me.getMe,{host:ke}),g=_(M.admin.setRole),b=_(M.admin.setUserPermissions),x=_(M.admin.startImpersonation),S=_(M.admin.deleteUser),C=_(M.admin.setUserName),w=Ce(),E=we(),D=L(),[O,k]=(0,X.useState)(null),A=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of m??[])e.add(t.role);return[...e]},[m]),j=n!==``||i!==Q;function N(){t({search:{},replace:!0})}async function P(e){try{await g(e)}catch(e){D.error(me(),e)}}async function F(e){try{await b(e)}catch(e){D.error(de(),e)}}async function R(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await w({title:r(),description:te({user:t}),confirmWord:oe(),confirmLabel:ie(),destructive:!0}))try{await S({profileId:e._id}),D.success(d({user:t}))}catch(e){D.error(ae(),e)}}async function z(e){let t=e.email||e.name||e.userId.slice(0,8),n=await E({title:p(),label:c({user:t}),placeholder:re(),defaultValue:e.name??``,confirmLabel:se()});if(n!==null)try{await C({profileId:e._id,name:n}),D.success(v())}catch(e){D.error(l(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{q:n,onQChange:s,searchPlaceholder:ce(),onReset:N,canReset:j,children:(0,Z.jsxs)(V,{value:i,onValueChange:f,children:[(0,Z.jsx)(I,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:Q,children:le()}),A.map(e=>(0,Z.jsx)(B,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:pe(),rows:m,emptyHint:ue(),rowActions:e=>{let t=[{label:u(),onSelect:()=>k({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:fe(),onSelect:()=>void z(e)}];return e.userId!==h?.userId&&t.push({label:he(),onSelect:()=>void x({profileId:e._id})},{label:T(),variant:`destructive`,onSelect:()=>void R(e)}),t},columns:[{header:y(),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:a(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(V,{value:e.role,onValueChange:t=>void P({profileId:e._id,role:t}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(B,{value:`user`,children:$(`user`)}),(0,Z.jsx)(B,{value:`admin`,children:$(`admin`)})]})]})},{header:ge(),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:ne()}):(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:ee(),cell:e=>(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(K,{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:O?.profileId??null,userLabel:O?.label??``,open:O!==null,onOpenChange:e=>{e||k(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{$n as r,CB as i,Ci as a,In as o,Jn as s,SB as c,Sd as ee,Si as l,Ti as u,Xn as te,Yn as d,Zn as f,_i as p,ai as m,ar as h,bB as ne,bi as g,ci as _,cr as v,di as re,er as y,fi as b,gB as x,gi as S,gr as C,hi as w,ii as T,li as E,lr as ie,mB as D,mi as ae,mk as O,ni as k,nr as A,oi as j,or as oe,pi as se,qf as M,ri as ce,si as N,sr as le,t as P,ti as ue,tr as de,ui as fe,vi as pe,wd as F,wi as I,xi as L,yi as R}from"./api-B9t7A61E.js";import{i as z,n as B,r as me,t as he}from"./tabs-BC9QRLg2.js";import{t as V}from"./button-0XSqjZXP.js";import{$ as H,$t as ge,Cn as _e,Et as U,Gn as ve,Kn as ye,Q as W,Wn as be,X as G,Z as K,an as xe,en as Se,et as q,in as J,nn as Ce,q as we,rn as Y,sn as Te,tn as Ee,ut as X}from"./index-CqHFDZOR.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>pe()],[`fr-FR`,()=>ie()],[`en-US`,()=>v()],[`en-GB`,()=>le()],[`de-DE`,()=>oe()],[`es-ES`,()=>h()]],Oe=[[`0.75`,()=>S()],[`1`,()=>w()],[`1.25`,()=>ae()],[`1.5`,()=>se()]],$=0;function ke({instance:e}){let t=c(P.admin.upsertInstanceConfig),n=e.config??{},r={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[i,a]=(0,Z.useState)(r),[l,u]=(0,Z.useState)(`idle`),[m,h]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(!1),S=ne(P.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{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}),u(`idle`)},[e._id]);let C=i.enabled!==r.enabled||i.engine!==r.engine||i.lang!==r.lang||i.rate!==r.rate||i.autoRead!==r.autoRead;async function w(){u(`saving`);try{let n={...e.config??{}};n.voiceEnabled=i.enabled,i.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,i.lang===`auto`?delete n.voiceLang:n.voiceLang=i.lang;let r=Number.parseFloat(i.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,i.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),u(`idle`)}catch{u(`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)(U,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:i.enabled,onCheckedChange:e=>a({...i,enabled:e===!0}),"aria-label":g()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),(0,Q.jsxs)(G,{value:i.engine,onValueChange:e=>a({...i,engine:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":f(),children:(0,Q.jsx)(q,{})}),(0,Q.jsxs)(K,{children:[(0,Q.jsx)(W,{value:`browser`,children:te()}),e.kind===`hermes`?null:(0,Q.jsx)(W,{value:`gateway`,children:d()})]})]})]}),i.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:s()}):null,i.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)(G,{value:i.lang,onValueChange:e=>a({...i,lang:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":R(),children:(0,Q.jsx)(q,{})}),(0,Q.jsx)(K,{children:De.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()}),(0,Q.jsxs)(G,{value:i.rate,onValueChange:e=>a({...i,rate:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":p(),children:(0,Q.jsx)(q,{})}),(0,Q.jsx)(K,{children:Oe.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),i.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:i.autoRead,onCheckedChange:e=>a({...i,autoRead:e===!0}),disabled:!i.enabled,"aria-label":b()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:re()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(V,{size:`sm`,disabled:!C||l===`saving`,onClick:()=>void w(),children:l===`saving`?M():F()}),(0,Q.jsx)(V,{variant:`outline`,size:`sm`,disabled:!i.enabled||m,onClick:()=>{let t=Number.parseFloat(i.rate)||1,n=++$;if(y(!1),J(),Y(),i.engine!==`gateway`){Ce(_(),{lang:Ee(i.lang,x()),rate:t});return}h(!0),S({instanceName:e.name,text:_()}).then(({mime:e,audioBase64:r})=>{n===$&&Se(r,e,{rate:t})}).catch(()=>{n===$&&y(!0)}).finally(()=>h(!1))},children:m?M():fe()}),(0,Q.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>{$++,h(!1),J(),Y()},children:E()})]}),l===`error`||v?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v?o():ee()}):null]})}function Ae({stt:e}){let t=i(P.me.getMe,{host:we}),n=c(P.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,a=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:j()}),(0,Q.jsx)(U,{variant:e?`secondary`:`outline`,children:e?k():ue()}),(0,Q.jsx)(U,{variant:r?`secondary`:`destructive`,children:r?de():y()})]}),a?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":A()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:m()})]})}function je(){let e=i(P.admin.listInstances,{}),t=(0,Z.useMemo)(()=>xe(),[]),n=(0,Z.useMemo)(()=>ge(),[]),{section:o}=ye({from:`/settings/voice`}),s=ve({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(U,{variant:t?`secondary`:`destructive`,children:t?I():a()}),(0,Q.jsx)(U,{variant:n?`secondary`:`destructive`,children:n?l():L()})]}),(0,Q.jsxs)(he,{value:o,onValueChange:e=>void s({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(me,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Te,{size:13,"aria-hidden":!0}),r()]}),(0,Q.jsxs)(z,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(_e,{size:13,"aria-hidden":!0}),j()]}),(0,Q.jsxs)(z,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(be,{size:13,"aria-hidden":!0}),T()]})]}),(0,Q.jsx)(B,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(B,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsxs)(B,{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:T()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ce()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=c(P.admin.upsertInstanceConfig),n=e.config??{},r=n.talkEnabled===!0,i=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)(U,{variant:`secondary`,children:i?`Hermes`:`OpenClaw`})]}),i?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:C()}):(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:r,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":O()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()})]})]})}export{je as VoiceTab};
|