@lacneu/atrium 0.82.1 → 0.83.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccessTab-BfGSfHkJ.js → AccessTab-Dwa8D3-K.js} +1 -1
- package/dist/assets/{AdvancedFilter-Dhl9vbbC.js → AdvancedFilter-3ID4qv_d.js} +1 -1
- package/dist/assets/{AgentFilesTab-BsFMKqxN.js → AgentFilesTab-1j8C9jVb.js} +2 -2
- package/dist/assets/AnomaliesTab-EzFX-Buo.js +1 -0
- package/dist/assets/AuditTab-bekMTb1y.js +1 -0
- package/dist/assets/{BridgeTab-d8LOFi5Q.js → BridgeTab-CG9yn0Is.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-C4IhtS0f.js → ChatDefaultsTab-DyJ3_O5M.js} +1 -1
- package/dist/assets/{DataTableShell-CSEsiKU5.js → DataTableShell-1-eBDd8r.js} +1 -1
- package/dist/assets/{DetailChips-BvJrftpU.js → DetailChips-u5DvS43f.js} +1 -1
- package/dist/assets/FeedbacksTab-L33eDrgp.js +1 -0
- package/dist/assets/{FieldLabel-D831BT1G.js → FieldLabel-CZ3VfRyz.js} +1 -1
- package/dist/assets/FilesTab-BndeFtC6.js +1 -0
- package/dist/assets/{FilterBar-udwh54Yv.js → FilterBar-N2zMJz7R.js} +1 -1
- package/dist/assets/{GroupsTab-BZzuCNzE.js → GroupsTab-Cv5gGkOm.js} +1 -1
- package/dist/assets/InstancesTab-BgaeSfCo.js +1 -0
- package/dist/assets/{IntegrationsTab-CSTl3yAO.js → IntegrationsTab-BlRVGGSg.js} +1 -1
- package/dist/assets/{KpiTab-BT5sJk0f.js → KpiTab-DvkpFZv4.js} +1 -1
- package/dist/assets/PreferencesTab-Y61Qun_P.js +1 -0
- package/dist/assets/ProjectPage-CR06EfQb.js +1 -0
- package/dist/assets/PromptInjectionsTab-BM61xm3g.js +4 -0
- package/dist/assets/RolesTab-CMbsPHbj.js +1 -0
- package/dist/assets/ScheduledTab-B9VplcvH.js +1 -0
- package/dist/assets/ServiceAccountsTab-CQ_mj8_l.js +1 -0
- package/dist/assets/{SubAgentReportsTab-CenPwDMG.js → SubAgentReportsTab-CM8J5CTP.js} +1 -1
- package/dist/assets/ThemeShowroom-BxrFjxrg.js +1 -0
- package/dist/assets/{TimeRangePicker-C-N7Oi_O.js → TimeRangePicker-yK1328F9.js} +1 -1
- package/dist/assets/{TimezoneCombobox-B7yB12f8.js → TimezoneCombobox-CzTx9wPL.js} +1 -1
- package/dist/assets/TracesTab-B4yZnlZg.js +1 -0
- package/dist/assets/UsersTab-Bks9QSBZ.js +1 -0
- package/dist/assets/VoiceTab-GaXBCdz0.js +1 -0
- package/dist/assets/api-BPOlScPa.js +44 -0
- package/dist/assets/{button-DzIspcBY.js → button-B5OAA4fh.js} +1 -1
- package/dist/assets/{card-AAO0v9Vm.js → card-Dv2G1V3P.js} +1 -1
- package/dist/assets/chevrons-up-down-WwYjqxmn.js +1 -0
- package/dist/assets/{compatView-B55x_jLI.js → compatView-Ca_1Ks2z.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-CuGiUb14.js → dispatchErrorInfo-CpxQCfFa.js} +1 -1
- package/dist/assets/{dist-DimWGHXr.js → dist-Bz3z-NbY.js} +1 -1
- package/dist/assets/{dist-kCZGRh3V.js → dist-CohYA7lf.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-7Vs0Gyx9.js → highlighted-body-OFNGDK62-CeoAgNEn.js} +1 -1
- package/dist/assets/index-BFVb3Mjo.css +1 -0
- package/dist/assets/index-Cd7vK8g7.js +324 -0
- package/dist/assets/{list-CpHCJVWf.js → list-fB2wMIBf.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-BUWvemOo.js +1 -0
- package/dist/assets/{pdf-DdjfDjYm.js → pdf-vb-5HO4B.js} +1 -1
- package/dist/assets/roleDescriptions-BuewtMrO.js +1 -0
- package/dist/assets/{table-1BG3EWti.js → table-Bgj0w4qc.js} +1 -1
- package/dist/assets/{tabs-BRizUL-U.js → tabs-BuQ2R5Cs.js} +1 -1
- package/dist/assets/x-BC9FbaDw.js +1 -0
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/dist/assets/AnomaliesTab-BRo33Szo.js +0 -1
- package/dist/assets/AuditTab-Btg9SO-3.js +0 -1
- package/dist/assets/FeedbacksTab-odf2CZj6.js +0 -1
- package/dist/assets/FilesTab-CddIvk_h.js +0 -1
- package/dist/assets/InstancesTab-Fz5H84bF.js +0 -1
- package/dist/assets/PreferencesTab-DH2fgelv.js +0 -1
- package/dist/assets/ProjectPage-CsIQN8Gd.js +0 -1
- package/dist/assets/PromptInjectionsTab-zoE2FL0G.js +0 -4
- package/dist/assets/RolesTab-B-9nR9hK.js +0 -1
- package/dist/assets/ScheduledTab-BoFpz0HW.js +0 -1
- package/dist/assets/ServiceAccountsTab-C16xtLqD.js +0 -1
- package/dist/assets/ThemeShowroom-ThcCg4YK.js +0 -1
- package/dist/assets/TracesTab-D95QflLo.js +0 -1
- package/dist/assets/UsersTab-fifwJpfR.js +0 -1
- package/dist/assets/VoiceTab-DleFSAIb.js +0 -1
- package/dist/assets/api-BKX0b765.js +0 -44
- package/dist/assets/chevrons-up-down-Ds54l-NQ.js +0 -1
- package/dist/assets/index-BbZI7MO0.js +0 -324
- package/dist/assets/index-DEMhzN6j.css +0 -1
- package/dist/assets/mermaid-GHXKKRXX-Df6cOE5v.js +0 -1
- package/dist/assets/roleDescriptions-Bc3Grr9Z.js +0 -1
- package/dist/assets/x-DP601e4A.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Gw as e,Hw as t,Kw as n,Uw as r,Ww as i}from"./api-BPOlScPa.js";var a={pending:n,user:e,admin:i,observer:r,agent:t};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-
|
|
1
|
+
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-BPOlScPa.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{b as r,d as i,f as a,g as o,n as s,p as c,r as l,y as u}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{b as r,d as i,f as a,g as o,n as s,p as c,r as l,y as u}from"./api-BPOlScPa.js";import{Gt as d,Jt as f,Kt as p,qt as m}from"./index-Cd7vK8g7.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=o(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:a,onValueChange:o,defaultValue:s,orientation:l=`horizontal`,dir:u,activationMode:d=`automatic`,...p}=e,m=f(u),[h,v]=c({prop:a,onChange:o,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:i(),value:h,onValueChange:v,orientation:l,dir:m,activationMode:d,children:(0,g.jsx)(r.div,{dir:m,"data-orientation":l,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:i=!0,...a}=e,o=S(w,n),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:(0,g.jsx)(r.div,{role:`tablist`,"aria-orientation":o.orientation,...a,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,i),f=j(s.baseId,i),p=i===s.value;return(0,g.jsx)(d,{asChild:!0,...c,focusable:!a,active:p,children:(0,g.jsx)(r.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":f,"data-state":p?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:u(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:u(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:u(e.onFocus,()=>{let e=s.activationMode!==`manual`;!p&&!a&&e&&s.onValueChange(i)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:o,children:s,...c}=e,l=S(O,n),u=A(l.baseId,i),d=j(l.baseId,i),f=i===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(a,{present:o||f,children:({present:n})=>(0,g.jsx)(r.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&s})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:l(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=s(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function R({className:e,variant:t=`default`,...n}){return(0,g.jsx)(N,{"data-slot":`tabs-list`,"data-variant":t,className:l(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:l(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function B({className:e,...t}){return(0,g.jsx)(F,{"data-slot":`tabs-content`,className:l(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D as e}from"./api-BPOlScPa.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
|
package/dist/index.html
CHANGED
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
document.documentElement.dataset.motion = "static";
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
|
-
<script type="module" crossorigin src="/assets/index-
|
|
65
|
+
<script type="module" crossorigin src="/assets/index-Cd7vK8g7.js"></script>
|
|
66
66
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
|
|
67
|
-
<link rel="modulepreload" crossorigin href="/assets/api-
|
|
68
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
69
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/x-
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/button-
|
|
72
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
67
|
+
<link rel="modulepreload" crossorigin href="/assets/api-BPOlScPa.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-Bz3z-NbY.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-CohYA7lf.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/x-BC9FbaDw.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/button-B5OAA4fh.js">
|
|
72
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BFVb3Mjo.css">
|
|
73
73
|
</head>
|
|
74
74
|
<body>
|
|
75
75
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lacneu/atrium",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.83.0",
|
|
4
4
|
"description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,Aw as i,BC as a,Cw as ee,Dw as o,Ew as te,FC as s,GC as ne,HC as c,IC as l,JC as re,KC as ie,LC as u,Ow as d,QC as ae,RC as f,Sw as oe,Tw as se,UC as ce,VC as p,WC as le,XC as ue,YC as de,ZC as fe,_w as pe,aw as me,bw as he,cw as m,dB as h,dw as ge,ew as g,fw as _e,gw as ve,hw as ye,iw as be,kw as _,lw as xe,mw as Se,nw as v,ow as Ce,pw as y,qC as b,rw as x,sw as S,t as C,tw as w,uB as T,uw as E,vw as D,ww as O,xw as k,yw as A,zC as j}from"./api-BKX0b765.js";import{$ as M,Dt as we,Et as N,Gn as P,Kn as Te,Q as F,U as Ee,X as I,Z as L,at as R,ct as z,et as B,i as V,nt as H,o as De,ot as U,q as Oe,tt as W}from"./index-BbZI7MO0.js";import{n as ke}from"./TimeRangePicker-C-N7Oi_O.js";import{t as Ae}from"./FilterBar-udwh54Yv.js";import{t as je}from"./DataTableShell-CSEsiKU5.js";import{t as G}from"./dispatchErrorInfo-CuGiUb14.js";var K=t(e(),1),q=n(),J=`__all__`,Me=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ne(e){return e===`open`?i():e===`acknowledged`?_():d()}var Pe=[`info`,`warn`,`critical`],Fe=[`detector`,`agent`,`user`],Ie={kind:`relative`,from:`now-30d`,to:`now`},Le=200,Y=`all`;function X(){let e=Te({from:`/settings/anomalies`}),t=P({from:`/settings/anomalies`}),n=e.q??``,i=e.status===Y?J:e.status,a=e.severity??J,s=e.kind??J,[c,l]=(0,K.useState)(J),u=V(e.from,e.to),{from:d,to:f}=ke(u),p=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),_=e=>void t({search:t=>({...t,status:e===J?Y:e})}),j=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),H=e=>void t({search:t=>({...t,...De(e)})}),U=Ee(),W=we(),G=T(C.anomalies.resolveAnomaly),X=(h(C.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),Z=h(C.anomalies.listAnomalies,{limit:Le,filter:{q:n||void 0,from:d,to:f,anomalyStatus:i===J?void 0:i,severity:a===J?void 0:a,source:c===J?void 0:c,kind:s===J?void 0:s}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),$=n!==``||i!==`open`||a!==J||c!==J||s!==J||u.kind!==`relative`||u.from!==Ie.from;function Ue(){l(J),t({search:{status:`open`},replace:!0})}async function We(e){if(await U({title:o(),description:(0,q.jsxs)(q.Fragment,{children:[te(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,se(),` `,(0,q.jsx)(`strong`,{children:O()}),`.`,` `,ee()]}),confirmLabel:oe()}))try{await G({anomalyId:e._id,status:`resolved`}),W.success(k(),e.kind)}catch(e){W.error(he(),e)}}async function Ge(e){try{await G({anomalyId:e._id,status:`acknowledged`}),W.success(A(),e.kind)}catch(e){W.error(D(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[pe(),` `,(0,q.jsx)(`strong`,{children:ve()}),` `,ye(),` `,(0,q.jsx)(`strong`,{children:Se()}),` `,y(),` `,(0,q.jsx)(`strong`,{children:_e()}),` `,ge(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:E()})]}),(0,q.jsxs)(Ae,{q:n,onQChange:p,searchPlaceholder:xe(),timeRange:u,onTimeRangeChange:H,onReset:Ue,canReset:$,children:[(0,q.jsxs)(I,{value:i,onValueChange:_,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:m()}),Me.map(e=>(0,q.jsx)(F,{value:e.value,children:Ne(e.value)},e.value))]})]}),(0,q.jsxs)(I,{value:a,onValueChange:j,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{placeholder:S()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:x()}),Pe.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:c,onValueChange:l,children:[(0,q.jsx)(M,{size:`sm`,className:`w-32`,children:(0,q.jsx)(B,{placeholder:v()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:w()}),Fe.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:s,onValueChange:R,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{placeholder:g()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(F,{value:J,children:r()}),Q.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]})]}),(0,q.jsx)(je,{title:ae(),rows:Z,emptyHint:i===`open`?fe():ue(),rowActions:e=>X&&e.status===`open`?[{label:de(),onSelect:()=>void We(e)},{label:re(),onSelect:()=>void Ge(e)}]:[],columns:[{header:b(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:g(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:Ce(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,q.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:be({when:z(e.firstAt)}),children:me({count:String(e.occurrenceCount)})}):(0,q.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:S(),cell:e=>(0,q.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ie(),cell:e=>(0,q.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:v(),cell:e=>(0,q.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ne(),cell:e=>(0,q.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,q.jsx)(ze,{row:e})]}),sort:e=>e.message},{header:le(),cell:e=>(0,q.jsx)(Re,{row:e}),sort:e=>e.evidence??null},{header:ce(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:He(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var Z=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Q(e){if(!Z.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Re({row:e}){let t=P();if(e.kind===`subagent.failure`){let n=$(e);return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,c()]}):null]})}let n=Q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,q.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,c()]})}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=G(n.dominantCode),i=n.sampleCorrelationId;return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,q.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,c()]}):null]})}function ze({row:e}){let[t,n]=(0,K.useState)(!1),r=h(C.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[p(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(W,{open:t,onOpenChange:n,children:(0,q.jsxs)(H,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(R,{children:(0,q.jsx)(U,{children:a()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:j()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:f()}):(0,q.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,q.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,q.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,q.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Be({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,q.jsx)(N,{variant:`destructive`,children:u()}):e===`acknowledged`?(0,q.jsx)(N,{variant:`secondary`,children:l()}):(0,q.jsx)(N,{variant:`outline`,children:s()})}function He(e){return e.length>8?e.slice(0,8):e}export{X as AnomaliesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,CT as i,DT as a,ET as o,FT as s,MT as c,NT as l,OT as u,PT as d,ST as f,TT as p,aa as m,dB as h,ia as g,jT as _,kT as v,na as y,oa as b,ra as x,sa as S,t as C,wT as w,xT as T}from"./api-BKX0b765.js";import{$ as E,Gn as D,Kn as O,Q as k,X as A,Z as j,a as M,ct as N,et as P,i as F,n as I,o as L,s as R}from"./index-BbZI7MO0.js";import{n as ee}from"./TimeRangePicker-C-N7Oi_O.js";import{t as z}from"./FilterBar-udwh54Yv.js";import{t as B}from"./AdvancedFilter-Dhl9vbbC.js";import{t as V}from"./DataTableShell-CSEsiKU5.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:S()},{value:`realLabel`,label:b()},{value:`targetLabel`,label:m()},{value:`impersonated`,label:g()},{value:`resource`,label:x()},{value:`resourceId`,label:y()}];function q(){let e=O({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,m=e.action??G,g=e.impersonated??G,y=e.resource??G,b=F(e.from,e.to),x=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:S,to:I}=ee(b),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=h(C.admin.listAudit,{filter:{q:n||void 0,from:S,to:I,action:m===G?void 0:m,resource:y===G?void 0:y,impersonated:g===G?void 0:g===`yes`,advanced:x.length>0?x:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||m!==G||g!==G||y!==G||x.length>0||b.kind!==`relative`||b.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:d()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:l(),timeRange:b,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(A,{value:m,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:c()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:_()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(A,{value:g,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:r()}),(0,U.jsx)(k,{value:`yes`,children:v()}),(0,U.jsx)(k,{value:`no`,children:u()})]})]}),(0,U.jsxs)(A,{value:y,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:a()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:o()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:x,onChange:Q}),(0,U.jsx)(V,{title:p(),rows:$,emptyHint:w(),columns:[{header:i(),cell:e=>N(e.at),sort:e=>e.at},{header:c(),cell:e=>e.action,sort:e=>e.action},{header:f(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:T(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:a(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,$O as i,$o as a,AO as o,BO as s,CO as c,DO as l,EO as u,FO as d,GO as ee,HO as f,IO as te,JO as p,KO as m,LO as h,MO as g,NO as ne,OO as re,PO as ie,QO as _,RO as ae,SO as v,TO as oe,UO as y,VO as b,WO as x,XO as S,YO as C,ZO as w,Zo as T,_O as E,aO as D,bO as O,cO as k,dB as A,dO as j,eO as M,ek as N,fO as P,gO as F,hO as I,iO as L,jO as R,kO as z,lO as B,mO as V,nO as H,oO as se,pO as U,qO as W,rO as G,sO as K,t as q,tO as ce,tk as le,uB as J,uO as ue,vO as de,wO as fe,xO as pe,yO as me,zO as he}from"./api-BKX0b765.js";import{t as ge}from"./button-DzIspcBY.js";import{U as _e,ct as Y}from"./index-BbZI7MO0.js";import{t as ve}from"./DataTableShell-CSEsiKU5.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>le(),incorrect:()=>N(),incoherence:()=>i(),formatting:()=>_(),latency:()=>w(),api_error:()=>S(),other:()=>C()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:W()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:m()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:p()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,i=J(q.feedback.respondToFeedback),[c,p]=(0,X.useState)(e.thread),[m,_]=(0,X.useState)(``),[v,S]=(0,X.useState)(!1);async function C(){let t=m.trim();if(!(!t||v)){S(!0);try{await i({feedbackId:e._id,text:t}),p(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),_(``)}finally{S(!1)}}}let w=[];try{w=r.contextJson?JSON.parse(r.contextJson):[]}catch{w=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${ee()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:me(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:D()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:y()}),c.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:c.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?f():e.authorRole===`agent`?e.authorLabel??a():b()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:s()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:he(),value:m,maxLength:2e3,rows:3,onChange:e=>_(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void C(),disabled:!m.trim()||v,children:v?ae():h()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:te()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||d()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||d()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ne()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,w.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g({count:r.contextCount??w.length,truncated:r.contextTruncated?R():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:w.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:o()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?l({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[u(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,oe()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=A(q.feedback.listForAdmin,{}),t=J(q.feedback.readSnapshot),n=J(q.feedback.deleteFeedback),i=_e(),[a,o]=(0,X.useState)(null),[s,l]=(0,X.useState)({});async function u(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});l(t=>({...t,[e._id]:n}))}o(e._id)}async function d(e){await i({title:ce(),description:M(),confirmLabel:r(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&o(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[fe(),` `,(0,Z.jsx)(`strong`,{children:c()}),` `,v()]}),(0,Z.jsx)(ve,{title:pe(),rows:e,emptyHint:O(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Z.jsx)(be,{data:s[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:de(),cell:e=>Y(e.at),sort:e=>e.at},{header:E(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:F(),cell:e=>e.messageRole===`user`?I():V(),sort:e=>e.messageRole},{header:U(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${P({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:j(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ue(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:B(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:k()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:K()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:T()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:se()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?L():G(),onSelect:()=>void u(e)},{label:H(),onSelect:()=>void d(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$R as r,Cz as i,GR as ee,HR as te,JR as ne,KR as re,QR as ie,Sz as ae,UR as oe,WR as a,XR as o,YR as s,ZR as c,_z as l,az as u,bz as d,cz as f,dB as se,dz as p,ez as ce,fz as m,gz as le,hz as ue,iB as de,iz as fe,lz as h,mz as pe,nB as me,ns as he,nz as ge,oz as g,pz as _e,qR as ve,rs as _,rz as ye,sM as be,sz as v,t as y,tz as b,uB as x,uz as S,vz as C,xz as w,yz as T}from"./api-BKX0b765.js";import{t as E}from"./button-DzIspcBY.js";import{$ as D,Ct as O,Dt as k,Et as A,Fn as j,Lt as M,Mt as N,Nt as xe,Pn as Se,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,bt as Te,dn as Ee,et as R,hn as De,ut as Oe,vt as ke,wt as Ae,xt as je,yt as Me}from"./index-BbZI7MO0.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-1BG3EWti.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return m();case`audio`:return p();case`video`:return S();case`pdf`:return h();case`document`:return f();case`archive`:return v();default:return g()}}function K(){let[e,t]=(0,H.useState)(W),[n,f]=(0,H.useState)(W),[p,m]=(0,H.useState)(W),[h,g]=(0,H.useState)(W),[v,S]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=x(y.files.softDelete),Y=k();function Ie(){t(W),f(W),m(W),g(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(s())}catch(e){Y.error(ne(),e)}}let X=se(y.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:p===W?void 0:p,category:h===W?void 0:h,includeAutoGenerated:v||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(de(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:me()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||p!==W||h!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":ae(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:w()}),(0,U.jsx)(F,{value:`inbound`,children:d()}),(0,U.jsx)(F,{value:`outbound`,children:T()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:f,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":C(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:l()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:p,onValueChange:m,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":le(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:ue()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:h,onValueChange:g,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":pe(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:_e()}),Q.categories.map(e=>(0,U.jsx)(F,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:v,onCheckedChange:e=>S(e===!0),"aria-label":_()}),(0,U.jsx)(`span`,{children:_()})]}),$?(0,U.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(De,{size:14,"aria-hidden":!0}),ie()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?oe():a()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:u()}),(0,U.jsx)(z,{children:fe()}),(0,U.jsx)(z,{children:ye()}),(0,U.jsx)(z,{children:ge()}),(0,U.jsx)(z,{children:b()}),(0,U.jsx)(z,{className:`text-right`,children:ce()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:he()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?d():T()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(N,{children:[(0,U.jsx)(M,{asChild:!0,children:(0,U.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":c(),children:(0,U.jsx)(Se,{size:16})})}),(0,U.jsxs)(xe,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(j,{size:14}),r()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(j,{size:14}),ee()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),o()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:te({cap:Be})}):null]}),(0,U.jsx)(ke,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Ae,{children:[(0,U.jsx)(we,{children:ve()}),(0,U.jsx)(Ce,{children:re()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Te,{children:be()}),(0,U.jsx)(Me,{onClick:()=>void Le(),children:o()})]})]})})]})}export{K as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$T as i,AE as a,B as o,BE as s,BT as c,CD as l,CE as u,DE as d,EE as f,Ex as p,F as m,FE as h,Fi as ee,GE as g,GT as _,H as v,HE as y,HT as b,I as x,IE as S,IT as C,JE as te,JT as w,KE as T,KT as ne,L as re,LE as ie,LT as ae,M as oe,ME as se,N as ce,NE as le,Ni as ue,OE as de,P as fe,PE as pe,Pi as me,QE as he,QT as ge,R as _e,RE as ve,RT as ye,SD as be,SE as xe,TD as Se,TE as Ce,Tx as we,UE as Te,UT as Ee,V as De,VE as Oe,VT as ke,WE as Ae,WT as je,XE as Me,XT as Ne,YE as Pe,YT as Fe,ZE as Ie,ZT as Le,_D as Re,_E as ze,aD as Be,bD as Ve,bE as He,cB as E,cD as Ue,cE as We,cN as Ge,cc as Ke,dB as D,dD as O,dE as k,dc as qe,eD as Je,eE as Ye,fD as Xe,fE as Ze,gD as Qe,gE as $e,hD as et,hE as tt,iD as nt,iE as rt,j as it,jE as A,kE as at,lD as ot,lE as j,lN as M,lc as st,mD as ct,mE as lt,nD as ut,nE as dt,oD as ft,oE as N,pD as pt,pE as mt,qE as ht,qT as gt,rD as _t,rE as vt,sD as yt,sE as bt,t as P,tD as xt,tE as St,uB as F,uD as Ct,uE as wt,uc as Tt,vD as Et,vE as Dt,wD as Ot,wE as kt,xD as At,xE as jt,yD as Mt,yE as Nt,z as Pt,zE as Ft,zT as It}from"./api-BKX0b765.js";import{a as Lt,c as Rt}from"./FieldLabel-D831BT1G.js";import{t as I}from"./button-DzIspcBY.js";import{$ as L,Bt as zt,Dt as R,Et as z,Q as B,Rt as Bt,U as Vt,X as V,Z as H,_ as Ht,at as U,et as W,jt as G,nt as K,ot as q,rt as J,tt as Ut,ut as Wt,zt as Gt}from"./index-BbZI7MO0.js";import{t as Kt}from"./DataTableShell-CSEsiKU5.js";import{InstanceConfigDialog as qt}from"./BridgeTab-d8LOFi5Q.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],Jt=new Set(X),Yt=`conversational`;function Xt(e){let t=new Set((e??[]).filter(e=>Jt.has(e)));return t.size===0?[Yt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,systemIdentity:``,streamTransport:Lt},Zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Qt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function $t(){let e=D(P.admin.listInstances,{}),t=D(P.agents.listAllInstanceAgents,{}),n=F(P.admin.upsertInstance),i=F(P.admin.deleteInstance),a=R(),[s,c]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(Q),[f,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(null);async function w(){try{await n({instanceId:S??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,transport:u.kind===`hermes`?u.transport:void 0,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,...u.kind===`openclaw`?{authMode:u.authMode,personScopes:u.personScopes,systemIdentity:u.systemIdentity||void 0}:{},streamTransport:u.streamTransport}),d(Q),C(null),c(!1)}catch(e){a.error(l(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[be(),(0,Z.jsx)(`strong`,{children:At()}),Ve()]}),(0,Z.jsx)(Kt,{title:Mt(),rows:e,addLabel:Et(),onAdd:()=>{C(null),d(Q),c(!0)},emptyHint:Re(),columns:[{header:Qe(),cell:e=>e.name,sort:e=>e.name},{header:et(),cell:e=>(0,Z.jsx)(z,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:ct(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:pt(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Se(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(z,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?ae():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ot(),onSelect:()=>{C(e._id),d(Qt(e)),c(!0)}},{label:Ot(),onSelect:()=>h(e.name)},{label:te(),onSelect:()=>b(e)},{label:Xe(),onSelect:()=>_(e)},{label:O(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:O(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(Ht,{open:s,onOpenChange:c,title:S?Ue():Ct(),description:ft(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:w,submitLabel:Be(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:nt(),children:[(0,Z.jsx)(G,{value:u.name,disabled:S!==null,onChange:e=>d({...u,name:e.target.value})}),S?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:yt()}):null]}),(0,Z.jsx)($,{label:_t(),children:(0,Z.jsxs)(V,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(B,{value:`hermes`,children:`Hermes`})]})]})}),u.kind===`hermes`?(0,Z.jsx)($,{label:ee(),children:(0,Z.jsxs)(V,{value:u.transport,onValueChange:e=>d({...u,transport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:`ws`,children:me()}),(0,Z.jsx)(B,{value:`rest`,children:ue()})]})]})}):null,(0,Z.jsx)($,{label:ut(),children:(0,Z.jsx)(G,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:xt(),children:(0,Z.jsx)(G,{value:u.bridgeUrl,placeholder:Je(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:r(),children:(0,Z.jsx)(G,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:p(),children:[(0,Z.jsxs)(V,{value:u.streamTransport,onValueChange:e=>d({...u,streamTransport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsx)(H,{children:Rt.map(e=>(0,Z.jsx)(B,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:we()})]}),(0,Z.jsx)($,{label:he(),children:(0,Z.jsx)(G,{value:u.gatewayVersion,placeholder:Ie(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),u.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:re(),children:[(0,Z.jsxs)(V,{value:u.authMode,onValueChange:e=>d({...u,authMode:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:`token`,children:x()}),(0,Z.jsx)(B,{value:`trusted-proxy`,children:m()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:u.authMode===`trusted-proxy`?ce():fe()})]}),u.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:v(),children:[(0,Z.jsxs)(V,{value:u.personScopes,onValueChange:e=>d({...u,personScopes:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:`capped`,children:De()}),(0,Z.jsx)(B,{value:`full`,children:o()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:u.personScopes===`full`?_e():Pt()})]}):null,u.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:oe(),children:(0,Z.jsx)(G,{value:u.systemIdentity,placeholder:it(),onChange:e=>d({...u,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:Me(),children:(0,Z.jsx)(G,{value:u.gatewayHttpUrl,placeholder:Pe(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(un,{instanceName:f,open:f!==null,onOpenChange:e=>{e||h(null)}}),g?(0,Z.jsx)(qt,{instance:g,onClose:()=>_(null)},g._id):null,y?(0,Z.jsx)(en,{instance:y,onClose:()=>b(null)},y._id):null]})}function en({instance:e,onClose:t}){let n=D(P.instanceSecrets.listInstanceSecretStatus,{}),r=Zt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(Ut,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(q,{children:ht({instance:e.displayName??e.name})}),(0,Z.jsx)(J,{children:T()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(rn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(nn,{instance:e})}),(0,Z.jsx)(tn,{instance:e})]})})}function tn({instance:e}){let t=E(P.instanceSync.forceInstanceSync),n=R(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(f());break;case`no_agents`:n.success(kt());break;case`no_bridge_url`:n.error(u());break;case`deploy_misconfigured`:n.error(xe());break;case`unauthorized`:n.error(He());break;case`not_served`:n.error(Nt());break;default:n.error(jt());break}}catch(e){n.error(Ce(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Dt()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?d():de()})})]})}function nn({instance:e}){let t=D(P.bridgeAuth.listBridgeAuthStatus,{}),n=E(P.bridgeAuth.mintBridgeSecret),r=F(P.bridgeAuth.revokeBridgeSecret),i=R(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(k(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(Ze())}catch(e){i.error(k(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:ze(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:f?`outline`:`secondary`,children:f?`${y()} · ${d.prefix}…${d.lastFour}`:Oe()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?lt():tt()}),f?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:mt()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:wt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?M():Ge()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:j()})]}):null]})}function rn({instanceId:e,field:t,updatedAt:n}){let r=E(P.instanceSecrets.setInstanceSecret),i=F(P.instanceSecrets.clearInstanceSecret),o=E(P.deviceIdentity.generateDeviceIdentity),c=R(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[ee,_]=(0,Y.useState)(!1),v=n!==null,b=t===`deviceIdentity`,x=t===`token`?g():t===`deviceIdentity`?Ae():Te();async function C(){if(!(!l.trim()||d)){f(!0);try{await r({instanceId:e,field:t,plaintext:l}),u(``),m(null),_(!1),c.success(S())}catch(e){c.error(h(),e)}finally{f(!1)}}}async function te(){if(!d){f(!0);try{await i({instanceId:e,field:t}),m(null),_(!1),c.success(pe())}catch(e){c.error(h(),e)}finally{f(!1)}}}async function w(){if(!d){f(!0);try{m(await o({instanceId:e})),_(!1),c.success(A())}catch(e){c.error(at(),e)}finally{f(!1)}}}let T=p?`openclaw devices approve ${p.id}`:``;async function ne(){if(T)try{await navigator.clipboard.writeText(T),_(!0)}catch{}}return(0,Z.jsxs)($,{label:x,children:[b?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(z,{variant:v?`outline`:`secondary`,children:v?y():Oe()}),(0,Z.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:v?Ft():s(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void C(),disabled:d||l.trim().length===0,children:ve()}),b?(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void w(),disabled:d,children:le()}):null,v?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void te(),disabled:d,children:ie()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:A()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:T}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void ne(),children:ee?M():Ge()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),_(!1)},children:j()})]}):null]})}var an={conversational:ge,documentary:Ne,summarizer:qe,curator:st},on={conversational:Le,documentary:Fe,summarizer:Tt,curator:Ke},sn=e=>(an[e]??(()=>e))(),cn=e=>(on[e]??(()=>``))();function ln({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:dt()}),t.map(e=>(0,Z.jsx)(z,{variant:`secondary`,className:`oc-agenttype__chip`,title:cn(e),children:sn(e)},e)),(0,Z.jsxs)(Bt,{children:[(0,Z.jsx)(zt,{asChild:!0,children:(0,Z.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:St()})}),(0,Z.jsxs)(Gt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Ye()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:i()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(Wt,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:sn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:cn(r)})]})]},r)})})]})]})]})}function un({instanceName:e,open:t,onOpenChange:n}){let r=D(P.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=F(P.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=F(P.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=F(P.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Xt(r);e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=F(P.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=F(P.agents.removeInstanceAgent),u=Vt(),d=R();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(N(),e)}}async function p(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){d.error(N(),e)}}async function m(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){d.error(N(),e)}}async function h(t,n){if(e&&await u({title:ne({name:n}),description:_(),confirmLabel:je(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(Ee())}catch(e){d.error(N(),e)}}return(0,Z.jsx)(Ut,{open:t,onOpenChange:n,children:(0,Z.jsxs)(K,{className:`oc-access`,children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(q,{children:We({name:e??``})}),(0,Z.jsx)(J,{children:bt()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:b()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ke():r.discovery.lastPollOk?c():It({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ye()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(Wt,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{variant:`outline`,className:`oc-access__gone`,children:C()}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(t.agentId,a),children:gt()})]}):i?(0,Z.jsx)(z,{variant:`default`,children:ae()}):(0,Z.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void p(t.agentId),children:w()})]}),t.enabled?(0,Z.jsx)(ln,{agentId:t.agentId,types:o,onToggle:e=>void m(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(dn,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(N(),e)}}}):null]},t.agentId)})})]})]})})}function dn({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(G,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:rt(),"aria-label":vt(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{$t as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$n as i,AP as a,Az as o,BP as s,Bz as c,CP as l,DP as u,Dz as d,EP as f,Ez as p,FP as m,Fn as h,Fz as g,GP as ee,Gz as te,HP as ne,Hz as re,IP as ie,In as ae,Iz as oe,JP as se,Jz as ce,KP as le,Kz as ue,LP as de,Ln as fe,Lz as pe,MP as me,Mn as he,Mz as ge,NP as _e,Nn as _,Nz as v,OP as y,Oz as b,PP as x,Pn as S,Pz as C,QP as w,Qn as T,RP as E,Rn as D,Rz as O,SP as k,TP as A,Tz as j,UP as M,Uz as N,VP as P,Vz as F,WP as I,Wz as ve,XP as ye,YP as be,ZP as xe,Zz as Se,aD as Ce,aF as we,dB as L,eF as Te,iF as Ee,jP as De,jz as Oe,kP as ke,kz as Ae,nB as je,nF as Me,oF as Ne,qP as Pe,qn as Fe,qz as Ie,r as R,rF as Le,t as z,tF as Re,uB as B,wP as ze,xP as Be,zP as Ve,zn as He,zz as Ue}from"./api-BKX0b765.js";import{t as V}from"./button-DzIspcBY.js";import{$ as We,At as Ge,Dt as Ke,Et as H,Ot as qe,Q as U,V as Je,X as Ye,Z as Xe,et as Ze,jt as W,kt as Qe,q as G,t as $e,ut as K}from"./index-BbZI7MO0.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-B7yB12f8.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:R(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:R(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>Ne()},{id:`composer`,label:()=>we()},{id:`sidebar`,label:()=>Ee()},{id:`notifications`,label:()=>P()},{id:`other`,label:()=>Le()}],X={showSource:{category:`messages`,label:()=>Me(),help:()=>Re()},showReport:{category:`messages`,label:()=>Te(),help:()=>r()},copyAssistant:{category:`messages`,label:()=>w()},copyUser:{category:`messages`,label:()=>xe()},showDelete:{category:`messages`,label:()=>ye()},showTools:{category:`messages`,label:()=>be(),help:()=>se()},voiceInput:{category:`composer`,label:()=>Pe(),help:()=>le()},showUsage:{category:`composer`,label:()=>ee(),help:()=>I()},autoReadAloud:{category:`composer`,label:()=>i(),help:()=>T()},showChatAge:{category:`sidebar`,label:()=>M(),help:()=>ne()},notifSound:{category:`notifications`,label:()=>s(),help:()=>Ve()},notifSystem:{category:`notifications`,label:()=>E(),help:()=>de()},replySound:{category:`notifications`,label:()=>ie(),help:()=>m()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var rt=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],it={voiceInput:`voiceInput`};function at(e){return rt.includes(e)}function $(e){return e===`admin`}function ot(e){return e===!0?`on`:e===!1?`off`:`inherit`}function st(e){return e===`on`?!0:e===`off`?!1:null}function ct(e){return at(e)?it[e]:void 0}var lt={voiceInput:()=>A()};function ut({prefKey:e,ui:t}){let n=B(z.admin.setUiPrefDefault),r=B(z.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ke()}),(0,J.jsxs)(Ye,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(We,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ze,{})}),(0,J.jsxs)(Xe,{children:[(0,J.jsx)(U,{value:`on`,children:l()}),(0,J.jsx)(U,{value:`off`,children:k()}),(0,J.jsx)(U,{value:`inherit`,children:Be()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":y()}),y()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=B(z.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[He(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?ae():r?fe():D()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:he()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?_():e?S():h()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=L(z.me.getMe,{host:G}),o=i?.ui,s=$(i?.role)&&n,c=B(z.me.setUiPref).withOptimisticUpdate(Je),l=(0,q.useMemo)(()=>o?Q(Object.keys(o.effective),e):[],[o,e]);return o?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":a()}),a()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:u()}),(0,J.jsx)(`p`,{children:f()}),(0,J.jsx)(`p`,{children:ze()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:x(),"aria-label":x(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:_e()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],l=o.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(H,{variant:`outline`,children:me()}):l?(0,J.jsx)(H,{variant:`secondary`,children:Fe()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:De()}):null,(0,J.jsx)(nt,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,J.jsx)(ut,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:je()})}var pt={sm:()=>oe(),md:()=>g(),lg:()=>C(),xl:()=>v(),"2xl":()=>ge(),"3xl":()=>Oe()};function mt(){let e=L(z.me.getMe,{host:G}),t=B(z.me.setLocale),n=B(z.me.setTimezone),r=B(z.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(z.me.getMe,{host:G});n&&e.setQuery(z.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=B(z.me.setMyName),a=Ke(),s=e?.locale??`default`,l=e?.name??``,[u,f]=(0,q.useState)(null),m=u??l,h=m.trim()!==l.trim();async function g(){try{await i({name:m}),f(null),a.success(ve())}catch(e){a.error(N(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ce()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ie()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:m,maxLength:120,placeholder:ue(),onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h&&(e.preventDefault(),g())}}),(0,J.jsx)(V,{size:`sm`,disabled:!h,onClick:()=>void g(),children:Ce()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:re()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:F()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:s===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:s==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:Se()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:o()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:b()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Ue()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:O()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:$e.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:p()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:j()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Av as i,Cv as a,D as o,Dv as s,Ev as c,Fv as l,Gv as u,Hv as d,Iv as f,Jv as p,Lv as m,Mv as h,Nv as g,Ov as _,Pv as ee,Rv as v,Tv as y,Uv as b,Vv as te,Wv as x,Xv as ne,Yv as re,Zv as ie,_g as ae,av as oe,ay as se,bv as ce,cv as le,dB as S,dy as ue,fv as C,fy as de,iv as fe,jv as w,kv as pe,lv as T,mv as me,nB as E,nv as D,ny as he,ot as ge,ov as _e,oy as O,pv as ve,qv as k,ry as ye,st as be,sv as A,t as j,uB as M,uv as N,uy as xe,vv as Se,wv as Ce,xv as we,yv as Te,zv as Ee}from"./api-BKX0b765.js";import{t as De}from"./list-CpHCJVWf.js";import{t as P}from"./button-DzIspcBY.js";import{A as Oe,An as ke,Bn as Ae,C as je,D as F,Dt as Me,E as Ne,Ft as Pe,Gn as I,Hn as Fe,It as Ie,J as Le,Kn as Re,Lt as ze,Mn as Be,Mt as Ve,Nn as He,Nt as Ue,O as L,P as We,Pn as Ge,Pt as R,S as Ke,Sn as qe,T as Je,Tn as Ye,U as Xe,W as Ze,Y as Qe,_ as $e,b as z,bn as et,d as tt,dn as nt,f as rt,g as B,h as V,j as H,jn as U,jt as W,k as it,kn as G,m as at,p as ot,qn as st,v as K,vn as ct,w as lt,wn as ut,x as q,y as dt,yn as J}from"./index-BbZI7MO0.js";var ft=o(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),pt=o(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),mt=o(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),Y=o(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function ht({className:e}){return(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":N(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(Ge,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let o=M(j.projects.renameProject),s=M(j.projects.setProjectColor),c=M(j.projects.moveProject),l=M(j.projects.deleteProject),u=M(j.projects.createProject),d=Xe(),f=Ze(),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(t),[ee,y]=(0,X.useState)(!1),[b,te]=(0,X.useState)(!1),x=S(j.projects.projectTreeCount,b?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{onOpenChange:e=>e&&te(!0),children:[(0,Z.jsx)(ht,{className:i}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>a(),children:[(0,Z.jsx)(U,{}),` `,k()]}),(0,Z.jsxs)(R,{onSelect:()=>{_(t),h(!0)},children:[(0,Z.jsx)(et,{}),` `,T()]}),(0,Z.jsxs)(R,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await f({title:v(),label:de(),placeholder:ue(),confirmLabel:xe()});t&&await u({name:t,parentId:e})})},children:[(0,Z.jsx)(ke,{}),` `,v()]}),(0,Z.jsxs)(R,{onSelect:()=>y(!0),children:[(0,Z.jsx)(pt,{}),` `,ce()]}),(0,Z.jsx)(Pe,{children:_e()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void s({projectId:e,color:null}),"aria-label":oe(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void s({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=x?.folders??0,r=x?.chats??0;await d({title:ne({name:t}),description:n>0?p({folders:n,chats:r}):r>0?re({count:r}):ve(),confirmWord:C(),confirmLabel:ie(),destructive:!0})&&await l({projectId:e})})},children:[(0,Z.jsx)(nt,{}),` `,C()]})]})]}),(0,Z.jsx)($e,{open:m,onOpenChange:h,title:he(),canSubmit:g.trim().length>0,onSubmit:async()=>{await o({projectId:e,name:g.trim()}),h(!1)},submitLabel:T(),children:(0,Z.jsx)(W,{value:g,onChange:e=>_(e.target.value),autoFocus:!0})}),ee?(0,Z.jsx)(ot,{open:ee,onOpenChange:y,title:Se(),movingFolderId:e,currentId:r,onPick:t=>void c({projectId:e,parentId:t})}):null]})}function gt({chat:e,currentFolderId:t,className:n}){let r=M(j.chats.pinChat),i=M(j.chats.deleteChat),a=M(j.chats.renameChat),o=M(j.chats.setChatSidebar),s=M(j.chats.moveChatToProject),c=Xe(),[l,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(e.title??``),[m,h]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ht,{className:n}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>{p(e.title??``),d(!0)},children:[(0,Z.jsx)(et,{}),` `,T()]}),(0,Z.jsxs)(R,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(ct,{}):(0,Z.jsx)(J,{}),e.pinned?le():A()]}),(0,Z.jsxs)(R,{onSelect:()=>h(!0),children:[(0,Z.jsx)(pt,{}),` `,we()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(R,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(qe,{}):(0,Z.jsx)(Y,{}),e.inSidebar?x():u()]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await c({title:fe(),description:ve(),confirmLabel:C(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,Z.jsx)(nt,{}),` `,C()]})]})]}),(0,Z.jsx)($e,{open:l,onOpenChange:d,title:D(),canSubmit:f.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:f.trim()}),d(!1)},submitLabel:T(),children:(0,Z.jsx)(W,{value:f,onChange:e=>p(e.target.value),autoFocus:!0})}),m?(0,Z.jsx)(ot,{open:m,onOpenChange:h,title:Te(),currentId:t,onPick:t=>void s({chatId:e._id,projectId:t})}):null]})}function _t(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function vt(e,t,n,r,i){let a=e.map(t),o=a.indexOf(i);if(o<0)return null;let s=a.indexOf(r);if(s>=0){let t=[...e],[r]=t.splice(s,1);t.splice(o,0,r);let i=t[o-1],a=t[o+1];return{prevKey:i===void 0?null:n(i),nextKey:a===void 0?null:n(a)}}let c=e[o-1];return{prevKey:c===void 0?null:n(c),nextKey:n(e[o])}}function yt(e,t){let n=new Map(t.map(e=>[e.chatId,e.lastSeenAt])),r=new Set;for(let t of e){let e=n.get(t._id);e!==void 0&&t.lastAssistantAt!==null&&t.lastAssistantAt>e&&r.add(t._id)}return r}var bt=`oc.projpage.view`;function xt(){let e=localStorage.getItem(bt);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,St=e=>`col:${e??`null`}`,Ct=e=>`crumb:${e}`;function wt(e){if(e.startsWith(`into:`))return e.slice(5);if(e.startsWith(`crumb:`))return e.slice(6);if(e.startsWith(`col:`)){let t=e.slice(4);return t===`null`?null:t}}function Tt(){let{projectId:e}=st({from:`/project/$projectId`}),t=I(),n=S(j.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:E()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:c()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:y()}),(0,Z.jsx)(P,{variant:`outline`,onClick:()=>void t({to:`/`}),children:Ce()})]}):(0,Z.jsx)(Et,{page:n})})}function Et({page:e}){let t=I(),n=Xe(),r=Ze(),o=Me(),c=M(j.projects.renameProject),u=M(j.projects.setProjectColor),f=M(j.projects.deleteProject),m=M(j.projects.createProject),h=M(j.projects.moveProject),y=M(j.projects.setProjectSidebar),x=M(j.chats.moveChatToProject),se=M(j.chats.reorderChat),le=M(j.projects.reorderProject),fe=S(j.projects.projectTreeCount,{projectId:e.project._id}),[w,E]=(0,X.useState)(xt),D=e=>{localStorage.setItem(bt,e),E(e)},k=S(j.projects.folderColumns,w===`columns`?{projectId:e.project._id}:`skip`),A=S(j.projects.projectTreeList,w===`list`?{projectId:e.project._id}:`skip`),{c:N}=Re({from:`/project/$projectId`}),Ce=S(j.projects.listProjects,{}),we=S(j.chatReads.myBusyChats,{}),Te=(0,X.useMemo)(()=>new Set(we??[]),[we]),Ae=S(j.chatReads.myChatReads,{}),Fe=(0,X.useMemo)(()=>yt(e.chats,Ae??[]),[e.chats,Ae]),{startNewChat:L,picker:qe}=tt(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[z,rt]=(0,X.useState)(``),[V,H]=(0,X.useState)(!1),[U,st]=(0,X.useState)(e.project.name),[ct,J]=(0,X.useState)(!1),[Y,ht]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ht(z.trim()),180);return()=>clearTimeout(e)},[z]);let Q=S(j.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),gt=Oe(it(lt,{activationConstraint:{distance:4}}),it(Je,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),St=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Ct,Tt]=(0,X.useState)(null),Et=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=k?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||O()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(Ce??[]).find(t=>t._id===e)?.name??``}}return null},kt=e=>Tt(Et(String(e.active.id))),jt=(0,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=F(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=F(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=F(n(`crumb:`));if(a.length>0)return a;let o=F(n(`col:`));return o.length>0?o:Ne(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(w===`columns`){for(let e of k?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(w===`list`){let e=A?.chats.find(e=>e._id===t);return e?{list:A.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Pt=t=>{if(w===`columns`){for(let e of k?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(w===`list`){let e=A?.folders.find(e=>e._id===t);if(!e||!A)return null;let n=e.parentId??A.rootId;return{list:Qe(A.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},It=async e=>{Tt(null),St();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),a=i.startsWith(`chat:`);try{let e=wt(r);if(e!==void 0){if(a)await x({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Le(Ce??[],t,e)){o.error(Ee());return}await h({projectId:t,parentId:e})}return}if(a&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=Nt(t);if(!n)return;n.list.some(t=>t._id===e)||await x({chatId:e,projectId:n.folderId});let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await se({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Pt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Le(Ce??[],e,n.parentId)){o.error(Ee());return}await h({projectId:e,parentId:n.parentId})}let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await le({projectId:e,...a});return}}catch{o.error(Ee())}},[,Lt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Lt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Rt=Date.now(),zt=B(e.project),Bt=_t(e.chats,z),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,Z.jsxs)(Ke,{sensors:gt,collisionDetection:jt,onDragStart:kt,onDragEnd:It,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":zt},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":a(),children:[Vt.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(Dt,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Ht(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Z.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Z.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,Z.jsxs)(P,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:be(),onClick:()=>{y({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(He,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:ge()}),(0,Z.jsx)(Be,{"aria-hidden":!0})]}):null,(0,Z.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":b(),children:[(0,Z.jsx)(P,{variant:w===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":b(),title:b(),"aria-pressed":w===`cards`,onClick:()=>D(`cards`),children:(0,Z.jsx)(mt,{})}),(0,Z.jsx)(P,{variant:w===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":d(),title:d(),"aria-pressed":w===`columns`,onClick:()=>D(`columns`),children:(0,Z.jsx)(ft,{})}),(0,Z.jsx)(P,{variant:w===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":te(),title:te(),"aria-pressed":w===`list`,onClick:()=>D(`list`),children:(0,Z.jsx)(De,{})})]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>void L({projectId:e.project._id}),children:[(0,Z.jsx)(Ye,{}),g()]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await r({title:v(),label:de(),placeholder:ue(),confirmLabel:xe()});t&&await m({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(ke,{}),v()]}),(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":ye(),children:(0,Z.jsx)(Ge,{})})}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(R,{onSelect:()=>{st(e.project.name),H(!0)},children:[(0,Z.jsx)(et,{}),` `,T()]}),(0,Z.jsxs)(R,{onSelect:()=>J(!0),children:[(0,Z.jsx)(pt,{}),` `,ce()]}),(0,Z.jsx)(Pe,{children:_e()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void u({projectId:e.project._id,color:null}),"aria-label":oe(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void u({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=fe?.folders??0,a=fe?.chats??0;await n({title:ne({name:e.project.name}),description:i>0?p({folders:i,chats:a}):a>0?re({count:a}):ve(),confirmWord:C(),confirmLabel:ie(),destructive:!0})&&(await f({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,Z.jsx)(nt,{}),` `,C()]})]})]})]})]}),w===`columns`?(0,Z.jsx)(Ft,{data:k,currentId:e.project._id,busyIds:Te,suppressClick:$,locateChatId:N??null}):w===`list`?(0,Z.jsx)(Mt,{data:A,busyIds:Te,suppressClick:$,locateChatId:N??null}):(0,Z.jsxs)(Z.Fragment,{children:[e.children.length>0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:l()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(K,{items:e.children.map(e=>`folder:${e._id}`),strategy:dt,children:e.children.map(t=>(0,Z.jsx)(Ot,{child:t,parentId:e.project._id,now:Rt,suppressClick:$},t._id))})})]}):null,(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ee()}),e.chats.length>0?(0,Z.jsx)(W,{value:z,onChange:e=>rt(e.target.value),placeholder:i(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?_():s()}):Bt.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:pe({term:z.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(K,{items:Bt.map(e=>`chat:${e._id}`),strategy:q,children:Bt.map(t=>(0,Z.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:Te.has(t._id),unread:Fe.has(t._id),locate:t._id===N,suppressClick:$},t._id))})})]}),Y.length>=2&&Q!==void 0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:me()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:pe({term:Y})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:Q.map(e=>(0,Z.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&Y&&We(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(ut,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Z.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||ae()}),e.projectPath&&e.projectPath.length>1?(0,Z.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,Z.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,Z.jsx)($e,{open:V,onOpenChange:H,title:he(),canSubmit:U.trim().length>0,onSubmit:async()=>{await c({projectId:e.project._id,name:U.trim()}),H(!1)},submitLabel:T(),children:(0,Z.jsx)(W,{value:U,onChange:e=>st(e.target.value),autoFocus:!0})}),ct?(0,Z.jsx)(ot,{open:ct,onOpenChange:J,title:Se(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void h({projectId:e.project._id,parentId:t})}):null,qe]}),(0,Z.jsx)(je,{children:Ct?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,Z.jsx)(G,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ut,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=L({id:Ct(e)});return(0,Z.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Ot({child:e,parentId:t,now:n,suppressClick:r}){let i=I(),a=z({id:`folder:${e._id}`}),o=L({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":B(e),transform:H.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,Z.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Z.jsx)(G,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,Z.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?h({count:e.folderCount})+` · `:``,w({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:rt(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=M(j.chats.setChatSidebar),n=e.inSidebar?x():u();return(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,Z.jsx)(qe,{}):(0,Z.jsx)(Y,{})})}function At({chat:e,currentFolderId:t,now:n,busy:i,unread:a,locate:o,suppressClick:s}){let c=I(),l=V(e.color),u=z({id:`chat:${e._id}`}),d=jt(o);return(0,Z.jsxs)(`li`,{ref:e=>{u.setNodeRef(e),d.current=e},className:`oc-projpage__chatrow`+(u.isDragging?` is-dragging`:``)+(o?` is-locate`:``),style:{transform:H.Transform.toString(u.transform),transition:u.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{s.current||c({to:`/chat/$chatId`,params:{chatId:e._id}})},...u.listeners,...u.attributes,children:[l?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||O()}),e.pinned?(0,Z.jsx)(J,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:rt(e.updatedAt,n)}),i?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:se(),"aria-label":se()}):null,a&&!i?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:r(),"aria-label":r()}):null]}),(0,Z.jsx)(kt,{chat:e}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function jt(e){let t=(0,X.useRef)(null);return(0,X.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Mt({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,X.useState)(new Set),o=(0,X.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:E()});if(e===null)return null;let s=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=(a,l)=>{let u=o.get(a??e.rootId)??[],d=Qe(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{items:u.map(e=>`chat:${e._id}`),strategy:q,children:u.map(e=>(0,Z.jsx)(Pt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(K,{items:d.map(e=>`folder:${e._id}`),strategy:q,children:d.map(t=>(0,Z.jsx)(Nt,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&Qe(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:_()}):c(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=I(),c=z({id:`folder:${e._id}`}),l=L({id:$(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":B(e),transform:H.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?m():f(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(Ae,{size:13}):(0,Z.jsx)(Fe,{size:13})}),(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Pt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=I(),o=z({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a({to:`/chat/$chatId`,params:{chatId:e._id}})},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||O()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(kt,{chat:e})]})}function Ft({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:E()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.jsx)(It,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function It({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=I(),c=L({id:St(e.folderId)});return(0,Z.jsxs)(`div`,{ref:c.setNodeRef,className:`oc-projpage__col`+(c.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(K,{items:e.folders.map(e=>`folder:${e._id}`),strategy:q,children:e.folders.map(t=>(0,Z.jsx)(Lt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,Z.jsx)(K,{items:e.chats.map(e=>`chat:${e._id}`),strategy:q,children:e.chats.map(t=>(0,Z.jsx)(Rt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:s()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=z({id:`folder:${e._id}`}),o=L({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":B(e),transform:H.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Rt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=z({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||O()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(kt,{chat:e})]})}export{Tt as ProjectPage};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ax as r,Co as i,Eo as a,Ii as o,Li as s,Ri as c,Sx as l,To as u,_x as d,ax as f,bx as p,cx as m,dB as h,dx as g,fc as _,fo as v,fx as y,gc as b,go as x,gx as S,hc as C,ho as w,hx as T,ix as E,kx as D,lx as O,mc as k,mo as ee,mx as te,ox as ne,pc as re,po as ie,px as ae,rt as oe,rx as A,sx as j,t as M,uB as N,ux as P,vx as F,wo as I,xx as L,yx as R}from"./api-BKX0b765.js";import{i as z,n as B,r as V,t as H}from"./FieldLabel-D831BT1G.js";import{t as U}from"./button-DzIspcBY.js";import{$ as W,Dt as se,Q as G,Qt as K,X as q,Xt as ce,Yt as J,Z as Y,Zt as le,et as X,q as ue,ut as de}from"./index-BbZI7MO0.js";import{r as Z,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:d,help:S},documentary_fetch:{label:T,help:te},inbound_files:{label:ae,help:y},history_summary:{label:b,help:C},file_curation:{label:a,help:x},quote_reply:{label:u,help:I}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
|
-
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
|
-
Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
|
|
4
|
-
- [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:f,references:E,files:A,previous_summary:k,new_messages:re,max_chars:_,file_name:w,budget_chars:ee,feedback:ie,content:v,excerpt:i};function _e(){let e=h(M.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:P()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:l(),help:L()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:g()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=N(M.admin.upsertInstanceConfig),n=se(),i=h(M.me.getMe,{host:ue}),a=e.config??{},l=Z(e.config?.contentLocale,i?.defaultLocale??void 0),[u,d]=(0,Q.useState)(()=>z(a,l));(0,Q.useEffect)(()=>{d(z(a,l))},[l,e._id]);let[f,p]=(0,Q.useState)(!1),m=u.promptInjections,g=(e,t)=>d({...u,promptInjections:{...m,[e]:{...m[e],...t}}});async function _(){p(!0);try{await t({instanceId:e._id,config:V(u,a,l)})}catch(e){n.error(D(),e)}finally{p(!1)}}async function v(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(D(),e)}}let y=e.config?.contentLocale??`default`,b=fe[Z(void 0,i?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:c()}),(0,$.jsxs)(q,{value:y,onValueChange:e=>void v(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(G,{value:`default`,children:o({locale:b})}),pe().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}),ce.map(e=>(0,$.jsx)(ye,{injKey:e,def:J[e],i18n:me[e],row:m[e]??{enabled:!0,template:J[e].defaultTemplate[l]},contentLocale:l,onChange:t=>g(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void _(),disabled:f,children:r()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),c=r.template.trim()!==t.defaultTemplate[i],l=t.togglable&&!r.enabled,u=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),d=le(e,r,i),f=d?K(d,u):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(de,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),c&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:R()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:l,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:F()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?m():O()}),c&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:p()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:f}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:j()}),t.pluralDefaultTemplate!==void 0&&!l?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:oe()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:ne()})})]})}export{_e as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Fw as ee,Gw as te,Iw as ne,Jw as i,Kw as re,Lw as a,Mw as o,Nw as s,Pw as c,Qw as l,Rw as u,Xo as d,Xw as f,Yw as p,Zw as m,_T as h,aT as g,bT as _,cT as v,dB as y,dT as b,eT as x,fT as S,gT as C,hT as w,iT as ie,jw as T,lT as E,mT as D,nT as O,oT as k,pT as A,qw as j,rT as M,sT as N,t as P,tT as F,uB as I,uT as L,vT as R,yT as z,zw as ae}from"./api-BKX0b765.js";import{t as B}from"./button-DzIspcBY.js";import{Dt as V,En as H,Et as U,U as W,_ as G,jt as K,ut as q}from"./index-BbZI7MO0.js";import{t as J}from"./roleDescriptions-Bc3Grr9Z.js";var Y=t(e(),1),X=n(),Z=[{group:()=>_(),keys:[{key:`traces.read`,label:()=>w()},{key:`traces.read.content`,label:()=>D(),phi:!0},{key:`traces.write`,label:()=>A()}]},{group:()=>z(),keys:[{key:`kpi.read`,label:()=>w()},{key:`kpi.write`,label:()=>A()}]},{group:()=>R(),keys:[{key:`openclaw.query`,label:()=>S()},{key:`anomalies.read`,label:()=>b()},{key:`anomalies.report`,label:()=>L()}]},{group:()=>h(),keys:[{key:`chats.read`,label:()=>w()},{key:`selfheal`,label:()=>v()},{key:`feedback.respond`,label:()=>d()}]},{group:()=>C(),keys:[{key:`admin.manage`,label:()=>E()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=y(P.apiKeys.listRoles,{}),t=I(P.apiKeys.createRole),n=I(P.apiKeys.ensureRolesSeeded),d=I(P.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(P.apiKeys.listRoles,{});r&&e.setQuery(P.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),h=W(),_=V(),[v,b]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)($),[w,E]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{_.error(k(),e)})},[n,_]);let D=e??[];async function A(e,t){if(Q(e.permissions))return;if(e.builtin){await h({title:g({name:e.name}),description:ie(),confirmLabel:M()});return}if(w.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];E(t=>new Set(t).add(e._id));try{await d({roleId:e._id,permissions:n})}catch(e){_.error(O(),e)}finally{E(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function L(){try{await t({key:S.key,name:S.name,description:S.description||void 0,permissions:[]}),C($),b(!1)}catch(e){_.error(F(),e)}}let R=e===void 0,z=!R&&D.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,r(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,l()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:m()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{C($),b(!0)},children:f()})})]}),R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:j()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?N({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:D.map(e=>{let t=Q(e.permissions),n=w.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,re()]}):(0,X.jsx)(U,{variant:`secondary`,children:te()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(q,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?ae():n?u():r,onCheckedChange:()=>void A(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:v,onOpenChange:b,title:a(),description:ne(),canSubmit:!!(S.key&&S.name),onSubmit:L,submitLabel:ee(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:c()}),(0,X.jsx)(K,{value:S.key,placeholder:s(),onChange:e=>C({...S,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,X.jsx)(K,{value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:T()}),(0,X.jsx)(K,{value:S.description,onChange:e=>C({...S,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,$L as i,AR as a,BI as o,BL as s,BR as c,CL as l,D as u,DL as ee,DR as d,EL as f,ER as p,FL as m,FR as h,GI as te,HI as ne,IL as re,IR as ie,JI as ae,JL as oe,KI as se,KL as ce,LL as le,LR as ue,ML as de,MR as fe,NI as pe,NL as me,NR as he,OR as ge,PL as _e,PR as ve,QI as ye,QL as be,RL as xe,RR as Se,SL as Ce,TL as g,TR as we,UI as Te,UL as Ee,VI as De,VL as Oe,WI as ke,XI as Ae,XL as je,YI as Me,YL as Ne,ZI as Pe,ZL as Fe,_L as Ie,aR as Le,bL as Re,cB as _,dB as ze,eL as Be,eR as v,fL as Ve,gL as He,hL as Ue,iB as y,iR as We,jR as Ge,kR as Ke,mL as b,nB as qe,nL as Je,nR as Ye,oR as Xe,pL as Ze,qI as Qe,qL as $e,rR as et,sR as tt,t as x,tL as nt,vL as S,wL as rt,xL as it,yL as at,zI as ot,zL as st,zR as ct}from"./api-BKX0b765.js";import{t as lt}from"./list-CpHCJVWf.js";import{t as C}from"./button-DzIspcBY.js";import{$ as w,Bn as T,Bt as E,Ct as ut,Dn as dt,Dt as ft,Et as D,Q as O,Rt as k,St as pt,Tt as mt,Vn as A,X as j,Z as M,_n as ht,_t as gt,at as _t,bn as vt,bt as yt,dn as bt,et as N,gt as xt,hn as St,it as Ct,jt as wt,nt as Tt,on as Et,ot as Dt,q as Ot,rt as kt,tt as At,vt as jt,wt as Mt,xn as Nt,xt as Pt,yt as Ft,zt as P}from"./index-BbZI7MO0.js";import{a as It,i as F,n as Lt,o as Rt,r as I,t as zt}from"./table-1BG3EWti.js";import{t as Bt}from"./FilterBar-udwh54Yv.js";/* empty css */import{a as Vt,c as L,i as R,l as Ht,n as Ut,o as Wt,r as Gt,s as Kt,t as qt,u as z}from"./TimezoneCombobox-B7yB12f8.js";var Jt=u(`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`}]]),Yt=u(`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`}]]),B=t(e(),1),V=n();function H(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 Xt({value:e,onChange:t}){let n=Ht(e),r=(0,B.useMemo)(()=>new Date,[]),[i,a]=(0,B.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,B.useState)(!1),c=(0,B.useMemo)(()=>H(y()),[]),u=(0,B.useMemo)(()=>new Intl.DateTimeFormat(y(),{month:`long`,year:`numeric`}),[]),d=(0,B.useMemo)(()=>new Intl.DateTimeFormat(y(),{dateStyle:`medium`,timeStyle:`short`}),[]),p=L(i.year,i.month),m=n?.hour??9,h=n?.minute??0,te=(e,n,r,i,a)=>t(z(e,n,r,i,a)),ne=(e,t,n)=>{a({year:e,month:t}),te(e,t,n,m,h)},re=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},ie=n===null?f():d.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,V.jsxs)(k,{modal:!0,open:o,onOpenChange:s,children:[(0,V.jsx)(E,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":ee(),children:[(0,V.jsx)(Jt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,V.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:ie})]})}),(0,V.jsxs)(P,{align:`start`,className:`oc-dtp__pop`,children:[(0,V.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":g(),onClick:()=>re(-1),children:(0,V.jsx)(A,{size:15,"aria-hidden":!0})}),(0,V.jsx)(`span`,{className:`oc-dtp__month`,children:u.format(new Date(i.year,i.month,1))}),(0,V.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":rt(),onClick:()=>re(1),children:(0,V.jsx)(T,{size:15,"aria-hidden":!0})})]}),(0,V.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,V.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),p.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,V.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>ne(e.year,e.month,e.day),children:e.day},t)})]}),(0,V.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,V.jsxs)(j,{value:String(m),onValueChange:e=>te(i.year,i.month,n?.day??r.getDate(),Number(e),h),children:[(0,V.jsx)(w,{size:`sm`,"aria-label":l(),children:(0,V.jsx)(N,{})}),(0,V.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,V.jsx)(O,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,V.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,V.jsxs)(j,{value:String(h),onValueChange:e=>te(i.year,i.month,n?.day??r.getDate(),m,Number(e)),children:[(0,V.jsx)(w,{size:`sm`,"aria-label":Ce(),children:(0,V.jsx)(N,{})}),(0,V.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,V.jsx)(O,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function U(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Zt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Qt(e){let t=new Map;for(let n of e){let e=U(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 $t(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(Zt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function en(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function tn(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function nn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var W=3;function rn({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=y(),c=(0,B.useMemo)(()=>Qt(e),[e]),l=(0,B.useMemo)(()=>en(s),[s]),u=(0,B.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),ee=(0,B.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),d=(0,B.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),f=new Date,p=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()})},m=t===`year`?String(n.year):u.format(new Date(n.year,n.month,1));return(0,V.jsxs)(`div`,{className:`oc-cal`,children:[(0,V.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,V.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":Ue(),onClick:()=>p(-1),children:(0,V.jsx)(A,{})}),(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":b(),onClick:()=>p(1),children:(0,V.jsx)(T,{})}),(0,V.jsx)(C,{variant:`ghost`,size:`sm`,onClick:()=>i({year:f.getFullYear(),month:f.getMonth()}),children:He()})]}),(0,V.jsx)(`span`,{className:`oc-cal__title`,children:m}),(0,V.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,V.jsx)(C,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:S()}),(0,V.jsx)(C,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:Ie()})]})]}),t===`month`?(0,V.jsx)(an,{cursor:n,byDay:c,weekdays:l,timeFmt:d,now:f,onEventClick:a}):(0,V.jsx)(on,{year:n.year,byDay:c,monthShortFmt:ee,now:f,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,V.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function an({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=L(e.year,e.month);return(0,V.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,V.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Zt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,V.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,V.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,W).map(e=>(0,V.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,V.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,V.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>W?(0,V.jsx)(`span`,{className:`oc-cal__more`,children:Ze({count:o.length-W})}):null]},n)})]})}function on({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,V.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=$t(t,e,o),c=L(e,o);return(0,V.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,V.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,V.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,V.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var sn={h:36e5,min:6e4,s:1e3,ms:1};function cn(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])*sn[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 G(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 K(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=G(t[0],0,59),r=G(t[1],0,23),i=G(t[2],1,31),a=G(t[3],1,12),o=G(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 ln=new Map;function q(e){let t=ln.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 ln.set(e,n),n}function J(e,t){if(t!==null){let n=q(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 Y(e,t,n,r,i,a){if(a===null||q(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=J(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 X(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=K(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=J(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=Y(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=Y(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 Z=`crons`;function un(e,t){return`${e}\u0000${t}`}function dn(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=un(a.instanceName,e.id);i.set(o,a);let s=Wt(e)!==`active`,c=X(s?null:cn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Z,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var Q={minutes:6e4,hours:36e5,days:864e5};function $(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Kt(e)){case`ok`:return(0,V.jsx)(D,{variant:`secondary`,children:s()});case`error`:return(0,V.jsx)(D,{variant:`destructive`,children:xe()});case`running`:return(0,V.jsx)(D,{variant:`outline`,children:le()});case`other`:return(0,V.jsx)(D,{variant:`outline`,children:e});case`none`:return(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=_(x.scheduled.listMyCrons),t=_(x.scheduled.getCronDetail),n=_(x.scheduled.listCronRuns),l=_(x.scheduled.updateCron),u=_(x.scheduled.removeCron),ee=_(x.scheduled.runCronNow),f=ft(),Ce=ze(x.me.getMe,{host:Ot})?.timezone,[g,Ie]=(0,B.useState)(null),[He,Ue]=(0,B.useState)(!1),[b,Ze]=(0,B.useState)(!1),[S,rt]=(0,B.useState)(null),[T,E]=(0,B.useState)(null),[k,A]=(0,B.useState)(null),[P,L]=(0,B.useState)(null),[Ht,Kt]=(0,B.useState)(!1),[z,H]=(0,B.useState)(Ut),[U,Zt]=(0,B.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Qt=e=>{localStorage.setItem(`oc.sched.view`,e),Zt(e)},[$t,en]=(0,B.useState)(`month`),[W,an]=(0,B.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),on=(0,B.useMemo)(()=>{let e=[];for(let t of g??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Vt(r,z)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[g,z]),sn=(0,B.useMemo)(()=>$t===`year`?nn(W.year):tn(W.year,W.month),[$t,W]),cn=(0,B.useMemo)(()=>dn(on,sn.startMs,sn.endMs),[on,sn]),G=e=>{let t=cn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},K=(0,B.useCallback)(async()=>{Ue(!0),Ze(!1);try{Ie(await e({}))}catch{Ze(!0)}finally{Ue(!1)}},[e]);(0,B.useEffect)(()=>{K()},[K]);let ln=(0,B.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),q=(0,B.useRef)(null);(0,B.useEffect)(()=>{g!==null&&q.current!==null&&q.current.scrollIntoView({block:`center`})},[g]);let J=(0,B.useMemo)(()=>new Intl.DateTimeFormat(y(),{dateStyle:`medium`,timeStyle:`short`}),[]),Y=async(e,t,n)=>{rt(e);try{await t(),f.success(n),await K()}catch(e){f.toast({variant:`error`,title:v({code:$(e)})})}finally{rt(null)}},X=(0,B.useRef)(0),Z=(0,B.useRef)(0),un=async(e,t)=>{if(t.id===null)return;let r=++X.current;A({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==X.current)return;A({name:t.name??t.id,entries:i})}catch(e){if(r!==X.current)return;A(null),f.toast({variant:`error`,title:v({code:$(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Z.current;L({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%Q.days===0?(s=String(e/Q.days),c=`days`):e%Q.hours===0?(s=String(e/Q.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/Q.minutes))),c=`minutes`))}if(r!==Z.current)return;L(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Z.current)return;L(null),f.toast({variant:`error`,title:v({code:$(e)})})}},mn=async()=>{if(P===null)return;let e={};if(P.nameDirty&&P.name.trim()===``||P.messageDirty&&P.hasMessage&&P.message.trim()===``){f.toast({variant:`error`,title:ot()});return}if(P.nameDirty&&P.name.trim()!==``&&(e.name=P.name.trim()),P.scheduleDirty){if(P.scheduleKind===`cron`&&P.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:P.cronExpr.trim(),...P.tz.trim()===``?{}:{tz:P.tz.trim()}};else if(P.scheduleKind===`every`){let t=Number(P.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*Q[P.everyUnit])})}else if(P.scheduleKind===`at`&&P.at!==``){let t=Date.parse(P.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(P.scheduleDirty&&e.schedule===void 0){f.toast({variant:`error`,title:o()});return}if(P.messageDirty&&P.hasMessage&&P.message.trim()!==``&&(e.message=P.message.trim()),Object.keys(e).length===0){L(null);return}let t=Z.current;Kt(!0);try{await l({instanceName:P.instanceName,jobId:P.jobId,patch:e}),f.success(r()),t===Z.current&&L(null),await K()}catch(e){f.toast({variant:`error`,title:v({code:$(e)})})}finally{Kt(!1)}},hn=g?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,V.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:c()}),(0,V.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":it(),children:[(0,V.jsx)(C,{variant:U===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Re(),title:Re(),"aria-pressed":U===`list`,onClick:()=>Qt(`list`),children:(0,V.jsx)(lt,{})}),(0,V.jsx)(C,{variant:U===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":at(),title:at(),"aria-pressed":U===`calendar`,onClick:()=>Qt(`calendar`),children:(0,V.jsx)(Jt,{})})]}),(0,V.jsxs)(C,{variant:`ghost`,size:`sm`,onClick:()=>void K(),disabled:He,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,V.jsx)(St,{size:14,"aria-hidden":!0}),ct()]})]}),g!==null&&hn>0?(0,V.jsxs)(Bt,{q:z.q,onQChange:e=>H(t=>({...t,q:e})),searchPlaceholder:m(),onReset:()=>H(Ut),canReset:Gt(z),children:[(0,V.jsxs)(j,{value:z.state,onValueChange:e=>H(t=>({...t,state:e})),children:[(0,V.jsx)(w,{size:`sm`,className:`w-40`,children:(0,V.jsx)(N,{})}),(0,V.jsxs)(M,{children:[(0,V.jsx)(O,{value:`all`,children:_e()}),(0,V.jsx)(O,{value:`active`,children:p()}),(0,V.jsx)(O,{value:`paused`,children:d()}),(0,V.jsx)(O,{value:`auto-disabled`,children:we()})]})]}),(0,V.jsxs)(j,{value:z.result,onValueChange:e=>H(t=>({...t,result:e})),children:[(0,V.jsx)(w,{size:`sm`,className:`w-40`,children:(0,V.jsx)(N,{})}),(0,V.jsxs)(M,{children:[(0,V.jsx)(O,{value:`all`,children:me()}),(0,V.jsx)(O,{value:`ok`,children:s()}),(0,V.jsx)(O,{value:`error`,children:xe()}),(0,V.jsx)(O,{value:`running`,children:le()}),(0,V.jsx)(O,{value:`none`,children:re()})]})]})]}):null,g===null?(0,V.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":He,children:b?Se():qe()}):U===`calendar`?(0,V.jsxs)(V.Fragment,{children:[b?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):null,g.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):(0,V.jsx)(rn,{events:cn.events,mode:$t,cursor:W,onModeChange:en,onCursorChange:an,onEventClick:G,footnote:Ve()})]}):(0,V.jsxs)(V.Fragment,{children:[b?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):null,g.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):null,g.map(e=>{let t=e.jobs.filter(e=>Vt(e,z)),n=Gt(z)&&e.jobs.length>0&&t.length===0;return(0,V.jsxs)(`section`,{style:{marginBottom:20},children:[g.length>1||e.error||!e.supported?(0,V.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,V.jsx)(D,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:h({code:e.error})}):e.jobs.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):n?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):(0,V.jsxs)(zt,{children:[(0,V.jsx)(It,{children:(0,V.jsxs)(Rt,{children:[(0,V.jsx)(F,{children:he()}),(0,V.jsx)(F,{children:fe()}),(0,V.jsx)(F,{children:Ge()}),(0,V.jsx)(F,{children:a()}),(0,V.jsx)(F,{children:Ke()}),(0,V.jsx)(F,{children:Oe()}),(0,V.jsx)(F,{children:Je()})]})}),(0,V.jsx)(Lt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,a=S===r,o=e.manageSupported,s=e.kind===`openclaw`&&o;return(0,V.jsxs)(Rt,{ref:t.id!==null&&t.id===ln?q:void 0,"data-state":t.id!==null&&t.id===ln?`selected`:void 0,children:[(0,V.jsx)(I,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??ge()}),(0,V.jsx)(I,{children:(0,V.jsx)(D,{variant:`secondary`,children:t.agentId})}),(0,V.jsxs)(I,{className:`whitespace-nowrap`,children:[(0,V.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=xt(t.schedule),n=e===null?null:gt(e);return n===null?null:(0,V.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,V.jsx)(I,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:J.format(t.nextRunAtMs)}),(0,V.jsx)(I,{children:Wt(t)===`auto-disabled`?(0,V.jsx)(D,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${J.format(t.autoDisabledAtMs)}`}`,children:we()}):Wt(t)===`active`?(0,V.jsx)(D,{variant:`secondary`,children:p()}):Wt(t)===`paused`?(0,V.jsx)(D,{variant:`outline`,children:d()}):(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,V.jsxs)(I,{children:[(0,V.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,V.jsx)(D,{variant:`destructive`,title:t.lastDeliveryError??tt(),children:st()}):null]}),(0,V.jsx)(I,{className:`whitespace-nowrap`,children:t.id===null?(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,V.jsx)(dt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,V.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Le(),"aria-label":Le(),disabled:S!==null,onClick:()=>void Y(r,async()=>{let n=await ee({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},i()),children:(0,V.jsx)(Et,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:R(t)===`pause`?We():et(),"aria-label":R(t)===`pause`?We():et(),disabled:S!==null,onClick:()=>void Y(r,()=>l({instanceName:e.instanceName,jobId:t.id,patch:{enabled:R(t)===`resume`}}),R(t)===`pause`?be():Fe()),children:R(t)===`pause`?(0,V.jsx)(Nt,{size:14,"aria-hidden":!0}):(0,V.jsx)(ht,{size:14,"aria-hidden":!0})}):null,s?(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:nt(),"aria-label":nt(),disabled:S!==null,onClick:()=>void pn(e.instanceName,t),children:(0,V.jsx)(vt,{size:14,"aria-hidden":!0})}):null,s?(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Be(),"aria-label":Be(),disabled:S!==null,onClick:()=>void un(e.instanceName,t),children:(0,V.jsx)(Yt,{size:14,"aria-hidden":!0})}):null,o?(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Ye(),"aria-label":Ye(),disabled:S!==null,onClick:()=>E({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,V.jsx)(bt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:ie()})]},e.instanceName)}),hn>0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:pe()}):null]}),(0,V.jsx)(jt,{open:T!==null,onOpenChange:e=>{e||E(null)},children:(0,V.jsxs)(Pt,{children:[(0,V.jsxs)(Mt,{children:[(0,V.jsx)(mt,{children:Ne()}),(0,V.jsx)(pt,{children:oe({name:T?.name??``})})]}),(0,V.jsxs)(ut,{children:[(0,V.jsx)(yt,{children:$e()}),(0,V.jsx)(Ft,{onClick:()=>{let e=T;E(null),e!==null&&Y(`${e.instanceName}:${e.jobId}`,()=>u({instanceName:e.instanceName,jobId:e.jobId}),je())},children:ce()})]})]})}),(0,V.jsx)(At,{open:k!==null,onOpenChange:e=>{e||(X.current++,A(null))},children:(0,V.jsxs)(Tt,{style:{maxWidth:640},children:[(0,V.jsx)(_t,{children:(0,V.jsx)(Dt,{children:ye({name:k?.name??``})})}),k?.entries===null?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):k!==null&&k.entries.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}):k===null?null:(0,V.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:k.entries.map((e,t)=>(0,V.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,V.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,V.jsx)(fn,{status:e.status}),(0,V.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?J.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,V.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,V.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,V.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,V.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[Ee({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,V.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,V.jsx)(At,{open:P!==null,onOpenChange:e=>{e||(Z.current++,L(null))},children:(0,V.jsxs)(Tt,{className:`oc-cronedit`,children:[(0,V.jsxs)(_t,{children:[(0,V.jsx)(Dt,{children:Ae()}),(0,V.jsx)(kt,{children:Me()})]}),P===null?null:P.loading?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,V.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,V.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:he()}),(0,V.jsx)(wt,{value:P.name,maxLength:200,onChange:e=>L({...P,name:e.target.value,nameDirty:!0})})]}),(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,V.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ae()}),(0,V.jsxs)(j,{value:P.scheduleKind,onValueChange:e=>L({...P,scheduleKind:e,scheduleDirty:!0}),children:[(0,V.jsx)(w,{children:(0,V.jsx)(N,{})}),(0,V.jsxs)(M,{children:[(0,V.jsx)(O,{value:`cron`,children:Qe()}),(0,V.jsx)(O,{value:`every`,children:se()}),(0,V.jsx)(O,{value:`at`,children:te()})]})]}),P.scheduleKind===`cron`?(0,V.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,V.jsx)(wt,{value:P.cronExpr,onChange:e=>L({...P,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,V.jsx)(qt,{value:P.tz,onChange:e=>L({...P,tz:e,scheduleDirty:!0}),fallbackTz:Ce??void 0})]}):P.scheduleKind===`every`?(0,V.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,V.jsx)(wt,{type:`number`,min:1,value:P.everyValue,onChange:e=>L({...P,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,V.jsxs)(j,{value:P.everyUnit,onValueChange:e=>L({...P,everyUnit:e,scheduleDirty:!0}),children:[(0,V.jsx)(w,{style:{maxWidth:160},children:(0,V.jsx)(N,{})}),(0,V.jsxs)(M,{children:[(0,V.jsx)(O,{value:`minutes`,children:ke()}),(0,V.jsx)(O,{value:`hours`,children:Te()}),(0,V.jsx)(O,{value:`days`,children:ne()})]})]})]}):(0,V.jsx)(Xt,{value:P.at,onChange:e=>L({...P,at:e,scheduleDirty:!0})})]}),P.hasMessage?(0,V.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,V.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Xe()}),(0,V.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:P.message,onChange:e=>L({...P,message:e.target.value,messageDirty:!0})})]}):null]}),(0,V.jsxs)(Ct,{children:[(0,V.jsx)(C,{variant:`ghost`,onClick:()=>L(null),children:$e()}),(0,V.jsxs)(C,{onClick:()=>void mn(),disabled:P===null||P.loading||Ht,children:[Ht?(0,V.jsx)(dt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,De()]})]})]})})]})}export{pn as ScheduledTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,AN as i,BN as ee,CN as a,DN as te,EN 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 ue,NN as de,ON as fe,PN as pe,QN as me,RN as he,SN as o,TN as ge,UN as _e,VN as ve,WN as ye,XN as be,YN as xe,ZN as Se,_N as s,_P as Ce,aN as we,aP as Te,bN as Ee,bP as De,cB as Oe,cN as ke,cP as Ae,dB as c,dN as l,dP as je,eN as u,eP as Me,fN as d,fP as Ne,gN as f,gP as Pe,hN as p,hP as m,iN as h,iP as Fe,jN as Ie,kN as Le,lN as g,lP as Re,mN as _,mP as v,nN as y,nP as ze,oN as b,oP as Be,pN as x,pP as Ve,qN as He,rN as S,rP as Ue,sN as C,sP as We,t as w,tN as T,tP as Ge,uB as E,uN as D,uP as Ke,vN as O,vP as qe,wN as Je,xN as k,yN as A,yP as Ye,zN as Xe}from"./api-BKX0b765.js";import{t as j}from"./button-DzIspcBY.js";import{$ as M,Bn as Ze,Dt as Qe,Et as N,Gn as $e,Hn as et,In as P,Kn as tt,Q as F,U as nt,Un as I,X as L,Z as R,_ as rt,at as z,ct as B,et as V,it as H,jt as U,nt as W,ot as G,rt as it,st as at,tt as K}from"./index-BbZI7MO0.js";import{t as ot}from"./FilterBar-udwh54Yv.js";import{t as st}from"./DataTableShell-CSEsiKU5.js";import{t as ct}from"./roleDescriptions-Bc3Grr9Z.js";var q=t(e(),1),J=n(),lt=[{value:`never`,label:()=>b(),days:null},{value:`30`,label:()=>we(),days:30},{value:`90`,label:()=>h(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=tt({from:`/settings/serviceAccounts`}),t=$e({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??X,[o,s]=(0,q.useState)(X),we=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Ee=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),ke=c(w.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===X?void 0:o,disabled:a===X?void 0:a===`disabled`}}),l=c(w.apiKeys.listKeys,{}),u=c(w.apiKeys.listRoles,{}),d=E(w.apiKeys.createServiceAccount),f=E(w.apiKeys.updateServiceAccount),p=E(w.apiKeys.deleteServiceAccount),h=Oe(w.apiKeys.mintApiKey),g=E(w.apiKeys.revokeApiKey),_=nt(),y=Qe(),b=n!==``||o!==X||a!==X;function x(){s(X),t({search:{},replace:!0})}let[S,C]=(0,q.useState)(!1),[T,D]=(0,q.useState)(Z),[O,k]=(0,q.useState)(null),[A,P]=(0,q.useState)(new Set),[I,z]=(0,q.useState)(null),B=(0,q.useRef)(!1),[H,W]=(0,q.useState)(new Set),[G,it]=(0,q.useState)({}),[at,K]=(0,q.useState)(null),Y=(0,q.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[l]);function Q(e){P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{O?(await f({serviceAccountId:O,name:T.name,roleKey:T.roleKey,description:T.description}),y.success(he())):await d({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),D(Z),k(null),C(!1)}catch(e){y.error(O?Xe():ee(),e)}}function pt(e){D({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),C(!0)}async function mt(e){if(B.current)return;B.current=!0;let t=G[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;z(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});K({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(le(),e)}finally{B.current=!1,z(null)}}async function $(e){if(await _({title:oe(),description:(0,J.jsxs)(J.Fragment,{children:[re(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,pe(),` `,(0,J.jsx)(`strong`,{children:de()}),` `,ue()]}),confirmWord:e.name,confirmLabel:Ie(),destructive:!0}))try{await p({serviceAccountId:e._id}),y.success(i(),e.name)}catch(e){y.error(Le(),e)}}async function ht(e){if(await _({title:fe(),description:(0,J.jsxs)(J.Fragment,{children:[te(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ne()]}),confirmLabel:ge(),destructive:!0})&&!H.has(e._id)){W(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){y.error(Je(),e)}finally{W(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:De()}),(0,J.jsxs)(ot,{q:n,onQChange:we,searchPlaceholder:Ye(),onReset:x,canReset:b,children:[(0,J.jsxs)(L,{value:o,onValueChange:s,children:[(0,J.jsx)(M,{size:`sm`,className:`w-40`,children:(0,J.jsx)(V,{placeholder:qe()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(F,{value:X,children:Ce()}),(u??[]).map(e=>(0,J.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(L,{value:a,onValueChange:Ee,children:[(0,J.jsx)(M,{size:`sm`,className:`w-36`,children:(0,J.jsx)(V,{})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(F,{value:X,children:Pe()}),(0,J.jsx)(F,{value:`active`,children:m()}),(0,J.jsx)(F,{value:`disabled`,children:v()})]})]})]}),(0,J.jsx)(st,{title:Ve(),rows:ke,addLabel:Ne(),onAdd:()=>{D(Z),k(null),C(!0)},emptyHint:je(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,J.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:H}),rowActions:e=>[...(e.managedBy??null)===null?[{label:We(),onSelect:()=>pt(e)},{label:Ke(),onSelect:()=>void mt(e)}]:[],{label:A.has(e._id)?Re():Ae(),onSelect:()=>Q(e._id)},...(e.managedBy??null)===null?[{label:Be(),variant:`destructive`,onSelect:()=>void $(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?Te():Fe(),onClick:()=>Q(e._id),children:A.has(e._id)?(0,J.jsx)(et,{}):(0,J.jsx)(Ze,{})})},{header:Ue(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:ze(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(N,{variant:`secondary`,children:e.roleKey})},{header:Ge(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(N,{variant:`destructive`,children:v()}):(0,J.jsx)(N,{variant:`outline`,children:m()})},{header:Me(),cell:e=>(0,J.jsxs)(L,{value:G[e._id]??`never`,onValueChange:t=>it(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(M,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{})}),(0,J.jsx)(R,{children:lt.map(e=>(0,J.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:r(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:I===e._id?me():Se({count:t})})}}]}),(0,J.jsx)(rt,{open:S,onOpenChange:e=>{C(e),e||k(null)},title:O?be():He(),description:O?xe():ce(),canSubmit:!!(T.name&&T.roleKey),onSubmit:ft,submitLabel:O?se():ie(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:ye()}),(0,J.jsx)(U,{value:T.name,onChange:e=>D({...T,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:_e()}),(0,J.jsxs)(L,{value:T.roleKey||void 0,onValueChange:e=>D({...T,roleKey:e}),children:[(0,J.jsx)(M,{className:`w-full`,children:(0,J.jsx)(V,{placeholder:ae()})}),(0,J.jsx)(R,{children:(u??[]).map(e=>(0,J.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===T.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:ve()}),(0,J.jsx)(U,{value:T.description,onChange:e=>D({...T,description:e.target.value})})]})]})}),(0,J.jsx)(dt,{minted:at,onClose:()=>K(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[a(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:k()}),(0,J.jsx)(`th`,{children:Ee()}),(0,J.jsx)(`th`,{children:A()}),(0,J.jsx)(`th`,{children:O()}),(0,J.jsx)(`th`,{children:s()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(N,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:B(t.createdAt)}),(0,J.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:mt(t.expiresAt)}),(0,J.jsx)(`td`,{children:$(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,J.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?p():_()}):null})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(K,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(W,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(z,{children:[(0,J.jsx)(G,{children:x()}),(0,J.jsx)(it,{children:d({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:l()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":D(),children:[n?(0,J.jsx)(I,{}):(0,J.jsx)(P,{}),n?g():ke()]})]}),(0,J.jsx)(H,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:C()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?S():B(e)}function mt(e){return e===null?`—`:at(e)}function $(e){return e.disabled?(0,J.jsx)(N,{variant:`destructive`,children:y()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(N,{variant:`outline`,children:T()}):(0,J.jsx)(N,{variant:`outline`,children:u()})}export{Q as ServiceAccountsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,$z as i,AF as a,BF as o,CF as s,CI as c,DF as l,DI as u,EF as d,EI as f,FF as p,GF as m,HF as h,IF as g,JF as _,KF as v,LF as y,MF as ee,NF as te,OF as ne,OI as re,PF as ie,QF as ae,Qz as oe,RF as se,SF as ce,SI as le,TF as ue,TI as de,UF as fe,VF as pe,WF as me,XF as he,YF as ge,ZF as _e,_F as ve,_I as ye,_c as be,aI as xe,bF as Se,bI as Ce,bc as b,cB as we,cF as Te,cI as Ee,dB as x,dF as S,dI as De,eB as Oe,eI as ke,fF as Ae,fI as je,gF as Me,gI as Ne,hF as C,hI as Pe,iI as Fe,jF as Ie,kF as Le,kI as Re,lF as ze,lI as Be,mF as Ve,mI as He,nI as Ue,oI as We,pF as Ge,pI as Ke,qF as qe,r as Je,rI as Ye,sF as Xe,sI as Ze,t as w,tI as Qe,uB as T,uF as $e,uI as et,vF as tt,vI as nt,vc as rt,wF as it,wI as at,xF as ot,xI as st,yF as ct,yI as E,yc as D,zF as lt}from"./api-BKX0b765.js";import{t as O}from"./x-DP601e4A.js";import{t as k}from"./button-DzIspcBY.js";import{$ as A,Et as j,Fn as ut,Ft as dt,G as ft,It as M,K as pt,Lt as mt,Mt as ht,Nt as gt,Pn as N,Pt as P,Q as F,Un as I,X as L,Z as R,et as z,jt as B,ln as V,q as H,ut as U}from"./index-BbZI7MO0.js";import{t as _t}from"./localePickerView-C2RmOS86.js";import{a as vt,i as yt,n as bt,o as xt,r as St,t as Ct}from"./card-AAO0v9Vm.js";import{a as wt,i as W,n as Tt,o as G,r as K,t as Et}from"./table-1BG3EWti.js";import{t as Dt}from"./TimeRangePicker-C-N7Oi_O.js";import{t as Ot}from"./FilterBar-udwh54Yv.js";import{t as kt}from"./AdvancedFilter-Dhl9vbbC.js";var q=t(e(),1),At=.1,jt=[248,248,248],Mt=[24,24,24];function Nt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Pt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function J(e,t,n){return Pt(e,t,n)>=At}function Ft(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function It(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(a());if(e.size>Lt)throw Error(Le());let{source:n,width:r,height:i,cleanup:o}=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)),u=document.createElement(`canvas`);u.width=s,u.height=c;let f=u.getContext(`2d`);if(!f)throw Error(l());f.imageSmoothingEnabled=!0,f.imageSmoothingQuality=`high`,f.drawImage(n,0,0,s,c);let p=Nt(f.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},m=document.createElement(`canvas`);m.width=p.width,m.height=p.height;let h=m.getContext(`2d`);if(!h)throw Error(l());if(h.drawImage(u,p.x,p.y,p.width,p.height,0,0,p.width,p.height),t.variantFor){let e=h.getImageData(0,0,p.width,p.height);J(e.data,p.width,p.height)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(e.data),h.putImageData(e,0,0)}let g=J(h.getImageData(0,0,p.width,p.height).data,p.width,p.height),_=await Y(m,`image/webp`,Bt)??await Y(m,`image/png`);if(!_)throw Error(d());return{blob:_,hasAlpha:g}}finally{o()}}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(ne())),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`?Oe():e===`dark`?i():oe()}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:Je(`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)(I,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":b(),title:b(),children:(0,X.jsx)(ut,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=x(w.charts.listMyCharts),r=T(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:st()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ce()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:E(),subtitle:nt(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?ye():n.via===`owner`?Ne():Pe({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:He()}):null]})}function Qt(){let e=T(w.charts.importChart),[t,n]=(0,q.useState)(``),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1),[u,d]=(0,q.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(v())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(me());return}let r;try{r=JSON.parse(i)}catch{s(v());return}d(!0);try{await e({name:t.trim(),tokens:r}),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:ke()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:r()})]}),(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:ae()}),(0,X.jsx)(B,{value:t,onChange:e=>n(e.target.value),placeholder:_e(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:he()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:ge(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(V,{className:`size-4`}),_(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:u,onClick:()=>void p(),children:qe()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:m()}):null]})]})}function $t({chart:e}){let t=we(w.charts.setChartLogo),n=T(w.charts.removeChartLogo),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Vt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?y():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)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(V,{className:`size-4`}),t?ie():p(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:ee()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:te()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:se()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(f,{mode:`light`}),(0,X.jsx)(f,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ie()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=x(w.me.getMe,{host:H}),n=T(w.charts.addChartDomain),r=T(w.charts.removeChartDomain),[i,a]=(0,q.useState)(``),[o,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=i.trim();if(t!==``){c(null),u(!0);try{await n({chartKey:e.key,domain:t}),a(``)}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:ue()}),(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:ot()}):d.map(e=>(0,X.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Se({domain:e}),onClick:()=>void p(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(B,{value:i,onChange:e=>a(e.target.value),placeholder:s(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:ce()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:it()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=T(w.charts.updateChart),n=T(w.charts.deleteChart),[r,i]=(0,q.useState)(!1),[a,s]=(0,q.useState)(e.name),[c,l]=(0,q.useState)(()=>$(e.tokens)),[u,d]=(0,q.useState)(e.tokens.bpm??0),[f,p]=(0,q.useState)(null),[m,h]=(0,q.useState)(!1);function g(){s(e.name),l($(e.tokens)),d(e.tokens.bpm??0),p(null),i(!0)}async function _(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(c)}catch{p(v());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}h(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}}async function y(){if(e.chartId!==void 0&&window.confirm(C()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:g,children:o()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void y(),children:lt()})]})})]}),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:ve()}),(0,X.jsx)(B,{value:a,onChange:e=>s(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children: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:u,onChange:e=>d(Number(e.target.value)),"aria-label":D()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?rt():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:be()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Me()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:m,onClick:()=>void _(),children:ct()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:tt()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=x(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:fe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:pe()}):(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=T(w.charts.addChartToGroupPool),r=T(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)(j,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?We():e.kind===`custom`&&e.scope===`personal`?S():Ze()}),e.isGlobalDefault?(0,X.jsx)(j,{variant:`default`,children:xe()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ye()}),(a??[]).map(e=>(0,X.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Qe({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(L,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(A,{size:`sm`,className:`w-56`,children:(0,X.jsx)(z,{placeholder:Ue()})}),(0,X.jsx)(R,{children:s.map(e=>(0,X.jsx)(F,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Fe()}):null]})]})}function an({chart:e}){let t=T(w.charts.promoteChartToCommon),n=T(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(C()))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)(j,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?$e():S()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ae({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:ze()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Te()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=T(w.admin.setDefaultThemeMode),i=T(w.admin.setDefaultLocale),a=T(w.charts.setDefaultChart),o=x(w.charts.listChartsAdmin),s=x(w.groups.listGroups,{}),l=e??`system`,d=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:c()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:le()})]}),(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:je()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:E()}),pt.map(e=>(0,X.jsx)(k,{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)(k,{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:De()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:et()})]}),(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:s??[]},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:Be()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(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:Ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ge()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Xe()}):(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:Re()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant: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:u()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:f()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:_t().map(e=>(0,X.jsx)(k,{variant:d===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:de()})]})]})}function sn(){let e=x(w.me.getMe,{host:H}),t=ft(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(nn,{}),e?.role===`admin`?(0,X.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,q.useState)(!0),[n,r]=(0,q.useState)(`per-user`),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(Z),[c,l]=(0,q.useState)(Z),[u,d]=(0,q.useState)(Gt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Gt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(sn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:at()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(N,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{children:`Default`}),(0,X.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(j,{variant:`outline`,children:`Outline`}),(0,X.jsx)(j,{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)(B,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(L,{value:n,onValueChange:r,children:[(0,X.jsx)(A,{className:`w-56`,children:(0,X.jsx)(z,{placeholder:`Select…`})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(F,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(F,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(U,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(L,{value:o,onValueChange:s,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(z,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(F,{value:Z,children:`Toutes directions`}),(0,X.jsx)(F,{value:`inbound`,children:`inbound`}),(0,X.jsx)(F,{value:`outbound`,children:`outbound`}),(0,X.jsx)(F,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(L,{value:c,onValueChange:l,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(z,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(F,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(F,{value:`info`,children:`info`}),(0,X.jsx)(F,{value:`warn`,children:`warn`}),(0,X.jsx)(F,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(kt,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Dt,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(ht,{children:[(0,X.jsx)(mt,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(N,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(dt,{children:`Actions`}),(0,X.jsx)(M,{}),(0,X.jsx)(P,{children:`Edit`}),(0,X.jsx)(P,{children:`Duplicate`}),(0,X.jsx)(M,{}),(0,X.jsx)(P,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(Ct,{className:`w-80`,children:[(0,X.jsxs)(vt,{children:[(0,X.jsx)(xt,{children:`Instance`}),(0,X.jsx)(St,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(bt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(yt,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Et,{children:[(0,X.jsx)(wt,{children:(0,X.jsxs)(G,{children:[(0,X.jsx)(W,{className:`w-8`,children:(0,X.jsx)(U,{"aria-label":`select all`})}),(0,X.jsx)(W,{children:`Name`}),(0,X.jsx)(W,{children:`Mode`}),(0,X.jsx)(W,{className:`text-right`,children:`Status`}),(0,X.jsx)(W,{className:`w-8`})]})}),(0,X.jsx)(Tt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(G,{children:[(0,X.jsx)(K,{children:(0,X.jsx)(U,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(K,{className:`font-medium`,children:e.n}),(0,X.jsx)(K,{children:(0,X.jsx)(j,{variant:`secondary`,children:e.m})}),(0,X.jsx)(K,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(I,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(K,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(N,{})})})]},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 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,$i as i,AS as a,BS as o,Bk as s,CA as c,D as l,DS as u,ES as d,FS as f,Fk as p,GS as m,Gk as h,HS as g,Hk as _,IS as ee,Ik as v,JS as te,Jk as ne,KS as re,Kk as y,LS as ie,Lk as b,MS as ae,NS as oe,OS as se,PS as ce,QS as le,RS as ue,Rk as x,SA as S,TS as C,US as de,Uk as w,VS as fe,Vk as pe,WS as me,Wk as he,XS as ge,YS as _e,Yk as ve,ZS as ye,_A as T,aA as E,aC as be,bA as D,cA as O,dA as k,dB as A,eA as xe,eC as Se,ea as Ce,fA as j,gA as we,hA as Te,iA as Ee,iC as De,jS as Oe,kS as ke,lA as Ae,mA as je,nA as Me,nC as Ne,oA as M,oC as Pe,pA as N,qS as Fe,qk as Ie,rA as Le,rC as Re,sA as ze,sC as Be,t as P,tA as F,tC as Ve,ta as He,uA as Ue,uB as I,vA as We,wA as Ge,wS as Ke,xA as qe,yA as Je,zS as Ye,zk as Xe}from"./api-BKX0b765.js";import{t as Ze}from"./x-DP601e4A.js";import{i as L,n as R,r as Qe,t as $e}from"./tabs-BRizUL-U.js";import{t as z}from"./button-DzIspcBY.js";import{$ as B,Et as V,Gn as et,H as tt,In as nt,Kn as rt,Mn as it,Nn as at,On as ot,Q as H,Un as st,X as U,Z as W,a as ct,at as lt,ct as G,et as K,i as ut,lt as dt,nt as ft,o as pt,ot as mt,q as ht,rt as gt,s as _t,tt as vt}from"./index-BbZI7MO0.js";import{n as yt}from"./TimeRangePicker-C-N7Oi_O.js";import{t as bt}from"./FilterBar-udwh54Yv.js";import{t as xt}from"./AdvancedFilter-Dhl9vbbC.js";import{t as St}from"./DataTableShell-CSEsiKU5.js";var Ct=l(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?E():n===`agent`?`${Ee()} - ${r}`:e}function Tt(){let e=A(P.me.getMe,{host:ht})?.role===`admin`,t=A(P.deliveryTiming.getDeliveryStatus,{}),n=I(P.deliveryTiming.startDeliveryRecord),r=I(P.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),l=t?.recording??!1,u=async()=>{s(!0);try{l?await r({}):await n({})}finally{s(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:Ge()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}),e?(0,J.jsx)(z,{variant:l?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void u(),children:l?qe():S()}):null]}),l?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(V,{variant:`secondary`,children:D()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:Je({time:dt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?we():T()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=A(P.deliveryTiming.listDeliverySessions,{}),n=I(P.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(`all`),[s,c]=(0,q.useState)(Y),[l,u]=(0,q.useState)(null),{from:d,to:f}=yt(s),p=s.to===`now`?1/0:f,m=r.trim()!==``||a!==`all`||s!==Y,h=()=>{i(``),o(`all`),c(Y)},g=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=d&&t.startedAt<=p).map(e=>({...e,_id:e.sessionId}))},[t,r,a,d,p]),_=e=>{let t=new Set((g??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),l!==null&&r.includes(l)&&u(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:i,searchPlaceholder:je(),timeRange:s,onTimeRangeChange:c,onReset:h,canReset:m,children:(0,J.jsxs)(U,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:`all`,children:N()}),(0,J.jsx)(H,{value:`active`,children:j()}),(0,J.jsx)(H,{value:`stopped`,children:k()})]})]})}),(0,J.jsx)(St,{title:Te(),rows:g,emptyHint:v(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":l===e.sessionId?Me():Le(),onClick:()=>u(t=>t===e.sessionId?null:e.sessionId),children:l===e.sessionId?(0,J.jsx)(at,{size:15,"aria-hidden":!0}):(0,J.jsx)(it,{size:15,"aria-hidden":!0})})},{header:Ue(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:Ae(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.stoppedAt)})},{header:O(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:ze(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:M(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(V,{variant:`secondary`,children:j()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:k()})}],rowActions:e?e=>[{label:F(),variant:`destructive`,onSelect:()=>_([e.sessionId])}]:void 0,bulkActions:e?[{label:F(),variant:`destructive`,onSelect:e=>_(e)}]:void 0,isExpanded:e=>e.sessionId===l,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=A(P.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(tt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:xe()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:We()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,p()]}),(0,J.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(st,{size:13,"aria-hidden":!0}):(0,J.jsx)(nt,{size:13,"aria-hidden":!0}),t?b():x()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:Ie()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:y()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:h()})]})}),(0,J.jsxs)(`tbody`,{children:[i(he(),r.bridge),i(w(),r.A),i(_(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]})}var kt=[50,100,200,500],Z=`all`,Q=`__all__`,At=[`2xx`,`4xx`,`5xx`],jt=[`user`,`service`,`system`],Mt=[`inbound`,`outbound`,`internal`],Nt={kind:`relative`,from:`now-30d`,to:`now`},Pt=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:He()},{value:`principalType`,label:Ce()},{value:`direction`,label:`direction`},{value:`roleKey`,label:i()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=rt({from:`/settings/traces`}),t=et({from:`/settings/traces`}),n=e.limit,i=e.kind,s=e.statusClass??Q,c=e.principalType??Q,l=e.direction??Q,d=e.roleKey??Q,p=e.q??``,h=e.correlationId,_=ut(e.from,e.to),v=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:y,to:b}=yt(_),[x,S]=(0,q.useState)(null),[C,w]=(0,q.useState)(null),pe=e=>void t({search:t=>({...t,limit:e})}),he=e=>void t({search:t=>({...t,kind:e})}),T=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),E=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),D=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),O=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),xe=e=>void t({search:t=>({...t,...pt(e)})}),Ce=e=>void t({search:t=>({...t,adv:ct(e)}),replace:!0}),j=A(P.observability.listEvents,{limit:n}),we=A(P.observability.listEvents,{limit:n,kind:i===Z?void 0:i,...h?{correlationId:h}:{},filter:{q:p||void 0,from:y,to:b,statusClass:s===Q?void 0:s,principalType:c===Q?void 0:c,direction:l===Q?void 0:l,roleKey:d===Q?void 0:d,advanced:v.length>0?v:void 0}}),Te=(0,q.useMemo)(()=>{let e=new Set;for(let t of j??[])e.add(t.kind);return[...e].sort()},[j]),Ee=(0,q.useMemo)(()=>{let e=new Set;for(let t of j??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[j]),Ae=p!==``||s!==Q||c!==Q||l!==Q||d!==Q||v.length>0||_.kind!==`relative`||_.from!==Nt.from;function je(){t({search:{limit:100,kind:`all`},replace:!0})}let Me=x?j?.filter(e=>e.correlationId===x):we,M=e.section,N=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)($e,{value:M,onValueChange:e=>N(e),children:[(0,J.jsxs)(Qe,{className:`w-full`,children:[(0,J.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(ot,{size:13,"aria-hidden":!0}),ve()]}),(0,J.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),ne()]})]}),(0,J.jsx)(R,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(R,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[Be(),(0,J.jsx)(`strong`,{children:Pe()}),be(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:De()})]}),(0,J.jsxs)(bt,{q:p,onQChange:T,searchPlaceholder:Re(),timeRange:_,onTimeRangeChange:xe,onReset:je,canReset:Ae,children:[(0,J.jsxs)(U,{value:s,onValueChange:E,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:Ne()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Ve()}),At.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:c,onValueChange:D,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:Se()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:r()}),jt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:l,onValueChange:O,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:le()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:ye()}),Mt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:d,onValueChange:k,children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{placeholder:ge()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:_e()}),Ee.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:i===Z?``:i,placeholder:te(),"aria-label":te(),onChange:e=>{let t=e.target.value.trim();he(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:Te.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(U,{value:String(n),onValueChange:e=>pe(Number(e)),children:[(0,J.jsx)(B,{size:`sm`,className:`w-28`,children:(0,J.jsx)(K,{})}),(0,J.jsx)(W,{children:kt.map(e=>(0,J.jsx)(H,{value:String(e),children:Fe({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:v,onChange:Ce}),x?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>S(null),title:re(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[m(),(0,J.jsx)(`code`,{children:$(x)})]}),(0,J.jsx)(Ze,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:me()})]})}):null,(0,J.jsx)(St,{title:de(),rows:Me,emptyHint:x?g():fe(),columns:[{header:o(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:Ye(),sort:e=>e.kind,cell:e=>(0,J.jsx)(V,{variant:`secondary`,children:e.kind})},{header:ue(),sort:e=>Lt(e)??null,cell:e=>{let t=Lt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":ie(),children:`✓`})}},{header:ee(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(V,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:f(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(V,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:ce(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(V,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:oe(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ae(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${It(e.status)}`,children:e.status})},{header:Oe(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:a(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:ke(),onClick:()=>S(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:se(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:u()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:C,onClose:()=>w(null)})]})]})}function It(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Lt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Rt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(vt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(ft,{className:`max-w-lg`,children:[(0,J.jsxs)(lt,{children:[(0,J.jsxs)(mt,{className:`oc-traces__meta-title`,children:[d(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(V,{variant:`outline`,children:C()})]}),(0,J.jsx)(gt,{children:Ke()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AD as r,BD as i,Bx as a,DD as o,Dp as s,ED as c,FD as l,GD as u,Gx as d,HD as f,Hx as p,ID as m,JD as ee,Jx as h,KD as te,Kx as g,LD as ne,MD as re,ND as ie,OD as ae,Op as _,PD as oe,QD as v,RD as se,Rx as y,TD as ce,UD as le,Ux as b,VD as ue,Vx as x,WD as S,Wx as C,XD as w,Xx as T,YD as de,Yx as E,ZD as D,aD as O,dB as k,jD as fe,kD as pe,kp as A,qD as me,qx as j,t as M,uB as N,wD as he,zD as ge,zx as P}from"./api-BKX0b765.js";import{t as F}from"./button-DzIspcBY.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-BbZI7MO0.js";import{t as Me}from"./FilterBar-udwh54Yv.js";import{t as Ne}from"./DataTableShell-CSEsiKU5.js";import{t as Pe}from"./DetailChips-BvJrftpU.js";var Y=t(e(),1),X=n();function Z({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=k(M.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=k(M.agents.listUserAgents,n&&e?{profileId:e}:`skip`),o=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),s=(a??[]).find(e=>e.isDefault)??null,c=s?`${s.instanceName}/${s.agentId}`:null,l=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),u=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).filter(e=>!l.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}))],d=new Map;for(let e of u){let t=d.get(e.instanceName)??[];t.push(e),d.set(e.instanceName,t)}return(0,X.jsx)(je,{open:n,onOpenChange:r,children:(0,X.jsxs)(De,{className:`oc-access`,children:[(0,X.jsxs)(Te,{children:[(0,X.jsx)(Oe,{children:T({user:t})}),(0,X.jsx)(Ae,{children:E()})]}),i?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?h():j()}):null,(0,X.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:g()}):u.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:b()}):[...d.entries()].map(([t,n])=>(0,X.jsx)(Fe,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:o,defaultKey:c},t))})]})})}function Fe({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:o}){let s=N(M.agents.assignAgent),c=N(M.agents.removeAgent),l=N(M.agents.setDefaultAgent),u=L();if(!e)return null;async function f(n,r){try{r?await c({profileId:e,instanceName:t,agentId:n}):await s({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(d(),e)}}async function m(n){try{await l({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(C(),e)}}return(0,X.jsxs)(`div`,{className:`oc-access__group`,children:[(0,X.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,X.jsx)(K,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:t}),(0,X.jsx)(R,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),s=o===n,c=e.state===`deleted`,l=!e.enabled;return(0,X.jsxs)(`div`,{className:`oc-access__row${l?` is-disabled`:``}`,children:[(0,X.jsx)(J,{checked:r,disabled:(c||l)&&!r,onCheckedChange:()=>void f(e.agentId,r),"aria-label":p({name:e.displayName??e.agentId})}),(0,X.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,c?(0,X.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:x()}):null,e.outOfPool?(0,X.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:a()}):null,r?s?(0,X.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":P(),title:P(),children:(0,X.jsx)(G,{size:14,fill:`currentColor`})}):(0,X.jsx)(F,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":y(),title:y(),disabled:l,onClick:()=>void m(e.agentId),children:(0,X.jsx)(G,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return s();case`user`:return _();case`admin`:return A();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,X.jsxs)(be,{children:[(0,X.jsx)(ye,{asChild:!0,children:(0,X.jsx)(F,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?v():D({count:r})})}),(0,X.jsxs)(xe,{align:`start`,className:`w-52`,children:[(0,X.jsx)(z,{children:w()}),U.map(e=>{let r=q[e];return(0,X.jsxs)(Se,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,X.jsx)(J,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,X.jsx)(`span`,{children:Ee[e]()})]},e)})]})]})}function Le(){let e=ve({from:`/settings/users`}),t=_e({from:`/settings/users`}),n=e.q??``,a=e.role??Q,s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),d=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),p=k(M.admin.listUsers,{filter:{q:n||void 0,role:a===Q?void 0:a},withAgents:!0}),h=k(M.me.getMe,{host:ke}),g=N(M.admin.setRole),_=N(M.admin.setUserPermissions),v=N(M.admin.startImpersonation),y=N(M.admin.deleteUser),b=N(M.admin.setUserName),x=Ce(),C=we(),w=L(),[T,E]=(0,Y.useState)(null),D=(0,Y.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of p??[])e.add(t.role);return[...e]},[p]),A=n!==``||a!==Q;function j(){t({search:{},replace:!0})}async function P(e){try{await g(e)}catch(e){w.error(de(),e)}}async function F(e){try{await _(e)}catch(e){w.error(ee(),e)}}async function R(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await x({title:ue(),description:i({user:t}),confirmWord:ge(),confirmLabel:se(),destructive:!0}))try{await y({profileId:e._id}),w.success(m({user:t}))}catch(e){w.error(ne(),e)}}async function z(e){let t=e.email||e.name||e.userId.slice(0,8),n=await C({title:oe(),label:ie({user:t}),placeholder:re(),defaultValue:e.name??``,confirmLabel:O()});if(n!==null)try{await b({profileId:e._id,name:n}),w.success(fe())}catch(e){w.error(r(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Me,{q:n,onQChange:s,searchPlaceholder:me(),onReset:j,canReset:A,children:(0,X.jsxs)(V,{value:a,onValueChange:d,children:[(0,X.jsx)(I,{size:`sm`,className:`w-36`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:Q,children:te()}),D.map(e=>(0,X.jsx)(B,{value:e,children:$(e)},e))]})]})}),(0,X.jsx)(Ne,{title:u(),rows:p,emptyHint:S(),rowActions:e=>{let t=[{label:he(),onSelect:()=>E({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:l(),onSelect:()=>void z(e)}];return e.userId!==h?.userId&&t.push({label:le(),onSelect:()=>void v({profileId:e._id})},{label:f(),variant:`destructive`,onSelect:()=>void R(e)}),t},columns:[{header:pe(),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,X.jsxs)(`div`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{children:t}),n?(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:ae(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,X.jsxs)(V,{value:e.role,onValueChange:t=>void P({profileId:e._id,role:t}),children:[(0,X.jsx)(I,{size:`sm`,className:`w-28`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:`pending`,children:$(`pending`)}),(0,X.jsx)(B,{value:`user`,children:$(`user`)}),(0,X.jsx)(B,{value:`admin`,children:$(`admin`)})]})]})},{header:o(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:c()}):(0,X.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:ce(),cell:e=>(0,X.jsx)(Pe,{icon:(0,X.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,X.jsx)(Z,{profileId:T?.profileId??null,userLabel:T?.label??``,open:T!==null,onOpenChange:e=>{e||E(null)}})]})}export{Le as UsersTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$r as r,Gn as i,Jn as a,Kn as o,Qr as s,Un as ee,Vf as c,Wn as te,Xn as l,Xr as u,Yn as d,Zn as f,Zr as p,_i as m,ai as ne,bi as h,cB as re,ci as g,dB as _,di as v,dr as y,ei as ie,er as ae,fi as b,gd as oe,gi as se,hi as x,iB as ce,ii as le,ir as ue,jn as de,li as fe,mi as S,nB as C,ni as w,nk as T,nr as E,oi as D,pi as pe,ri as O,rr as me,si as k,t as A,ti as j,tr as M,uB as N,ui as P,vd as F,vi as I,yi as L}from"./api-BKX0b765.js";import{i as R,n as z,r as he,t as ge}from"./tabs-BRizUL-U.js";import{t as B}from"./button-DzIspcBY.js";import{$ as V,$t as H,Cn as _e,Et as U,Gn as ve,Kn as ye,Q as W,Wn as be,X as G,Z as K,an as xe,en as Se,et as q,in as J,nn as Ce,q as we,rn as Y,sn as Te,tn as Ee,ut as X}from"./index-BbZI7MO0.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>pe()],[`fr-FR`,()=>ue()],[`en-US`,()=>me()],[`en-GB`,()=>E()],[`de-DE`,()=>M()],[`es-ES`,()=>ae()]],Oe=[[`0.75`,()=>v()],[`1`,()=>P()],[`1.25`,()=>fe()],[`1.5`,()=>g()]],$=0;function ke({instance:e}){let t=N(A.admin.upsertInstanceConfig),n=e.config??{},r={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[a,s]=(0,Z.useState)(r),[l,u]=(0,Z.useState)(`idle`),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!1),h=re(A.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}),u(`idle`)},[e._id]);let g=a.enabled!==r.enabled||a.engine!==r.engine||a.lang!==r.lang||a.rate!==r.rate||a.autoRead!==r.autoRead;async function _(){u(`saving`);try{let n={...e.config??{}};n.voiceEnabled=a.enabled,a.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,a.lang===`auto`?delete n.voiceLang:n.voiceLang=a.lang;let r=Number.parseFloat(a.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,a.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),u(`idle`)}catch{u(`error`)}}return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(U,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:a.enabled,onCheckedChange:e=>s({...a,enabled:e===!0}),"aria-label":x()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()}),(0,Q.jsxs)(G,{value:a.engine,onValueChange:e=>s({...a,engine:e}),disabled:!a.enabled,children:[(0,Q.jsx)(V,{size:`sm`,"aria-label":o(),children:(0,Q.jsx)(q,{})}),(0,Q.jsxs)(K,{children:[(0,Q.jsx)(W,{value:`browser`,children:i()}),e.kind===`hermes`?null:(0,Q.jsx)(W,{value:`gateway`,children:te()})]})]})]}),a.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ee()}):null,a.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,Q.jsxs)(G,{value:a.lang,onValueChange:e=>s({...a,lang:e}),disabled:!a.enabled,children:[(0,Q.jsx)(V,{size:`sm`,"aria-label":S(),children:(0,Q.jsx)(q,{})}),(0,Q.jsx)(K,{children:De.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()}),(0,Q.jsxs)(G,{value:a.rate,onValueChange:e=>s({...a,rate:e}),disabled:!a.enabled,children:[(0,Q.jsx)(V,{size:`sm`,"aria-label":b(),children:(0,Q.jsx)(q,{})}),(0,Q.jsx)(K,{children:Oe.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),a.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:a.autoRead,onCheckedChange:e=>s({...a,autoRead:e===!0}),disabled:!a.enabled,"aria-label":k()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:D()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(B,{size:`sm`,disabled:!g||l===`saving`,onClick:()=>void _(),children:l===`saving`?c():F()}),(0,Q.jsx)(B,{variant:`outline`,size:`sm`,disabled:!a.enabled||d,onClick:()=>{let t=Number.parseFloat(a.rate)||1,n=++$;if(m(!1),J(),Y(),a.engine!==`gateway`){Ce(O(),{lang:Ee(a.lang,ce()),rate:t});return}f(!0),h({instanceName:e.name,text:O()}).then(({mime:e,audioBase64:r})=>{n===$&&Se(r,e,{rate:t})}).catch(()=>{n===$&&m(!0)}).finally(()=>f(!1))},children:d?c():ne()}),(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>{$++,f(!1),J(),Y()},children:le()})]}),l===`error`||p?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p?de():oe()}):null]})}function Ae({stt:e}){let t=_(A.me.getMe,{host:we}),n=N(A.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:j()}),(0,Q.jsx)(U,{variant:e?`secondary`:`outline`,children:e?p():u()}),(0,Q.jsx)(U,{variant:r?`secondary`:`destructive`,children:r?l():d()})]}),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":f()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ie()})]})}function je(){let e=_(A.admin.listInstances,{}),t=(0,Z.useMemo)(()=>xe(),[]),n=(0,Z.useMemo)(()=>H(),[]),{section:i}=ye({from:`/settings/voice`}),o=ve({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(U,{variant:t?`secondary`:`destructive`,children:t?L():I()}),(0,Q.jsx)(U,{variant:n?`secondary`:`destructive`,children:n?m():se()})]}),(0,Q.jsxs)(ge,{value:i,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}),a()]}),(0,Q.jsxs)(R,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(_e,{size:13,"aria-hidden":!0}),j()]}),(0,Q.jsxs)(R,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(be,{size:13,"aria-hidden":!0}),r()]})]}),(0,Q.jsx)(z,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):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:r()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:s()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=N(A.admin.upsertInstanceConfig),n=e.config??{},r=n.talkEnabled===!0,i=e.kind===`hermes`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(U,{variant:`secondary`,children:i?`Hermes`:`OpenClaw`})]}),i?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()}):(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":T()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()})]})]})}export{je as VoiceTab};
|