@lacneu/atrium 0.84.2 → 0.84.4
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-BnjDbsIq.js → AccessTab-U9gkqPi_.js} +1 -1
- package/dist/assets/{AdvancedFilter-6o-vjEqR.js → AdvancedFilter-BbGwAk2J.js} +1 -1
- package/dist/assets/AgentFilesTab-B8Yjl6k_.js +3 -0
- package/dist/assets/AnomaliesTab-j2y9uU-G.js +1 -0
- package/dist/assets/AuditTab-Hce8hJqk.js +1 -0
- package/dist/assets/BridgeTab-fCJQhfcl.js +1 -0
- package/dist/assets/ChatDefaultsTab-CU8MWJDx.js +1 -0
- package/dist/assets/{DataTableShell-CQpAyEEP.js → DataTableShell-tMQLeAkL.js} +1 -1
- package/dist/assets/{DetailChips-2FbzhIf1.js → DetailChips-BJrU9abA.js} +1 -1
- package/dist/assets/FeedbacksTab-ChbJhdh0.js +1 -0
- package/dist/assets/{FieldLabel-4QP66FKv.js → FieldLabel-D-1TOAEd.js} +1 -1
- package/dist/assets/FilesTab-BK5AB6xP.js +1 -0
- package/dist/assets/{FilterBar-CZtflyw0.js → FilterBar-BB9HpiR0.js} +1 -1
- package/dist/assets/GroupsTab-Cvthu-9e.js +1 -0
- package/dist/assets/InstancesTab-BGpPt4KT.js +1 -0
- package/dist/assets/{IntegrationsTab-CfuI1MGk.js → IntegrationsTab-D7z-nVKE.js} +1 -1
- package/dist/assets/KpiTab-1TZebhaA.js +1 -0
- package/dist/assets/PreferencesTab-IF07Bg1d.js +1 -0
- package/dist/assets/ProjectPage-D2cJu3qQ.js +1 -0
- package/dist/assets/PromptInjectionsTab-BLc91QlQ.js +4 -0
- package/dist/assets/RolesTab-CWanW3h-.js +1 -0
- package/dist/assets/ScheduledTab-Bd-mayHR.js +1 -0
- package/dist/assets/ServiceAccountsTab-BhZ24YSZ.js +1 -0
- package/dist/assets/SubAgentReportsTab-t74GNChq.js +1 -0
- package/dist/assets/ThemeShowroom-CxUfL_C0.js +1 -0
- package/dist/assets/{TimeRangePicker-Br6VJeCu.js → TimeRangePicker-BNzXp6XH.js} +1 -1
- package/dist/assets/{TimezoneCombobox-Ca1xgI0k.js → TimezoneCombobox-I1Uc-Ubw.js} +1 -1
- package/dist/assets/TracesTab-DmBA2Kdl.js +1 -0
- package/dist/assets/UsersTab-DeLrFIwE.js +1 -0
- package/dist/assets/VoiceTab-BwqfO1Qw.js +1 -0
- package/dist/assets/{api-CzqUiUHp.js → api-NzmVMBHn.js} +5 -5
- package/dist/assets/{button-mVD1CeVl.js → button-BHiy_q9F.js} +1 -1
- package/dist/assets/{card-D75hHhpt.js → card-Dgi0cIBy.js} +1 -1
- package/dist/assets/chevrons-up-down-ByP4WpSK.js +1 -0
- package/dist/assets/{compatView-CDOjftYx.js → compatView-DaOCauKc.js} +1 -1
- package/dist/assets/dispatchErrorInfo-Cv5NrLNL.js +1 -0
- package/dist/assets/{dist-BZeJS6Sb.js → dist-Bq7TOaac.js} +1 -1
- package/dist/assets/{dist-BmaVGWkf.js → dist-Dlw2jmvE.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-Ck7PppRT.js → highlighted-body-OFNGDK62-B_P-O6Hv.js} +1 -1
- package/dist/assets/{index-BFVb3Mjo.css → index-ButHo2z6.css} +1 -1
- package/dist/assets/index-DRTZkZgA.js +324 -0
- package/dist/assets/{list-D82d6otE.js → list-Dbcww3Mb.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-BXcnFAbM.js +1 -0
- package/dist/assets/{pdf-G6tnCj_R.js → pdf-qp966rql.js} +1 -1
- package/dist/assets/roleDescriptions-Dj1fvyuY.js +1 -0
- package/dist/assets/{table-J7fjwIkj.js → table-BKRXY_Eg.js} +1 -1
- package/dist/assets/{tabs-gkzHrCFV.js → tabs-JuirMY8K.js} +1 -1
- package/dist/assets/x-B2aLNZur.js +1 -0
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-D4h1Eu5S.js +0 -3
- package/dist/assets/AnomaliesTab-CFJwY8OX.js +0 -1
- package/dist/assets/AuditTab-CUsPVYYA.js +0 -1
- package/dist/assets/BridgeTab-DXLJRxq0.js +0 -1
- package/dist/assets/ChatDefaultsTab-pmrb04Z8.js +0 -1
- package/dist/assets/FeedbacksTab-C4SWnnLu.js +0 -1
- package/dist/assets/FilesTab-WF7Ywnw5.js +0 -1
- package/dist/assets/GroupsTab-D5yFhbEf.js +0 -1
- package/dist/assets/InstancesTab-rpykNSgd.js +0 -1
- package/dist/assets/KpiTab-BlR8kWRx.js +0 -1
- package/dist/assets/PreferencesTab-BLHBDN_p.js +0 -1
- package/dist/assets/ProjectPage-iG5lwJKE.js +0 -1
- package/dist/assets/PromptInjectionsTab-Bo48J3FL.js +0 -4
- package/dist/assets/RolesTab-DrrF836-.js +0 -1
- package/dist/assets/ScheduledTab-SZz4k8uK.js +0 -1
- package/dist/assets/ServiceAccountsTab-C4T3vVW5.js +0 -1
- package/dist/assets/SubAgentReportsTab-DaUidFsA.js +0 -1
- package/dist/assets/ThemeShowroom-C-tuB0xu.js +0 -1
- package/dist/assets/TracesTab-Dx1WMkPR.js +0 -1
- package/dist/assets/UsersTab-BmfZaKj1.js +0 -1
- package/dist/assets/VoiceTab-DcngXxuS.js +0 -1
- package/dist/assets/chevrons-up-down-BQwZKuAc.js +0 -1
- package/dist/assets/dispatchErrorInfo-DYk7zLf1.js +0 -1
- package/dist/assets/index-B_pZhBYM.js +0 -324
- package/dist/assets/mermaid-GHXKKRXX-p--yzMEy.js +0 -1
- package/dist/assets/roleDescriptions-DVC-Aspp.js +0 -1
- package/dist/assets/x-CNUeHA-C.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,AL as i,BR as a,CL as o,D as s,DL as c,EL as l,FL as u,FR as d,GL as ee,GR as f,HI as p,HL as m,HR as h,IL as g,IR as _,JI as te,JL as ne,JR as re,KL as ie,KR as ae,LR as oe,ML as se,NL as ce,OL as le,PL as ue,PR as de,QI as fe,QL as pe,RR as me,SL as v,TL as he,UL as ge,UR as _e,VL as ve,VR as ye,WL as be,WR as xe,XI as Se,XL as Ce,YI as we,YL as Te,YR as Ee,ZI as De,_B as y,aL as Oe,aR as ke,bB as Ae,cL as je,cR as Me,dB as Ne,dL as Pe,dR as Fe,eL as Ie,fR as Le,gR as Re,hR as ze,iL as Be,iR as Ve,jL as b,kL as He,lL as Ue,lR as x,mR as We,nL as Ge,nR as Ke,oL as qe,oR as Je,pB as S,pR as Ye,qL as Xe,qR as Ze,rL as Qe,rR as $e,sL as et,sR as tt,t as C,tL as nt,tR as rt,uL as it,wL as at,xL as ot,zR as st}from"./api-NzmVMBHn.js";import{t as ct}from"./list-Dbcww3Mb.js";import{t as w}from"./button-BHiy_q9F.js";import{$ as T,Bn as E,Bt as D,Ct as lt,Dn as ut,Dt as dt,Et as O,Q as k,Rt as A,St as ft,Tt as pt,Vn as j,X as M,Z as N,_n as mt,_t as ht,at as gt,bn as _t,bt as vt,dn as yt,et as P,gt as bt,hn as xt,it as St,jt as Ct,nt as wt,on as Tt,ot as Et,q as Dt,rt as Ot,tt as kt,vt as At,wt as jt,xn as Mt,xt as Nt,yt as Pt,zt as F}from"./index-DRTZkZgA.js";import{a as Ft,i as I,n as It,o as Lt,r as L,t as Rt}from"./table-BKRXY_Eg.js";import{t as zt}from"./FilterBar-BB9HpiR0.js";/* empty css */import{a as Bt,c as R,i as z,l as Vt,n as Ht,o as Ut,r as Wt,s as Gt,t as Kt,u as B}from"./TimezoneCombobox-I1Uc-Ubw.js";var qt=s(`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=s(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),V=t(e(),1),H=n();function U(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Yt({value:e,onChange:t}){let n=Vt(e),r=(0,V.useMemo)(()=>new Date,[]),[i,a]=(0,V.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,V.useState)(!1),c=(0,V.useMemo)(()=>U(S()),[]),l=(0,V.useMemo)(()=>new Intl.DateTimeFormat(S(),{month:`long`,year:`numeric`}),[]),d=(0,V.useMemo)(()=>new Intl.DateTimeFormat(S(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=R(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?u():d.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,H.jsxs)(A,{modal:!0,open:o,onOpenChange:s,children:[(0,H.jsx)(D,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":g(),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)(F,{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":ue(),onClick:()=>_(-1),children:(0,H.jsx)(j,{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":ce(),onClick:()=>_(1),children:(0,H.jsx)(E,{size:15,"aria-hidden":!0})})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>h(e.year,e.month,e.day),children:e.day},t)})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,H.jsxs)(M,{value:String(f),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),Number(e),p),children:[(0,H.jsx)(T,{size:`sm`,"aria-label":se(),children:(0,H.jsx)(P,{})}),(0,H.jsx)(N,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,H.jsx)(k,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,H.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,H.jsxs)(M,{value:String(p),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),f,Number(e)),children:[(0,H.jsx)(T,{size:`sm`,"aria-label":b(),children:(0,H.jsx)(P,{})}),(0,H.jsx)(N,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,H.jsx)(k,{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:s}){let u=S(),d=(0,V.useMemo)(()=>Zt(e),[e]),ee=(0,V.useMemo)(()=>$t(u),[u]),f=(0,V.useMemo)(()=>new Intl.DateTimeFormat(u,{month:`long`,year:`numeric`}),[u]),p=(0,V.useMemo)(()=>new Intl.DateTimeFormat(u,{month:`long`}),[u]),m=(0,V.useMemo)(()=>new Intl.DateTimeFormat(u,{hour:`2-digit`,minute:`2-digit`}),[u]),h=new Date,g=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()})},_=t===`year`?String(n.year):f.format(new Date(n.year,n.month,1));return(0,H.jsxs)(`div`,{className:`oc-cal`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,"aria-label":at(),onClick:()=>g(-1),children:(0,H.jsx)(j,{})}),(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),onClick:()=>g(1),children:(0,H.jsx)(E,{})}),(0,H.jsx)(w,{variant:`ghost`,size:`sm`,onClick:()=>i({year:h.getFullYear(),month:h.getMonth()}),children:he()})]}),(0,H.jsx)(`span`,{className:`oc-cal__title`,children:_}),(0,H.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,H.jsx)(w,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:c()}),(0,H.jsx)(w,{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:d,weekdays:ee,timeFmt:m,now:h,onEventClick:a}):(0,H.jsx)(an,{year:n.year,byDay:d,monthShortFmt:p,now:h,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),s?(0,H.jsx)(`p`,{className:`oc-cal__footnote`,children:s}):null]})}function rn({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=R(e.year,e.month);return(0,H.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Xt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,H.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,H.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,G).map(e=>(0,H.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,H.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,H.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>G?(0,H.jsx)(`span`,{className:`oc-cal__more`,children:v({count:o.length-G})}):null]},n)})]})}function an({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,H.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=Qt(t,e,o),c=R(e,o);return(0,H.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,H.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,H.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,H.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var on={h:36e5,min:6e4,s:1e3,ms:1};function sn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*on[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function K(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function q(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=K(t[0],0,59),r=K(t[1],0,23),i=K(t[2],1,31),a=K(t[3],1,12),o=K(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var cn=new Map;function J(e){let t=cn.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return cn.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=q(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=Ut(e)!==`active`,c=Z(s?null:sn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Gt(e)){case`ok`:return(0,H.jsx)(O,{variant:`secondary`,children:Te()});case`error`:return(0,H.jsx)(O,{variant:`destructive`,children:Xe()});case`running`:return(0,H.jsx)(O,{variant:`outline`,children:ie()});case`other`:return(0,H.jsx)(O,{variant:`outline`,children:e});case`none`:return(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=y(C.scheduled.listMyCrons),t=y(C.scheduled.getCronDetail),n=y(C.scheduled.listCronRuns),o=y(C.scheduled.updateCron),s=y(C.scheduled.removeCron),c=y(C.scheduled.runCronNow),l=dt(),u=Ae(C.me.getMe,{host:Dt})?.timezone,[g,se]=(0,V.useState)(null),[ce,ue]=(0,V.useState)(!1),[v,he]=(0,V.useState)(!1),[b,at]=(0,V.useState)(null),[E,D]=(0,V.useState)(null),[A,j]=(0,V.useState)(null),[F,R]=(0,V.useState)(null),[Vt,Gt]=(0,V.useState)(!1),[B,U]=(0,V.useState)(Ht),[W,Xt]=(0,V.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Zt=e=>{localStorage.setItem(`oc.sched.view`,e),Xt(e)},[Qt,$t]=(0,V.useState)(`month`),[G,rn]=(0,V.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),an=(0,V.useMemo)(()=>{let e=[];for(let t of g??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Bt(r,B)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[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()=>{ue(!0),he(!1);try{se(await e({}))}catch{he(!0)}finally{ue(!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(S(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{at(e);try{await t(),l.success(n),await q()}catch(e){l.toast({variant:`error`,title:x({code:dn(e)})})}finally{at(null)}},Z=(0,V.useRef)(0),Q=(0,V.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;j({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;j({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;j(null),l.toast({variant:`error`,title:x({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;R({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;R(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Q.current)return;R(null),l.toast({variant:`error`,title:x({code:dn(e)})})}},mn=async()=>{if(F===null)return;let e={};if(F.nameDirty&&F.name.trim()===``||F.messageDirty&&F.hasMessage&&F.message.trim()===``){l.toast({variant:`error`,title:te()});return}if(F.nameDirty&&F.name.trim()!==``&&(e.name=F.name.trim()),F.scheduleDirty){if(F.scheduleKind===`cron`&&F.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:F.cronExpr.trim(),...F.tz.trim()===``?{}:{tz:F.tz.trim()}};else if(F.scheduleKind===`every`){let t=Number(F.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[F.everyUnit])})}else if(F.scheduleKind===`at`&&F.at!==``){let t=Date.parse(F.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(F.scheduleDirty&&e.schedule===void 0){l.toast({variant:`error`,title:we()});return}if(F.messageDirty&&F.hasMessage&&F.message.trim()!==``&&(e.message=F.message.trim()),Object.keys(e).length===0){R(null);return}let t=Q.current;Gt(!0);try{await o({instanceName:F.instanceName,jobId:F.jobId,patch:e}),l.success(je()),t===Q.current&&R(null),await q()}catch(e){l.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:Ee()}),(0,H.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":i(),children:[(0,H.jsx)(w,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":He(),title:He(),"aria-pressed":W===`list`,onClick:()=>Zt(`list`),children:(0,H.jsx)(ct,{})}),(0,H.jsx)(w,{variant:W===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":le(),title:le(),"aria-pressed":W===`calendar`,onClick:()=>Zt(`calendar`),children:(0,H.jsx)(qt,{})})]}),(0,H.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:ce,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,H.jsx)(xt,{size:14,"aria-hidden":!0}),re()]})]}),g!==null&&hn>0?(0,H.jsxs)(zt,{q:B.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:be(),onReset:()=>U(Ht),canReset:Wt(B),children:[(0,H.jsxs)(M,{value:B.state,onValueChange:e=>U(t=>({...t,state:e})),children:[(0,H.jsx)(T,{size:`sm`,className:`w-40`,children:(0,H.jsx)(P,{})}),(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{value:`all`,children:ge()}),(0,H.jsx)(k,{value:`active`,children:d()}),(0,H.jsx)(k,{value:`paused`,children:_()}),(0,H.jsx)(k,{value:`auto-disabled`,children:de()})]})]}),(0,H.jsxs)(M,{value:B.result,onValueChange:e=>U(t=>({...t,result:e})),children:[(0,H.jsx)(T,{size:`sm`,className:`w-40`,children:(0,H.jsx)(P,{})}),(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{value:`all`,children:m()}),(0,H.jsx)(k,{value:`ok`,children:Te()}),(0,H.jsx)(k,{value:`error`,children:Xe()}),(0,H.jsx)(k,{value:`running`,children:ie()}),(0,H.jsx)(k,{value:`none`,children:ee()})]})]})]}):null,g===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":ce,children:v?Ze():Ne()}):W===`calendar`?(0,H.jsxs)(H.Fragment,{children:[v?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):null,g.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):(0,H.jsx)(nn,{events:sn.events,mode:Qt,cursor:G,onModeChange:$t,onCursorChange:rn,onEventClick:K,footnote:ot()})]}):(0,H.jsxs)(H.Fragment,{children:[v?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):null,g.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):null,g.map(e=>{let t=e.jobs.filter(e=>Bt(e,B)),n=Wt(B)&&e.jobs.length>0&&t.length===0;return(0,H.jsxs)(`section`,{style:{marginBottom:20},children:[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)(O,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:xe({code:e.error})}):e.jobs.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):n?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):(0,H.jsxs)(Rt,{children:[(0,H.jsx)(Ft,{children:(0,H.jsxs)(Lt,{children:[(0,H.jsx)(I,{children:h()}),(0,H.jsx)(I,{children:ye()}),(0,H.jsx)(I,{children:a()}),(0,H.jsx)(I,{children:st()}),(0,H.jsx)(I,{children:me()}),(0,H.jsx)(I,{children:Ce()}),(0,H.jsx)(I,{children:Pe()})]})}),(0,H.jsx)(It,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=b===r,a=e.manageSupported,s=e.kind===`openclaw`&&a;return(0,H.jsxs)(Lt,{ref:t.id!==null&&t.id===cn?J:void 0,"data-state":t.id!==null&&t.id===cn?`selected`:void 0,children:[(0,H.jsx)(L,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??oe()}),(0,H.jsx)(L,{children:(0,H.jsx)(O,{variant:`secondary`,children:t.agentId})}),(0,H.jsxs)(L,{className:`whitespace-nowrap`,children:[(0,H.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=bt(t.schedule),n=e===null?null:ht(e);return n===null?null:(0,H.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,H.jsx)(L,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,H.jsx)(L,{children:Ut(t)===`auto-disabled`?(0,H.jsx)(O,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:de()}):Ut(t)===`active`?(0,H.jsx)(O,{variant:`secondary`,children:d()}):Ut(t)===`paused`?(0,H.jsx)(O,{variant:`outline`,children:_()}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,H.jsxs)(L,{children:[(0,H.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,H.jsx)(O,{variant:`destructive`,title:t.lastDeliveryError??Re(),children:ne()}):null]}),(0,H.jsx)(L,{className:`whitespace-nowrap`,children:t.id===null?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,H.jsx)(ut,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,H.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:We(),"aria-label":We(),disabled:b!==null,onClick:()=>void X(r,async()=>{let n=await c({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},Me()),children:(0,H.jsx)(Tt,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:z(t)===`pause`?Ye():Le(),"aria-label":z(t)===`pause`?Ye():Le(),disabled:b!==null,onClick:()=>void X(r,()=>o({instanceName:e.instanceName,jobId:t.id,patch:{enabled:z(t)===`resume`}}),z(t)===`pause`?tt():Je()),children:z(t)===`pause`?(0,H.jsx)(Mt,{size:14,"aria-hidden":!0}):(0,H.jsx)(mt,{size:14,"aria-hidden":!0})}):null,s?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:it(),"aria-label":it(),disabled:b!==null,onClick:()=>void pn(e.instanceName,t),children:(0,H.jsx)(_t,{size:14,"aria-hidden":!0})}):null,s?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:Ue(),"aria-label":Ue(),disabled:b!==null,onClick:()=>void ln(e.instanceName,t),children:(0,H.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,a?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:Fe(),"aria-label":Fe(),disabled:b!==null,onClick:()=>D({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,H.jsx)(yt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:f()})]},e.instanceName)}),hn>0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:p()}):null]}),(0,H.jsx)(At,{open:E!==null,onOpenChange:e=>{e||D(null)},children:(0,H.jsxs)(Nt,{children:[(0,H.jsxs)(jt,{children:[(0,H.jsx)(pt,{children:Ve()}),(0,H.jsx)(ft,{children:$e({name:E?.name??``})})]}),(0,H.jsxs)(lt,{children:[(0,H.jsx)(vt,{children:Ke()}),(0,H.jsx)(Pt,{onClick:()=>{let e=E;D(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>s({instanceName:e.instanceName,jobId:e.jobId}),ke())},children:rt()})]})]})}),(0,H.jsx)(kt,{open:A!==null,onOpenChange:e=>{e||(Z.current++,j(null))},children:(0,H.jsxs)(wt,{style:{maxWidth:640},children:[(0,H.jsx)(gt,{children:(0,H.jsx)(Et,{children:et({name:A?.name??``})})}),A?.entries===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):A!==null&&A.entries.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):A===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:A.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:[pe({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,H.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,H.jsx)(kt,{open:F!==null,onOpenChange:e=>{e||(Q.current++,R(null))},children:(0,H.jsxs)(wt,{className:`oc-cronedit`,children:[(0,H.jsxs)(gt,{children:[(0,H.jsx)(Et,{children:Oe()}),(0,H.jsx)(Ot,{children:Be()})]}),F===null?null:F.loading?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):(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:h()}),(0,H.jsx)(Ct,{value:F.name,maxLength:200,onChange:e=>R({...F,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:Qe()}),(0,H.jsxs)(M,{value:F.scheduleKind,onValueChange:e=>R({...F,scheduleKind:e,scheduleDirty:!0}),children:[(0,H.jsx)(T,{children:(0,H.jsx)(P,{})}),(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{value:`cron`,children:Ge()}),(0,H.jsx)(k,{value:`every`,children:nt()}),(0,H.jsx)(k,{value:`at`,children:Ie()})]})]}),F.scheduleKind===`cron`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(Ct,{value:F.cronExpr,onChange:e=>R({...F,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,H.jsx)(Kt,{value:F.tz,onChange:e=>R({...F,tz:e,scheduleDirty:!0}),fallbackTz:u??void 0})]}):F.scheduleKind===`every`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(Ct,{type:`number`,min:1,value:F.everyValue,onChange:e=>R({...F,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,H.jsxs)(M,{value:F.everyUnit,onValueChange:e=>R({...F,everyUnit:e,scheduleDirty:!0}),children:[(0,H.jsx)(T,{style:{maxWidth:160},children:(0,H.jsx)(P,{})}),(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{value:`minutes`,children:r()}),(0,H.jsx)(k,{value:`hours`,children:fe()}),(0,H.jsx)(k,{value:`days`,children:De()})]})]})]}):(0,H.jsx)(Yt,{value:F.at,onChange:e=>R({...F,at:e,scheduleDirty:!0})})]}),F.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:ze()}),(0,H.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:F.message,onChange:e=>R({...F,message:e.target.value,messageDirty:!0})})]}):null]}),(0,H.jsxs)(St,{children:[(0,H.jsx)(w,{variant:`ghost`,onClick:()=>R(null),children:Ke()}),(0,H.jsxs)(w,{onClick:()=>void mn(),disabled:F===null||F.loading||Vt,children:[Vt?(0,H.jsx)(ut,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,Se()]})]})]})})]})}export{pn as ScheduledTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,AN as i,BN as ee,CN as a,CP as o,DN as s,DP as te,EN as c,EP as ne,FN as re,GN as ie,HN as ae,IN as oe,JN as se,KN as ce,LN as le,MN as l,NN as ue,ON as u,OP as de,PN as fe,QN as pe,RN as me,SN as d,SP as he,TN as f,TP as ge,UN as _e,VN as ve,WN as ye,XN as be,YN as xe,ZN as Se,_B 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,lN as x,lP as Ie,mN as S,mP as Le,nP as Re,oP as ze,pN as C,pP as Be,qN as Ve,rP as He,sP as Ue,t as w,tP as We,uN as T,uP as Ge,vN as E,vP as Ke,wN as D,wP as O,xN as k,xP as qe,yB as A,yN as j,yP as Je,zN as Ye}from"./api-NzmVMBHn.js";import{t as M}from"./button-BHiy_q9F.js";import{$ as N,Bn as Xe,Dt as Ze,Et as P,Gn as Qe,Hn as $e,In as F,Kn as et,Q as I,U as tt,Un as L,X as R,Z as z,_ as nt,at as B,ct as V,et as H,it as U,jt as rt,nt as W,ot as G,rt as it,st as K,tt as q}from"./index-DRTZkZgA.js";import{t as at}from"./FilterBar-BB9HpiR0.js";import{t as ot}from"./DataTableShell-tMQLeAkL.js";import{t as st}from"./roleDescriptions-Dj1fvyuY.js";var J=t(e(),1),Y=n(),ct=[{value:`never`,label:()=>v(),days:null},{value:`30`,label:()=>S(),days:30},{value:`90`,label:()=>C(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=et({from:`/settings/serviceAccounts`}),t=Qe({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Z,[a,s]=(0,J.useState)(Z),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),u=p(w.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:i===Z?void 0:i===`disabled`}}),d=p(w.apiKeys.listKeys,{}),f=p(w.apiKeys.listRoles,{}),we=A(w.apiKeys.createServiceAccount),m=A(w.apiKeys.updateServiceAccount),h=A(w.apiKeys.deleteServiceAccount),g=Ce(w.apiKeys.mintApiKey),_=A(w.apiKeys.revokeApiKey),v=tt(),y=Ze(),b=n!==``||a!==Z||i!==Z;function x(){s(Z),t({search:{},replace:!0})}let[S,C]=(0,J.useState)(!1),[T,E]=(0,J.useState)(Q),[D,k]=(0,J.useState)(null),[j,F]=(0,J.useState)(new Set),[L,B]=(0,J.useState)(null),V=(0,J.useRef)(!1),[U,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 d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function $(e){F(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{D?(await m({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),y.success(Ve())):await we({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Q),k(null),C(!1)}catch(e){y.error(D?se():xe(),e)}}function ft(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),C(!0)}async function pt(e){if(V.current)return;V.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;B(e._id);try{let t=await g({serviceAccountId:e._id,expiresAt:r});q({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(ce(),e)}finally{V.current=!1,B(null)}}async function mt(e){if(await v({title:ie(),description:(0,Y.jsxs)(Y.Fragment,{children:[ye(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,_e(),` `,(0,Y.jsx)(`strong`,{children:ae()}),` `,ve()]}),confirmWord:e.name,confirmLabel:ee(),destructive:!0}))try{await h({serviceAccountId:e._id}),y.success(Ye(),e.name)}catch(e){y.error(me(),e)}}async function ht(e){if(await v({title:le(),description:(0,Y.jsxs)(Y.Fragment,{children:[oe(),` `,(0,Y.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,re()]}),confirmLabel:fe(),destructive:!0})&&!U.has(e._id)){W(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){y.error(ue(),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:Fe()}),(0,Y.jsxs)(at,{q:n,onQChange:c,searchPlaceholder:de(),onReset:x,canReset:b,children:[(0,Y.jsxs)(R,{value:a,onValueChange:s,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Y.jsx)(H,{placeholder:te()})}),(0,Y.jsxs)(z,{children:[(0,Y.jsx)(I,{value:Z,children:ne()}),(f??[]).map(e=>(0,Y.jsx)(I,{value:e.key,children:e.key},e._id))]})]}),(0,Y.jsxs)(R,{value:i,onValueChange:l,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(H,{})}),(0,Y.jsxs)(z,{children:[(0,Y.jsx)(I,{value:Z,children:ge()}),(0,Y.jsx)(I,{value:`active`,children:O()}),(0,Y.jsx)(I,{value:`disabled`,children:o()})]})]})]}),(0,Y.jsx)(ot,{title:he(),rows:u,addLabel:qe(),onAdd:()=>{E(Q),k(null),C(!0)},emptyHint:De(),isExpanded:e=>j.has(e._id),renderExpanded:e=>(0,Y.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:U}),rowActions:e=>[...(e.managedBy??null)===null?[{label:Me(),onSelect:()=>ft(e)},{label:Je(),onSelect:()=>void pt(e)}]:[],{label:j.has(e._id)?Ke():Te(),onSelect:()=>$(e._id)},...(e.managedBy??null)===null?[{label:Ne(),variant:`destructive`,onSelect:()=>void mt(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":j.has(e._id)?Le():Be(),onClick:()=>$(e._id),children:j.has(e._id)?(0,Y.jsx)($e,{}):(0,Y.jsx)(Xe,{})})},{header:je(),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:ke(),sort:e=>e.roleKey,cell:e=>(0,Y.jsx)(P,{variant:`secondary`,children:e.roleKey})},{header:Ge(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,Y.jsx)(P,{variant:`destructive`,children:o()}):(0,Y.jsx)(P,{variant:`outline`,children:O()})},{header:Ie(),cell:e=>(0,Y.jsxs)(R,{value:G[e._id]??`never`,onValueChange:t=>it(n=>({...n,[e._id]:t})),children:[(0,Y.jsx)(N,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(z,{children:ct.map(e=>(0,Y.jsx)(I,{value:e.value,children:e.label()},e.value))})]})},{header:Oe(),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:L===e._id?Ue():ze({count:t})})}}]}),(0,Y.jsx)(nt,{open:S,onOpenChange:e=>{C(e),e||k(null)},title:D?Ee():Re(),description:D?Pe():We(),canSubmit:!!(T.name&&T.roleKey),onSubmit:dt,submitLabel:D?He():Ae(),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:r()}),(0,Y.jsx)(rt,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:pe()}),(0,Y.jsxs)(R,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,Y.jsx)(N,{className:`w-full`,children:(0,Y.jsx)(H,{placeholder:Se()})}),(0,Y.jsx)(z,{children:(f??[]).map(e=>(0,Y.jsxs)(I,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===T.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:be()}),(0,Y.jsx)(rt,{value:T.description,onChange:e=>E({...T,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:y()}):(0,Y.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{children:i()}),(0,Y.jsx)(`th`,{children:b()}),(0,Y.jsx)(`th`,{children:u()}),(0,Y.jsx)(`th`,{children:s()}),(0,Y.jsx)(`th`,{children:c()}),(0,Y.jsx)(`th`,{children:f()}),(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)(P,{variant:`secondary`,children:e.roleKey})}),(0,Y.jsx)(`td`,{children:V(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)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?D():a()}):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)(B,{children:[(0,Y.jsx)(G,{children:d()}),(0,Y.jsx)(it,{children:k({name:e.accountName})})]}),(0,Y.jsx)(`div`,{className:`oc-sa__minted-warning`,children:m()}),(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)(M,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":j(),children:[n?(0,Y.jsx)(L,{}):(0,Y.jsx)(F,{}),n?E():we()]})]}),(0,Y.jsx)(U,{children:(0,Y.jsx)(M,{onClick:()=>{r(!1),t()},children:_()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?g():V(e)}function pt(e){return e===null?`—`:K(e)}function mt(e){return e.disabled?(0,Y.jsx)(P,{variant:`destructive`,children:h()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,Y.jsx)(P,{variant:`outline`,children:T()}):(0,Y.jsx)(P,{variant:`outline`,children:x()})}export{$ as ServiceAccountsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,Ac as i,Bc as a,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,yB as H,zc as U}from"./api-NzmVMBHn.js";import{t as W}from"./button-BHiy_q9F.js";import{U as G,ct as K}from"./index-DRTZkZgA.js";import{t as q}from"./DataTableShell-tMQLeAkL.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=H(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=O(z.subAgentReports.listForAdmin,{}),t=H(z.subAgentReports.readReport),n=H(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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,AF as i,AI as a,BF as o,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 ee,KF as b,LF as te,LI as ne,MF as re,MI as ie,NF as ae,NI as oe,OF as se,OI as x,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 ve,UF as ye,VF as be,WF as xe,XF as Se,YF as Ce,ZF as we,_B as Te,_F as Ee,_I as De,aI as Oe,bB as S,bF as C,bI as ke,cB as Ae,cI as je,dI as Me,eI as Ne,fI as Pe,gF as Fe,gI as Ie,hI as Le,iI as Re,jF as ze,jI as Be,kF as Ve,kI as He,lB as Ue,lI as We,mI as Ge,nI as Ke,oI as qe,pI as Je,qF as Ye,r as Xe,rI as Ze,sB as Qe,sI as $e,t as w,tI as T,uI as et,vF as tt,vI as nt,wF as E,wI as rt,wc as D,xF as it,xI as at,yB as O,yF as ot,yI as st,zF as ct}from"./api-NzmVMBHn.js";import{t as k}from"./x-B2aLNZur.js";import{t as A}from"./button-BHiy_q9F.js";import{$ as j,Et as M,Fn as lt,Ft as ut,G as dt,It as N,K as ft,Lt as pt,Mt as mt,Nt as ht,Pn as P,Pt as F,Q as I,Un as L,X as R,Z as z,et as B,jt as V,ln as H,q as U,ut as W}from"./index-DRTZkZgA.js";import{t as gt}from"./localePickerView-C2RmOS86.js";import{a as _t,i as vt,n as yt,o as bt,r as xt,t as St}from"./card-Dgi0cIBy.js";import{a as Ct,i as G,n as wt,o as K,r as q,t as Tt}from"./table-BKRXY_Eg.js";import{t as Et}from"./TimeRangePicker-BNzXp6XH.js";import{t as Dt}from"./FilterBar-BB9HpiR0.js";import{t as Ot}from"./AdvancedFilter-BbGwAk2J.js";var J=t(e(),1),kt=.1,At=[248,248,248],jt=[24,24,24];function Mt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Nt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function Pt(e,t,n){return Nt(e,t,n)>=kt}function Ft(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function It(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ct());if(e.size>Lt)throw Error(de());let{source:n,width:r,height:i,cleanup:a}=await Ht(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Rt/r,zt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(v());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Mt(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(v());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);Pt(e.data,d.width,d.height)?Ft(e.data,t.variantFor===`dark`?At:jt):It(e.data),p.putImageData(e,0,0)}let h=Pt(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),g=await Y(f,`image/webp`,Bt)??await Y(f,`image/png`);if(!g)throw Error(m());return{blob:g,hasAlpha:h}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return Ut(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Ut(e)}async function Ut(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(te())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Wt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Gt={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?Ue():e===`dark`?Ae():Qe()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Xe(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(L,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":ve(),title:ve(),children:(0,X.jsx)(lt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=S(w.charts.listMyCharts),r=O(w.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:a()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:He()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:x(),subtitle:d(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?p():n.via===`owner`?_e():rt({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Wt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()}):null]})}function Qt(){let e=O(w.charts.importChart),[t,n]=(0,J.useState)(``),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(T())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(r());return}let o;try{o=JSON.parse(i)}catch{s(T());return}d(!0);try{await e({name:t.trim(),tokens:o}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:We()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:je()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:$e()}),(0,X.jsx)(V,{value:t,onChange:e=>n(e.target.value),placeholder:qe(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Oe()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:Re(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(H,{className:`size-4`}),Ze(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(A,{size:`sm`,disabled:u,onClick:()=>void p(),children:Ke()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:Ne()}):null]})]})}function $t({chart:e}){let t=Te(w.charts.setChartLogo),n=O(w.charts.removeChartLogo),[r,i]=(0,J.useState)(!1),[a,s]=(0,J.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){s(null),i(!0);try{let{blob:i,hasAlpha:o}=await Vt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?b():g()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(H,{className:`size-4`}),t?ye():xe(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:be()}):null,t?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:_()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ye()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:o()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=S(w.me.getMe,{host:U}),n=O(w.charts.addChartDomain),r=O(w.charts.removeChartDomain),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(null),[l,u]=(0,J.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,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ce()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:i()}):d.map(e=>(0,X.jsxs)(M,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ve({domain:e}),onClick:()=>void p(e),children:(0,X.jsx)(k,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(V,{value:a,onChange:e=>o(e.target.value),placeholder:re(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:ze()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ae()}),s?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=O(w.charts.updateChart),n=O(w.charts.deleteChart),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.name),[s,c]=(0,J.useState)(()=>$(e.tokens)),[d,p]=(0,J.useState)(e.tokens.bpm??0),[m,h]=(0,J.useState)(null),[g,_]=(0,J.useState)(!1);function v(){o(e.name),c($(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(E()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:v,children:Ce()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:ee()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:f()}),(0,X.jsx)(V,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:D()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:d,onChange:e=>p(Number(e.target.value)),"aria-label":D()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:d===0?l():`${d} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:he()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ge()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),m?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:m}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,disabled:g,onClick:()=>void y(),children:se()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:u()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=S(w.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ue()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:we()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Se()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=O(w.charts.addChartToGroupPool),r=O(w.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(M,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Le():e.kind===`custom`&&e.scope===`personal`?C():Ie()}),e.isGlobalDefault?(0,X.jsx)(M,{variant:`default`,children:Ge()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Pe()}),(a??[]).map(e=>(0,X.jsxs)(M,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":et({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(k,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(R,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(j,{size:`sm`,className:`w-56`,children:(0,X.jsx)(B,{placeholder:Me()})}),(0,X.jsx)(z,{children:s.map(e=>(0,X.jsx)(I,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Je()}):null]})]})}function an({chart:e}){let t=O(w.charts.promoteChartToCommon),n=O(w.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(E()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(M,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?ot():C()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:it({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:tt()}):null,(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Ee()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=O(w.admin.setDefaultThemeMode),i=O(w.admin.setDefaultLocale),a=O(w.charts.setDefaultChart),o=S(w.charts.listChartsAdmin),c=S(w.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ie()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Be()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:at()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:x()}),ft.map(e=>(0,X.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ke()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:st()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(rn,{chart:e,groups:c??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:nt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:De()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(en,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:s()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Fe()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(an,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:fe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(A,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:y()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:gt().map(e=>(0,X.jsx)(A,{variant:u===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:le()})]})]})}function sn(){let e=S(w.me.getMe,{host:U}),t=dt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(nn,{}),e?.role===`admin`?(0,X.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,J.useState)(!0),[n,r]=(0,J.useState)(`per-user`),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(Z),[c,l]=(0,J.useState)(Z),[u,d]=(0,J.useState)(Gt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Gt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(sn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:oe()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(A,{variant:`outline`,children:`Outline`}),(0,X.jsx)(A,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(A,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(A,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,children:`Small`}),(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{size:`lg`,children:`Large`}),(0,X.jsx)(A,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(P,{})}),(0,X.jsx)(A,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(M,{children:`Default`}),(0,X.jsx)(M,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(M,{variant:`outline`,children:`Outline`}),(0,X.jsx)(M,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(V,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(R,{value:n,onValueChange:r,children:[(0,X.jsx)(j,{className:`w-56`,children:(0,X.jsx)(B,{placeholder:`Select…`})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(I,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(I,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(W,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(Dt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(R,{value:o,onValueChange:s,children:[(0,X.jsx)(j,{size:`sm`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(I,{value:Z,children:`Toutes directions`}),(0,X.jsx)(I,{value:`inbound`,children:`inbound`}),(0,X.jsx)(I,{value:`outbound`,children:`outbound`}),(0,X.jsx)(I,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(R,{value:c,onValueChange:l,children:[(0,X.jsx)(j,{size:`sm`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(I,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(I,{value:`info`,children:`info`}),(0,X.jsx)(I,{value:`warn`,children:`warn`}),(0,X.jsx)(I,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(Ot,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Et,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(mt,{children:[(0,X.jsx)(pt,{asChild:!0,children:(0,X.jsx)(A,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(P,{})})}),(0,X.jsxs)(ht,{align:`start`,children:[(0,X.jsx)(ut,{children:`Actions`}),(0,X.jsx)(N,{}),(0,X.jsx)(F,{children:`Edit`}),(0,X.jsx)(F,{children:`Duplicate`}),(0,X.jsx)(N,{}),(0,X.jsx)(F,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(St,{className:`w-80`,children:[(0,X.jsxs)(_t,{children:[(0,X.jsx)(bt,{children:`Instance`}),(0,X.jsx)(xt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(yt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(vt,{className:`gap-2`,children:[(0,X.jsx)(A,{size:`sm`,children:`Save`}),(0,X.jsx)(A,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Tt,{children:[(0,X.jsx)(Ct,{children:(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{className:`w-8`,children:(0,X.jsx)(W,{"aria-label":`select all`})}),(0,X.jsx)(G,{children:`Name`}),(0,X.jsx)(G,{children:`Mode`}),(0,X.jsx)(G,{className:`text-right`,children:`Status`}),(0,X.jsx)(G,{className:`w-8`})]})}),(0,X.jsx)(wt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(K,{children:[(0,X.jsx)(q,{children:(0,X.jsx)(W,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(q,{className:`font-medium`,children:e.n}),(0,X.jsx)(q,{children:(0,X.jsx)(M,{variant:`secondary`,children:e.m})}),(0,X.jsx)(q,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(L,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(q,{children:(0,X.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(P,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{cn as ThemeShowroom};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Qy as i,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Qy as i,Zy as a,ab as o,ao as s,cb as c,co as l,eb as u,ib as d,io as f,lb as p,lo as m,nb as h,ob as g,oo as _,rb as v,ro as y,sb as b,so as x,tb as S}from"./api-NzmVMBHn.js";import{t as C}from"./button-BHiy_q9F.js";import{Ht as w,Ln as T,Ut as E,Vt as D,Wt as O,ct as k,jt as A,mn as j}from"./index-DRTZkZgA.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:p(),from:`now-5m`},{label:c(),from:`now-15m`},{label:b(),from:`now-30m`},{label:g(),from:`now-1h`},{label:o(),from:`now-3h`},{label:d(),from:`now-6h`},{label:v(),from:`now-12h`},{label:h(),from:`now-24h`},{label:S(),from:`now-2d`},{label:u(),from:`now-7d`},{label:r(),from:`now-30d`},{label:i(),from:`now-90d`},{label:a(),from:`now-520w`}];function L(e){return k(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,r]=(0,M.useState)(!1),[i,a]=(0,M.useState)(``),o=F(e),[c,u]=(0,M.useState)(()=>z(o.from)),[d,p]=(0,M.useState)(()=>z(o.to));function h(t){if(t){let t=F(e);u(z(t.from)),p(z(t.to)),a(``)}r(t)}function g(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function v(){let e=B(c),n=B(d);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let b=(0,M.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),S=B(c)!==null&&B(d)!==null;return(0,H.jsxs)(E,{open:n,onOpenChange:h,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(T,{}),R(e)]})}),(0,H.jsx)(w,{children:(0,H.jsx)(D,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:m()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:l()}),(0,H.jsx)(A,{type:`datetime-local`,value:c,onChange:e=>u(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,H.jsx)(A,{type:`datetime-local`,value:d,onChange:e=>p(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!S,onClick:v,children:_()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(j,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(A,{value:i,onChange:e=>a(e.target.value),placeholder:s(),"aria-label":f()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:y()}):b.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>g(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BL as r,LL as i,RL as a,zL as o}from"./api-NzmVMBHn.js";import{t as s}from"./chevrons-up-down-ByP4WpSK.js";import{Bt as c,Rt as l,Un as u,jt as d,zt as f}from"./index-DRTZkZgA.js";/* empty css */var p=t(e(),1);function m(e){if(e==null||e===``)return`none`;let t=e.trim().toLowerCase();return t===`ok`||t===`success`||t===`completed`?`ok`:t===`error`||t===`failed`||t===`failure`?`error`:t===`running`||t===`in_progress`||t===`pending`?`running`:`other`}function h(e){return e===!0?`active`:e===!1?`paused`:`unknown`}function g(e){return typeof e.autoDisabledReason==`string`&&e.autoDisabledReason!==``?`auto-disabled`:h(e.enabled)}function _(e){return g(e)===`active`?`pause`:`resume`}var v={q:``,state:`all`,result:`all`};function y(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function b(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&g(e)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function x(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function S(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function C(e,t,n=50,r){let i=e=>e.toLowerCase().replace(/[_/]+/g,` `),a=i(t.trim()),o=(a===``?e:e.filter(e=>i(e).includes(a))).slice(0,n);return r&&r!==``&&!o.includes(r)?[r,...o].slice(0,n):o}function w(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++){let n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+e);i.push({year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),inMonth:n.getMonth()===t})}return i}function T(e,t,n,r,i){let a=(e,t=2)=>String(e).padStart(t,`0`);return`${a(e,4)}-${a(t+1)}-${a(n)}T${a(r)}:${a(i)}`}function E(e){let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(t===null)return null;let[,n,r,i,a,o]=t;return{year:Number(n),month:Number(r)-1,day:Number(i),hour:Number(a),minute:Number(o)}}var D=n();function O({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>x(),[]),[g,_]=(0,p.useState)(!1),[v,y]=(0,p.useState)(``);if(h.length===0)return(0,D.jsx)(d,{value:e,onChange:e=>t(e.target.value),placeholder:m||S()||`America/Toronto`,className:n});let b=C(h,v,h.length,e||void 0),w=e===``?m||S()||i():e;return(0,D.jsxs)(l,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(c,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":r(),children:[(0,D.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,D.jsx)(s,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,D.jsxs)(f,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,D.jsx)(d,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:o(),className:`oc-tzcombo__search`}),(0,D.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:b.length===0?(0,D.jsx)(`p`,{className:`oc-tzcombo__empty`,children:a()}):b.map(n=>(0,D.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),y(``)},children:[(0,D.jsx)(u,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,D.jsx)(`span`,{children:n})]},n))})]})]})}export{b as a,w as c,_ as i,E as l,v as n,g as o,y as r,m as s,O as t,T as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$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 ee,IS as m,JS as h,Jk as g,KS as _,Kk as v,LS as te,MA as y,NA as b,NS as x,OA as ne,PS as S,QS as re,Qk as ie,RS as ae,SA as oe,TA as se,US as ce,VS as le,WS as ue,Wk as de,XS as fe,Xk as pe,YS as me,Yk as he,ZS as ge,Zk as _e,_A as ve,aC as ye,aa as C,bA as w,bB as T,cC as be,dA as E,dC as xe,eA as D,eC as Se,fA as O,fC as Ce,gA as k,gC as we,hA as A,hC as Te,iA as Ee,iC as De,ia as j,jA as M,kA as N,lA 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 P,sC as Ve,t as F,tA as He,tC as Ue,uA as I,uC as We,vA as Ge,wA as Ke,xA as qe,yA as Je,yB as L,zS as Ye}from"./api-NzmVMBHn.js";import{t as Xe}from"./x-B2aLNZur.js";import{i as Ze,n as Qe,r as $e,t as et}from"./tabs-JuirMY8K.js";import{t as R}from"./button-BHiy_q9F.js";import{$ as z,Et as B,Gn as tt,H as nt,In as rt,Kn as it,Mn as at,Nn as ot,On as st,Q as V,Un as ct,X as H,Z as U,a as lt,at as ut,ct as W,et as G,i as dt,lt as ft,nt as pt,o as mt,ot as ht,q as gt,rt as _t,s as vt,tt as yt}from"./index-DRTZkZgA.js";import{n as bt}from"./TimeRangePicker-BNzXp6XH.js";import{t as xt}from"./FilterBar-BB9HpiR0.js";import{t as St}from"./AdvancedFilter-BbGwAk2J.js";import{t as Ct}from"./DataTableShell-tMQLeAkL.js";var wt=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`}]]),K=t(e(),1),q=n(),J={kind:`relative`,from:`now-520w`,to:`now`},Y=e=>e===null?`-`:String(Math.round(e));function Tt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?Ae():n===`agent`?`${Ie()} - ${r}`:e}function Et(){let e=T(F.me.getMe,{host:gt})?.role===`admin`,t=T(F.deliveryTiming.getDeliveryStatus,{}),n=L(F.deliveryTiming.startDeliveryRecord),r=L(F.deliveryTiming.stopDeliveryRecord),[i,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(!1),l=t?.recording??!1,d=async()=>{c(!0);try{l?await r({}):await n({})}finally{c(!1)}};return(0,q.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold`,children:b()}),(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:y()})]}),e?(0,q.jsx)(R,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void d(),children:l?a():M()}):null]}),l?(0,q.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,q.jsx)(B,{variant:`secondary`,children:N()}),t?.startedAt?(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:ne({time:ft(t.startedAt)})}):null]}):null,(0,q.jsx)(`div`,{children:(0,q.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:i?se():u()})}),i?(0,q.jsx)(Dt,{isAdmin:e}):null]})}function Dt({isAdmin:e}){let t=T(F.deliveryTiming.listDeliverySessions,{}),n=L(F.deliveryTiming.deleteDeliverySessions),[r,i]=(0,K.useState)(``),[a,o]=(0,K.useState)(`all`),[c,l]=(0,K.useState)(J),[u,d]=(0,K.useState)(null),{from:f,to:ee}=bt(c),m=c.to===`now`?1/0:ee,h=r.trim()!==``||a!==`all`||c!==J,g=()=>{i(``),o(`all`),l(J)},_=(0,K.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,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(xt,{q:r,onQChange:i,searchPlaceholder:s(),timeRange:c,onTimeRangeChange:l,onReset:g,canReset:h,children:(0,q.jsxs)(H,{value:a,onValueChange:e=>o(e),children:[(0,q.jsx)(z,{size:`sm`,className:`w-36`,children:(0,q.jsx)(G,{})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(V,{value:`all`,children:oe()}),(0,q.jsx)(V,{value:`active`,children:qe()}),(0,q.jsx)(V,{value:`stopped`,children:w()})]})]})}),(0,q.jsx)(Ct,{title:Ke(),rows:_,emptyHint:p(),columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(R,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?E():O(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,q.jsx)(ot,{size:15,"aria-hidden":!0}):(0,q.jsx)(at,{size:15,"aria-hidden":!0})})},{header:Je(),sort:e=>e.startedAt,cell:e=>(0,q.jsx)(`span`,{className:`tabular-nums`,children:W(e.startedAt)})},{header:Ge(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,q.jsx)(`span`,{className:`tabular-nums`,children:W(e.stoppedAt)})},{header:ve(),sort:e=>e.count,cell:e=>(0,q.jsx)(`span`,{className:`tabular-nums`,children:Y(e.count)})},{header:k(),sort:e=>e.startedBy,cell:e=>Tt(e.startedBy)},{header:A(),sort:e=>e.active,cell:e=>e.active?(0,q.jsx)(B,{variant:`secondary`,children:qe()}):(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:w()})}],rowActions:e?e=>[{label:I(),variant:`destructive`,onSelect:()=>v([e.sessionId])}]:void 0,bulkActions:e?[{label:I(),variant:`destructive`,onSelect:e=>v(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,q.jsx)(Ot,{sessionId:e.sessionId})})]})}function Ot({sessionId:e}){let t=T(F.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,K.useState)(!1);return(0,q.jsx)(kt,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(nt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function kt({report:e,copied:t,onCopy:n}){if(!e)return(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()});if(e.count===0||e.segments===null)return(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:l()});let r=e.segments,a=(e,t)=>(0,q.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,q.jsx)(`td`,{className:`py-1`,children:e}),(0,q.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,q.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[Y(t.p50),` / `,Y(t.p95),` / `,Y(t.max)]})]});return(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,de()]}),(0,q.jsxs)(R,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,q.jsx)(ct,{size:13,"aria-hidden":!0}):(0,q.jsx)(rt,{size:13,"aria-hidden":!0}),t?v():ze()]})]}),(0,q.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,q.jsx)(`th`,{className:`py-1 font-medium`,children:Me()}),(0,q.jsx)(`th`,{className:`py-1 text-right font-medium`,children:He()}),(0,q.jsx)(`th`,{className:`py-1 text-right font-medium`,children:D()})]})}),(0,q.jsxs)(`tbody`,{children:[a(i(),r.bridge),a(ie(),r.A),a(_e(),r.C)]})]}),(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),e.truncated?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):null,(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:he()})]})}var At=[50,100,200,500],X=`all`,Z=`__all__`,jt=[`2xx`,`4xx`,`5xx`],Mt=[`user`,`service`,`system`],Nt=[`inbound`,`outbound`,`internal`],Pt={kind:`relative`,from:`now-30d`,to:`now`},Ft=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:Fe()},{value:`principalType`,label:C()},{value:`direction`,label:`direction`},{value:`roleKey`,label:j()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=it({from:`/settings/traces`}),t=tt({from:`/settings/traces`}),n=e.limit,i=e.kind,a=e.statusClass??Z,s=e.principalType??Z,c=e.direction??Z,l=e.roleKey??Z,u=e.q??``,d=e.correlationId,p=dt(e.from,e.to),g=(0,K.useMemo)(()=>vt(e.adv),[e.adv]),{from:v,to:y}=bt(p),[b,x]=(0,K.useState)(null),[ne,S]=(0,K.useState)(null),ie=e=>void t({search:t=>({...t,limit:e})}),oe=e=>void t({search:t=>({...t,kind:e})}),se=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),de=e=>void t({search:t=>({...t,statusClass:e===Z?void 0:e})}),pe=e=>void t({search:t=>({...t,principalType:e===Z?void 0:e})}),he=e=>void t({search:t=>({...t,direction:e===Z?void 0:e})}),_e=e=>void t({search:t=>({...t,roleKey:e===Z?void 0:e})}),ve=e=>void t({search:t=>({...t,...mt(e)})}),C=e=>void t({search:t=>({...t,adv:lt(e)}),replace:!0}),w=T(F.observability.listEvents,{limit:n}),E=T(F.observability.listEvents,{limit:n,kind:i===X?void 0:i,...d?{correlationId:d}:{},filter:{q:u||void 0,from:v,to:y,statusClass:a===Z?void 0:a,principalType:s===Z?void 0:s,direction:c===Z?void 0:c,roleKey:l===Z?void 0:l,advanced:g.length>0?g:void 0}}),D=(0,K.useMemo)(()=>{let e=new Set;for(let t of w??[])e.add(t.kind);return[...e].sort()},[w]),O=(0,K.useMemo)(()=>{let e=new Set;for(let t of w??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[w]),k=u!==``||a!==Z||s!==Z||c!==Z||l!==Z||g.length>0||p.kind!==`relative`||p.from!==Pt.from;function A(){t({search:{limit:100,kind:`all`},replace:!0})}let j=b?w?.filter(e=>e.correlationId===b):E,M=e.section,N=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,q.jsxs)(et,{value:M,onValueChange:e=>N(e),children:[(0,q.jsxs)($e,{className:`w-full`,children:[(0,q.jsxs)(Ze,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,q.jsx)(st,{size:13,"aria-hidden":!0}),Ee()]}),(0,q.jsxs)(Ze,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,q.jsx)(wt,{size:13,"aria-hidden":!0}),Be()]})]}),(0,q.jsx)(Qe,{value:`latency`,children:(0,q.jsx)(Et,{})}),(0,q.jsxs)(Qe,{value:`events`,className:`flex flex-col gap-3`,children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[we(),(0,q.jsx)(`strong`,{children:Te()}),je(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:Le()})]}),(0,q.jsxs)(xt,{q:u,onQChange:se,searchPlaceholder:Ce(),timeRange:p,onTimeRangeChange:ve,onReset:A,canReset:k,children:[(0,q.jsxs)(H,{value:a,onValueChange:de,children:[(0,q.jsx)(z,{size:`sm`,className:`w-32`,children:(0,q.jsx)(G,{placeholder:xe()})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(V,{value:Z,children:We()}),jt.map(e=>(0,q.jsx)(V,{value:e,children:e},e))]})]}),(0,q.jsxs)(H,{value:s,onValueChange:pe,children:[(0,q.jsx)(z,{size:`sm`,className:`w-32`,children:(0,q.jsx)(G,{placeholder:ke()})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(V,{value:Z,children:be()}),Mt.map(e=>(0,q.jsx)(V,{value:e,children:e},e))]})]}),(0,q.jsxs)(H,{value:c,onValueChange:he,children:[(0,q.jsx)(z,{size:`sm`,className:`w-32`,children:(0,q.jsx)(G,{placeholder:Ve()})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(V,{value:Z,children:Pe()}),Nt.map(e=>(0,q.jsx)(V,{value:e,children:e},e))]})]}),(0,q.jsxs)(H,{value:l,onValueChange:_e,children:[(0,q.jsx)(z,{size:`sm`,className:`w-36`,children:(0,q.jsx)(G,{placeholder:ye()})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(V,{value:Z,children:De()}),O.map(e=>(0,q.jsx)(V,{value:e,children:e},e))]})]}),(0,q.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:i===X?``:i,placeholder:P(),"aria-label":P(),onChange:e=>{let t=e.target.value.trim();oe(t===``?X:t)}}),(0,q.jsx)(`datalist`,{id:`oc-trace-kinds`,children:D.map(e=>(0,q.jsx)(`option`,{value:e},e))}),(0,q.jsxs)(H,{value:String(n),onValueChange:e=>ie(Number(e)),children:[(0,q.jsx)(z,{size:`sm`,className:`w-28`,children:(0,q.jsx)(G,{})}),(0,q.jsx)(U,{children:At.map(e=>(0,q.jsx)(V,{value:String(e),children:Ne({count:e})},e))})]})]}),(0,q.jsx)(St,{fields:Ft,seed:g,onChange:C}),b?(0,q.jsx)(`div`,{className:`oc-traces__followline`,children:(0,q.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>x(null),title:Ue(),children:[(0,q.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[Se(),(0,q.jsx)(`code`,{children:Q(b)})]}),(0,q.jsx)(Xe,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`sr-only`,children:r()})]})}):null,(0,q.jsx)(Ct,{title:re(),rows:j,emptyHint:b?ge():fe(),columns:[{header:me(),sort:e=>e.at,cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:W(e.at)})},{header:h(),sort:e=>e.kind,cell:e=>(0,q.jsx)(B,{variant:`secondary`,children:e.kind})},{header:Re(),sort:e=>$(e)??null,cell:e=>{let t=$(e);return t?(0,q.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,q.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":_(),children:`✓`})}},{header:f(),sort:e=>e.direction,cell:e=>e.direction?(0,q.jsx)(B,{variant:`outline`,children:e.direction}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ue(),sort:e=>e.principalType,cell:e=>(0,q.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,q.jsx)(B,{variant:`outline`,children:e.principalType}),e.principalId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:Q(e.principalId)}):null]})},{header:ce(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,q.jsx)(B,{variant:`secondary`,children:e.roleKey}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ee(),sort:e=>e.route,cell:e=>e.route?(0,q.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,q.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:le(),sort:e=>e.status,cell:e=>e.status===null?(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,q.jsx)(`span`,{className:`oc-traces__status ${Lt(e.status)}`,children:e.status})},{header:o(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,q.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:Ye(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,q.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:ae(),onClick:()=>x(e.correlationId),children:Q(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:te(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,q.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>S(e),children:m()}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,q.jsx)(Rt,{row:ne,onClose:()=>S(null)})]})]})}function Lt(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 Q(e){return e.length>8?e.slice(0,8):e}function $(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,K.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,q.jsx)(yt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,q.jsxs)(pt,{className:`max-w-lg`,children:[(0,q.jsxs)(ut,{children:[(0,q.jsxs)(ht,{className:`oc-traces__meta-title`,children:[d(),` `,(0,q.jsx)(`code`,{children:e.kind}),(0,q.jsx)(B,{variant:`outline`,children:S()})]}),(0,q.jsx)(_t,{children:x()})]}),(0,q.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{It as TracesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,$x as i,BD as a,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 ee,Kx as m,LD as h,ND as g,Np as _,PD as te,Pp as v,QD as y,Qx as b,RD as ne,UD as re,VD as ie,WD as ae,XD as oe,Xx as x,YD as se,Yx as S,ZD as ce,Zx as C,aO as w,bB as T,eO as le,eS as E,iO as ue,mD 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,yB as P,zD as ge}from"./api-NzmVMBHn.js";import{t as F}from"./button-BHiy_q9F.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-DRTZkZgA.js";import{t as Y}from"./FilterBar-BB9HpiR0.js";import{t as Me}from"./DataTableShell-tMQLeAkL.js";import{t as Ne}from"./DetailChips-BJrU9abA.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let a=T(M.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=T(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:x()}):[...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=P(M.agents.assignAgent),s=P(M.agents.removeAgent),c=P(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(b(),e)}}async function f(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(C(),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":S({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,s?(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children: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":m(),title:m(),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 _();case`user`:return v();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?j():O({count:r})})}),(0,Z.jsxs)(xe,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(z,{children:w()}),U.map(e=>{let r=q[e];return(0,Z.jsxs)(Se,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(J,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:Ee[e]()})]},e)})]})]})}function Le(){let e=ve({from:`/settings/users`}),t=_e({from:`/settings/users`}),n=e.q??``,i=e.role??Q,s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),p=T(M.admin.listUsers,{filter:{q:n||void 0,role:i===Q?void 0:i},withAgents:!0}),m=T(M.me.getMe,{host:ke}),_=P(M.admin.setRole),v=P(M.admin.setUserPermissions),b=P(M.admin.startImpersonation),x=P(M.admin.deleteUser),S=P(M.admin.setUserName),C=Ce(),w=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 _(e)}catch(e){E.error(ue(),e)}}async function F(e){try{await v(e)}catch(e){E.error(me(),e)}}async function R(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await C({title:oe(),description:se({user:t}),confirmWord:f(),confirmLabel:pe(),destructive:!0}))try{await x({profileId:e._id}),E.success(c({user:t}))}catch(e){E.error(ee(),e)}}async function z(e){let t=e.email||e.name||e.userId.slice(0,8),n=await w({title:re(),label:u({user:t}),placeholder:ie(),defaultValue:e.name??``,confirmLabel:de()});if(n!==null)try{await S({profileId:e._id,name:n}),E.success(a())}catch(e){E.error(ge(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{q:n,onQChange:s,searchPlaceholder:fe(),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:he()}),k.map(e=>(0,Z.jsx)(B,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:le(),rows:p,emptyHint:r(),rowActions:e=>{let t=[{label:g(),onSelect:()=>O({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:ae(),onSelect:()=>void z(e)}];return e.userId!==m?.userId&&t.push({label:y(),onSelect:()=>void b({profileId:e._id})},{label:ce(),variant:`destructive`,onSelect:()=>void R(e)}),t},columns:[{header:ne(),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:h(),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:d(),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:o()}):(0,Z.jsx)(Ie,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),F({profileId:e._id,permissions:[...n]})}})},{header:te(),cell:e=>(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(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};
|
|
@@ -0,0 +1 @@
|
|
|
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,_B as re,_i as u,ai as d,ar as f,bB as p,bi as m,ci as h,cr as g,dB as _,di as v,dk as y,er as b,fi as x,gi as S,gr as ie,hi as ae,ii as C,li as oe,lr as se,mi as w,ni as ce,nr as T,oi as E,or as D,pB as O,pi as le,qf as k,ri as ue,si as A,sr as de,t as j,ti as fe,tr as pe,ui as me,vi as M,wd as N,wi as P,xi as F,yB as I,yi as L}from"./api-NzmVMBHn.js";import{i as R,n as z,r as he,t as ge}from"./tabs-JuirMY8K.js";import{t as B}from"./button-BHiy_q9F.js";import{$ as V,$t as _e,Cn as ve,Et as H,Gn as ye,Kn as be,Q as U,Wn as W,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-DRTZkZgA.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>M()],[`fr-FR`,()=>se()],[`en-US`,()=>g()],[`en-GB`,()=>de()],[`de-DE`,()=>D()],[`es-ES`,()=>f()]],Oe=[[`0.75`,()=>S()],[`1`,()=>ae()],[`1.25`,()=>w()],[`1.5`,()=>le()]],$=0;function ke({instance:e}){let t=I(j.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,p]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(!1),y=re(j.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 b=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)(H,{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)(V,{size:`sm`,"aria-label":l(),children:(0,Q.jsx)(q,{})}),(0,Q.jsxs)(K,{children:[(0,Q.jsx)(U,{value:`browser`,children:te()}),e.kind===`hermes`?null:(0,Q.jsx)(U,{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:L()}),(0,Q.jsxs)(G,{value:i.lang,onValueChange:e=>s({...i,lang:e}),disabled:!i.enabled,children:[(0,Q.jsx)(V,{size:`sm`,"aria-label":L(),children:(0,Q.jsx)(q,{})}),(0,Q.jsx)(K,{children:De.map(([e,t])=>(0,Q.jsx)(U,{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)(V,{size:`sm`,"aria-label":u(),children:(0,Q.jsx)(q,{})}),(0,Q.jsx)(K,{children:Oe.map(([e,t])=>(0,Q.jsx)(U,{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":x()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:v()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(B,{size:`sm`,disabled:!b||c===`saving`,onClick:()=>void S(),children:c===`saving`?k():N()}),(0,Q.jsx)(B,{variant:`outline`,size:`sm`,disabled:!i.enabled||f,onClick:()=>{let t=Number.parseFloat(i.rate)||1,n=++$;if(_(!1),J(),Y(),i.engine!==`gateway`){Ce(h(),{lang:Ee(i.lang,O()),rate:t});return}p(!0),y({instanceName:e.name,text:h()}).then(({mime:e,audioBase64:r})=>{n===$&&Se(r,e,{rate:t})}).catch(()=>{n===$&&_(!0)}).finally(()=>p(!1))},children:f?k():me()}),(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>{$++,p(!1),J(),Y()},children:oe()})]}),c===`error`||g?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g?a():ee()}):null]})}function Ae({stt:e}){let t=p(j.me.getMe,{host:we}),n=I(j.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:E()}),(0,Q.jsx)(H,{variant:e?`secondary`:`outline`,children:e?ce():fe()}),(0,Q.jsx)(H,{variant:r?`secondary`:`destructive`,children:r?pe():b()})]}),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":T()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:d()})]})}function je(){let e=p(j.admin.listInstances,{}),t=(0,Z.useMemo)(()=>xe(),[]),n=(0,Z.useMemo)(()=>_e(),[]),{section:a}=be({from:`/settings/voice`}),o=ye({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(H,{variant:t?`secondary`:`destructive`,children:t?P():i()}),(0,Q.jsx)(H,{variant:n?`secondary`:`destructive`,children:n?s():F()})]}),(0,Q.jsxs)(ge,{value:a,onValueChange:e=>void o({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(he,{className:`w-full`,children:[(0,Q.jsxs)(R,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Te,{size:13,"aria-hidden":!0}),r()]}),(0,Q.jsxs)(R,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(ve,{size:13,"aria-hidden":!0}),E()]}),(0,Q.jsxs)(R,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(W,{size:13,"aria-hidden":!0}),C()]})]}),(0,Q.jsx)(z,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(z,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsxs)(z,{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:ue()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=I(j.admin.upsertInstanceConfig),n=e.config??{},r=n.talkEnabled===!0,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)(H,{variant:`secondary`,children:i?`Hermes`:`OpenClaw`})]}),i?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ie()}):(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":y()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()})]})]})}export{je as VoiceTab};
|