@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
|
@@ -1 +0,0 @@
|
|
|
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,CL as s,D as c,DL as l,EL as u,FL as ee,FR as d,GL as f,GR as p,HL as m,HR as h,IL as g,IR as _,JL as te,JR as ne,KL as re,KR as ie,LL as ae,LR as oe,ML as se,NL as ce,OL as le,PL as ue,QI as de,RR as fe,SL as pe,TL as v,UI as me,UL as he,UR as ge,VR as _e,WL as ve,WR as ye,XI as be,XL as xe,XR as Se,YI as Ce,YL as we,YR as Te,ZI as Ee,ZL as De,_R as Oe,aL as ke,aR as Ae,cL as je,cR as Me,dL as Ne,eL as Pe,fB as Fe,fL as Ie,fR as Le,gR as Re,hR as ze,iL as Be,iR as Ve,jL as He,kL as Ue,lL as We,lR as Ge,mB as y,mR as Ke,nL as qe,nR as Je,oL as Ye,oR as Xe,pR as Ze,qL as Qe,qR as $e,rL as et,rR as tt,sL as nt,sR as rt,t as b,tL as it,uL as at,uR as x,vB as S,wL as ot,xB as st,zR as ct}from"./api-DS0UCfP0.js";import{t as lt}from"./list-BEBtqnHm.js";import{t as C}from"./button-wZk4ylVE.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-SBKa9qhz.js";import{a as It,i as F,n as Lt,o as Rt,r as I,t as zt}from"./table-DlldEKg7.js";import{t as Bt}from"./FilterBar-Dp85xc2n.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-B_GmUBef.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(y()),[]),l=(0,V.useMemo)(()=>new Intl.DateTimeFormat(y(),{month:`long`,year:`numeric`}),[]),u=(0,V.useMemo)(()=>new Intl.DateTimeFormat(y(),{dateStyle:`medium`,timeStyle:`short`}),[]),d=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)),h=(e,t,n)=>{a({year:e,month:t}),m(e,t,n,f,p)},_=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},te=n===null?g():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":ae(),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:te})]})}),(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":ee(),onClick:()=>_(-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":ue(),onClick:()=>_(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)),d.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:()=>h(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":ce(),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":se(),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:a,footnote:o}){let s=y(),c=(0,V.useMemo)(()=>Zt(e),[e]),ee=(0,V.useMemo)(()=>$t(s),[s]),d=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),f=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),p=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),m=new Date,h=e=>{if(t===`year`){i({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);i({year:r.getFullYear(),month:r.getMonth()})},g=t===`year`?String(n.year):d.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":v(),onClick:()=>h(-1),children:(0,H.jsx)(A,{})}),(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":ot(),onClick:()=>h(1),children:(0,H.jsx)(T,{})}),(0,H.jsx)(C,{variant:`ghost`,size:`sm`,onClick:()=>i({year:m.getFullYear(),month:m.getMonth()}),children:u()})]}),(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:le()}),(0,H.jsx)(C,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:l()})]})]}),t===`month`?(0,H.jsx)(rn,{cursor:n,byDay:c,weekdays:ee,timeFmt:p,now:m,onEventClick:a}):(0,H.jsx)(an,{year:n.year,byDay:c,monthShortFmt:f,now:m,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,H.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function rn({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=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))??[],c=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`)+(c?` 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:s({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:xe()});case`error`:return(0,H.jsx)(D,{variant:`destructive`,children:te()});case`running`:return(0,H.jsx)(D,{variant:`outline`,children:Qe()});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=S(b.scheduled.listMyCrons),t=S(b.scheduled.getCronDetail),n=S(b.scheduled.listCronRuns),s=S(b.scheduled.updateCron),c=S(b.scheduled.removeCron),l=S(b.scheduled.runCronNow),u=ft(),ee=st(b.me.getMe,{host:Ot})?.timezone,[g,ae]=(0,V.useState)(null),[se,ce]=(0,V.useState)(!1),[le,ue]=(0,V.useState)(!1),[v,ot]=(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 g??[]){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},[g,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()=>{ce(!0),ue(!1);try{ae(await e({}))}catch{ue(!0)}finally{ce(!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)(()=>{g!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[g]);let Y=(0,V.useMemo)(()=>new Intl.DateTimeFormat(y(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{ot(e);try{await t(),u.success(n),await q()}catch(e){u.toast({variant:`error`,title:x({code:dn(e)})})}finally{ot(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:x({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:x({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:be()});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 s({instanceName:P.instanceName,jobId:P.jobId,patch:e}),u.success(We()),t===Q.current&&L(null),await q()}catch(e){u.toast({variant:`error`,title:x({code:dn(e)})})}finally{Gt(!1)}},hn=g?.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:Se()}),(0,H.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":He(),children:[(0,H.jsx)(C,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":a(),title:a(),"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":Ue(),title:Ue(),"aria-pressed":W===`calendar`,onClick:()=>Zt(`calendar`),children:(0,H.jsx)(qt,{})})]}),(0,H.jsxs)(C,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:se,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,H.jsx)(St,{size:14,"aria-hidden":!0}),Te()]})]}),g!==null&&hn>0?(0,H.jsxs)(Bt,{q:B.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:f(),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:ve()}),(0,H.jsx)(O,{value:`active`,children:_()}),(0,H.jsx)(O,{value:`paused`,children:oe()}),(0,H.jsx)(O,{value:`auto-disabled`,children:d()})]})]}),(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:he()}),(0,H.jsx)(O,{value:`ok`,children:xe()}),(0,H.jsx)(O,{value:`error`,children:te()}),(0,H.jsx)(O,{value:`running`,children:Qe()}),(0,H.jsx)(O,{value:`none`,children:re()})]})]})]}):null,g===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":se,children:le?ne():Fe()}):W===`calendar`?(0,H.jsxs)(H.Fragment,{children:[le?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):null,g.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}):(0,H.jsx)(nn,{events:sn.events,mode:Qt,cursor:G,onModeChange:$t,onCursorChange:rn,onEventClick:K,footnote:pe()})]}):(0,H.jsxs)(H.Fragment,{children:[le?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):null,g.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}):null,g.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:[g.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:p({code:e.error})}):e.jobs.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):n?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,H.jsxs)(zt,{children:[(0,H.jsx)(It,{children:(0,H.jsxs)(Rt,{children:[(0,H.jsx)(F,{children:ge()}),(0,H.jsx)(F,{children:h()}),(0,H.jsx)(F,{children:_e()}),(0,H.jsx)(F,{children:o()}),(0,H.jsx)(F,{children:ct()}),(0,H.jsx)(F,{children:De()}),(0,H.jsx)(F,{children:Ie()})]})}),(0,H.jsx)(Lt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=v===r,a=e.manageSupported,o=e.kind===`openclaw`&&a;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??fe()}),(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:d()}):z(t)===`active`?(0,H.jsx)(D,{variant:`secondary`,children:_()}):z(t)===`paused`?(0,H.jsx)(D,{variant:`outline`,children:oe()}):(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??Oe(),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:[o?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:ze(),"aria-label":ze(),disabled:v!==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`}}},Ge()),children:(0,H.jsx)(Et,{size:14,"aria-hidden":!0})}):null,o&&t.enabled!==null?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:R(t)===`pause`?Ke():Ze(),"aria-label":R(t)===`pause`?Ke():Ze(),disabled:v!==null,onClick:()=>void X(r,()=>s({instanceName:e.instanceName,jobId:t.id,patch:{enabled:R(t)===`resume`}}),R(t)===`pause`?Me():rt()),children:R(t)===`pause`?(0,H.jsx)(Nt,{size:14,"aria-hidden":!0}):(0,H.jsx)(ht,{size:14,"aria-hidden":!0})}):null,o?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Ne(),"aria-label":Ne(),disabled:v!==null,onClick:()=>void pn(e.instanceName,t),children:(0,H.jsx)(vt,{size:14,"aria-hidden":!0})}):null,o?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:at(),"aria-label":at(),disabled:v!==null,onClick:()=>void ln(e.instanceName,t),children:(0,H.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,a?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Le(),"aria-label":Le(),disabled:v!==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:ie()})]},e.instanceName)}),hn>0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:me()}):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:Ae()}),(0,H.jsx)(pt,{children:Ve({name:T?.name??``})})]}),(0,H.jsxs)(ut,{children:[(0,H.jsx)(yt,{children:tt()}),(0,H.jsx)(Ft,{onClick:()=>{let e=T;E(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>c({instanceName:e.instanceName,jobId:e.jobId}),Xe())},children:Je()})]})]})}),(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:je({name:k?.name??``})})}),k?.entries===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):k!==null&&k.entries.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}):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:[i({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:Ye()}),(0,H.jsx)(kt,{children:ke()})]}),P===null?null:P.loading?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):(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:ge()}),(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:Be()}),(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:et()}),(0,H.jsx)(O,{value:`every`,children:qe()}),(0,H.jsx)(O,{value:`at`,children:it()})]})]}),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:ee??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:Pe()}),(0,H.jsx)(O,{value:`hours`,children:r()}),(0,H.jsx)(O,{value:`days`,children:de()})]})]})]}):(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:Re()}),(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:tt()}),(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,Ee()]})]})]})})]})}export{pn as ScheduledTab};
|
|
@@ -1 +0,0 @@
|
|
|
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,CN as a,CP as ne,DN as o,DP as re,EN as s,EP as ie,FN as ae,GN as oe,HN as se,IN as ce,JN as le,KN as ue,LN as de,MN as c,NN as l,ON as u,OP as fe,PN as pe,QN as me,RN as he,SN as d,SP as ge,TN as f,TP as _e,UN as ve,VN as ye,WN as be,XN as xe,YN as Se,ZN as Ce,_N as we,_P as Te,aP as Ee,bB as p,bN as m,bP as De,cP as Oe,dN as h,dP as ke,eP as Ae,fN as g,fP as je,gN as _,gP as Me,hN as v,hP as Ne,iP as Pe,jN as y,kN as b,kP as Fe,lP as Ie,mN as x,mP as Le,nP as Re,oP as ze,pN as S,pP as Be,qN as Ve,rP as He,sP as Ue,t as C,tP as We,uN as w,uP as Ge,vB as Ke,vN as T,vP as qe,wN as E,wP as D,xB as O,xN as k,xP as Je,yN as A,yP as Ye,zN as Xe}from"./api-DS0UCfP0.js";import{t as j}from"./button-wZk4ylVE.js";import{$ as M,Bn as Ze,Dt as Qe,Et as N,Gn as $e,Hn as et,In as P,Kn as tt,Q as F,U as nt,Un as I,X as L,Z as R,_ as rt,at as z,ct as B,et as V,it as H,jt as U,nt as W,ot as G,rt as it,st as K,tt as q}from"./index-SBKa9qhz.js";import{t as at}from"./FilterBar-Dp85xc2n.js";import{t as ot}from"./DataTableShell-yD_nPHl_.js";import{t as st}from"./roleDescriptions-q9e87Q_C.js";var J=t(e(),1),Y=n(),ct=[{value:`never`,label:()=>_(),days:null},{value:`30`,label:()=>v(),days:30},{value:`90`,label:()=>x(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=tt({from:`/settings/serviceAccounts`}),t=$e({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Z,[a,o]=(0,J.useState)(Z),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),l=O(C.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:i===Z?void 0:i===`disabled`}}),u=O(C.apiKeys.listKeys,{}),d=O(C.apiKeys.listRoles,{}),f=p(C.apiKeys.createServiceAccount),we=p(C.apiKeys.updateServiceAccount),m=p(C.apiKeys.deleteServiceAccount),h=Ke(C.apiKeys.mintApiKey),g=p(C.apiKeys.revokeApiKey),_=nt(),v=Qe(),y=n!==``||a!==Z||i!==Z;function b(){o(Z),t({search:{},replace:!0})}let[x,S]=(0,J.useState)(!1),[w,T]=(0,J.useState)(Q),[E,k]=(0,J.useState)(null),[A,P]=(0,J.useState)(new Set),[I,z]=(0,J.useState)(null),B=(0,J.useRef)(!1),[H,W]=(0,J.useState)(new Set),[G,it]=(0,J.useState)({}),[K,q]=(0,J.useState)(null),X=(0,J.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[u]);function $(e){P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{E?(await we({serviceAccountId:E,name:w.name,roleKey:w.roleKey,description:w.description}),v.success(le())):await f({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Q),k(null),S(!1)}catch(e){v.error(E?Se():xe(),e)}}function ft(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),S(!0)}async function pt(e){if(B.current)return;B.current=!0;let t=G[e._id]??`never`,n=ct.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;z(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});q({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(Ve(),e)}finally{B.current=!1,z(null)}}async function mt(e){if(await _({title:ue(),description:(0,Y.jsxs)(Y.Fragment,{children:[oe(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,be(),` `,(0,Y.jsx)(`strong`,{children:ve()}),` `,se()]}),confirmWord:e.name,confirmLabel:ye(),destructive:!0}))try{await m({serviceAccountId:e._id}),v.success(te(),e.name)}catch(e){v.error(Xe(),e)}}async function ht(e){if(await _({title:he(),description:(0,Y.jsxs)(Y.Fragment,{children:[de(),` `,(0,Y.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ce()]}),confirmLabel:ae(),destructive:!0})&&!H.has(e._id)){W(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){v.error(pe(),e)}finally{W(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}),(0,Y.jsxs)(at,{q:n,onQChange:s,searchPlaceholder:Fe(),onReset:b,canReset:y,children:[(0,Y.jsxs)(L,{value:a,onValueChange:o,children:[(0,Y.jsx)(M,{size:`sm`,className:`w-40`,children:(0,Y.jsx)(V,{placeholder:fe()})}),(0,Y.jsxs)(R,{children:[(0,Y.jsx)(F,{value:Z,children:re()}),(d??[]).map(e=>(0,Y.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,Y.jsxs)(L,{value:i,onValueChange:c,children:[(0,Y.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(V,{})}),(0,Y.jsxs)(R,{children:[(0,Y.jsx)(F,{value:Z,children:ie()}),(0,Y.jsx)(F,{value:`active`,children:_e()}),(0,Y.jsx)(F,{value:`disabled`,children:D()})]})]})]}),(0,Y.jsx)(ot,{title:ne(),rows:l,addLabel:ge(),onAdd:()=>{T(Q),k(null),S(!0)},emptyHint:Je(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,Y.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:H}),rowActions:e=>[...(e.managedBy??null)===null?[{label:Te(),onSelect:()=>ft(e)},{label:De(),onSelect:()=>void pt(e)}]:[],{label:A.has(e._id)?Ye():qe(),onSelect:()=>$(e._id)},...(e.managedBy??null)===null?[{label:Me(),variant:`destructive`,onSelect:()=>void mt(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?Ne():Le(),onClick:()=>$(e._id),children:A.has(e._id)?(0,Y.jsx)(et,{}):(0,Y.jsx)(Ze,{})})},{header:Be(),sort:e=>e.name,cell:e=>(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:je(),sort:e=>e.roleKey,cell:e=>(0,Y.jsx)(N,{variant:`secondary`,children:e.roleKey})},{header:ke(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,Y.jsx)(N,{variant:`destructive`,children:D()}):(0,Y.jsx)(N,{variant:`outline`,children:_e()})},{header:Ge(),cell:e=>(0,Y.jsxs)(L,{value:G[e._id]??`never`,onValueChange:t=>it(n=>({...n,[e._id]:t})),children:[(0,Y.jsx)(M,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(V,{})}),(0,Y.jsx)(R,{children:ct.map(e=>(0,Y.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:Ie(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,Y.jsx)(`span`,{className:`oc-sa__keycount`,children:I===e._id?Oe():Ue({count:t})})}}]}),(0,Y.jsx)(rt,{open:x,onOpenChange:e=>{S(e),e||k(null)},title:E?ze():He(),description:E?Ee():Re(),canSubmit:!!(w.name&&w.roleKey),onSubmit:dt,submitLabel:E?Pe():We(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:Ae()}),(0,Y.jsx)(U,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,Y.jsxs)(L,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,Y.jsx)(M,{className:`w-full`,children:(0,Y.jsx)(V,{placeholder:me()})}),(0,Y.jsx)(R,{children:(d??[]).map(e=>(0,Y.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(d??[]).find(e=>e.key===w.roleKey),t=e?st(e):null;return t?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:Ce()}),(0,Y.jsx)(U,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,Y.jsx)(ut,{minted:K,onClose:()=>q(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,Y.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,Y.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[l(),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Y.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{children:y()}),(0,Y.jsx)(`th`,{children:i()}),(0,Y.jsx)(`th`,{children:b()}),(0,Y.jsx)(`th`,{children:u()}),(0,Y.jsx)(`th`,{children:o()}),(0,Y.jsx)(`th`,{children:s()}),(0,Y.jsx)(`th`,{})]})}),(0,Y.jsx)(`tbody`,{children:t.map(t=>(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`td`,{children:(0,Y.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,Y.jsx)(`td`,{children:(0,Y.jsx)(N,{variant:`secondary`,children:e.roleKey})}),(0,Y.jsx)(`td`,{children:B(t.createdAt)}),(0,Y.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,Y.jsx)(`td`,{children:pt(t.expiresAt)}),(0,Y.jsx)(`td`,{children:mt(t)}),(0,Y.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,Y.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?f():E()}):null})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,J.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,Y.jsx)(q,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,Y.jsxs)(W,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,Y.jsxs)(z,{children:[(0,Y.jsx)(G,{children:a()}),(0,Y.jsx)(it,{children:d({name:e.accountName})})]}),(0,Y.jsx)(`div`,{className:`oc-sa__minted-warning`,children:k()}),(0,Y.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Y.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,Y.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":m(),children:[n?(0,Y.jsx)(I,{}):(0,Y.jsx)(P,{}),n?A():T()]})]}),(0,Y.jsx)(H,{children:(0,Y.jsx)(j,{onClick:()=>{r(!1),t()},children:we()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?S():B(e)}function pt(e){return e===null?`—`:K(e)}function mt(e){return e.disabled?(0,Y.jsx)(N,{variant:`destructive`,children:g()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,Y.jsx)(N,{variant:`outline`,children:h()}):(0,Y.jsx)(N,{variant:`outline`,children:w()})}export{$ as ServiceAccountsTab};
|
|
@@ -1 +0,0 @@
|
|
|
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,Dc as o,Ec as s,Fc as c,Gc as l,Hc as u,Ic as d,Jc as f,Kc as p,Lc as m,Mc as h,Nc as g,Oc as _,Pc as v,Qc as y,Rc as b,Uc as x,Vc as S,Wc as C,Xc as w,Yc as T,Zc as E,al as D,bB as O,cl as k,el as A,il as j,jc as M,kc as N,ll as P,nl as F,ol as I,qc as ee,rl as L,sl as R,t as z,tl as B,ul as V,xB as H,zc as U}from"./api-DS0UCfP0.js";import{t as W}from"./button-wZk4ylVE.js";import{U as G,ct as K}from"./index-SBKa9qhz.js";import{t as q}from"./DataTableShell-yD_nPHl_.js";var J=t(e(),1),Y=n(),X={hung:()=>ee(),wrong_result:()=>p(),error:()=>l(),other:()=>C()},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=O(z.subAgentReports.respondToReport),[r,o]=(0,J.useState)(e.thread),[s,l]=(0,J.useState)(``),[f,p]=(0,J.useState)(!1);async function _(){let t=s.trim();if(!(!t||f)){p(!0);try{await n({reportId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}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),` · `,x({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:u()}),(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:S()}),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:b()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:m(),value:s,maxLength:2e3,rows:3,onChange:e=>l(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 _(),disabled:!s.trim()||f,children:f?c():d()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[v({count:t.children.length}),t.childrenTruncated?` ${g()}`:``,t.textTruncated?` ${h()}`:``]}),(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?` · ${M()}`:``]}),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:N()}),(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=H(z.subAgentReports.listForAdmin,{}),t=O(z.subAgentReports.readReport),n=O(z.subAgentReports.deleteReport),i=G(),[a,c]=(0,J.useState)(null),[l,u]=(0,J.useState)({});async function d(e){if(a===e._id){c(null);return}if(!l[e._id]){let n=await t({reportId:e._id});u(t=>({...t,[e._id]:n}))}c(e._id)}async function p(e){await i({title:_(),description:o(),confirmLabel:s(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&c(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[k(),` `,(0,Y.jsx)(`strong`,{children:R()}),` `,I()]}),(0,Y.jsx)(q,{title:V(),rows:e,emptyHint:P(),isExpanded:e=>a===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Y.jsx)($,{data:l[e._id]}):null,columns:[{header:D(),cell:e=>K(e.at),sort:e=>e.at},{header:j(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:L(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:F(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${r({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:B(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:A(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:y()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:E()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?T():w(),onSelect:()=>void d(e)},{label:f(),onSelect:()=>void p(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|
|
@@ -1 +0,0 @@
|
|
|
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,CF as s,CI as c,Cc as l,DF as u,DI as d,EF as f,EI as p,FF as m,FI as h,GF as g,HF as _,IF as v,II as y,JF as b,KF as ee,LF as x,LI as te,MF as ne,MI as re,NF as ie,NI as ae,OF as oe,OI as se,PF as ce,PI as le,QF as ue,RF as de,RI as fe,SF as pe,SI as me,Sc as he,TF as ge,TI as _e,Tc as S,UF as ve,VF as ye,WF as be,XF as xe,YF as Se,ZF as Ce,_F as we,_I as Te,aI as Ee,bB as C,bF as De,bI as Oe,cB as ke,cI as Ae,dI as je,eI as Me,fI as Ne,gI as Pe,hI as Fe,iI as Ie,jF as Le,jI as Re,kF as ze,kI as w,lB as Be,lI as Ve,mI as He,nI as T,oI as Ue,pI as We,qF as Ge,r as Ke,rI as qe,sI as Je,t as E,tI as Ye,uB as Xe,uI as Ze,vB as Qe,vF as $e,vI as et,wF as tt,wI as nt,wc as D,xB as O,xF as k,xI as rt,yF as it,yI as at,zF as ot,zI as st}from"./api-DS0UCfP0.js";import{t as A}from"./x-DSVIpKLV.js";import{t as j}from"./button-wZk4ylVE.js";import{$ as M,Et as N,Fn as ct,Ft as lt,G as ut,It as P,K as dt,Lt as ft,Mt as pt,Nt as mt,Pn as F,Pt as I,Q as L,Un as R,X as z,Z as B,et as V,jt as H,ln as U,q as W,ut as G}from"./index-SBKa9qhz.js";import{t as ht}from"./localePickerView-C2RmOS86.js";import{a as gt,i as _t,n as vt,o as yt,r as bt,t as xt}from"./card-CurFse5M.js";import{a as St,i as K,n as Ct,o as q,r as J,t as wt}from"./table-DlldEKg7.js";import{t as Tt}from"./TimeRangePicker-BlCtUw8V.js";import{t as Et}from"./FilterBar-Dp85xc2n.js";import{t as Dt}from"./AdvancedFilter-BDMSRiwU.js";var Y=t(e(),1),Ot=.1,kt=[248,248,248],At=[24,24,24];function jt(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 Mt(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 Nt(e,t,n){return Mt(e,t,n)>=Ot}function Pt(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 Ft(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 It=12*1024*1024,Lt=480,Rt=160,zt=.92;async function Bt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(o());if(e.size>It)throw Error(ot());let{source:n,width:r,height:i,cleanup:a}=await Vt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Lt/r,Rt/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(x());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=jt(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(x());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);Nt(e.data,d.width,d.height)?Pt(e.data,t.variantFor===`dark`?kt:At):Ft(e.data),p.putImageData(e,0,0)}let m=Nt(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await X(f,`image/webp`,zt)??await X(f,`image/png`);if(!h)throw Error(v());return{blob:h,hasAlpha:m}}finally{a()}}async function Vt(e){if(e.type===`image/svg+xml`)return Ht(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 Ht(e)}async function Ht(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(de())),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 X(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Z=n();function Ut(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 Q=`__all__`,Wt={kind:`relative`,from:`now-24h`,to:`now`},Gt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Kt(e){return e===`light`?Xe():e===`dark`?Be():ke()}var qt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Jt({tokens:e,mode:t}){let n=e.colors[t];return(0,Z.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:qt.map(e=>{let t=n[e];return(0,Z.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Yt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,Z.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:Ke(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Z.jsx)(R,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Z.jsx)(Jt,{tokens:r,mode:i}):(0,Z.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Z.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Z.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":S(),title:S(),children:(0,Z.jsx)(ct,{className:`size-4`})}):null]})}function Xt({selectedKey:e,resolvedMode:t}){let n=O(E.charts.listMyCharts),r=C(E.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Re()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:a()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Z.jsx)(Yt,{selected:e===null,title:w(),subtitle:se(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?d():n.via===`owner`?p():_e({group:n.via.group});return(0,Z.jsx)(Yt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Ut(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:nt()}):null]})}function Zt(){let e=C(E.charts.importChart),[t,n]=(0,Y.useState)(``),[r,i]=(0,Y.useState)(``),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.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(T())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(Me());return}let a;try{a=JSON.parse(r)}catch{o(T());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,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Ze()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ve()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ae()}),(0,Z.jsx)(H,{value:t,onChange:e=>n(e.target.value),placeholder:Je(),maxLength:60})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ue()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:Ee(),rows:8,spellCheck:!1})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(U,{className:`size-4`}),Ie(),(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,Z.jsx)(j,{size:`sm`,disabled:l,onClick:()=>void f(),children:qe()})]}),a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,Z.jsx)(`p`,{className:`oc-chart-import__ok`,children:Ye()}):null]})]})}function Qt({chart:e}){let t=Qe(E.charts.setChartLogo),n=C(E.charts.removeChartLogo),[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.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 Bt(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,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Ge():ee()}),(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Z.jsx)(`img`,{src:t,alt:``}):null}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(U,{className:`size-4`}),t?be():g(),(0,Z.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:_()}):null,t?(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:ve()}):null]})}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:b()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Z.jsx)(f,{mode:`light`}),(0,Z.jsx)(f,{mode:`dark`})]}),r?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:ye()}):null,a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function $t({chart:e}){let t=O(E.me.getMe,{host:W}),n=C(E.charts.addChartDomain),r=C(E.charts.removeChartDomain),[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=a.trim();if(t!==``){c(null),u(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(t){c(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:m()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Le()}):d.map(e=>(0,Z.jsxs)(N,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":i({domain:e}),onClick:()=>void p(e),children:(0,Z.jsx)(A,{className:`size-3`})})]},e))}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(H,{value:a,onChange:e=>o(e.target.value),placeholder:ie(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:ne()})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:ce()}),s?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function en(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=C(E.charts.updateChart),n=C(E.charts.deleteChart),[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(e.name),[s,c]=(0,Y.useState)(()=>en(e.tokens)),[d,p]=(0,Y.useState)(e.tokens.bpm??0),[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1);function v(){o(e.name),c(en(e.tokens)),p(e.tokens.bpm??0),h(null),i(!0)}async function y(){if(e.chartId===void 0)return;h(null);let n;try{n=JSON.parse(s)}catch{h(T());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;d>0?e.bpm=d:delete e.bpm}_(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(ge()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:v,children:xe()}),(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:Se()})]})})]}),r?(0,Z.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:u()}),(0,Z.jsx)(H,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:D()}),(0,Z.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Z.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:d,onChange:e=>p(Number(e.target.value)),"aria-label":D()}),(0,Z.jsx)(`span`,{className:`oc-chart-bpm__value`,children:d===0?l():`${d} BPM`})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:he()})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:f()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),m?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:m}):null,(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{size:`sm`,disabled:g,onClick:()=>void y(),children:ze()}),(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:oe()})]})]}):null,(0,Z.jsx)(Qt,{chart:e}),(0,Z.jsx)($t,{chart:e})]})}function nn(){let e=O(E.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:r()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ue()})]}),e!==void 0&&t.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ce()}):(0,Z.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Z.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=C(E.charts.addChartToGroupPool),r=C(E.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(N,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Pe():e.kind===`custom`&&e.scope===`personal`?k():Te()}),e.isGlobalDefault?(0,Z.jsx)(N,{variant:`default`,children:Fe()}):null]}),(0,Z.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:We()}),(a??[]).map(e=>(0,Z.jsxs)(N,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":je({group:e.name}),onClick:()=>void l(e.groupId),children:(0,Z.jsx)(A,{className:`size-3`})})]},e.groupId)),s.length>0?(0,Z.jsxs)(z,{value:``,onValueChange:e=>void c(e),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(V,{placeholder:Ne()})}),(0,Z.jsx)(B,{children:s.map(e=>(0,Z.jsx)(L,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:He()}):null]})]})}function an({chart:e}){let t=C(E.charts.promoteChartToCommon),n=C(E.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(ge()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(N,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?De():k()}),e.ownerLabel?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:pe({owner:e.ownerLabel})}):null]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:it()}):null,(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:$e()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=C(E.admin.setDefaultThemeMode),i=C(E.admin.setDefaultLocale),a=C(E.charts.setDefaultChart),o=O(E.charts.listChartsAdmin),l=O(E.groups.listGroups,{}),u=e??`system`,d=t??`fr`;return(0,Z.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:ae()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:c()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:w()}),dt.map(e=>(0,Z.jsx)(j,{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,Z.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:rt()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Z.jsx)(rn,{chart:e,groups:l??[]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:at()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:et()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Z.jsx)($t,{chart:e})]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:tt()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:we()}):(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Z.jsx)(an,{chart:e},e.key))})})()]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:st()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Z.jsx)(j,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Kt(e)},e))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:te()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:ht().map(e=>(0,Z.jsx)(j,{variant:d===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:h()})]})]})}function sn(){let e=O(E.me.getMe,{host:W}),t=ut(e?.resolvedThemeMode);return(0,Z.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Z.jsx)(Xt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Z.jsx)(Zt,{}),(0,Z.jsx)(nn,{}),e?.role===`admin`?(0,Z.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,Y.useState)(!0),[n,r]=(0,Y.useState)(`per-user`),[i,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(Q),[c,l]=(0,Y.useState)(Q),[u,d]=(0,Y.useState)(Wt),f=i!==``||o!==Q||c!==Q;function p(){a(``),s(Q),l(Q),d(Wt)}return(0,Z.jsxs)(`div`,{className:`oc-show`,children:[(0,Z.jsx)(sn,{}),(0,Z.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Z.jsx)(`summary`,{className:`oc-show__title`,children:le()}),(0,Z.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{children:`Default`}),(0,Z.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(j,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(j,{variant:`ghost`,children:`Ghost`}),(0,Z.jsx)(j,{variant:`destructive`,children:`Destructive`}),(0,Z.jsx)(j,{variant:`link`,children:`Link`})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{size:`sm`,children:`Small`}),(0,Z.jsx)(j,{children:`Default`}),(0,Z.jsx)(j,{size:`lg`,children:`Large`}),(0,Z.jsx)(j,{size:`icon`,"aria-label":`more`,children:(0,Z.jsx)(F,{})}),(0,Z.jsx)(j,{disabled:!0,children:`Disabled`})]})]}),(0,Z.jsx)($,{title:`Badges`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(N,{children:`Default`}),(0,Z.jsx)(N,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(N,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(N,{variant:`destructive`,children:`Destructive`})]})}),(0,Z.jsx)($,{title:`Inputs & selection`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(H,{placeholder:`Text input…`}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsxs)(z,{value:n,onValueChange:r,children:[(0,Z.jsx)(M,{className:`w-56`,children:(0,Z.jsx)(V,{placeholder:`Select…`})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(L,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Z.jsx)(L,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Z.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Z.jsx)(G,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Z.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsxs)(Et,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Z.jsxs)(z,{value:o,onValueChange:s,children:[(0,Z.jsx)(M,{size:`sm`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(L,{value:Q,children:`Toutes directions`}),(0,Z.jsx)(L,{value:`inbound`,children:`inbound`}),(0,Z.jsx)(L,{value:`outbound`,children:`outbound`}),(0,Z.jsx)(L,{value:`internal`,children:`internal`})]})]}),(0,Z.jsxs)(z,{value:c,onValueChange:l,children:[(0,Z.jsx)(M,{size:`sm`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(L,{value:Q,children:`Toutes sévérités`}),(0,Z.jsx)(L,{value:`info`,children:`info`}),(0,Z.jsx)(L,{value:`warn`,children:`warn`}),(0,Z.jsx)(L,{value:`critical`,children:`critical`})]})]})]}),(0,Z.jsx)(Dt,{fields:Gt,onChange:()=>{}}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Z.jsx)(Tt,{value:u,onChange:d})]})]})}),(0,Z.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Z.jsxs)(pt,{children:[(0,Z.jsx)(ft,{asChild:!0,children:(0,Z.jsx)(j,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Z.jsx)(F,{})})}),(0,Z.jsxs)(mt,{align:`start`,children:[(0,Z.jsx)(lt,{children:`Actions`}),(0,Z.jsx)(P,{}),(0,Z.jsx)(I,{children:`Edit`}),(0,Z.jsx)(I,{children:`Duplicate`}),(0,Z.jsx)(P,{}),(0,Z.jsx)(I,{variant:`destructive`,children:`Delete`})]})]})}),(0,Z.jsx)($,{title:`Card`,children:(0,Z.jsxs)(xt,{className:`w-80`,children:[(0,Z.jsxs)(gt,{children:[(0,Z.jsx)(yt,{children:`Instance`}),(0,Z.jsx)(bt,{children:`Non-secret metadata only.`})]}),(0,Z.jsx)(vt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Z.jsxs)(_t,{className:`gap-2`,children:[(0,Z.jsx)(j,{size:`sm`,children:`Save`}),(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Z.jsx)($,{title:`Table`,children:(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(St,{children:(0,Z.jsxs)(q,{children:[(0,Z.jsx)(K,{className:`w-8`,children:(0,Z.jsx)(G,{"aria-label":`select all`})}),(0,Z.jsx)(K,{children:`Name`}),(0,Z.jsx)(K,{children:`Mode`}),(0,Z.jsx)(K,{className:`text-right`,children:`Status`}),(0,Z.jsx)(K,{className:`w-8`})]})}),(0,Z.jsx)(Ct,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Z.jsxs)(q,{children:[(0,Z.jsx)(J,{children:(0,Z.jsx)(G,{"aria-label":`select ${e.n}`})}),(0,Z.jsx)(J,{className:`font-medium`,children:e.n}),(0,Z.jsx)(J,{children:(0,Z.jsx)(N,{variant:`secondary`,children:e.m})}),(0,Z.jsx)(J,{className:`text-right`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Z.jsx)(R,{className:`size-3.5`}),` `,e.s]})}),(0,Z.jsx)(J,{children:(0,Z.jsx)(j,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Z.jsx)(F,{})})})]},e.n))})]})}),(0,Z.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Z.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Z.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Z.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Z.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Z.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Z.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Z.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Z.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Z.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{cn as ThemeShowroom};
|
|
@@ -1 +0,0 @@
|
|
|
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,D as c,DA as l,EA as u,FS as d,GS as f,Gk as p,HS as m,IS as h,JS as g,Jk as _,KS as v,Kk as y,LS as ee,MA as b,NA as x,NS as S,OA as C,PA as w,PS as T,QS as te,Qk as ne,RS as re,SA 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,aA as he,aC as ge,aa as D,bA as O,bB as k,cC as _e,dA as A,dC as ve,eA as j,eC as ye,fA as M,fC as be,gA as N,gC as xe,hA as Se,hC as Ce,iA as we,iC as Te,ia as Ee,jA as De,kA as Oe,lC as ke,mA as Ae,mC as je,nA as Me,nC as Ne,oC as Pe,oa as Fe,pA as Ie,pC as Le,qS as Re,qk as ze,rA as Be,rC as Ve,sC as He,t as P,tA as Ue,tC as We,uA as Ge,uC as Ke,vA as qe,wA as Je,xA as F,xB as I,yA as Ye,zS as Xe}from"./api-DS0UCfP0.js";import{t as Ze}from"./x-DSVIpKLV.js";import{i as L,n as R,r as Qe,t as $e}from"./tabs-DJM-iyEY.js";import{t as z}from"./button-wZk4ylVE.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-SBKa9qhz.js";import{n as yt}from"./TimeRangePicker-BlCtUw8V.js";import{t as bt}from"./FilterBar-Dp85xc2n.js";import{t as xt}from"./AdvancedFilter-BDMSRiwU.js";import{t as St}from"./DataTableShell-yD_nPHl_.js";var Ct=c(`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`?Se():n===`agent`?`${Ae()} - ${r}`:e}function Tt(){let e=I(P.me.getMe,{host:ht})?.role===`admin`,t=I(P.deliveryTiming.getDeliveryStatus,{}),n=k(P.deliveryTiming.startDeliveryRecord),r=k(P.deliveryTiming.stopDeliveryRecord),[i,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),d=t?.recording??!1,f=async()=>{c(!0);try{d?await r({}):await n({})}finally{c(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:w()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:x()})]}),e?(0,J.jsx)(z,{variant:d?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void f(),children:d?De():b()}):null]}),d?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(V,{variant:`secondary`,children:a()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:Oe({time:dt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:i?u():l()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=I(P.deliveryTiming.listDeliverySessions,{}),n=k(P.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:f,to:p}=yt(c),m=c.to===`now`?1/0:p,h=r.trim()!==``||a!==`all`||c!==Y,g=()=>{i(``),o(`all`),l(Y)},_=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=m).map(e=>({...e,_id:e.sessionId}))},[t,r,a,f,m]),v=e=>{let t=new Set((_??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:i,searchPlaceholder:Je(),timeRange:c,onTimeRangeChange:l,onReset:g,canReset:h,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:s()}),(0,J.jsx)(H,{value:`active`,children:E()}),(0,J.jsx)(H,{value:`stopped`,children:F()})]})]})}),(0,J.jsx)(St,{title:ie(),rows:_,emptyHint:y(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?M():Ie(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(at,{size:15,"aria-hidden":!0}):(0,J.jsx)(it,{size:15,"aria-hidden":!0})})},{header:O(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:Ye(),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:qe(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:me(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:N(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(V,{variant:`secondary`,children:E()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:F()})}],rowActions:e?e=>[{label:A(),variant:`destructive`,onSelect:()=>v([e.sessionId])}]:void 0,bulkActions:e?[{label:A(),variant:`destructive`,onSelect:e=>v(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=I(P.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(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:Ge()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:C()});let r=e.segments,a=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,p()]}),(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?ze():_()]})]}),(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:Be()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Me()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Ue()})]})}),(0,J.jsxs)(`tbody`,{children:[a(j(),r.bridge),a(i(),r.A),a(ne(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:le()})]})}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:D()},{value:`direction`,label:`direction`},{value:`roleKey`,label:Ee()},{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,c=e.direction??Q,l=e.roleKey??Q,u=e.q??``,d=e.correlationId,p=ut(e.from,e.to),_=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:y,to:b}=yt(p),[x,S]=(0,q.useState)(null),[C,w]=(0,q.useState)(null),T=e=>void t({search:t=>({...t,limit:e})}),ne=e=>void t({search:t=>({...t,kind:e})}),E=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),ie=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),le=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),de=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),pe=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),me=e=>void t({search:t=>({...t,...pt(e)})}),D=e=>void t({search:t=>({...t,adv:ct(e)}),replace:!0}),O=I(P.observability.listEvents,{limit:n}),k=I(P.observability.listEvents,{limit:n,kind:i===Z?void 0:i,...d?{correlationId:d}:{},filter:{q:u||void 0,from:y,to:b,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:c===Q?void 0:c,roleKey:l===Q?void 0:l,advanced:_.length>0?_:void 0}}),A=(0,q.useMemo)(()=>{let e=new Set;for(let t of O??[])e.add(t.kind);return[...e].sort()},[O]),j=(0,q.useMemo)(()=>{let e=new Set;for(let t of O??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[O]),M=u!==``||a!==Q||s!==Q||c!==Q||l!==Q||_.length>0||p.kind!==`relative`||p.from!==Nt.from;function N(){t({search:{limit:100,kind:`all`},replace:!0})}let Se=x?O?.filter(e=>e.correlationId===x):k,Ee=e.section,De=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)($e,{value:Ee,onValueChange:e=>De(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}),he()]}),(0,J.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),we()]})]}),(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:[xe(),(0,J.jsx)(`strong`,{children:Ce()}),je(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:Le()})]}),(0,J.jsxs)(bt,{q:u,onQChange:E,searchPlaceholder:be(),timeRange:p,onTimeRangeChange:me,onReset:N,canReset:M,children:[(0,J.jsxs)(U,{value:a,onValueChange:ie,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:ve()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Ke()}),At.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:s,onValueChange:le,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:ke()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:_e()}),jt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:c,onValueChange:de,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:He()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Pe()}),Mt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:l,onValueChange:pe,children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{placeholder:ge()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Te()}),j.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:Ve(),"aria-label":Ve(),onChange:e=>{let t=e.target.value.trim();ne(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=>T(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:Ne({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:_,onChange:D}),x?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>S(null),title:We(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ye(),(0,J.jsx)(`code`,{children:$(x)})]}),(0,J.jsx)(Ze,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:r()})]})}):null,(0,J.jsx)(St,{title:te(),rows:Se,emptyHint:x?fe():ce(),columns:[{header:ue(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:g(),sort:e=>e.kind,cell:e=>(0,J.jsx)(V,{variant:`secondary`,children:e.kind})},{header:Re(),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":v(),children:`✓`})}},{header:f(),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:se(),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:ae(),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:m(),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:oe(),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:o(),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:Xe(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:re(),onClick:()=>S(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ee(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:h()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:C,onClose:()=>w(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:[d(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(V,{variant:`outline`,children:T()})]}),(0,J.jsx)(gt,{children:S()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
|
|
@@ -1 +0,0 @@
|
|
|
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,FD as o,Fp as s,GD as c,Gx as l,HD as u,ID as d,JD as f,Jx as p,KD as m,Kx as h,LD as ee,Np as g,PD as te,Pp as _,QD as ne,Qx as v,RD as y,UD as re,VD as ie,WD as ae,XD as oe,Xx as b,YD as se,Yx as x,ZD as ce,Zx as S,aO as C,bB as w,cO as T,eO as le,eS as E,hD as ue,iO as de,nO as fe,nS as D,oO as O,qD as pe,qx as k,rO as me,rS as A,sO as j,t as M,tO as he,tS as N,xB as P,zD as ge}from"./api-DS0UCfP0.js";import{t as F}from"./button-wZk4ylVE.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-SBKa9qhz.js";import{t as Y}from"./FilterBar-Dp85xc2n.js";import{t as Me}from"./DataTableShell-yD_nPHl_.js";import{t as Ne}from"./DetailChips-DVgEoxGq.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let a=P(M.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=P(M.agents.listUserAgents,n&&e?{profileId:e}:`skip`),s=new Set((o??[]).map(e=>`${e.instanceName}/${e.agentId}`)),c=(o??[]).find(e=>e.isDefault)??null,l=c?`${c.instanceName}/${c.agentId}`:null,u=new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),d=[...(a?.agents??[]).map(e=>({...e,outOfPool:!1})),...(o??[]).filter(e=>!u.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,enabled:e.enabled,state:e.state,outOfPool:!0}))],f=new Map;for(let e of d){let t=f.get(e.instanceName)??[];t.push(e),f.set(e.instanceName,t)}return(0,Z.jsx)(je,{open:n,onOpenChange:r,children:(0,Z.jsxs)(De,{className:`oc-access`,children:[(0,Z.jsxs)(Te,{children:[(0,Z.jsx)(Oe,{children:A({user:t})}),(0,Z.jsx)(Ae,{children:D()})]}),a?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:a.inGroup?N():E()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:a===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i()}):d.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:b()}):[...f.entries()].map(([t,n])=>(0,Z.jsx)(Fe,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:l},t))})]})})}function Fe({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=w(M.agents.assignAgent),s=w(M.agents.removeAgent),c=w(M.agents.setDefaultAgent),u=L();if(!e)return null;async function d(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(v(),e)}}async function f(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(S(),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=i.has(n),o=a===n,s=e.state===`deleted`,c=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${c?` is-disabled`:``}`,children:[(0,Z.jsx)(J,{checked:r,disabled:(s||c)&&!r,onCheckedChange:()=>void d(e.agentId,r),"aria-label":x({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:p()}):null,e.outOfPool?(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:k()}):null,r?o?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":h(),title:h(),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":l(),title:l(),disabled:c,onClick:()=>void f(e.agentId),children:(0,Z.jsx)(G,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return g();case`user`:return _();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?T():j({count:r})})}),(0,Z.jsxs)(xe,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(z,{children:O()}),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}),l=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),p=P(M.admin.listUsers,{filter:{q:n||void 0,role:i===Q?void 0:i},withAgents:!0}),h=P(M.me.getMe,{host:ke}),g=w(M.admin.setRole),_=w(M.admin.setUserPermissions),v=w(M.admin.startImpersonation),b=w(M.admin.deleteUser),x=w(M.admin.setUserName),S=Ce(),T=we(),E=L(),[D,O]=(0,X.useState)(null),k=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of p??[])e.add(t.role);return[...e]},[p]),A=n!==``||i!==Q;function j(){t({search:{},replace:!0})}async function N(e){try{await g(e)}catch(e){E.error(C(),e)}}async function F(e){try{await _(e)}catch(e){E.error(de(),e)}}async function R(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await S({title:ce(),description:oe({user:t}),confirmWord:se(),confirmLabel:f(),destructive:!0}))try{await b({profileId:e._id}),E.success(m({user:t}))}catch(e){E.error(pe(),e)}}async function z(e){let t=e.email||e.name||e.userId.slice(0,8),n=await T({title:ae(),label:re({user:t}),placeholder:u(),defaultValue:e.name??``,confirmLabel:ue()});if(n!==null)try{await x({profileId:e._id,name:n}),E.success(ie())}catch(e){E.error(a(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{q:n,onQChange:s,searchPlaceholder:me(),onReset:j,canReset:A,children:(0,Z.jsxs)(V,{value:i,onValueChange:l,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:fe()}),k.map(e=>(0,Z.jsx)(B,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:he(),rows:p,emptyHint:le(),rowActions:e=>{let t=[{label:te(),onSelect:()=>O({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:c(),onSelect:()=>void z(e)}];return e.userId!==h?.userId&&t.push({label:r(),onSelect:()=>void v({profileId:e._id})},{label:ne(),variant:`destructive`,onSelect:()=>void R(e)}),t},columns:[{header:ge(),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:y(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(V,{value:e.role,onValueChange:t=>void N({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:ee(),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:d()}):(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:o(),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:D?.profileId??null,userLabel:D?.label??``,open:D!==null,onOpenChange:e=>{e||O(null)}})]})}export{Le as UsersTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$n as r,Ci as i,In as a,Jn as o,Sd as ee,Si as s,Ti as c,Xn as te,Yn as ne,Zn as l,_i as u,ai as d,ar as f,bB as p,bi as m,ci as h,cr as g,di as re,er as _,fB as v,fi as y,fk as b,gi as x,gr as S,hi as ie,ii as C,li as ae,lr as oe,mB as se,mi as w,ni as T,nr as E,oi as D,or as O,pi as k,qf as A,ri as ce,si as j,sr as M,t as N,ti as le,tr as ue,ui as de,vB as fe,vi as pe,wd as P,wi as F,xB as I,xi as L,yi as R}from"./api-DS0UCfP0.js";import{i as z,n as B,r as me,t as he}from"./tabs-DJM-iyEY.js";import{t as V}from"./button-wZk4ylVE.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-SBKa9qhz.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>pe()],[`fr-FR`,()=>oe()],[`en-US`,()=>g()],[`en-GB`,()=>M()],[`de-DE`,()=>O()],[`es-ES`,()=>f()]],Oe=[[`0.75`,()=>x()],[`1`,()=>ie()],[`1.25`,()=>w()],[`1.5`,()=>k()]],$=0;function ke({instance:e}){let t=p(N.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,s]=(0,Z.useState)(r),[c,d]=(0,Z.useState)(`idle`),[f,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(!1),b=fe(N.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{s({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}),d(`idle`)},[e._id]);let x=i.enabled!==r.enabled||i.engine!==r.engine||i.lang!==r.lang||i.rate!==r.rate||i.autoRead!==r.autoRead;async function S(){d(`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}),d(`idle`)}catch{d(`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=>s({...i,enabled:e===!0}),"aria-label":m()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:l()}),(0,Q.jsxs)(G,{value:i.engine,onValueChange:e=>s({...i,engine:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":l(),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:ne()})]})]})]}),i.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:o()}):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=>s({...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:u()}),(0,Q.jsxs)(G,{value:i.rate,onValueChange:e=>s({...i,rate:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":u(),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=>s({...i,autoRead:e===!0}),disabled:!i.enabled,"aria-label":y()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()})]}),(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:!x||c===`saving`,onClick:()=>void S(),children:c===`saving`?A():P()}),(0,Q.jsx)(V,{variant:`outline`,size:`sm`,disabled:!i.enabled||f,onClick:()=>{let t=Number.parseFloat(i.rate)||1,n=++$;if(v(!1),J(),Y(),i.engine!==`gateway`){Ce(h(),{lang:Ee(i.lang,se()),rate:t});return}g(!0),b({instanceName:e.name,text:h()}).then(({mime:e,audioBase64:r})=>{n===$&&Se(r,e,{rate:t})}).catch(()=>{n===$&&v(!0)}).finally(()=>g(!1))},children:f?A():de()}),(0,Q.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>{$++,g(!1),J(),Y()},children:ae()})]}),c===`error`||_?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_?a():ee()}):null]})}function Ae({stt:e}){let t=I(N.me.getMe,{host:we}),n=p(N.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=t?.role===`admin`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:D()}),(0,Q.jsx)(U,{variant:e?`secondary`:`outline`,children:e?T():le()}),(0,Q.jsx)(U,{variant:r?`secondary`:`destructive`,children:r?ue():_()})]}),i?(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":E()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:d()})]})}function je(){let e=I(N.admin.listInstances,{}),t=(0,Z.useMemo)(()=>xe(),[]),n=(0,Z.useMemo)(()=>ge(),[]),{section:a}=ye({from:`/settings/voice`}),o=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:c()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(U,{variant:t?`secondary`:`destructive`,children:t?F():i()}),(0,Q.jsx)(U,{variant:n?`secondary`:`destructive`,children:n?s():L()})]}),(0,Q.jsxs)(he,{value:a,onValueChange:e=>void o({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}),D()]}),(0,Q.jsxs)(z,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(be,{size:13,"aria-hidden":!0}),C()]})]}),(0,Q.jsx)(B,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):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:C()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ce()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=p(N.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:S()}):(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":b()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()})]})]})}export{je as VoiceTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as e}from"./api-DS0UCfP0.js";var t=e(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]);export{t};
|