@lacneu/atrium 0.101.3 → 0.102.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-JmFp20Kp.js +1 -0
- package/dist/assets/AdminSettings-B8n1yLsD.js +1 -0
- package/dist/assets/AdvancedFilter-Bb66m5kb.js +1 -0
- package/dist/assets/AgentFilesTab-C3CUT4Ep.js +3 -0
- package/dist/assets/AnomaliesTab-BQ2Bu98W.js +1 -0
- package/dist/assets/AuditTab-BV-XydO_.js +1 -0
- package/dist/assets/BridgeTab-D4RFq-Rb.js +1 -0
- package/dist/assets/ChatDefaultsTab-D0d9yEow.js +1 -0
- package/dist/assets/ConfirmDialog-BXcki0Ee.js +1 -0
- package/dist/assets/DataTableShell-DRFFBx_j.js +1 -0
- package/dist/assets/DeletedChatsTab-COYSFkNf.js +1 -0
- package/dist/assets/DetailChips-Cv1sxdhU.js +1 -0
- package/dist/assets/EntitySheet-B2B48bss.js +1 -0
- package/dist/assets/FeedbacksTab-6URuFdfg.js +1 -0
- package/dist/assets/FieldLabel-Tea3wyVe.js +1 -0
- package/dist/assets/FilesTab-esMtHJXt.js +1 -0
- package/dist/assets/FilterBar-DTVwlDpF.js +1 -0
- package/dist/assets/GroupsTab-Io16XZHz.js +1 -0
- package/dist/assets/InstancesTab-BevtM68H.js +1 -0
- package/dist/assets/IntegrationsTab-DMY6VTUC.js +1 -0
- package/dist/assets/KnobRow-BsOT2O6U.js +1 -0
- package/dist/assets/KpiTab-KPPcgUxA.js +1 -0
- package/dist/assets/PreferencesTab-DJ9p401L.js +1 -0
- package/dist/assets/ProjectPage-BxEF71jN.js +1 -0
- package/dist/assets/PromptInjectionsTab-Vdb1lF36.js +4 -0
- package/dist/assets/RolesTab-DU0g4d-R.js +1 -0
- package/dist/assets/ScheduledTab-B6gWc0HN.js +1 -0
- package/dist/assets/ServiceAccountsTab-Dmb_LH0V.js +1 -0
- package/dist/assets/SubAgentReportsTab-D9rclslo.js +1 -0
- package/dist/assets/ThemeShowroom-N4qzUtlq.js +1 -0
- package/dist/assets/TimeRangePicker-D3PJq1H8.js +1 -0
- package/dist/assets/TimezoneCombobox-CPTpWNQm.js +1 -0
- package/dist/assets/TracesTab-DiAkOmei.js +1 -0
- package/dist/assets/TrashTab-BMSJ7ANC.js +1 -0
- package/dist/assets/UsersTab-BQaLsUCK.js +1 -0
- package/dist/assets/VoiceTab-BSh-05Ze.js +1 -0
- package/dist/assets/alert-dialog-BoEv1f8g.js +7 -0
- package/dist/assets/api-DSJJn0d7.js +44 -0
- package/dist/assets/appHost-CH3EGcJw.js +1 -0
- package/dist/assets/badge-C4po8DQ1.js +1 -0
- package/dist/assets/{button-HksxbiUF.js → button-Dio0PVrp.js} +1 -1
- package/dist/assets/capabilities-BTqhMVxR.js +1 -0
- package/dist/assets/{card-BS-Ukkxw.js → card-CerX9wDn.js} +1 -1
- package/dist/assets/check-DmQzfrws.js +1 -0
- package/dist/assets/checkbox-CsI4ggnp.js +1 -0
- package/dist/assets/chevron-left-DQ9FCoo_.js +1 -0
- package/dist/assets/chevron-right-C_b_y922.js +1 -0
- package/dist/assets/chevron-up-Dsqj2Oaj.js +1 -0
- package/dist/assets/chevrons-up-down-Pva00Np5.js +1 -0
- package/dist/assets/chunk-7TTQLYRW-ByhoRIPY.js +156 -0
- package/dist/assets/{compatView-BmFG4Q3R.js → compatView--1YlftIc.js} +1 -1
- package/dist/assets/convexApi-CyScjgcq.js +1 -0
- package/dist/assets/copy-BaUCUMp2.js +1 -0
- package/dist/assets/cronDescribe-CAuRX7uW.js +1 -0
- package/dist/assets/deliveryRecorder-C7NQZrrH.js +2 -0
- package/dist/assets/dialog-BfrsWZiD.js +1 -0
- package/dist/assets/dispatchErrorInfo-Bb7JyJFO.js +1 -0
- package/dist/assets/dist-ChrIV8UV.js +1 -0
- package/dist/assets/{dist-DjxjpzgS.js → dist-CkbybbG7.js} +1 -1
- package/dist/assets/dist-ClkJChBn.js +1 -0
- package/dist/assets/dist-Cw3aN_jM.js +1 -0
- package/dist/assets/{dist-BDjijy9l.js → dist-D-RIDSJc.js} +1 -1
- package/dist/assets/dist-D7doQlva.js +1 -0
- package/dist/assets/dist-DDCmobc1.js +1 -0
- package/dist/assets/download-DWgC7zCa.js +1 -0
- package/dist/assets/dropdown-menu-DHMOOlaP.js +1 -0
- package/dist/assets/eye-B-ipuYEd.js +1 -0
- package/dist/assets/fileMetaView-Ci5C4w9Q.js +1 -0
- package/dist/assets/format-DGKgJf2p.js +1 -0
- package/dist/assets/groupManageView-BMBqgRhV.js +1 -0
- package/dist/assets/highlighted-body-JLMTFACH-3FraDdGA.js +1 -0
- package/dist/assets/index-D6RuTaB7.css +1 -0
- package/dist/assets/index-DQC7YnEQ.js +158 -0
- package/dist/assets/input-BSpTsBA6.js +1 -0
- package/dist/assets/{list-DnhyuzZ4.js → list-eSch39T9.js} +1 -1
- package/dist/assets/loader-circle-BNhIFGdg.js +1 -0
- package/dist/assets/lock-0lxfSnTE.js +1 -0
- package/dist/assets/mermaid-WFAXDIZX-DpR3_BmG.js +1 -0
- package/dist/assets/pdf-EQHMWEbX.js +54 -0
- package/dist/assets/pencil-aUWxuLhy.js +1 -0
- package/dist/assets/plus-Djbdyc2E.js +1 -0
- package/dist/assets/popover-DBaIbsBr.js +1 -0
- package/dist/assets/preload-helper-Czpn1I53.js +1 -0
- package/dist/assets/roleDescriptions-x3mUxTcX.js +1 -0
- package/dist/assets/rotate-ccw-BD-9XzMC.js +1 -0
- package/dist/assets/search-BK6bzZNi.js +1 -0
- package/dist/assets/searchSchemas-CS2ZgsHC.js +64 -0
- package/dist/assets/select-qM3ZfTHx.js +1 -0
- package/dist/assets/server-DLnWqkX-.js +1 -0
- package/dist/assets/speech-CrNma2Ue.js +1 -0
- package/dist/assets/star-CM6J2w_J.js +1 -0
- package/dist/assets/{table-CwhkOFwK.js → table-D2SJC960.js} +1 -1
- package/dist/assets/tabs-mZfLmn2f.js +1 -0
- package/dist/assets/toast-xNFwDnUy.js +1 -0
- package/dist/assets/tooltip-v_AyOWn6.js +87 -0
- package/dist/assets/trash-2-B4WSfc7G.js +1 -0
- package/dist/assets/trashPage-WtAhGCt7.js +1 -0
- package/dist/assets/trashView-Ct0Xw-a9.js +1 -0
- package/dist/assets/triangle-alert-BkDa-x8g.js +1 -0
- package/dist/assets/usageView-C9Y6E0Zu.js +1 -0
- package/dist/assets/useChart-CKFEN42T.js +1 -0
- package/dist/assets/useFontScale-ByBFat3y.js +1 -0
- package/dist/assets/useNavigate-D3GIoxyW.js +1 -0
- package/dist/assets/useStartNewChat-BszDHUjD.js +5 -0
- package/dist/assets/useStartNewChat-DgQf_3y0.css +1 -0
- package/dist/assets/{use_paginated_query-BKOSBoa7.js → use_paginated_query-CQj09xXv.js} +1 -1
- package/dist/assets/users-BJqaWlH1.js +1 -0
- package/dist/assets/x-CK8d5DC1.js +1 -0
- package/dist/index.html +64 -9
- package/package.json +2 -2
- package/dist/assets/AccessTab-DwQXs7Qd.js +0 -1
- package/dist/assets/AdvancedFilter-BmALfXnB.js +0 -1
- package/dist/assets/AgentFilesTab-BXBJmeSc.js +0 -3
- package/dist/assets/AnomaliesTab-CofoaMkF.js +0 -1
- package/dist/assets/AuditTab-XWQHKIp_.js +0 -1
- package/dist/assets/BridgeTab-BUFvmr2d.js +0 -1
- package/dist/assets/ChatDefaultsTab-Dmd6QOKm.js +0 -1
- package/dist/assets/DataTableShell-BYSvf6VZ.js +0 -1
- package/dist/assets/DeletedChatsTab-C_hfpRhG.js +0 -1
- package/dist/assets/DetailChips-DUlvwews.js +0 -1
- package/dist/assets/FeedbacksTab-DXelU8Ru.js +0 -1
- package/dist/assets/FieldLabel-CcWGFs5F.js +0 -1
- package/dist/assets/FilesTab-DkcqLbSs.js +0 -1
- package/dist/assets/FilterBar-BgVXfm-6.js +0 -1
- package/dist/assets/GroupsTab-I7HSSXyG.js +0 -1
- package/dist/assets/InstancesTab-CQwASkfp.js +0 -1
- package/dist/assets/IntegrationsTab-C2ZW4PH-.js +0 -1
- package/dist/assets/KpiTab-LgHgVxRb.js +0 -1
- package/dist/assets/PreferencesTab-BH7-p_lT.js +0 -1
- package/dist/assets/ProjectPage-Bl8fhfx1.js +0 -1
- package/dist/assets/PromptInjectionsTab-BIURoP_R.js +0 -4
- package/dist/assets/RolesTab-Baw2YHq3.js +0 -1
- package/dist/assets/ScheduledTab-DORhocyn.js +0 -1
- package/dist/assets/ServiceAccountsTab-UmjjOrwp.js +0 -1
- package/dist/assets/SubAgentReportsTab-cm_UrpNl.js +0 -1
- package/dist/assets/ThemeShowroom-CFTzDqq9.js +0 -1
- package/dist/assets/TimeRangePicker-CSLm7VwE.js +0 -1
- package/dist/assets/TimezoneCombobox-ObUCuHhu.js +0 -1
- package/dist/assets/TracesTab-BhR-6Ixe.js +0 -1
- package/dist/assets/TrashTab-BZUmrLBK.js +0 -1
- package/dist/assets/UsersTab-Cxo_mjSa.js +0 -1
- package/dist/assets/VoiceTab-BP_6mdHw.js +0 -1
- package/dist/assets/api--rqKQo-l.js +0 -44
- package/dist/assets/chevrons-up-down-4c0Fo5uU.js +0 -1
- package/dist/assets/dispatchErrorInfo-CW3gRHkP.js +0 -1
- package/dist/assets/dist-e05Gnyj5.js +0 -1
- package/dist/assets/dist-lcVkVTM0.js +0 -1
- package/dist/assets/highlighted-body-OFNGDK62-DAKnlLPW.js +0 -1
- package/dist/assets/index-DEccjMsV.css +0 -1
- package/dist/assets/index-l7elBM2O.js +0 -447
- package/dist/assets/mermaid-GHXKKRXX-CvLURkTf.js +0 -1
- package/dist/assets/pdf-CgxfnVev.js +0 -54
- package/dist/assets/roleDescriptions-Csn1bSUI.js +0 -1
- package/dist/assets/trashPage-DgXB4jOM.js +0 -1
- package/dist/assets/x-C5eyKPkE.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$y as i,Ab as a,Ay as o,Bb as s,By as c,Cb as l,Cx as u,Cy as d,Db as f,Dy as p,E as m,Eb as h,Ey as g,Fb as _,Fy as v,Gy as y,HX as b,Hb as x,Hy as S,Ib as C,Iy as ee,Jb as w,Jy as T,Kb as E,Ky as D,Lb as O,Ly as k,Mb as te,My as A,Nb as ne,Ny as j,Ob as M,Oy as re,Pb as ie,Py as N,Qb as ae,Qy as oe,Rb as se,Ry as ce,Sb as le,Sx as P,Sy as ue,Tb as de,Ty as F,UX as I,Uy as fe,Vb as L,Vy as pe,Wy as me,Xb as he,Xy as ge,Yb as R,Yy as _e,Zb as ve,Zy as ye,_b as z,_x as be,ax as xe,bb as B,bx as Se,by as Ce,cb as we,cx as Te,db as Ee,dx as De,dy as Oe,eb as ke,ex as Ae,fb as je,fx as Me,fy as Ne,gb as Pe,gx as Fe,hb as Ie,hx as Le,ix as Re,jb as ze,jy as Be,kb as Ve,ky as He,lb as Ue,lx as We,mb as Ge,mx as Ke,my as qe,nb as Je,nx as Ye,ox as Xe,pb as Ze,px as Qe,py as $e,qb as et,qy as tt,rb as nt,rx as rt,sb as it,sx as at,t as V,tb as ot,tx as st,ub as ct,ux as lt,vb as ut,vx as dt,wb as ft,wx as pt,wy as mt,xb as ht,xx as gt,xy as _t,yb as vt,yx as yt,zb as bt,zy as xt}from"./api--rqKQo-l.js";import{t as St}from"./x-C5eyKPkE.js";import{t as H}from"./button-HksxbiUF.js";import{$ as Ct,$t as U,Ct as wt,Dn as Tt,Dt as Et,En as Dt,G as Ot,J as W,Jt as G,K as kt,Mn as At,Mt as K,Nn as jt,Ot as Mt,Pn as Nt,Q as Pt,St as Ft,Tt as It,W as q,X as Lt,Y as Rt,Yt as J,Z as zt,at as Bt,b as Vt,bt as Ht,cr as Ut,ct as Wt,et as Gt,ft as Kt,it as qt,jn as Y,ot as Jt,q as Yt,sr as Xt,st as Zt,vt as Qt,wt as $t,xt as en,yt as tn}from"./index-l7elBM2O.js";import{t as nn}from"./FilterBar-BgVXfm-6.js";import{t as rn}from"./DataTableShell-BYSvf6VZ.js";import{t as X}from"./DetailChips-DUlvwews.js";var an=m(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Z=t(e(),1),Q=n(),on={name:``,description:``};function sn(){let e=I(V.groups.listGroups,{}),t=I(V.me.getMe,{host:Kt})?.role===`admin`,n=b(V.groups.createGroup),r=b(V.groups.updateGroup),i=b(V.groups.deleteGroup),a=Wt(),o=J(),[s,c]=(0,Z.useState)(!1),[l,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(on),[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(``),v=(0,Z.useMemo)(()=>{if(!e)return e;let t=g.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,g]);function y(){d(null),p(on),c(!0)}function x(e){d(e),p({name:e.name,description:e.description??``}),c(!0)}async function S(){try{l?await r({groupId:l._id,name:f.name,description:f.description}):await n({name:f.name,description:f.description||void 0}),p(on),d(null),c(!1)}catch(e){o.error(vt(),e)}}async function C(e){if(await a({title:xe({name:e.name}),description:Re(),confirmWord:e.name,confirmLabel:rt(),cancelLabel:De(),destructive:!0}))try{await i({groupId:e._id})}catch(e){o.error(ut(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),t?(0,Q.jsx)(pn,{}):null,(0,Q.jsx)(nn,{q:g,onQChange:_,onReset:()=>_(``),canReset:g!==``,searchPlaceholder:Fe()}),(0,Q.jsx)(rn,{title:pt(),rows:v,addLabel:P(),onAdd:t?y:void 0,emptyHint:gt(),columns:[{header:Se(),cell:e=>e.name,sort:e=>e.name},{header:yt(),cell:e=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{icon:(0,Q.jsx)(Dt,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(jt,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),e.pendingInviteCount>0?(0,Q.jsx)(G,{variant:`secondary`,children:it({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:dt(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(Nt,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:be(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(an,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(Y,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:Le(),onSelect:()=>h({groupId:e._id,name:e.name})},...t?[{label:Ke(),onSelect:()=>x(e)},{label:Qe(),variant:`destructive`,onSelect:()=>void C(e)}]:[]]}),(0,Q.jsx)(Vt,{open:s,onOpenChange:c,title:l?We():lt(),description:Te(),canSubmit:!!f.name.trim(),onSubmit:S,submitLabel:Me(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:at()}),(0,Q.jsx)(U,{value:f.name,onChange:e=>p({...f,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:Xe()}),(0,Q.jsx)(U,{value:f.description,onChange:e=>p({...f,description:e.target.value})})]})]})}),(0,Q.jsx)(ln,{groupId:m?.groupId??null,groupName:m?.name??``,open:m!==null,onOpenChange:e=>{e||h(null)}})]})}var cn=8;function $({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Ut,{size:14,"aria-hidden":!0}),w()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":E({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[et(),(0,Q.jsx)(Xt,{size:14,"aria-hidden":!0})]})]})}function ln({groupId:e,groupName:t,open:n,onOpenChange:a}){let o=I(V.groups.getGroup,n&&e?{groupId:e}:`skip`),c=o?.viewerIsAdmin===!0,u=I(V.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),d=I(V.groups.listAssignableUsers,n&&c?{}:`skip`),f=b(V.groups.addMember),p=b(V.groups.removeMember),m=b(V.groups.bulkSetMembers),h=b(V.groups.setGroupManager),g=J(),[_,v]=(0,Z.useState)(``),[y,C]=(0,Z.useState)(``),[ee,w]=(0,Z.useState)(`members`),[T,E]=(0,Z.useState)(1),[D,k]=(0,Z.useState)(null),[A,ne]=(0,Z.useState)(new Set),j=(0,Z.useRef)(null),M=(0,Z.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),re=(0,Z.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),ie=(0,Z.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[o]),N=(0,Z.useMemo)(()=>new Set((o?.agents??[]).map(e=>q(e.instanceName,e.agentId))),[o]),ce=(0,Z.useMemo)(()=>{let e=(o?.agents??[]).find(e=>e.isDefault);return e?q(e.instanceName,e.agentId):null},[o]);(0,Z.useEffect)(()=>{v(``),C(``),w(`members`),E(1),k(null),j.current=null},[n,e]),(0,Z.useEffect)(()=>{E(1)},[_]),(0,Z.useEffect)(()=>{n&&o&&e&&j.current!==e&&(j.current=e,ne(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let P=(0,Z.useMemo)(()=>d?Yt(d,_,A):[],[d,_,A]);async function ue(t,n){if(e)try{n?await p({groupId:e,userId:t}):await f({groupId:e,userId:t})}catch(e){g.error(z(),W(e))}}async function de(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){g.error(ht(),e)}}let F=Ct(P,e=>M.has(e.userId)),fe=P.filter(e=>M.has(e.userId)).length,L=zt(P,T,cn);async function pe(){if(!e||P.length===0)return;let t=P.map(e=>e.userId);try{await m({groupId:e,userIds:t,member:F!==`all`})}catch(e){g.error(z(),W(e))}}let me=(e,t)=>(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":oe({user:t}),title:oe({user:t}),onClick:()=>k({userId:e,label:t}),children:[(0,Q.jsx)(At,{size:13,"aria-hidden":!0}),i()]});return(0,Q.jsx)(wt,{open:n,onOpenChange:a,children:(0,Q.jsxs)($t,{className:`oc-access`,children:[(0,Q.jsxs)(Et,{children:[(0,Q.jsx)(Mt,{children:Ye({name:t})}),(0,Q.jsx)(It,{children:o&&!c?Ie():st()})]}),(0,Q.jsxs)(qt,{value:ee,onValueChange:w,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Jt,{className:`w-full`,children:[(0,Q.jsxs)(Zt,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Dt,{size:13,"aria-hidden":!0}),Ae(),o?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(Zt,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Nt,{size:13,"aria-hidden":!0}),ae(),o?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:N.size}):null]}),(0,Q.jsxs)(Zt,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(an,{size:13,"aria-hidden":!0}),te(),o?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,Q.jsx)(Bt,{value:`members`,children:o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()}):c?d===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()}):d.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:se()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:_,onChange:e=>v(e.target.value),placeholder:r(),className:`oc-access__search`}),P.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:he()}):(0,Q.jsxs)(Q.Fragment,{children:[P.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:F===`all`?!0:F===`some`?`indeterminate`:!1,onCheckedChange:()=>void pe(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,Q.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[fe,` / `,P.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=M.has(e.userId),n=Gt(e),r=re.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:t,onCheckedChange:()=>void ue(e.userId,t),"aria-label":x({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),t&&ie.has(e.userId)?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:ye()}):null,(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:Pt(e.role)}),t?me(e.userId,n.primary):null,(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?le():l(),title:r?le():l(),onClick:()=>void de(e.userId,r),children:(0,Q.jsx)(jt,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)($,{page:L.page,pageCount:L.pageCount,onPage:E})]})]}):e?(0,Q.jsx)(un,{groupId:e,members:o.members,agentsButton:me}):null}),(0,Q.jsxs)(Bt,{value:`agents`,children:[o&&!c?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:S()}):null,u===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:O()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:y,onChange:e=>C(e.target.value),placeholder:ve(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(t=>(0,Q.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:N,defaultKey:ce,viewerIsAdmin:c,query:y},`${e}-${t._id}`))})]})]}),(0,Q.jsx)(Bt,{value:`charts`,children:(0,Q.jsx)(mn,{groupId:e})})]}),(0,Q.jsx)(dn,{groupId:e,member:D,onOpenChange:e=>{e||k(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=I(V.groupInvites.listGroupInviteRequests,{groupId:e}),i=b(V.groupInvites.requestGroupInvite),a=b(V.groups.removeMember),o=Wt(),s=J(),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(1),f=zt(t,u,cn);async function p(t){t.preventDefault();let n=c.trim();if(n)try{await i({groupId:e,email:n}),l(``),s.success(ct())}catch(e){s.error(Ue(),e)}}async function m(t,n){if(await o({title:nt({user:n}),description:ot({user:n}),confirmLabel:ke(),cancelLabel:De(),destructive:!0}))try{await a({groupId:e,userId:t})}catch(e){s.error(z(),W(e))}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`form`,{className:`oc-access__invite`,onSubmit:e=>void p(e),children:[(0,Q.jsx)(U,{type:`email`,value:c,onChange:e=>l(e.target.value),placeholder:je(),"aria-label":Ge()}),(0,Q.jsxs)(H,{type:`submit`,size:`sm`,disabled:!c.trim(),children:[(0,Q.jsx)(Tt,{size:14,"aria-hidden":!0}),Ee()]})]}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ze()}),t.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ge()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:f.pageItems.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.label,children:e.label}),e.restricted?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:ye()}):null,n(e.userId,e.label),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:e.manager?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":ft(),title:ft(),children:(0,Q.jsx)(jt,{size:15,"aria-hidden":!0})}):null}),(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:e.manager||e.lastGroup,"aria-label":nt({user:e.label}),title:e.manager?Je():e.lastGroup?Ce():nt({user:e.label}),onClick:()=>void m(e.userId,e.label),children:(0,Q.jsx)(St,{size:14,"aria-hidden":!0})})]},e.userId))}),(0,Q.jsx)($,{page:f.page,pageCount:f.pageCount,onPage:d})]}),r!==void 0&&r.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:we()}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:r.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,Q.jsx)(G,{variant:e.status===`pending`?`secondary`:`outline`,className:`oc-access__role`,children:Rt(e.status)})]},e._id))})]}):null]})}function dn({groupId:e,member:t,onOpenChange:n}){let r=I(V.groups.getMemberAgentSettings,e&&t?{groupId:e,userId:t.userId}:`skip`),i=b(V.groups.setMemberAgents),a=b(V.groups.setMemberDefaultAgent),c=J();async function l(e){try{await e()}catch(e){c.error(_t(),e)}}let u=r?.agents??[],f=new Map(u.map(e=>[q(e.instanceName,e.agentId),e])),m=[...f.keys()],h=new Set(u.filter(e=>e.allowed).map(e=>q(e.instanceName,e.agentId)));function _(n){if(!e||!t||!r)return;let a=Lt(m,h,r.restricted,n).map(e=>{let t=f.get(e);return{instanceName:t.instanceName,agentId:t.agentId}});l(()=>i({groupId:e,userId:t.userId,agents:a}))}return(0,Q.jsx)(wt,{open:t!==null,onOpenChange:n,children:(0,Q.jsxs)($t,{className:`oc-access`,children:[(0,Q.jsxs)(Et,{children:[(0,Q.jsx)(Mt,{children:o({user:t?.label??``})}),(0,Q.jsx)(It,{children:He()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()}):r===null||u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ue()}):(0,Q.jsxs)(Q.Fragment,{children:[r.settable?null:(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Oe()}),r.adminNarrowed?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:qe()}):null,r.restrictedByAdmin&&!r.viewerIsAdmin?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ne()}):null,(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,children:r.restricted?p():re()}),r.restricted?(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin,onClick:()=>e&&t?void l(()=>i({groupId:e,userId:t.userId,agents:null})):void 0,children:g()}):null]}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(n=>{let i=q(n.instanceName,n.agentId),o=n.displayName??n.agentId;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:n.allowed,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>_(i),"aria-label":F({name:o})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:o,children:o}),n.limitedByAdmin?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:$e()}):null,n.state===`deleted`?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:ne()}):null,n.allowed?n.isMemberDefault?(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,disabled:!r.settable,"aria-label":mt(),title:mt(),onClick:()=>e&&t?void l(()=>a({groupId:e,userId:t.userId,agent:null})):void 0,children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,disabled:!r.settable,"aria-label":d(),title:d(),onClick:()=>e&&t?void l(()=>a({groupId:e,userId:t.userId,agent:{instanceName:n.instanceName,agentId:n.agentId}})):void 0,children:(0,Q.jsx)(Y,{size:14})}):null]},i)})})]})]})})}function fn({groupId:e,instanceName:t,kind:n,assigned:r,defaultKey:i,viewerIsAdmin:a,query:o}){let s=I(V.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),l=b(V.groups.assignAgentToGroup),u=b(V.groups.removeAgentFromGroup),d=b(V.groups.bulkSetGroupAgents),f=b(V.groups.claimAgentForGroup),p=b(V.groups.setGroupDefaultAgent),m=J(),[h,g]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{g(1)},[o]),!e)return null;let y=kt(s?.agents??[],o),x=s?.discovery&&!s.discovery.lastPollOk,S=e=>Ot({assigned:r.has(q(t,e.agentId)),claimable:e.claimable,reservedForGroup:e.reservedForGroup,enabled:e.enabled,present:e.presentInLastOk!==!1},a),w=y.filter(e=>S(e)!==`claim`),T=y.filter(e=>S(e)===`claim`);if(o.trim()&&y.length===0)return null;let E=w.filter(e=>S(e)===`toggle`&&e.presentInLastOk!==!1&&e.enabled!==!1),D=Ct(E,e=>r.has(q(t,e.agentId))),O=zt(w,h,cn);async function te(n,r){try{r?await u({groupId:e,instanceName:t,agentId:n}):await l({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(Pe(),W(e))}}async function M(){if(E.length===0)return;let n=E.map(e=>e.agentId);try{await d({groupId:e,instanceName:t,agentIds:n,assigned:D!==`all`})}catch(e){m.error(Pe(),W(e))}}async function re(n){try{await f({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(k(),e)}}async function ae(n){try{await p({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){m.error(Be(),e)}}let oe=e=>e.reservedForGroup?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:ee()}):e.reserved?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?N():v({group:e.reservedGroupName})}):null;return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(Nt,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),x?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:ie()}):null]}),s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:bt()}):y.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:x?_():C()}):(0,Q.jsxs)(Q.Fragment,{children:[E.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(K,{checked:D===`all`?!0:D===`some`?`indeterminate`:!1,onCheckedChange:()=>void M(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,O.pageItems.map(e=>{let n=q(t,e.agentId),a=r.has(n),o=e.presentInLastOk===!1,s=S(e)===`locked`;return(0,Q.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,Q.jsx)(K,{checked:a,disabled:s&&!a,onCheckedChange:()=>void te(e.agentId,a),"aria-label":L({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,oe(e),o?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:ne()}):null,a?i===n?(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":j(),title:j(),onClick:()=>void ae(null),children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":A(),title:A(),onClick:()=>void ae(e.agentId),children:(0,Q.jsx)(Y,{size:14})}):null]},e.agentId)}),(0,Q.jsx)($,{page:O.page,pageCount:O.pageCount,onPage:g}),T.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-access__subhead`,children:pe()}),(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:c()}),T.map(e=>{let t=e.displayName??e.agentId;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:t,children:[e.emoji?`${e.emoji} `:``,t]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,"aria-label":ce({name:t}),onClick:()=>void re(e.agentId),children:xt()})]},e.agentId)})]}):null]})]})}function pn(){let e=I(V.groupInvites.listPendingInviteRequests,{}),t=b(V.groupInvites.decideGroupInvite),n=J();if(e===void 0||e.length===0)return null;async function r(e,r){try{await t({requestId:e,approve:r})}catch(e){n.error(fe(),e)}}return(0,Q.jsxs)(`section`,{className:`oc-invites`,"aria-label":_e(),children:[(0,Q.jsxs)(`h3`,{className:`oc-invites__title`,children:[(0,Q.jsx)(Tt,{size:14,"aria-hidden":!0}),_e(),(0,Q.jsx)(G,{variant:`secondary`,children:e.length})]}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:e.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,Q.jsxs)(`span`,{className:`oc-access__sub`,children:[e.groupName??`?`,` ·`,` `,T({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?y():me()}),(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:tt()}),(0,Q.jsx)(H,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:D()})]},e._id))})]})}function mn({groupId:e}){let t=I(V.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=b(V.charts.assignChartToGroup),r=b(V.charts.removeChartFromGroup),i=b(V.charts.setGroupDefaultChart),o=b(V.charts.addChartToGroupPool),c=b(V.charts.removeChartFromGroupPool),l=J();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:s()});let{pool:u,addable:d,canManagePool:p}=t;if(u.length===0&&!p)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ze()});async function m(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){l.error(B(),e)}}async function g(t){try{await i({groupId:e,chartKey:t})}catch(e){l.error(B(),e)}}async function _(t){try{await o({groupId:e,chartKey:t})}catch(e){l.error(B(),e)}}async function v(t){try{await c({groupId:e,chartKey:t})}catch(e){l.error(B(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(K,{checked:e.selected,onCheckedChange:()=>void m(e.chartKey,e.selected),"aria-label":f({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":h(),title:h(),children:(0,Q.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:de()}):null,p?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":M({name:e.name}),title:M({name:e.name}),onClick:()=>void v(e.chartKey),children:(0,Q.jsx)(St,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),p?d.length>0?(0,Q.jsxs)(Qt,{value:``,onValueChange:e=>void _(e),children:[(0,Q.jsx)(en,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ft,{placeholder:Ve()})}),(0,Q.jsx)(tn,{children:d.map(e=>(0,Q.jsx)(Ht,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:a()}):null:null]})}export{sn as GroupsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$F as i,$P as a,AF as o,AP as s,An as c,Ao as l,BF as u,BP as d,BX as f,CF as p,CI as m,Co as h,DF as g,Dn as _,Do as v,EF as y,En as b,Eo as ee,Eu as x,FF as S,FP as C,Fn as te,Fo as w,GF as T,GP as E,HF as D,HP as O,HX as k,IF as A,IP as ne,J as re,JF as ie,JP as ae,K as oe,KF as se,KP as ce,LF as le,LP as ue,MF as de,MP as fe,Mn as pe,Mo as me,NF as j,NP as he,Nn as ge,No as _e,OF as ve,OP as ye,On as be,Oo as xe,PF as Se,PP as Ce,Pn as we,Po as Te,Q as Ee,QF as De,QP as Oe,RF as ke,RP as Ae,RU as M,SF as je,SI as Me,So as Ne,TF as Pe,To as Fe,Tu as Ie,UF as Le,UP as Re,UX as N,VF as ze,VP as Be,WF as Ve,WP as He,X as Ue,XF as We,XP as Ge,Y as Ke,YF as qe,YP as Je,Z as Ye,ZF as Xe,ZP as Ze,_F as Qe,_I as $e,aF as et,aI as tt,bF as nt,bI as rt,bo as it,cF as at,cI as ot,cm as st,cy as ct,dA as lt,dF as ut,dI as dt,dm as ft,eF as pt,eI as mt,et as ht,fA as gt,fF as _t,fI as vt,gF as yt,gI as bt,hF as xt,hI as St,iF as P,iI as Ct,jF as wt,jP as Tt,jn as Et,jo as Dt,kF as Ot,kP as kt,kn as At,ko as jt,lF as Mt,lI as Nt,lm as Pt,ly as Ft,mF as It,mI as Lt,nF as Rt,nI as zt,oF as Bt,oI as Vt,pF as Ht,pI as Ut,q as Wt,qF as Gt,qP as Kt,rI as qt,sF as Jt,sI as Yt,t as F,tF as Xt,tI as Zt,uF as Qt,uI as $t,um as en,uy as tn,vF as nn,vI as rn,wF as an,wo as on,wu as sn,xF as cn,xI as ln,xo as un,yF as dn,yI as fn,yo as pn,zF as mn,zP as hn,zU as I}from"./api--rqKQo-l.js";import{a as gn,c as _n}from"./FieldLabel-CcWGFs5F.js";import{t as L}from"./button-HksxbiUF.js";import{$t as R,Ct as z,Dt as B,J as V,Jt as H,Mt as vn,Ot as yn,St as U,Tt as bn,Yt as W,b as xn,bt as G,cn as Sn,ct as Cn,on as wn,sn as Tn,vt as K,wt as En,xt as q,yt as J}from"./index-l7elBM2O.js";import{t as Dn}from"./DataTableShell-BYSvf6VZ.js";import{InstanceConfigDialog as On}from"./BridgeTab-BUFvmr2d.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],kn=new Set(X),An=`conversational`;function jn(e){let t=new Set((e??[]).filter(e=>kn.has(e)));return t.size===0?[An]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:gn,widgetsEnabled:!0,widgetPromptConfirm:!1},Mn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nn(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`,identitySource:e.identitySource??`canonical`,participantIdentity:e.participantIdentity??`owner`,managePermissionModes:e.managePermissionModes===!0,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`,widgetsEnabled:e.config?.widgetsEnabled!==!1,widgetPromptConfirm:e.config?.widgetPromptConfirm===!0}}function Pn(){let e=N(F.admin.listInstances,{}),t=N(F.agents.listAllInstanceAgents,{}),n=k(F.admin.upsertInstance),a=k(F.widgets.setInstanceWidgets),o=k(F.admin.deleteInstance),s=W(),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(Q),[g,y]=(0,Y.useState)(null),[S,T]=(0,Y.useState)(null),[E,D]=(0,Y.useState)(null),[O,A]=(0,Y.useState)(null);async function ne(){try{let t=await n({instanceId:O??void 0,name:f.name,gatewayUrl:f.gatewayUrl,bridgeUrl:f.bridgeUrl||void 0,displayName:f.displayName||void 0,kind:f.kind,transport:f.kind===`hermes`?f.transport:void 0,gatewayVersion:f.gatewayVersion||void 0,gatewayHttpUrl:f.gatewayHttpUrl||void 0,...f.kind===`openclaw`?{authMode:f.authMode,personScopes:f.personScopes,identitySource:f.identitySource,participantIdentity:f.participantIdentity,managePermissionModes:f.managePermissionModes,systemIdentity:f.systemIdentity||void 0}:{},streamTransport:f.streamTransport}),r=O===null?null:e?.find(e=>e._id===O),i=r?.config?.widgetsEnabled!==!1,o=r?.config?.widgetPromptConfirm===!0;f.kind===`openclaw`&&(f.widgetsEnabled!==i||f.widgetPromptConfirm!==o)&&await a({instanceId:t,enabled:f.widgetsEnabled,promptConfirm:f.widgetPromptConfirm}),p(Q),A(null),d(!1)}catch(e){s.error(ln(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[rt(),(0,Z.jsx)(`strong`,{children:fn()}),rn()]}),(0,Z.jsx)(Dn,{title:$e(),rows:e,addLabel:bt(),onAdd:()=>{A(null),p(Q),d(!0)},emptyHint:St(),columns:[{header:Lt(),cell:e=>e.name,sort:e=>e.name},{header:Ut(),cell:e=>(0,Z.jsx)(H,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:vt(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:dt(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:m(),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)(H,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?C():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Yt(),onSelect:()=>{A(e._id),p(Nn(e)),d(!0)}},{label:Me(),onSelect:()=>y(e.name)},{label:se(),onSelect:()=>D(e)},{label:$t(),onSelect:()=>T(e)},{label:Nt(),variant:`destructive`,onSelect:()=>void o({instanceId:e._id})}],bulkActions:[{label:Nt(),variant:`destructive`,onSelect:e=>e.forEach(e=>void o({instanceId:e}))}]}),(0,Z.jsx)(xn,{open:u,onOpenChange:d,title:O?Vt():ot(),description:Ct(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:ne,submitLabel:qt(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:zt(),children:[(0,Z.jsx)(R,{value:f.name,disabled:O!==null,onChange:e=>p({...f,name:e.target.value})}),O?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:tt()}):null]}),(0,Z.jsx)($,{label:Zt(),children:(0,Z.jsxs)(K,{value:f.kind,onValueChange:e=>p({...f,kind:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(G,{value:`hermes`,children:`Hermes`})]})]})}),f.kind===`hermes`?(0,Z.jsx)($,{label:x(),children:(0,Z.jsxs)(K,{value:f.transport,onValueChange:e=>p({...f,transport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`ws`,children:Ie()}),(0,Z.jsx)(G,{value:`rest`,children:sn()})]})]})}):null,(0,Z.jsx)($,{label:mt(),children:(0,Z.jsx)(R,{value:f.gatewayUrl,onChange:e=>p({...f,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:i(),children:(0,Z.jsx)(R,{value:f.bridgeUrl,placeholder:De(),onChange:e=>p({...f,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Xe(),children:(0,Z.jsx)(R,{value:f.displayName,onChange:e=>p({...f,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:gt(),children:[(0,Z.jsxs)(K,{value:f.streamTransport,onValueChange:e=>p({...f,streamTransport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsx)(J,{children:_n.map(e=>(0,Z.jsx)(G,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:lt()})]}),(0,Z.jsx)($,{label:We(),children:(0,Z.jsx)(R,{value:f.gatewayVersion,placeholder:qe(),onChange:e=>p({...f,gatewayVersion:e.target.value})})}),f.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:Fe(),children:[(0,Z.jsxs)(K,{value:f.authMode,onValueChange:e=>p({...f,authMode:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`token`,children:on()}),(0,Z.jsx)(G,{value:`trusted-proxy`,children:h()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.authMode===`trusted-proxy`?un():Ne()})]}),f.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:w(),children:[(0,Z.jsxs)(K,{value:f.personScopes,onValueChange:e=>p({...f,personScopes:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`capped`,children:Te()}),(0,Z.jsx)(G,{value:`full`,children:_e()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.personScopes===`full`?Dt():me()})]}):null,f.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:l(),children:[(0,Z.jsxs)(K,{value:f.identitySource,onValueChange:e=>p({...f,identitySource:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`canonical`,children:jt()}),(0,Z.jsx)(G,{value:`email`,children:xe()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.identitySource===`email`?ee():v()})]}):null,f.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:te(),children:[(0,Z.jsxs)(K,{value:f.participantIdentity,onValueChange:e=>p({...f,participantIdentity:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`owner`,children:we()}),(0,Z.jsx)(G,{value:`self`,children:ge()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.participantIdentity===`self`?b():pe()})]}):null,f.kind===`openclaw`?(0,Z.jsxs)($,{label:Et(),children:[(0,Z.jsxs)(K,{value:f.managePermissionModes?`on`:`off`,onValueChange:e=>p({...f,managePermissionModes:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`off`,children:c()}),(0,Z.jsx)(G,{value:`on`,children:At()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.managePermissionModes?_():be()})]}):null,f.kind===`openclaw`?(0,Z.jsxs)($,{label:ht(),children:[(0,Z.jsxs)(K,{value:f.widgetsEnabled?`on`:`off`,onValueChange:e=>p({...f,widgetsEnabled:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`on`,children:r()}),(0,Z.jsx)(G,{value:`off`,children:Ee()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.widgetsEnabled?Ye():Ue()})]}):null,f.kind===`openclaw`&&f.widgetsEnabled?(0,Z.jsxs)($,{label:Ke(),children:[(0,Z.jsxs)(K,{value:f.widgetPromptConfirm?`on`:`off`,onValueChange:e=>p({...f,widgetPromptConfirm:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`off`,children:re()}),(0,Z.jsx)(G,{value:`on`,children:Wt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:oe()})]}):null,f.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:it(),children:(0,Z.jsx)(R,{value:f.systemIdentity,placeholder:pn(),onChange:e=>p({...f,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:ie(),children:(0,Z.jsx)(R,{value:f.gatewayHttpUrl,placeholder:Gt(),onChange:e=>p({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wn,{instanceName:g,open:g!==null,onOpenChange:e=>{e||y(null)}}),S?(0,Z.jsx)(On,{instance:S,onClose:()=>T(null)},S._id):null,E?(0,Z.jsx)(Fn,{instance:E,onClose:()=>D(null)},E._id):null]})}function Fn({instance:e,onClose:t}){let n=N(F.instanceSecrets.listInstanceSecretStatus,{}),r=Mn[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)(z,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(En,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(yn,{children:T({instance:e.displayName??e.name})}),(0,Z.jsx)(bn,{children:Ve()})]}),(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)(Ln,{instance:e})}),(0,Z.jsx)(In,{instance:e})]})})}function In({instance:e}){let t=f(F.instanceSync.forceInstanceSync),n=W(),[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(an());break;case`no_agents`:n.success(je());break;case`no_bridge_url`:n.error(cn());break;case`deploy_misconfigured`:n.error(nt());break;case`unauthorized`:n.error(nn());break;case`not_served`:n.error(Qe());break;default:n.error(dn());break}}catch(e){n.error(p(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:yt()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?Pe():y()})})]})}function Ln({instance:e}){let t=N(F.bridgeAuth.listBridgeAuthStatus,{}),n=f(F.bridgeAuth.mintBridgeSecret),r=k(F.bridgeAuth.revokeBridgeSecret),i=W(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,d]=(0,Y.useState)(!1),p=(t??[]).find(t=>t.instanceId===e._id),m=p!==void 0;async function h(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(Mt(),e)}finally{o(!1)}}}async function g(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(Qt())}catch(e){i.error(Mt(),e)}finally{o(!1)}}}async function _(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:xt(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:It()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:m?`outline`:`secondary`,children:m?`${u()} · ${p.prefix}…${p.lastFour}`:mn()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void h(),disabled:a,children:m?_t():Ht()}),m?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void g(),disabled:a,children:ut()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:at()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:l?I():M()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),d(!1)},children:Jt()})]}):null]})}function Rn({instanceId:e,field:t,updatedAt:n}){let r=f(F.instanceSecrets.setInstanceSecret),i=k(F.instanceSecrets.clearInstanceSecret),a=f(F.deviceIdentity.generateDeviceIdentity),s=W(),[c,l]=(0,Y.useState)(``),[d,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(!1),y=n!==null,b=t===`deviceIdentity`,ee=t===`token`?Le():t===`deviceIdentity`?D():ze();async function x(){if(!(!c.trim()||d)){p(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),h(null),v(!1),s.success(Se())}catch(e){s.error(j(),e)}finally{p(!1)}}}async function C(){if(!d){p(!0);try{await i({instanceId:e,field:t}),h(null),v(!1),s.success(de())}catch(e){s.error(j(),e)}finally{p(!1)}}}async function te(){if(!d){p(!0);try{h(await a({instanceId:e})),v(!1),s.success(Ot())}catch(e){s.error(g(),e)}finally{p(!1)}}}let w=m?`openclaw devices approve ${m.id}`:``;async function T(){if(w)try{await navigator.clipboard.writeText(w),v(!0)}catch{}}return(0,Z.jsxs)($,{label:ee,children:[b?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:y?`outline`:`secondary`,children:y?u():mn()}),(0,Z.jsx)(R,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:y?le():ke(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void x(),disabled:d||c.trim().length===0,children:A()}),b?(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void te(),disabled:d,children:wt()}):null,y?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void C(),disabled:d,children:S()}):null]})]}),m?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:Ot()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:w}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void T(),children:_?I():M()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{h(null),v(!1)},children:Jt()})]}):null]})}var zn={conversational:Ge,documentary:ae,summarizer:ft,curator:Pt},Bn={conversational:Je,documentary:Kt,summarizer:en,curator:st},Vn=e=>(zn[e]??(()=>e))(),Hn=e=>(Bn[e]??(()=>``))();function Un({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:pt()}),t.map(e=>(0,Z.jsx)(H,{variant:`secondary`,className:`oc-agenttype__chip`,title:Hn(e),children:Vn(e)},e)),(0,Z.jsxs)(wn,{children:[(0,Z.jsx)(Sn,{asChild:!0,children:(0,Z.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:a()})}),(0,Z.jsxs)(Tn,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Oe()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Ze()}),(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)(vn,{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:Vn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Hn(r)})]})]},r)})})]})]})]})}function Wn({instanceName:e,open:t,onOpenChange:n}){let r=N(F.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=k(F.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=k(F.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=k(F.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jn(r);e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=k(F.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=k(F.agents.removeInstanceAgent),u=k(F.agents.setAgentReservation),f=N(F.groups.listGroupLabels,t?{}:`skip`),p=Cn(),m=W();async function h(t,n){if(e&&await p({title:Tt({name:n}),description:s(),confirmLabel:fe()}))try{await u({instanceName:e,agentId:t,groupId:null})}catch(e){m.error(P(),V(e))}}async function g(t,n,r){if(!e)return;let i=(f??[]).find(e=>e._id===r)?.name??`?`;if(await p({title:tn({name:n,group:i}),description:Ft({group:i}),confirmLabel:ct()}))try{await u({instanceName:e,agentId:t,groupId:r})}catch(e){m.error(P(),V(e))}}async function _(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){m.error(P(),e)}}async function v(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){m.error(P(),e)}}async function y(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){m.error(P(),e)}}async function b(t,n){if(e&&await p({title:He({name:n}),description:Re(),confirmLabel:O(),destructive:!0}))try{await l({instanceName:e,agentId:t}),m.success(Be())}catch(e){m.error(P(),e)}}return(0,Z.jsx)(z,{open:t,onOpenChange:n,children:(0,Z.jsxs)(En,{className:`oc-access`,children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(yn,{children:Bt({name:e??``})}),(0,Z.jsx)(bn,{children:et()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:d()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?hn():r.discovery.lastPollOk?Ae():ue({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ne()}):(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)(vn,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void _(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,t.reserved?(0,Z.jsx)(H,{variant:`outline`,children:t.reserved.groupName===null?he():Ce({group:t.reserved.groupName})}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:ye()}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void b(t.agentId,a),children:E()})]}):i?(0,Z.jsx)(H,{variant:`default`,children:C()}):(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void v(t.agentId),children:ce()})]}),t.reserved?(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void h(t.agentId,a),children:fe()}),(0,Z.jsxs)(K,{value:``,onValueChange:e=>void g(t.agentId,a,e),children:[(0,Z.jsx)(q,{size:`sm`,className:`h-7`,children:(0,Z.jsx)(U,{placeholder:kt()})}),(0,Z.jsx)(J,{children:(f??[]).filter(e=>e._id!==t.reserved?.groupId).map(e=>(0,Z.jsx)(G,{value:e._id,children:e.name},e._id))})]})]}):null,t.enabled?(0,Z.jsx)(Un,{agentId:t.agentId,types:o,onToggle:e=>void y(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Gn,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){m.error(P(),e)}}}):null]},t.agentId)})})]})]})})}function Gn({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)(R,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:Rt(),"aria-label":Xt(),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{Pn as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,BX as i,Dh as a,Eh as o,HX as s,Mh as c,Oh as l,Th as u,UX as d,aR as f,cR as p,dR as m,fR as h,iR as g,jh as _,kh as v,lR as y,mR as b,nR as x,oR as S,pR as C,rR as w,sR as T,t as E,tR as D,uR as O,wh as k}from"./api--rqKQo-l.js";import{t as A}from"./button-HksxbiUF.js";import{$t as j,Jt as M,Mt as N}from"./index-l7elBM2O.js";var P=t(e(),1),F=n();function I(){let e=d(E.integrations.status.status,{}),t=s(E.admin.setIntegrationConfig),[n,i]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&i(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:b()});let a=n,o=(e,t,n)=>i({...a,[e]:{...a[e],[t]:n}}),l=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[C(),` `,(0,F.jsx)(`strong`,{children:h()}),` `,m()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(M,{variant:`secondary`,children:O()}):(0,F.jsx)(M,{variant:`outline`,children:y()}):(0,F.jsx)(M,{variant:`outline`,children:p()}),note:T(),children:[(0,F.jsx)(R,{label:f(),children:(0,F.jsx)(j,{value:a.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>o(`langfuse`,`host`,e.target.value),onBlur:()=>l(`langfuse`,{host:a.langfuse.host??``})})}),(0,F.jsx)(z,{label:D(),checked:a.langfuse.enabled??!0,onChange:e=>{o(`langfuse`,`enabled`,e),l(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(M,{variant:`secondary`,children:O()}):(0,F.jsx)(M,{variant:`outline`,children:y()}):(0,F.jsx)(M,{variant:`outline`,children:p()}),note:S(),children:[(0,F.jsx)(R,{label:g(),children:(0,F.jsx)(j,{value:a.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>o(`opik`,`baseUrl`,e.target.value),onBlur:()=>l(`opik`,{baseUrl:a.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(j,{value:a.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||x(),onChange:e=>o(`opik`,`workspace`,e.target.value),onBlur:()=>l(`opik`,{workspace:a.opik.workspace??``})})}),(0,F.jsx)(z,{label:D(),checked:a.opik.enabled??!0,onChange:e=>{o(`opik`,`enabled`,e),l(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(M,{variant:`secondary`,children:O()}):(0,F.jsx)(M,{variant:`outline`,children:y()}):(0,F.jsx)(M,{variant:`outline`,children:c()}),note:_(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(j,{value:a.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>o(`otlp`,`endpoint`,e.target.value),onBlur:()=>l(`otlp`,{endpoint:a.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:D(),checked:a.otlp.enabled??!0,onChange:e=>{o(`otlp`,`enabled`,e),l(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=i(E.integrations.otlpSecret.setOtlpHeaders),n=s(E.integrations.otlpSecret.clearOtlpHeaders),[r,c]=(0,P.useState)(``),[d,f]=(0,P.useState)(null),[p,m]=(0,P.useState)(!1),h=async()=>{m(!0),f(null);try{await t({headersJson:r}),c(``)}catch(e){f(e instanceof Error?e.message:String(e))}finally{m(!1)}};return(0,F.jsxs)(R,{label:v(),children:[(0,F.jsx)(j,{value:r,placeholder:e?l():a(),onChange:e=>c(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:p||r.trim().length===0,onClick:()=>void h(),children:o()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:p,onClick:()=>void n({}),children:u()}):null]}),d?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:d}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:k()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CO as r,DO as i,EO as a,Hz as o,OO as s,SO as c,TO as l,UX as u,_O as d,_z as f,bO as p,gO as m,gz as h,hO as g,hz as ee,kO as te,mz as _,oz as v,sz as y,t as b,vO as x,wO as S,xO as C,yO as w}from"./api--rqKQo-l.js";import{dr as T,fr as E,ft as D,i as ne,o as re,r as O}from"./index-l7elBM2O.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-BS-Ukkxw.js";import{n as P,t as F}from"./TimeRangePicker-CSLm7VwE.js";var I=t(e(),1),L={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},R=Object.keys(L).length,z=n(),B=15,V=e=>String(Math.round(e));function H(){let e=u(b.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=u(b.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,I.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,B).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:o()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:f()}),(0,z.jsx)(M,{children:ee()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,z.jsx)(U,{series:n})})]})]})}function U({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,z.jsxs)(`span`,{style:{color:`var(--primary)`},children:[v(),` p50 `,V(s.cP50),` `,h()]}),(0,z.jsxs)(`span`,{children:[y(),` p50 `,V(s.aP50),` `,h()]})]}),(0,z.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":f(),children:[(0,z.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,z.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var W=[{metric:`api.calls`,label:te(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:s(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:i(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:a(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:l(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:S(),unit:`/h`,group:`Assistant`,isError:!0},{metric:L.ASSISTANT_ANNOUNCE_ERRORS,label:r(),unit:`/h`,group:`Assistant`,isError:!0}],G=R,K=[`API`,`OpenClaw`,`Chat`,`Assistant`],q=1e3,J=36e5;function Y(e,t){let n=Math.max(1,Math.ceil((t-e)/J)),r=Math.min(n*G,q);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/G))}}function ie(){let e=E({from:`/settings/kpi`}),t=T({from:`/settings/kpi`}),n=ne(e.from,e.to,O,`now`),r=e=>void t({search:t=>({...t,...re(e)})}),{from:i,to:a}=P(n),{rowLimit:o,buckets:s}=Y(i,a),l=u(b.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),d=(0,I.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>s&&e.set(t,n.slice(n.length-s));return e},[l,s]),f=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:C()})]}),(0,z.jsx)(ae,{value:n,onChange:r})]});return l===void 0?(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:p()})]}):l.length===0?(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:w()})]}):(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),K.map(e=>{let t=W.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,z.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,z.jsx)(oe,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function ae({value:e,onChange:t}){return(0,z.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,z.jsx)(F,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,z.jsxs)(N,{size:`sm`,className:`oc-kpi__card`,children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{className:`oc-kpi__card-title`,children:e.label}),(0,z.jsx)(M,{className:`oc-kpi__card-metric`,children:(0,z.jsx)(`code`,{children:e.metric})})]}),(0,z.jsxs)(A,{className:`oc-kpi__card-body`,children:[(0,z.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,z.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,z.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,z.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,z.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,z.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:x({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:d()}),(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:m({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,z.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-se,1);return(0,z.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":g({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,z.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,z.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{ie as KpiTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$W as r,AG as i,Bc as a,CG as o,CX as s,Cc as c,DG as l,EG as u,Ec as d,FG as f,HX as p,IG as m,MG as ee,NG as h,NX as te,OG as ne,OX as re,PG as ie,Pc as ae,QW as oe,SG as se,SX as ce,Sc as le,TG as ue,TX as de,Tc as fe,UX as g,ZW as pe,_G as me,_X as he,aG as ge,aX as _e,bG as _,bX as v,bc as y,cG as b,cX as x,dG as S,dX as C,eG as w,fG as T,fX as E,gG as D,gX as O,hG as k,hX as A,iG as j,iX as M,jG as N,kG as P,lG as F,lX as I,mG as ve,mX as ye,nG as be,nX as xe,oG as L,oX as Se,pG as Ce,pX as we,r as R,rG as Te,rI as Ee,rX as De,sG as Oe,sX as ke,t as z,tG as Ae,uG as B,uX as je,vG as Me,vX as Ne,wG as Pe,wX as Fe,wc as Ie,xG as Le,xX as Re,xc as ze,yG as Be,yX as Ve,yc as He,zc as Ue}from"./api--rqKQo-l.js";import{t as V}from"./button-HksxbiUF.js";import{$t as H,H as We,Jt as U,Mt as W,Qt as Ge,St as Ke,Xt as qe,Yt as Je,Zt as Ye,bt as G,ft as K,t as Xe,vt as Ze,xt as Qe,yt as $e}from"./index-l7elBM2O.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-ObUCuHhu.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:()=>m()},{id:`composer`,label:()=>f()},{id:`sidebar`,label:()=>ie()},{id:`notifications`,label:()=>me()},{id:`other`,label:()=>h()}],X={showSource:{category:`messages`,label:()=>ee(),help:()=>N()},showReport:{category:`messages`,label:()=>i(),help:()=>P()},copyAssistant:{category:`messages`,label:()=>ne()},copyUser:{category:`messages`,label:()=>l()},showDelete:{category:`messages`,label:()=>u()},showTools:{category:`messages`,label:()=>ue(),help:()=>Pe()},voiceInput:{category:`composer`,label:()=>o(),help:()=>se()},showUsage:{category:`composer`,label:()=>Le(),help:()=>_()},autoReadAloud:{category:`composer`,label:()=>a(),help:()=>Ue()},showChatAge:{category:`sidebar`,label:()=>Be(),help:()=>Me()},notifSound:{category:`notifications`,label:()=>D(),help:()=>k()},notifSystem:{category:`notifications`,label:()=>ve(),help:()=>Ce()},replySound:{category:`notifications`,label:()=>T(),help:()=>S()}};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:()=>Ae()};function ut({prefKey:e,ui:t}){let n=p(z.admin.setUiPrefDefault),i=p(z.admin.setFeatureEnabled),a=ct(e),o=a?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:ge()}),(0,J.jsxs)(Ze,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(Qe,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ke,{})}),(0,J.jsxs)($e,{children:[(0,J.jsx)(G,{value:`on`,children:r()}),(0,J.jsx)(G,{value:`off`,children:oe()}),(0,J.jsx)(G,{value:`inherit`,children:pe()})]})]}),a?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(W,{checked:t.featuresEnabled[a]===!0,onCheckedChange:e=>void i({key:a,enabled:e===!0}),"aria-label":j()}),j()]}):null]}),o?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function dt({current:e,enabled:t}){let n=p(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=Ye(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:[d(),e?(0,J.jsx)(U,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?c():r?Ie():fe()})]}),(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?y():e?ze():le()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=g(z.me.getMe,{host:K}),a=i?.ui,o=$(i?.role)&&n,s=p(z.me.setUiPref).withOptimisticUpdate(We),c=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":L()}),L()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:Te()}),(0,J.jsx)(`p`,{children:be()}),(0,J.jsx)(`p`,{children:w()})]}):null,(0,J.jsx)(H,{value:e,onChange:e=>t(e.target.value),placeholder:B(),"aria-label":B(),className:`mb-2`}),c.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:F()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:c.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=a.locked[e],c=a.effective[e],l=a.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)(U,{variant:`outline`,children:b()}):l?(0,J.jsx)(U,{variant:`secondary`,children:ae()}):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 s({key:e,value:null}),children:Oe()}):null,(0,J.jsx)(nt,{checked:c,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),s({key:e,value:t})},"aria-label":n})]}),o?(0,J.jsx)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:te()})}var pt={sm:()=>we(),md:()=>E(),lg:()=>C(),xl:()=>je(),"2xl":()=>I(),"3xl":()=>x()};function mt(){let e=g(z.me.getMe,{host:K}),t=p(z.me.setLocale),n=p(z.me.setTimezone),r=p(z.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(z.me.getMe,{host:K});n&&e.setQuery(z.me.getMe,{host:K},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=p(z.me.setMyName),a=Je(),o=e?.locale??`default`,c=e?.name??``,[l,u]=(0,q.useState)(null),d=l??c,f=d.trim()!==c.trim();async function m(){try{await i({name:d}),u(null),a.success(Re())}catch(e){a.error(v(),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:de()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Fe()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(H,{className:`max-w-xs`,value:d,maxLength:120,placeholder:s(),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!f,onClick:()=>void m(),children:Ee()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ce()})]}),(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:Ve()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:o===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:o==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:re()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),(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:ke()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(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:_e()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:M()})]}),(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:A()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:Xe.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:ye()})]}),(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:De()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]}),(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{AD as r,CD as i,DD as a,E as o,GD as s,GE as c,HD as l,HX as u,ID as d,JE as f,KD as p,KE as m,Ko as h,LD as g,ND as ee,NX as _,OD as te,QD as ne,QE as v,SD as y,TD as re,UD as ie,UE as b,UX as x,WE as S,XD as ae,XE as C,YE as w,ZD as oe,_D as T,aD as E,bD as se,dD as D,eD as ce,fD as le,gD as ue,hD as de,iD as fe,jD as O,kD as pe,lD as me,lE as k,mD as he,oD as ge,pD as _e,qE as A,qo as ve,sD as ye,t as j,uD as be,vD as M,wD as N,xD as xe,yD as Se,zC as Ce,zD as P}from"./api--rqKQo-l.js";import{r as we}from"./dist-lcVkVTM0.js";import{t as Te}from"./list-DnhyuzZ4.js";import{t as F}from"./button-HksxbiUF.js";import{$n as Ee,$t as I,A as L,An as De,Bn as R,C as z,D as Oe,E as ke,Gn as Ae,I as je,Kn as Me,M as Ne,N as Pe,O as Fe,P as B,Qn as Ie,S as Le,T as Re,Un as V,Vn as ze,Xn as Be,Yt as Ve,Zn as He,_ as Ue,_t as We,an as Ge,b as Ke,ct as qe,d as Je,dr as H,en as Ye,er as Xe,f as Ze,fr as Qe,g as $e,gt as U,h as et,ht as tt,in as nt,j as W,k as rt,lt as it,mt as at,nn as G,p as ot,pr as st,pt as ct,rn as lt,sr as ut,tn as dt,tr as ft,v as K,w as q,x as J,y as pt,zn as mt}from"./index-l7elBM2O.js";var ht=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`}]]),gt=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`}]]),_t=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 vt({className:e}){return(0,Z.jsx)(Ge,{asChild:!0,children:(0,Z.jsx)(F,{variant:`ghost`,size:`icon-xs`,"aria-label":C(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(ft,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let o=u(j.projects.renameProject),s=u(j.projects.setProjectColor),f=u(j.projects.moveProject),p=u(j.projects.deleteProject),h=u(j.projects.createProject),_=qe(),te=et(),y=it(),[re,ie]=(0,X.useState)(!1),[b,S]=(0,X.useState)(t),[C,T]=(0,X.useState)(!1),[E,se]=(0,X.useState)(!1),D=x(j.projects.projectTreeCount,E?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ye,{onOpenChange:e=>e&&se(!0),children:[(0,Z.jsx)(vt,{className:i}),(0,Z.jsxs)(dt,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(G,{onSelect:()=>a(),children:[(0,Z.jsx)(Ie,{}),` `,ee()]}),(0,Z.jsxs)(G,{onSelect:()=>{S(t),ie(!0)},children:[(0,Z.jsx)(ze,{}),` `,w()]}),(0,Z.jsxs)(G,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await y({title:N(),label:ne(),placeholder:oe(),confirmLabel:ae()});t&&await h({name:t,parentId:e})})},children:[(0,Z.jsx)(He,{}),` `,N()]}),(0,Z.jsxs)(G,{onSelect:()=>T(!0),children:[(0,Z.jsx)(gt,{}),` `,ge()]}),(0,Z.jsx)(lt,{children:m()}),(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":c(),children:`✕`}),Ue.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)(nt,{}),(0,Z.jsxs)(G,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=D?.folders??0,r=D?.chats??0;await _({title:d({name:t}),description:ot({folders:n,chats:r,days:te}),confirmWord:v(),confirmLabel:g(),destructive:!0})&&await p({projectId:e})})},children:[(0,Z.jsx)(De,{}),` `,v()]})]})]}),(0,Z.jsx)(Ke,{open:re,onOpenChange:ie,title:l(),canSubmit:b.trim().length>0,onSubmit:async()=>{await o({projectId:e,name:b.trim()}),ie(!1)},submitLabel:w(),children:(0,Z.jsx)(I,{value:b,onChange:e=>S(e.target.value),autoFocus:!0})}),C?(0,Z.jsx)($e,{open:C,onOpenChange:T,title:fe(),movingFolderId:e,currentId:r,onPick:t=>void f({projectId:e,parentId:t})}):null]})}function yt({chat:e,currentFolderId:t,className:n}){let i=u(j.chats.pinChat),a=u(j.chats.deleteChat),o=u(j.chats.renameChat),s=u(j.chats.setChatSidebar),c=u(j.chats.moveChatToProject),l=qe(),d=et(),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(e.title??``),[ee,_]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ye,{children:[(0,Z.jsx)(vt,{className:n}),(0,Z.jsxs)(dt,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(G,{onSelect:()=>{g(e.title??``),m(!0)},children:[(0,Z.jsx)(ze,{}),` `,w()]}),(0,Z.jsxs)(G,{onSelect:()=>void i({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(mt,{}):(0,Z.jsx)(R,{}),e.pinned?f():A()]}),(0,Z.jsxs)(G,{onSelect:()=>_(!0),children:[(0,Z.jsx)(gt,{}),` `,ye()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(G,{onSelect:()=>void s({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(V,{}):(0,Z.jsx)(Y,{}),e.inSidebar?r():O()]}),(0,Z.jsx)(nt,{}),(0,Z.jsxs)(G,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await l({title:S(),description:b({days:d}),confirmLabel:v(),destructive:!0})&&await a({chatId:e._id})})},children:[(0,Z.jsx)(De,{}),` `,v()]})]})]}),(0,Z.jsx)(Ke,{open:p,onOpenChange:m,title:k(),canSubmit:h.trim().length>0,onSubmit:async()=>{await o({chatId:e._id,title:h.trim()}),m(!1)},submitLabel:w(),children:(0,Z.jsx)(I,{value:h,onChange:e=>g(e.target.value),autoFocus:!0})}),ee?(0,Z.jsx)($e,{open:ee,onOpenChange:_,title:E(),currentId:t,onPick:t=>void c({chatId:e._id,projectId:t})}):null]})}function bt(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function xt(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 St(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 Ct=`oc.projpage.view`;function wt(){let e=localStorage.getItem(Ct);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,Tt=e=>`col:${e??`null`}`,Et=e=>`crumb:${e}`;function Dt(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 Ot(){let{projectId:e}=st({from:`/project/$projectId`}),t=H(),n=x(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:_()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:le()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:D()}),(0,Z.jsx)(F,{variant:`outline`,onClick:()=>void t({to:`/`}),children:be()})]}):(0,Z.jsx)(kt,{page:n})})}function kt({page:e}){let t=H(),n=qe(),r=et(),i=it(),o=Ve(),s=u(j.projects.renameProject),f=u(j.projects.setProjectColor),ee=u(j.projects.deleteProject),_=u(j.projects.createProject),y=u(j.projects.moveProject),b=u(j.projects.setProjectSidebar),S=u(j.chats.moveChatToProject),C=u(j.chats.reorderChat),T=u(j.projects.reorderProject),E=x(j.projects.projectTreeCount,{projectId:e.project._id}),[D,le]=(0,X.useState)(wt),O=e=>{localStorage.setItem(Ct,e),le(e)},k=x(j.projects.folderColumns,D===`columns`?{projectId:e.project._id}:`skip`),A=x(j.projects.projectTreeList,D===`list`?{projectId:e.project._id}:`skip`),{c:ye}=Qe({from:`/project/$projectId`}),be=x(j.projects.listProjects,{}),M=x(j.chatReads.myBusyChats,{}),P=(0,X.useMemo)(()=>new Set(M??[]),[M]),{byChat:we}=We(M??null),R=x(j.chatReads.myChatReads,{}),z=(0,X.useMemo)(()=>St(e.chats,R??[]),[e.chats,R]),{startNewChat:B,picker:Ie}=Je(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[V,Ze]=(0,X.useState)(``),[U,W]=(0,X.useState)(!1),[st,ut]=(0,X.useState)(e.project.name),[K,mt]=(0,X.useState)(!1),[Y,vt]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>vt(V.trim()),180);return()=>clearTimeout(e)},[V]);let Q=x(j.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),yt=Pe(Ne(Oe,{activationConstraint:{distance:4}}),Ne(Fe,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),Tt=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Et,Ot]=(0,X.useState)(null),kt=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||p()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(be??[]).find(t=>t._id===e)?.name??``}}return null},Mt=e=>Ot(kt(String(e.active.id))),Pt=(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=L(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=L(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=L(n(`crumb:`));if(a.length>0)return a;let o=L(n(`col:`));return o.length>0?o:rt(n(t?`folder:`:`chat:`))},[]),It=t=>{if(D===`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(D===`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},Lt=t=>{if(D===`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(D===`list`){let e=A?.folders.find(e=>e._id===t);if(!e||!A)return null;let n=e.parentId??A.rootId;return{list:at(A.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},zt=async e=>{Ot(null),Tt();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=Dt(r);if(e!==void 0){if(a)await S({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!ct(be??[],t,e)){o.error(re());return}await y({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=It(t);if(!n)return;n.list.some(t=>t._id===e)||await S({chatId:e,projectId:n.folderId});let a=xt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await C({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Lt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!ct(be??[],e,n.parentId)){o.error(re());return}await y({projectId:e,parentId:n.parentId})}let a=xt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await T({projectId:e,...a});return}}catch{o.error(re())}},[,Bt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Bt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Vt=Date.now(),Ht=pt(e.project),Ut=bt(e.chats,V),Wt=e.breadcrumb.slice(0,-1),Gt=e=>()=>{$.current||e()};return(0,Z.jsx)(tt.Provider,{value:we,children:(0,Z.jsxs)(Re,{sensors:yt,collisionDetection:Pt,onDragStart:Mt,onDragEnd:zt,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":Ht},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":me(),children:[Wt.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(At,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Gt(()=>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)(F,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:ve(),onClick:()=>{b({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(Xe,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:h()}),(0,Z.jsx)(Ee,{"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":pe(),children:[(0,Z.jsx)(F,{variant:D===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":pe(),title:pe(),"aria-pressed":D===`cards`,onClick:()=>O(`cards`),children:(0,Z.jsx)(_t,{})}),(0,Z.jsx)(F,{variant:D===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":te(),title:te(),"aria-pressed":D===`columns`,onClick:()=>O(`columns`),children:(0,Z.jsx)(ht,{})}),(0,Z.jsx)(F,{variant:D===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":a(),title:a(),"aria-pressed":D===`list`,onClick:()=>O(`list`),children:(0,Z.jsx)(Te,{})})]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:()=>void B({projectId:e.project._id}),children:[(0,Z.jsx)(Me,{}),Se()]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await i({title:N(),label:ne(),placeholder:oe(),confirmLabel:ae()});t&&await _({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(He,{}),N()]}),(0,Z.jsxs)(Ye,{children:[(0,Z.jsx)(Ge,{asChild:!0,children:(0,Z.jsx)(F,{variant:`ghost`,size:`icon-sm`,"aria-label":ie(),children:(0,Z.jsx)(ft,{})})}),(0,Z.jsxs)(dt,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(G,{onSelect:()=>{ut(e.project.name),W(!0)},children:[(0,Z.jsx)(ze,{}),` `,w()]}),(0,Z.jsxs)(G,{onSelect:()=>mt(!0),children:[(0,Z.jsx)(gt,{}),` `,ge()]}),(0,Z.jsx)(lt,{children:m()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void f({projectId:e.project._id,color:null}),"aria-label":c(),children:`✕`}),Ue.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 f({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(nt,{}),(0,Z.jsxs)(G,{variant:`destructive`,onSelect:()=>{let i=e.project.parentId;requestAnimationFrame(async()=>{let a=E?.folders??0,o=E?.chats??0;await n({title:d({name:e.project.name}),description:ot({folders:a,chats:o,days:r}),confirmWord:v(),confirmLabel:g(),destructive:!0})&&(await ee({projectId:e.project._id}),t(i===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:i}}))})},children:[(0,Z.jsx)(De,{}),` `,v()]})]})]})]})]}),D===`columns`?(0,Z.jsx)(Rt,{data:k,currentId:e.project._id,busyIds:P,suppressClick:$,locateChatId:ye??null}):D===`list`?(0,Z.jsx)(Ft,{data:A,busyIds:P,suppressClick:$,locateChatId:ye??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:xe()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(J,{items:e.children.map(e=>`folder:${e._id}`),strategy:Le,children:e.children.map(t=>(0,Z.jsx)(jt,{child:t,parentId:e.project._id,now:Vt,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:se()}),e.chats.length>0?(0,Z.jsx)(I,{value:V,onChange:e=>Ze(e.target.value),placeholder:ue(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?he():_e()}):Ut.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:de({term:V.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(J,{items:Ut.map(e=>`chat:${e._id}`),strategy:q,children:Ut.map(t=>(0,Z.jsx)(Nt,{chat:t,currentFolderId:e.project._id,now:Vt,busy:P.has(t._id),unread:z.has(t._id),locate:t._id===ye,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:ce()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:de({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&&je(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(Ae,{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||Ce()}),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)(Ke,{open:U,onOpenChange:W,title:l(),canSubmit:st.trim().length>0,onSubmit:async()=>{await s({projectId:e.project._id,name:st.trim()}),W(!1)},submitLabel:w(),children:(0,Z.jsx)(I,{value:st,onChange:e=>ut(e.target.value),autoFocus:!0})}),K?(0,Z.jsx)($e,{open:K,onOpenChange:mt,title:fe(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void y({projectId:e.project._id,parentId:t})}):null,Ie]}),(0,Z.jsx)(ke,{children:Et?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Et.kind===`folder`?(0,Z.jsx)(Be,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Ae,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Et.label})]}):null})]})})}function At({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=W({id:Et(e)});return(0,Z.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function jt({child:e,parentId:t,now:n,suppressClick:r}){let i=H(),a=z({id:`folder:${e._id}`}),o=W({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":pt(e),transform:B.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)(Be,{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?M({count:e.folderCount})+` · `:``,T({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:Ze(e.lastActivityAt,n)})]})}function Mt({chat:e}){let t=u(j.chats.setChatSidebar),n=e.inSidebar?r():O();return(0,Z.jsx)(F,{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)(V,{}):(0,Z.jsx)(Y,{})})}function Nt({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let c=(0,X.useContext)(tt).get(e._id),l=H(),u=K(e.color),d=z({id:`chat:${e._id}`}),f=Pt(a);return(0,Z.jsxs)(`li`,{ref:e=>{d.setNodeRef(e),f.current=e},className:`oc-projpage__chatrow`+(d.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:B.Transform.toString(d.transform),transition:d.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||l({to:`/chat/$chatId`,params:{chatId:e._id}})},...d.listeners,...d.attributes,children:[u?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:u}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||p()}),e.pinned?(0,Z.jsx)(R,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:Ze(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:U(c,s()).className,title:U(c,s()).label,"aria-label":U(c,s()).label}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:P(),"aria-label":P()}):null]}),(0,Z.jsx)(Mt,{chat:e}),(0,Z.jsx)(yt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function Pt(e){let t=(0,X.useRef)(null);return(0,X.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Ft({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:_()});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=at(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(J,{items:u.map(e=>`chat:${e._id}`),strategy:q,children:u.map(e=>(0,Z.jsx)(Lt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(J,{items:d.map(e=>`folder:${e._id}`),strategy:q,children:d.map(t=>(0,Z.jsx)(It,{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&&at(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:he()}):c(null,0)})}function It({folder:e,parentId:t,depth:n,folded:r,onToggle:a,suppressClick:o,children:s}){let c=H(),l=z({id:`folder:${e._id}`}),u=W({id:$(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.jsxs)(`div`,{ref:e=>{l.setNodeRef(e),u.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(u.isOver?` is-over`:``)+(l.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":pt(e),transform:B.Transform.toString(l.transform),transition:l.transition},...l.listeners,...l.attributes,role:`button`,tabIndex:0,onClick:()=>{o.current||c({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&c({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?i():y(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!o.current&&a()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(ut,{size:13}):(0,Z.jsx)(we,{size:13})}),(0,Z.jsx)(Be,{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 c({to:`/project/$projectId`,params:{projectId:e._id}})})]}),s]})}function Lt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=(0,X.useContext)(tt).get(e._id),o=H(),s=z({id:`chat:${e._id}`}),c=Pt(r),l=K(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:B.Transform.toString(s.transform),transition:s.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||o({to:`/chat/$chatId`,params:{chatId:e._id}})},...s.listeners,...s.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__colname`,children:e.title||p()}),n?(0,Z.jsx)(`span`,{className:U(a,``).className,"aria-hidden":!0}):null]}),(0,Z.jsx)(yt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(Mt,{chat:e})]})}function Rt({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:_()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.jsx)(zt,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function zt({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=H(),s=W({id:Tt(e.folderId)});return(0,Z.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(J,{items:e.folders.map(e=>`folder:${e._id}`),strategy:q,children:e.folders.map(t=>(0,Z.jsx)(Bt,{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)(J,{items:e.chats.map(e=>`chat:${e._id}`),strategy:q,children:e.chats.map(t=>(0,Z.jsx)(Vt,{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:_e()}):null]})}function Bt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=z({id:`folder:${e._id}`}),o=W({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":pt(e),transform:B.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)(Be,{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 Vt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=(0,X.useContext)(tt).get(e._id),s=z({id:`chat:${e._id}`}),c=Pt(r),l=K(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:B.Transform.toString(s.transform),transition:s.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...s.listeners,...s.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__colname`,children:e.title||p()}),n?(0,Z.jsx)(`span`,{className:U(o,``).className,"aria-hidden":!0}):null]}),(0,Z.jsx)(yt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(Mt,{chat:e})]})}export{Ot as ProjectPage};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,Cf as i,Du as a,Gk as o,HX as s,Jk as c,Kk as l,Ou as u,Qk as d,Sf as f,UX as p,Uk as m,Uo as h,Wk as g,Xk as _,Yk as v,Zk as y,aA as ee,cA as b,df as x,eA as S,ff as C,fm as w,gA as T,gm as E,hA as D,hm as O,iA as te,ku as ne,mf as re,mm as ie,nA as ae,oA as oe,pf as k,pm as A,qk as j,rA as M,sA as N,t as P,tA as F,uf as I,wf as L,xf as R}from"./api--rqKQo-l.js";import{i as z,n as B,r as V,t as H}from"./FieldLabel-CcWGFs5F.js";import{t as U}from"./button-HksxbiUF.js";import{Mt as se,St as W,Yt as G,bt as K,ft as ce,gn as le,hn as ue,mn as de,pn as q,vt as J,xt as Y,yt as X}from"./index-l7elBM2O.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:M,help:ae},documentary_fetch:{label:F,help:S},inbound_files:{label:r,help:d},history_summary:{label:E,help:O},file_curation:{label:L,help:re},quote_reply:{label:i,help:f}},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:o,references:g,files:m,previous_summary:ie,new_messages:A,max_chars:w,file_name:k,budget_chars:C,feedback:x,content:I,excerpt:R};function _e(){let e=p(P.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:_()})});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:b(),help:N()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:y()}),(0,$.jsxs)(J,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(W,{})}),(0,$.jsx)(X,{children:e.map(e=>(0,$.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=s(P.admin.upsertInstanceConfig),n=G(),r=p(P.me.getMe,{host:ce}),i=e.config??{},o=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[c,l]=(0,Q.useState)(()=>z(i,o));(0,Q.useEffect)(()=>{l(z(i,o))},[o,e._id]);let[d,f]=(0,Q.useState)(!1),m=c.promptInjections,h=(e,t)=>l({...c,promptInjections:{...m,[e]:{...m[e],...t}}});async function g(){f(!0);try{await t({instanceId:e._id,config:V(c,i,o)})}catch(e){n.error(D(),e)}finally{f(!1)}}async function _(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 v=e.config?.contentLocale??`default`,y=fe[Z(void 0,r?.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:ne()}),(0,$.jsxs)(J,{value:v,onValueChange:e=>void _(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(W,{})}),(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{value:`default`,children:a({locale:y})}),pe().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:u()})]}),de.map(e=>(0,$.jsx)(ye,{injKey:e,def:q[e],i18n:me[e],row:m[e]??{enabled:!0,template:q[e].defaultTemplate[o]},contentLocale:o,onChange:t=>h(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void g(),disabled:d,children:T()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),u=r.template.trim()!==t.defaultTemplate[i],d=t.togglable&&!r.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),p=ue(e,r,i),m=p?le(p,f):``;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)(se,{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()}),u&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:ee()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:d,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:te()}),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?c():v()}),u&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:oe()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:j()}),t.pluralDefaultTemplate!==void 0&&!d?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:h()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:l()})})]})}export{_e as PromptInjectionsTab};
|
|
@@ -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 a,CN as o,DN as s,EN as c,GN as l,HN as u,HX as d,IN as f,JN as p,Jf as m,KN as h,LN as ee,ON as te,QN as ne,RN as re,SN as g,TN as _,UN as v,UX as y,VN as b,WN as x,XN as ie,YN as ae,ZN as S,aP as C,cP as w,dP as T,eP as E,fP as D,iP as O,kN as k,lP as A,nP as j,oP as M,qN as N,rP as P,sP as F,t as I,tP as L,uP as oe,wN as R,zN as z}from"./api--rqKQo-l.js";import{t as B}from"./button-HksxbiUF.js";import{$t as V,Jt as H,Mt as U,Yt as W,b as G,ct as K,qn as q}from"./index-l7elBM2O.js";import{t as J}from"./roleDescriptions-Csn1bSUI.js";var Y=t(e(),1),X=n(),Z=[{group:()=>D(),keys:[{key:`traces.read`,label:()=>F()},{key:`traces.read.content`,label:()=>M(),phi:!0},{key:`traces.write`,label:()=>C()}]},{group:()=>T(),keys:[{key:`kpi.read`,label:()=>F()},{key:`kpi.write`,label:()=>C()}]},{group:()=>oe(),keys:[{key:`openclaw.query`,label:()=>O()},{key:`anomalies.read`,label:()=>P()},{key:`anomalies.report`,label:()=>j()}]},{group:()=>A(),keys:[{key:`chats.read`,label:()=>F()},{key:`selfheal`,label:()=>E()},{key:`media.repair`,label:()=>r()},{key:`feedback.respond`,label:()=>m()}]},{group:()=>w(),keys:[{key:`admin.manage`,label:()=>L()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=y(I.apiKeys.listRoles,{}),t=d(I.apiKeys.createRole),n=d(I.apiKeys.ensureRolesSeeded),r=d(I.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(I.apiKeys.listRoles,{});r&&e.setQuery(I.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),m=K(),C=W(),[w,T]=(0,Y.useState)(!1),[E,D]=(0,Y.useState)($),[O,A]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{C.error(S(),e)})},[n,C]);let j=e??[];async function M(e,t){if(Q(e.permissions))return;if(e.builtin){await m({title:ie({name:e.name}),description:ae(),confirmLabel:p()});return}if(O.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];A(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){C.error(N(),e)}finally{A(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function P(){try{await t({key:E.key,name:E.name,description:E.description||void 0,permissions:[]}),D($),T(!1)}catch(e){C.error(h(),e)}}let F=e===void 0,L=!F&&j.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,x(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,v()]}),(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:u()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{D($),T(!0)},children:b()})})]}),F?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):(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:re()}),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?ne({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:j.map(e=>{let t=Q(e.permissions),n=O.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)(H,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(q,{}),` `,ee()]}):(0,X.jsx)(H,{variant:`secondary`,children:f()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),se.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(U,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?i():n?k():r,onCheckedChange:()=>void M(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:w,onOpenChange:T,title:te(),description:s(),canSubmit:!!(E.key&&E.name),onSubmit:P,submitLabel:c(),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:_()}),(0,X.jsx)(V,{value:E.key,placeholder:R(),onChange:e=>D({...E,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)(V,{value:E.name,onChange:e=>D({...E,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:g()}),(0,X.jsx)(V,{value:E.description,onChange:e=>D({...E,description:e.target.value})})]})]})})]})}export{ce as RolesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$q as r,AJ as i,Aq as a,BX as o,CJ as s,Cq as c,DJ as l,Dq as u,E as d,EJ as ee,Eq as f,FJ as p,FX as m,Gq as h,Hq as te,IJ as ne,Jq as g,Kq as re,LJ as ie,MJ as ae,Mq as oe,NJ as se,NX as ce,OJ as le,Oq as ue,PJ as de,Qq as _,SJ as fe,Sq as pe,TJ as me,Tq as he,UX as ge,Uq as _e,Wq as ve,Xq as ye,Yq as be,Zq as xe,_J as Se,_Y as Ce,_q as we,aY as Te,bq as Ee,cJ as De,cY as Oe,dJ as ke,dY as Ae,eJ as je,fJ as Me,fY as Ne,gJ as Pe,gY as Fe,gq as Ie,hJ as Le,hY as Re,hq as ze,iY as Be,jq as Ve,kJ as He,kq as Ue,lJ as We,lY as Ge,lq as Ke,mJ as qe,mY as Je,nJ as Ye,nY as Xe,oY as Ze,pJ as Qe,pY as $e,qq as et,rJ as v,rY as tt,sY as nt,t as y,tJ as rt,uJ as it,uY as at,vq as ot,wJ as st,wq as ct,xq as lt,yJ as ut,yq as dt}from"./api--rqKQo-l.js";import{t as ft}from"./list-DnhyuzZ4.js";import{t as b}from"./button-HksxbiUF.js";import{$t as pt,An as mt,Bt as ht,Ct as gt,Dt as _t,Et as vt,Gt as yt,Hn as bt,Ht as xt,In as St,Jn as Ct,Jt as x,Kt as wt,Ot as Tt,Rn as Et,Rt as Dt,St as S,Tt as Ot,Ut as kt,Vn as At,Vt as jt,Wt as Mt,Yt as Nt,bt as C,cn as w,cr as T,ft as Pt,on as E,qt as Ft,sn as D,sr as O,vt as k,wn as It,wt as Lt,xt as A,yt as j,zt as Rt}from"./index-l7elBM2O.js";import{a as zt,i as M,n as Bt,o as Vt,r as N,t as Ht}from"./table-CwhkOFwK.js";import{t as Ut}from"./FilterBar-BgVXfm-6.js";/* empty css */import{a as Wt,c as P,i as F,l as Gt,n as Kt,o as I,r as qt,s as Jt,t as Yt,u as L}from"./TimezoneCombobox-ObUCuHhu.js";var Xt=d(`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`}]]),Zt=d(`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`}]]),R=t(e(),1),z=n();function B(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 Qt({value:e,onChange:t}){let n=Gt(e),i=(0,R.useMemo)(()=>new Date,[]),[a,o]=(0,R.useState)(()=>({year:n?.year??i.getFullYear(),month:n?.month??i.getMonth()})),[s,c]=(0,R.useState)(!1),l=(0,R.useMemo)(()=>B(m()),[]),u=(0,R.useMemo)(()=>new Intl.DateTimeFormat(m(),{month:`long`,year:`numeric`}),[]),d=(0,R.useMemo)(()=>new Intl.DateTimeFormat(m(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=P(a.year,a.month),f=n?.hour??9,p=n?.minute??0,h=(e,n,r,i,a)=>t(L(e,n,r,i,a)),te=(e,t,n)=>{o({year:e,month:t}),h(e,t,n,f,p)},ne=e=>{let t=new Date(a.year,a.month+e,1);o({year:t.getFullYear(),month:t.getMonth()})},g=n===null?Ye():d.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,z.jsxs)(E,{modal:!0,open:s,onOpenChange:c,children:[(0,z.jsx)(w,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":v(),children:[(0,z.jsx)(Xt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,z.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:g})]})}),(0,z.jsxs)(D,{align:`start`,className:`oc-dtp__pop`,children:[(0,z.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":rt(),onClick:()=>ne(-1),children:(0,z.jsx)(T,{size:15,"aria-hidden":!0})}),(0,z.jsx)(`span`,{className:`oc-dtp__month`,children:u.format(new Date(a.year,a.month,1))}),(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":je(),onClick:()=>ne(1),children:(0,z.jsx)(O,{size:15,"aria-hidden":!0})})]}),(0,z.jsxs)(`div`,{className:`oc-dtp__grid`,children:[l.map((e,t)=>(0,z.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let r=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(r?` oc-dtp__day--sel`:``)+(a&&!r?` oc-dtp__day--today`:``),onClick:()=>te(e.year,e.month,e.day),children:e.day},t)})]}),(0,z.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,z.jsxs)(k,{value:String(f),onValueChange:e=>h(a.year,a.month,n?.day??i.getDate(),Number(e),p),children:[(0,z.jsx)(A,{size:`sm`,"aria-label":r(),children:(0,z.jsx)(S,{})}),(0,z.jsx)(j,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,z.jsx)(C,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,z.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,z.jsxs)(k,{value:String(p),onValueChange:e=>h(a.year,a.month,n?.day??i.getDate(),f,Number(e)),children:[(0,z.jsx)(A,{size:`sm`,"aria-label":_(),children:(0,z.jsx)(S,{})}),(0,z.jsx)(j,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,z.jsx)(C,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function V(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function $t(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function en(e){let t=new Map;for(let n of e){let e=V(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 H(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($t(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function tn(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 nn(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 rn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var U=3;function an({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=m(),c=(0,R.useMemo)(()=>en(e),[e]),l=(0,R.useMemo)(()=>tn(s),[s]),u=(0,R.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),d=(0,R.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),ee=(0,R.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()})},te=t===`year`?String(n.year):u.format(new Date(n.year,n.month,1));return(0,z.jsxs)(`div`,{className:`oc-cal`,children:[(0,z.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,z.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,z.jsx)(b,{variant:`ghost`,size:`icon-sm`,"aria-label":h(),onClick:()=>p(-1),children:(0,z.jsx)(T,{})}),(0,z.jsx)(b,{variant:`ghost`,size:`icon-sm`,"aria-label":ve(),onClick:()=>p(1),children:(0,z.jsx)(O,{})}),(0,z.jsx)(b,{variant:`ghost`,size:`sm`,onClick:()=>i({year:f.getFullYear(),month:f.getMonth()}),children:re()})]}),(0,z.jsx)(`span`,{className:`oc-cal__title`,children:te}),(0,z.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,z.jsx)(b,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:g()}),(0,z.jsx)(b,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:et()})]})]}),t===`month`?(0,z.jsx)(on,{cursor:n,byDay:c,weekdays:l,timeFmt:ee,now:f,onEventClick:a}):(0,z.jsx)(sn,{year:n.year,byDay:c,monthShortFmt:d,now:f,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,z.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function on({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=P(e.year,e.month);return(0,z.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,z.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get($t(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,z.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,z.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,U).map(e=>(0,z.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,z.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,z.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>U?(0,z.jsx)(`span`,{className:`oc-cal__more`,children:_e({count:o.length-U})}):null]},n)})]})}function sn({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,z.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=H(t,e,o),c=P(e,o);return(0,z.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,z.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,z.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,z.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var W={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])*W[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 q=new Map;function J(e){let t=q.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 q.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=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=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=I(e)!==`active`,c=Z(s?null:cn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Jt(e)){case`ok`:return(0,z.jsx)(x,{variant:`secondary`,children:Pe()});case`error`:return(0,z.jsx)(x,{variant:`destructive`,children:qe()});case`running`:return(0,z.jsx)(x,{variant:`outline`,children:Qe()});case`other`:return(0,z.jsx)(x,{variant:`outline`,children:e});case`none`:return(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=o(y.scheduled.listMyCrons),t=o(y.scheduled.getCronDetail),n=o(y.scheduled.listCronRuns),r=o(y.scheduled.updateCron),d=o(y.scheduled.removeCron),h=o(y.scheduled.runCronNow),g=Nt(),re=ge(y.me.getMe,{host:Pt})?.timezone,[_,_e]=(0,R.useState)(null),[ve,je]=(0,R.useState)(!1),[Ye,et]=(0,R.useState)(!1),[v,rt]=(0,R.useState)(null),[w,T]=(0,R.useState)(null),[E,D]=(0,R.useState)(null),[O,P]=(0,R.useState)(null),[Gt,Jt]=(0,R.useState)(!1),[L,B]=(0,R.useState)(Kt),[V,$t]=(0,R.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),en=e=>{localStorage.setItem(`oc.sched.view`,e),$t(e)},[H,tn]=(0,R.useState)(`month`),[U,on]=(0,R.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),sn=(0,R.useMemo)(()=>{let e=[];for(let t of _??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Wt(r,L)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[_,L]),W=(0,R.useMemo)(()=>H===`year`?rn(U.year):nn(U.year,U.month),[H,U]),cn=(0,R.useMemo)(()=>un(sn,W.startMs,W.endMs),[sn,W]),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,R.useCallback)(async()=>{je(!0),et(!1);try{_e(await e({}))}catch{et(!0)}finally{je(!1)}},[e]);(0,R.useEffect)(()=>{K()},[K]);let q=(0,R.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,R.useRef)(null);(0,R.useEffect)(()=>{_!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[_]);let Y=(0,R.useMemo)(()=>new Intl.DateTimeFormat(m(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{rt(e);try{await t(),g.success(n),await K()}catch(e){g.toast({variant:`error`,title:i({code:dn(e)})})}finally{rt(null)}},Z=(0,R.useRef)(0),Q=(0,R.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;D({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;D({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;D(null),g.toast({variant:`error`,title:i({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;P({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;P(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Q.current)return;P(null),g.toast({variant:`error`,title:i({code:dn(e)})})}},mn=async()=>{if(O===null)return;let e={};if(O.nameDirty&&O.name.trim()===``||O.messageDirty&&O.hasMessage&&O.message.trim()===``){g.toast({variant:`error`,title:ze()});return}if(O.nameDirty&&O.name.trim()!==``&&(e.name=O.name.trim()),O.scheduleDirty){if(O.scheduleKind===`cron`&&O.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:O.cronExpr.trim(),...O.tz.trim()===``?{}:{tz:O.tz.trim()}};else if(O.scheduleKind===`every`){let t=Number(O.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[O.everyUnit])})}else if(O.scheduleKind===`at`&&O.at!==``){let t=Date.parse(O.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(O.scheduleDirty&&e.schedule===void 0){g.toast({variant:`error`,title:Ie()});return}if(O.messageDirty&&O.hasMessage&&O.message.trim()!==``&&(e.message=O.message.trim()),Object.keys(e).length===0){P(null);return}let t=Q.current;Jt(!0);try{await r({instanceName:O.instanceName,jobId:O.jobId,patch:e}),g.success(Ue()),t===Q.current&&P(null),await K()}catch(e){g.toast({variant:`error`,title:i({code:dn(e)})})}finally{Jt(!1)}},hn=_?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,z.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:Ce()}),(0,z.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":xe(),children:[(0,z.jsx)(b,{variant:V===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ye(),title:ye(),"aria-pressed":V===`list`,onClick:()=>en(`list`),children:(0,z.jsx)(ft,{})}),(0,z.jsx)(b,{variant:V===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":be(),title:be(),"aria-pressed":V===`calendar`,onClick:()=>en(`calendar`),children:(0,z.jsx)(Xt,{})})]}),(0,z.jsxs)(b,{variant:`ghost`,size:`sm`,onClick:()=>void K(),disabled:ve,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,z.jsx)(St,{size:14,"aria-hidden":!0}),Fe()]})]}),_!==null&&hn>0?(0,z.jsxs)(Ut,{q:L.q,onQChange:e=>B(t=>({...t,q:e})),searchPlaceholder:ke(),onReset:()=>B(Kt),canReset:qt(L),children:[(0,z.jsxs)(k,{value:L.state,onValueChange:e=>B(t=>({...t,state:e})),children:[(0,z.jsx)(A,{size:`sm`,className:`w-40`,children:(0,z.jsx)(S,{})}),(0,z.jsxs)(j,{children:[(0,z.jsx)(C,{value:`all`,children:it()}),(0,z.jsx)(C,{value:`active`,children:tt()}),(0,z.jsx)(C,{value:`paused`,children:Be()}),(0,z.jsx)(C,{value:`auto-disabled`,children:Xe()})]})]}),(0,z.jsxs)(k,{value:L.result,onValueChange:e=>B(t=>({...t,result:e})),children:[(0,z.jsx)(A,{size:`sm`,className:`w-40`,children:(0,z.jsx)(S,{})}),(0,z.jsxs)(j,{children:[(0,z.jsx)(C,{value:`all`,children:We()}),(0,z.jsx)(C,{value:`ok`,children:Pe()}),(0,z.jsx)(C,{value:`error`,children:qe()}),(0,z.jsx)(C,{value:`running`,children:Qe()}),(0,z.jsx)(C,{value:`none`,children:Me()})]})]})]}):null,_===null?(0,z.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":ve,children:Ye?Re():ce()}):V===`calendar`?(0,z.jsxs)(z.Fragment,{children:[Ye?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Re()}):null,_.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}):(0,z.jsx)(an,{events:cn.events,mode:H,cursor:U,onModeChange:tn,onCursorChange:on,onEventClick:G,footnote:te()})]}):(0,z.jsxs)(z.Fragment,{children:[Ye?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Re()}):null,_.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}):null,_.map(e=>{let t=e.jobs.filter(e=>Wt(e,L)),n=qt(L)&&e.jobs.length>0&&t.length===0;return(0,z.jsxs)(`section`,{style:{marginBottom:20},children:[_.length>1||e.error||!e.supported?(0,z.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,z.jsx)(x,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Ne({code:e.error})}):e.jobs.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}):n?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:De()}):(0,z.jsxs)(Ht,{children:[(0,z.jsx)(zt,{children:(0,z.jsxs)(Vt,{children:[(0,z.jsx)(M,{children:at()}),(0,z.jsx)(M,{children:Ge()}),(0,z.jsx)(M,{children:Oe()}),(0,z.jsx)(M,{children:nt()}),(0,z.jsx)(M,{children:Ze()}),(0,z.jsx)(M,{children:Se()}),(0,z.jsx)(M,{children:oe()})]})}),(0,z.jsx)(Bt,{children:t.map((t,n)=>{let i=`${e.instanceName}:${t.id??n}`,o=v===i,s=e.manageSupported,c=e.kind===`openclaw`&&s;return(0,z.jsxs)(Vt,{ref:t.id!==null&&t.id===q?J:void 0,"data-state":t.id!==null&&t.id===q?`selected`:void 0,children:[(0,z.jsx)(N,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??Te()}),(0,z.jsx)(N,{children:(0,z.jsx)(x,{variant:`secondary`,children:t.agentId})}),(0,z.jsxs)(N,{className:`whitespace-nowrap`,children:[(0,z.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=Dt(t.schedule),n=e===null?null:Rt(e);return n===null?null:(0,z.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,z.jsx)(N,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,z.jsx)(N,{children:I(t)===`auto-disabled`?(0,z.jsx)(x,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:Xe()}):I(t)===`active`?(0,z.jsx)(x,{variant:`secondary`,children:tt()}):I(t)===`paused`?(0,z.jsx)(x,{variant:`outline`,children:Be()}):(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,z.jsxs)(N,{children:[(0,z.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,z.jsx)(x,{variant:`destructive`,title:t.lastDeliveryError??ie(),children:Le()}):null]}),(0,z.jsx)(N,{className:`whitespace-nowrap`,children:t.id===null?(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):o?(0,z.jsx)(Ct,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,z.jsxs)(`span`,{className:`oc-cronactions`,children:[c?(0,z.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:p(),"aria-label":p(),disabled:v!==null,onClick:()=>void X(i,async()=>{let n=await h({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},He()),children:(0,z.jsx)(It,{size:14,"aria-hidden":!0})}):null,c&&t.enabled!==null?(0,z.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:F(t)===`pause`?de():se(),"aria-label":F(t)===`pause`?de():se(),disabled:v!==null,onClick:()=>void X(i,()=>r({instanceName:e.instanceName,jobId:t.id,patch:{enabled:F(t)===`resume`}}),F(t)===`pause`?le():l()),children:F(t)===`pause`?(0,z.jsx)(bt,{size:14,"aria-hidden":!0}):(0,z.jsx)(Et,{size:14,"aria-hidden":!0})}):null,c?(0,z.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:Ve(),"aria-label":Ve(),disabled:v!==null,onClick:()=>void pn(e.instanceName,t),children:(0,z.jsx)(At,{size:14,"aria-hidden":!0})}):null,c?(0,z.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:a(),"aria-label":a(),disabled:v!==null,onClick:()=>void ln(e.instanceName,t),children:(0,z.jsx)(Zt,{size:14,"aria-hidden":!0})}):null,s?(0,z.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:ae(),"aria-label":ae(),disabled:v!==null,onClick:()=>T({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,z.jsx)(mt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:$e()})]},e.instanceName)}),hn>0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:Ke()}):null]}),(0,z.jsx)(ht,{open:w!==null,onOpenChange:e=>{e||T(null)},children:(0,z.jsxs)(kt,{children:[(0,z.jsxs)(wt,{children:[(0,z.jsx)(Ft,{children:me()}),(0,z.jsx)(Mt,{children:st({name:w?.name??``})})]}),(0,z.jsxs)(yt,{children:[(0,z.jsx)(xt,{children:s()}),(0,z.jsx)(jt,{onClick:()=>{let e=w;T(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>d({instanceName:e.instanceName,jobId:e.jobId}),ee())},children:fe()})]})]})}),(0,z.jsx)(gt,{open:E!==null,onOpenChange:e=>{e||(Z.current++,D(null))},children:(0,z.jsxs)(Lt,{style:{maxWidth:640},children:[(0,z.jsx)(_t,{children:(0,z.jsx)(Tt,{children:ue({name:E?.name??``})})}),E?.entries===null?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):E!==null&&E.entries.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):E===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:E.entries.map((e,t)=>(0,z.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,z.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,z.jsx)(fn,{status:e.status}),(0,z.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,z.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,z.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[ut({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,z.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,z.jsx)(gt,{open:O!==null,onOpenChange:e=>{e||(Q.current++,P(null))},children:(0,z.jsxs)(Lt,{className:`oc-cronedit`,children:[(0,z.jsxs)(_t,{children:[(0,z.jsx)(Tt,{children:f()}),(0,z.jsx)(Ot,{children:he()})]}),O===null?null:O.loading?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):(0,z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,z.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:at()}),(0,z.jsx)(pt,{value:O.name,maxLength:200,onChange:e=>P({...O,name:e.target.value,nameDirty:!0})})]}),(0,z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ct()}),(0,z.jsxs)(k,{value:O.scheduleKind,onValueChange:e=>P({...O,scheduleKind:e,scheduleDirty:!0}),children:[(0,z.jsx)(A,{children:(0,z.jsx)(S,{})}),(0,z.jsxs)(j,{children:[(0,z.jsx)(C,{value:`cron`,children:c()}),(0,z.jsx)(C,{value:`every`,children:pe()}),(0,z.jsx)(C,{value:`at`,children:lt()})]})]}),O.scheduleKind===`cron`?(0,z.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,z.jsx)(pt,{value:O.cronExpr,onChange:e=>P({...O,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,z.jsx)(Yt,{value:O.tz,onChange:e=>P({...O,tz:e,scheduleDirty:!0}),fallbackTz:re??void 0})]}):O.scheduleKind===`every`?(0,z.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,z.jsx)(pt,{type:`number`,min:1,value:O.everyValue,onChange:e=>P({...O,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,z.jsxs)(k,{value:O.everyUnit,onValueChange:e=>P({...O,everyUnit:e,scheduleDirty:!0}),children:[(0,z.jsx)(A,{style:{maxWidth:160},children:(0,z.jsx)(S,{})}),(0,z.jsxs)(j,{children:[(0,z.jsx)(C,{value:`minutes`,children:Ee()}),(0,z.jsx)(C,{value:`hours`,children:dt()}),(0,z.jsx)(C,{value:`days`,children:ot()})]})]})]}):(0,z.jsx)(Qt,{value:O.at,onChange:e=>P({...O,at:e,scheduleDirty:!0})})]}),O.hasMessage?(0,z.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ne()}),(0,z.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:O.message,onChange:e=>P({...O,message:e.target.value,messageDirty:!0})})]}):null]}),(0,z.jsxs)(vt,{children:[(0,z.jsx)(b,{variant:`ghost`,onClick:()=>P(null),children:s()}),(0,z.jsxs)(b,{onClick:()=>void mn(),disabled:O===null||O.loading||Gt,children:[Gt?(0,z.jsx)(Ct,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,we()]})]})]})})]})}export{pn as ScheduledTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$U as r,AU as i,AW as ee,BU as a,BW as te,BX as ne,CW as re,DW as ie,EW as ae,FU as o,FW as oe,GU as s,GW as c,HU as l,HW as se,HX as u,IU as d,IW as ce,JU as f,JW as le,KU as p,KW as ue,LU as m,LW as de,MU as h,MW as fe,NU as pe,NW as me,OW as he,PU as ge,PW as _e,QU as g,RU as _,RW as ve,SW as ye,TW as be,UU as xe,UW as Se,UX as v,VU as y,VW as Ce,WU as b,WW as x,XU as S,XW as we,YU as C,YW as Te,ZU as w,_W as Ee,aW as De,bW as Oe,cW as ke,dW as Ae,eW as je,fW as Me,gW as Ne,hW as Pe,iW as Fe,jU as T,jW as Ie,kW as Le,lW as Re,mW as ze,nW as Be,oW as Ve,pW as He,qU as E,qW as Ue,rW as We,sW as Ge,t as D,tW as Ke,uW as qe,vW as Je,wW as Ye,xW as Xe,yW as Ze,zU as O,zW as Qe}from"./api--rqKQo-l.js";import{r as $e}from"./dist-lcVkVTM0.js";import{t as k}from"./button-HksxbiUF.js";import{$t as A,At as j,Ct as M,Dt as N,Et as P,Jt as F,Ot as I,St as L,Tt as R,Yt as et,b as tt,bt as z,ct as nt,dr as rt,fr as it,kt as B,lr as V,rr as at,sr as ot,vt as H,wt as U,xt as W,yt as G}from"./index-l7elBM2O.js";import{t as st}from"./FilterBar-BgVXfm-6.js";import{t as ct}from"./DataTableShell-BYSvf6VZ.js";import{t as lt}from"./roleDescriptions-Csn1bSUI.js";var K=t(e(),1),q=n(),J=[{value:`never`,label:()=>d(),days:null},{value:`30`,label:()=>o(),days:30},{value:`90`,label:()=>ge(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=it({from:`/settings/serviceAccounts`}),t=rt({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??X,[i,a]=(0,K.useState)(X),o=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),s=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),l=v(D.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:i===X?void 0:i,disabled:r===X?void 0:r===`disabled`}}),d=v(D.apiKeys.listKeys,{}),f=v(D.apiKeys.listRoles,{}),p=u(D.apiKeys.createServiceAccount),m=u(D.apiKeys.updateServiceAccount),h=u(D.apiKeys.deleteServiceAccount),pe=ne(D.apiKeys.mintApiKey),ge=u(D.apiKeys.revokeApiKey),g=nt(),_=et(),xe=n!==``||i!==X||r!==X;function y(){a(X),t({search:{},replace:!0})}let[b,S]=(0,K.useState)(!1),[C,w]=(0,K.useState)(Z),[T,E]=(0,K.useState)(null),[O,j]=(0,K.useState)(new Set),[M,N]=(0,K.useState)(null),P=(0,K.useRef)(!1),[I,R]=(0,K.useState)(new Set),[B,V]=(0,K.useState)({}),[at,U]=(0,K.useState)(null),Y=(0,K.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function Q(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{T?(await m({serviceAccountId:T,name:C.name,roleKey:C.roleKey,description:C.description}),_.success(ze())):await p({name:C.name,roleKey:C.roleKey,description:C.description||void 0}),w(Z),E(null),S(!1)}catch(e){_.error(T?Pe():Ne(),e)}}function pt(e){w({name:e.name,roleKey:e.roleKey,description:e.description??``}),E(e._id),S(!0)}async function mt(e){if(P.current)return;P.current=!0;let t=B[e._id]??`never`,n=J.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;N(e._id);try{let t=await pe({serviceAccountId:e._id,expiresAt:r});U({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){_.error(He(),e)}finally{P.current=!1,N(null)}}async function $(e){if(await g({title:Me(),description:(0,q.jsxs)(q.Fragment,{children:[Ae(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,qe(),` `,(0,q.jsx)(`strong`,{children:Re()}),` `,ke()]}),confirmWord:e.name,confirmLabel:Ge(),destructive:!0}))try{await h({serviceAccountId:e._id}),_.success(Ve(),e.name)}catch(e){_.error(De(),e)}}async function ht(e){if(await g({title:Fe(),description:(0,q.jsxs)(q.Fragment,{children:[We(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Be()]}),confirmLabel:Ke(),destructive:!0})&&!I.has(e._id)){R(t=>new Set(t).add(e._id));try{await ge({keyId:e._id})}catch(e){_.error(je(),e)}finally{R(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:we()}),(0,q.jsxs)(st,{q:n,onQChange:o,searchPlaceholder:Te(),onReset:y,canReset:xe,children:[(0,q.jsxs)(H,{value:i,onValueChange:a,children:[(0,q.jsx)(W,{size:`sm`,className:`w-40`,children:(0,q.jsx)(L,{placeholder:le()})}),(0,q.jsxs)(G,{children:[(0,q.jsx)(z,{value:X,children:Ue()}),(f??[]).map(e=>(0,q.jsx)(z,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(H,{value:r,onValueChange:s,children:[(0,q.jsx)(W,{size:`sm`,className:`w-36`,children:(0,q.jsx)(L,{})}),(0,q.jsxs)(G,{children:[(0,q.jsx)(z,{value:X,children:ue()}),(0,q.jsx)(z,{value:`active`,children:c()}),(0,q.jsx)(z,{value:`disabled`,children:x()})]})]})]}),(0,q.jsx)(ct,{title:Se(),rows:l,addLabel:se(),onAdd:()=>{w(Z),E(null),S(!0)},emptyHint:Ce(),isExpanded:e=>O.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:I}),rowActions:e=>[...(e.managedBy??null)===null?[{label:de(),onSelect:()=>pt(e)},{label:te(),onSelect:()=>void mt(e)}]:[],{label:O.has(e._id)?Qe():ve(),onSelect:()=>Q(e._id)},...(e.managedBy??null)===null?[{label:ce(),variant:`destructive`,onSelect:()=>void $(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(k,{variant:`ghost`,size:`icon-sm`,"aria-label":O.has(e._id)?oe():_e(),onClick:()=>Q(e._id),children:O.has(e._id)?(0,q.jsx)($e,{}):(0,q.jsx)(ot,{})})},{header:me(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:fe(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(F,{variant:`secondary`,children:e.roleKey})},{header:Ie(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(F,{variant:`destructive`,children:x()}):(0,q.jsx)(F,{variant:`outline`,children:c()})},{header:ee(),cell:e=>(0,q.jsxs)(H,{value:B[e._id]??`never`,onValueChange:t=>V(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(W,{size:`sm`,className:`w-32`,children:(0,q.jsx)(L,{})}),(0,q.jsx)(G,{children:J.map(e=>(0,q.jsx)(z,{value:e.value,children:e.label()},e.value))})]})},{header:Le(),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,q.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?he():ie({count:t})})}}]}),(0,q.jsx)(tt,{open:b,onOpenChange:e=>{S(e),e||E(null)},title:T?ae():re(),description:T?be():ye(),canSubmit:!!(C.name&&C.roleKey),onSubmit:ft,submitLabel:T?Ye():Xe(),children:(0,q.jsxs)(`div`,{className:`oc-form`,children:[(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Oe()}),(0,q.jsx)(A,{value:C.name,onChange:e=>w({...C,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ze()}),(0,q.jsxs)(H,{value:C.roleKey||void 0,onValueChange:e=>w({...C,roleKey:e}),children:[(0,q.jsx)(W,{className:`w-full`,children:(0,q.jsx)(L,{placeholder:Je()})}),(0,q.jsx)(G,{children:(f??[]).map(e=>(0,q.jsxs)(z,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===C.roleKey),t=e?lt(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ee()}),(0,q.jsx)(A,{value:C.description,onChange:e=>w({...C,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:at,onClose:()=>U(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:i}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[r(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:w()}),(0,q.jsx)(`th`,{children:S()}),(0,q.jsx)(`th`,{children:C()}),(0,q.jsx)(`th`,{children:f()}),(0,q.jsx)(`th`,{children:E()}),(0,q.jsx)(`th`,{children:p()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(F,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:j(t.createdAt)}),(0,q.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:mt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,q.jsx)(k,{variant:`destructive`,size:`sm`,disabled:i.has(t._id),onClick:()=>n(t),children:i.has(t._id)?s():b()}):null})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(M,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(U,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(N,{children:[(0,q.jsx)(I,{children:xe()}),(0,q.jsx)(R,{children:l({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:y()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":a(),children:[n?(0,q.jsx)(V,{}):(0,q.jsx)(at,{}),n?O():_()]})]}),(0,q.jsx)(P,{children:(0,q.jsx)(k,{onClick:()=>{r(!1),t()},children:m()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?pe():j(e)}function mt(e){return e===null?`—`:B(e)}function $(e){return e.disabled?(0,q.jsx)(F,{variant:`destructive`,children:h()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(F,{variant:`outline`,children:T()}):(0,q.jsx)(F,{variant:`outline`,children:i()})}export{Q as ServiceAccountsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,Am as i,Bm as a,Cm as o,Dm as s,Em as c,Fm as l,Gm as u,HX as d,Hm as f,Im as p,Jm as m,Km as h,Lm as g,Mm as _,Nm as v,Om as y,Pm as b,Qm as x,Rm as S,Sm as C,Tm as w,UX as T,Um as E,Vm as D,Wm as O,Xm as k,Ym as A,Zm as j,ah as M,eh as N,ih as P,jm as F,km as I,nh as ee,qm as L,rh as R,t as z,th as B,wm as V,xm as H,zm as U}from"./api--rqKQo-l.js";import{t as W}from"./button-HksxbiUF.js";import{At as G,ct as K}from"./index-l7elBM2O.js";import{t as q}from"./DataTableShell-BYSvf6VZ.js";var J=t(e(),1),Y=n(),X={hung:()=>f(),wrong_result:()=>D(),error:()=>a(),other:()=>U()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=d(z.subAgentReports.respondToReport),[r,a]=(0,J.useState)(e.thread),[o,u]=(0,J.useState)(``),[f,m]=(0,J.useState)(!1);async function h(){let t=o.trim();if(!(!t||f)){m(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{m(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,S({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:p()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?l():b()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:v()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:_(),value:o,maxLength:2e3,rows:3,onChange:e=>u(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void h(),disabled:!o.trim()||f,children:f?i():F()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[I({count:t.children.length}),t.childrenTruncated?` ${y()}`:``,t.textTruncated?` ${s()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${c()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=T(z.subAgentReports.listForAdmin,{}),t=d(z.subAgentReports.readReport),n=d(z.subAgentReports.deleteReport),i=K(),[a,s]=(0,J.useState)(null),[c,l]=(0,J.useState)({});async function f(e){if(a===e._id){s(null);return}if(!c[e._id]){let n=await t({reportId:e._id});l(t=>({...t,[e._id]:n}))}s(e._id)}async function p(e){await i({title:o(),description:C(),confirmLabel:H(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&s(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[R(),` `,(0,Y.jsx)(`strong`,{children:ee()}),` `,B()]}),(0,Y.jsx)(q,{title:M(),rows:e,emptyHint:P(),isExpanded:e=>a===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Y.jsx)($,{data:c[e._id]}):null,columns:[{header:N(),cell:e=>G(e.at),sort:e=>e.at},{header:r(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:x(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:j(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${m({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:k(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:A(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:L()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:h()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?O():u(),onSelect:()=>void f(e)},{label:E(),onSelect:()=>void p(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$G as r,$K as i,AK as a,AX as o,BG as s,BK as c,BX as l,CK as u,DK as d,EK as f,FK as p,GG as m,GK as h,HG as g,HK as _,HX as v,IK as ee,JG as te,JK as ne,KG as re,KK as ie,LG as ae,LK as oe,MK as se,NK as ce,OK as le,PK as ue,QG as de,QK as fe,RG as pe,RK as me,SK as y,TK as he,UG as ge,UK as _e,UX as b,VG as x,VK as ve,WG as ye,WK as be,XG as xe,XK as Se,YG as Ce,YK as S,ZG as we,ZK as Te,_K as Ee,_m as De,aK as Oe,aq as ke,bK as Ae,bm as C,cK as je,dK as Me,eK as Ne,eq as Pe,fK as Fe,gK as Ie,hK as Le,iK as Re,iq as ze,jK as Be,jX as Ve,kK as He,kX as Ue,lK as We,mK as Ge,nK as Ke,nq as qe,oK as Je,pK as Ye,qG as Xe,qK as Ze,r as Qe,rK as w,rq as $e,sK as et,t as T,tK as tt,tq as nt,uK as rt,vK as it,vm as at,wK as ot,xK as st,yK as ct,ym as E,zG as lt,zK as ut}from"./api--rqKQo-l.js";import{t as D}from"./x-C5eyKPkE.js";import{t as O}from"./button-HksxbiUF.js";import{$t as k,Jt as A,Mt as j,On as M,St as N,an as dt,bt as P,dt as ft,en as pt,ft as F,in as I,lr as L,nn as R,nr as mt,rn as ht,tn as gt,tr as z,ut as _t,vt as B,xt as V,yt as H}from"./index-l7elBM2O.js";import{t as vt}from"./localePickerView-C2RmOS86.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-BS-Ukkxw.js";import{a as Tt,i as U,n as Et,o as W,r as G,t as Dt}from"./table-CwhkOFwK.js";import{t as Ot}from"./TimeRangePicker-CSLm7VwE.js";import{t as kt}from"./FilterBar-BgVXfm-6.js";import{t as At}from"./AdvancedFilter-BmALfXnB.js";var K=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Ft(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function q(e,t,n){return Ft(e,t,n)>=jt}function It(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Lt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(Je());if(e.size>Rt)throw Error(Oe());let{source:n,width:r,height:i,cleanup:a}=await Ut(e);try{let a=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(w());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Pt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(w());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);q(e.data,d.width,d.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Vt)??await Y(f,`image/png`);if(!h)throw Error(Ke());return{blob:h,hasAlpha:m}}finally{a()}}async function Ut(e){if(e.type===`image/svg+xml`)return J(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return J(e)}async function J(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(Re())),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`?Ve():e===`dark`?o():Ue()}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:Qe(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(L,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":C(),title:C(),children:(0,X.jsx)(mt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=b(T.charts.listMyCharts),r=v(T.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:Te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:S(),subtitle:ne(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?Ze():n.via===`owner`?ie():h({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:be()}):null]})}function Qt(){let e=v(T.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[p,m]=(0,K.useState)(!1);async function h(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(y())}}}async function g(){if(s(null),l(!1),t.trim()===``){s(Ae());return}let a;try{a=JSON.parse(r)}catch{s(y());return}m(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{m(!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:a()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:He()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:le()}),(0,X.jsx)(k,{value:t,onChange:e=>n(e.target.value),placeholder:d(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:f()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:he(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(M,{className:`size-4`}),ot(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void h(e)})]})}),(0,X.jsx)(O,{size:`sm`,disabled:p,onClick:()=>void g(),children:u()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:st()}):null]})]})}function $t({chart:e}){let t=l(T.charts.setChartLogo),n=v(T.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ht(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function d(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 f(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 p({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`?Ye():Fe()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(M,{className:`size-4`}),t?rt():Me(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:je()}):null,t?(0,X.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:We()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ge()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:et()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=b(T.me.getMe,{host:F}),n=v(T.charts.addChartDomain),i=v(T.charts.removeChartDomain),[a,o]=(0,K.useState)(``),[s,c]=(0,K.useState)(null),[l,u]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=a.trim();if(t!==``){c(null),u(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(t){c(null);try{await i({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:tt()}),(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:we()}):d.map(e=>(0,X.jsxs)(A,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":xe({domain:e}),onClick:()=>void p(e),children:(0,X.jsx)(D,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{value:a,onChange:e=>o(e.target.value),placeholder:r(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,X.jsx)(O,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:de()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ne()}),s?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=v(T.charts.updateChart),n=v(T.charts.deleteChart),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(e.name),[s,c]=(0,K.useState)(()=>$(e.tokens)),[l,u]=(0,K.useState)(e.tokens.bpm??0),[d,f]=(0,K.useState)(null),[p,h]=(0,K.useState)(!1);function g(){o(e.name),c($(e.tokens)),u(e.tokens.bpm??0),f(null),i(!0)}async function _(){if(e.chartId===void 0)return;f(null);let n;try{n=JSON.parse(s)}catch{f(y());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}h(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){f(e instanceof Error?e.message:String(e))}finally{h(!1)}}async function ee(){if(e.chartId!==void 0&&window.confirm(m()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{variant:`outline`,size:`sm`,onClick:g,children:Ie()}),(0,X.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void ee(),children:Le()})]})})]}),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:Xe()}),(0,X.jsx)(k,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:E()}),(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:l,onChange:e=>u(Number(e.target.value)),"aria-label":E()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?at():`${l} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:De()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:re()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),d?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:d}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{size:`sm`,disabled:p,onClick:()=>void _(),children:Ce()}),(0,X.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:te()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=b(T.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:ct()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:it()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ee()}):(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=v(T.charts.addChartToGroupPool),r=v(T.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)(A,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?ee():e.kind===`custom`&&e.scope===`personal`?x():oe()}),e.isGlobalDefault?(0,X.jsx)(A,{variant:`default`,children:p()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ce()}),(a??[]).map(e=>(0,X.jsxs)(A,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Be({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(D,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(B,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(V,{size:`sm`,className:`w-56`,children:(0,X.jsx)(N,{placeholder:se()})}),(0,X.jsx)(H,{children:s.map(e=>(0,X.jsx)(P,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ue()}):null]})]})}function an({chart:e}){let t=v(T.charts.promoteChartToCommon),n=v(T.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(m()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(A,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?s():x()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:g({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(O,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:lt()}):null,(0,X.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:pe()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=v(T.admin.setDefaultThemeMode),a=v(T.admin.setDefaultLocale),o=v(T.charts.setDefaultChart),s=b(T.charts.listChartsAdmin),l=b(T.groups.listGroups,{}),u=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:i()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(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:_e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:S()}),ft.map(e=>(0,X.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({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:ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(rn,{chart:e,groups:l??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ut()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).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:ye()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ge()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ae()}):(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:ke()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ze()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(O,{variant:u===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:$e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:qe()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:vt().map(e=>(0,X.jsx)(O,{variant:d===e.value?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:nt()})]})]})}function sn(){let e=b(T.me.getMe,{host:F}),t=_t(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(nn,{}),e?.role===`admin`?(0,X.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.useState)(Gt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Gt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(sn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:Pe()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{children:`Default`}),(0,X.jsx)(O,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(O,{variant:`outline`,children:`Outline`}),(0,X.jsx)(O,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(O,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(O,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{size:`sm`,children:`Small`}),(0,X.jsx)(O,{children:`Default`}),(0,X.jsx)(O,{size:`lg`,children:`Large`}),(0,X.jsx)(O,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(z,{})}),(0,X.jsx)(O,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(A,{variant:`outline`,children:`Outline`}),(0,X.jsx)(A,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(k,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(B,{value:n,onValueChange:r,children:[(0,X.jsx)(V,{className:`w-56`,children:(0,X.jsx)(N,{placeholder:`Select…`})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(P,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(j,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(kt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(B,{value:o,onValueChange:s,children:[(0,X.jsx)(V,{size:`sm`,children:(0,X.jsx)(N,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes directions`}),(0,X.jsx)(P,{value:`inbound`,children:`inbound`}),(0,X.jsx)(P,{value:`outbound`,children:`outbound`}),(0,X.jsx)(P,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(B,{value:c,onValueChange:l,children:[(0,X.jsx)(V,{size:`sm`,children:(0,X.jsx)(N,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(P,{value:`info`,children:`info`}),(0,X.jsx)(P,{value:`warn`,children:`warn`}),(0,X.jsx)(P,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(At,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Ot,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(pt,{children:[(0,X.jsx)(dt,{asChild:!0,children:(0,X.jsx)(O,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(z,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(ht,{children:`Actions`}),(0,X.jsx)(I,{}),(0,X.jsx)(R,{children:`Edit`}),(0,X.jsx)(R,{children:`Duplicate`}),(0,X.jsx)(I,{}),(0,X.jsx)(R,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(wt,{className:`w-80`,children:[(0,X.jsxs)(yt,{children:[(0,X.jsx)(St,{children:`Instance`}),(0,X.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(bt,{className:`gap-2`,children:[(0,X.jsx)(O,{size:`sm`,children:`Save`}),(0,X.jsx)(O,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Dt,{children:[(0,X.jsx)(Tt,{children:(0,X.jsxs)(W,{children:[(0,X.jsx)(U,{className:`w-8`,children:(0,X.jsx)(j,{"aria-label":`select all`})}),(0,X.jsx)(U,{children:`Name`}),(0,X.jsx)(U,{children:`Mode`}),(0,X.jsx)(U,{className:`text-right`,children:`Status`}),(0,X.jsx)(U,{className:`w-8`})]})}),(0,X.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(W,{children:[(0,X.jsx)(G,{children:(0,X.jsx)(j,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(G,{className:`font-medium`,children:e.n}),(0,X.jsx)(G,{children:(0,X.jsx)(A,{variant:`secondary`,children:e.m})}),(0,X.jsx)(G,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(L,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(G,{children:(0,X.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(z,{})})})]},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{$d as r,AO as i,BO as a,FO as o,HO as s,IO as c,LO as l,MO as u,NO as d,PO as f,Qd as p,RO as m,VO as h,Xd as g,Zd as _,ef as v,jO as y,nf as b,tf as x,zO as S}from"./api--rqKQo-l.js";import{t as C}from"./button-HksxbiUF.js";import{$t as w,At as T,Fn as E,dn as D,fn as O,ir as k,ln as A,un as j}from"./index-l7elBM2O.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:s(),from:`now-5m`},{label:h(),from:`now-15m`},{label:a(),from:`now-30m`},{label:S(),from:`now-1h`},{label:m(),from:`now-3h`},{label:l(),from:`now-6h`},{label:c(),from:`now-12h`},{label:o(),from:`now-24h`},{label:f(),from:`now-2d`},{label:d(),from:`now-7d`},{label:u(),from:`now-30d`},{label:y(),from:`now-90d`},{label:i(),from:`now-520w`}];function L(e){return T(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,i]=(0,M.useState)(!1),[a,o]=(0,M.useState)(``),s=F(e),[c,l]=(0,M.useState)(()=>z(s.from)),[u,d]=(0,M.useState)(()=>z(s.to));function f(t){if(t){let t=F(e);l(z(t.from)),d(z(t.to)),o(``)}i(t)}function m(e){t({kind:`relative`,from:e,to:`now`}),i(!1)}function h(){let e=B(c),n=B(u);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),i(!1))}let y=(0,M.useMemo)(()=>{let e=a.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[a]),S=B(c)!==null&&B(u)!==null;return(0,H.jsxs)(D,{open:n,onOpenChange:f,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(k,{}),R(e)]})}),(0,H.jsx)(j,{children:(0,H.jsx)(A,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:b()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,H.jsx)(w,{type:`datetime-local`,value:c,onChange:e=>l(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:v()}),(0,H.jsx)(w,{type:`datetime-local`,value:u,onChange:e=>d(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!S,onClick:h,children:r()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(E,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(w,{value:a,onChange:e=>o(e.target.value),placeholder:p(),"aria-label":_()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:y.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:g()}):y.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>m(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{aJ as r,iJ as i,oJ as a,sJ as o}from"./api--rqKQo-l.js";import{t as s}from"./chevrons-up-down-4c0Fo5uU.js";import{$t as c,cn as l,lr as u,on as d,sn as f}from"./index-l7elBM2O.js";/* empty css */var p=t(e(),1);function m(e){if(e==null||e===``)return`none`;let t=e.trim().toLowerCase();return t===`ok`||t===`success`||t===`completed`?`ok`:t===`error`||t===`failed`||t===`failure`?`error`:t===`running`||t===`in_progress`||t===`pending`?`running`:`other`}function h(e){return e===!0?`active`:e===!1?`paused`:`unknown`}function g(e){return typeof e.autoDisabledReason==`string`&&e.autoDisabledReason!==``?`auto-disabled`:h(e.enabled)}function _(e){return g(e)===`active`?`pause`:`resume`}var v={q:``,state:`all`,result:`all`};function y(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function b(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&g(e)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function x(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function S(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function C(e,t,n=50,r){let i=e=>e.toLowerCase().replace(/[_/]+/g,` `),a=i(t.trim()),o=(a===``?e:e.filter(e=>i(e).includes(a))).slice(0,n);return r&&r!==``&&!o.includes(r)?[r,...o].slice(0,n):o}function w(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++){let n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+e);i.push({year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),inMonth:n.getMonth()===t})}return i}function T(e,t,n,r,i){let a=(e,t=2)=>String(e).padStart(t,`0`);return`${a(e,4)}-${a(t+1)}-${a(n)}T${a(r)}:${a(i)}`}function E(e){let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(t===null)return null;let[,n,r,i,a,o]=t;return{year:Number(n),month:Number(r)-1,day:Number(i),hour:Number(a),minute:Number(o)}}var D=n();function O({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>x(),[]),[g,_]=(0,p.useState)(!1),[v,y]=(0,p.useState)(``);if(h.length===0)return(0,D.jsx)(c,{value:e,onChange:e=>t(e.target.value),placeholder:m||S()||`America/Toronto`,className:n});let b=C(h,v,h.length,e||void 0),w=e===``?m||S()||i():e;return(0,D.jsxs)(d,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(l,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":o(),children:[(0,D.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,D.jsx)(s,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,D.jsxs)(f,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,D.jsx)(c,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:a(),className:`oc-tzcombo__search`}),(0,D.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:b.length===0?(0,D.jsx)(`p`,{className:`oc-tzcombo__empty`,children:r()}):b.map(n=>(0,D.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),y(``)},children:[(0,D.jsx)(u,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,D.jsx)(`span`,{children:n})]},n))})]})]})}export{b as a,w as c,_ as i,E as l,v as n,g as o,y as r,m as s,O as t,T as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$R as r,Aj as i,Az as a,Bj as o,Bz as s,Cj as c,Cz as l,Dj as u,Dz as d,E as f,Ej as p,Ez as m,Fj as ee,Fz as h,Gj as g,Gu as _,HX as v,Hj as y,Hz as b,Ij as te,Iz as x,Jj as ne,Kj as re,Ku as S,Lj as ie,Lz as ae,Mj as oe,Mz as C,Nj as se,Nz as w,Oj as ce,Oz as T,Pj as le,Pz as ue,Qj as de,Rj as fe,Rz as pe,Sj as me,Sz as he,Tj as ge,Tz as _e,UX as E,Uj as ve,Vj as ye,Vz as be,Wj as xe,Xj as Se,Yj as Ce,Zj as we,_j as Te,az as D,bj as Ee,bz as O,cz as k,dz as A,ez as j,fz as De,gj as M,hj as Oe,iz as ke,jj as Ae,jz as je,kj as Me,kz as N,lz as Ne,nz as Pe,oz as Fe,pz as Ie,qj as Le,qu as Re,rz as ze,sz as Be,t as P,tz as Ve,uz as He,vj as Ue,vz as We,wj as Ge,wz as Ke,xj as qe,xz as Je,yj as Ye,yz as F,zj as I,zz as Xe}from"./api--rqKQo-l.js";import{t as Ze}from"./x-C5eyKPkE.js";import{t as L}from"./button-HksxbiUF.js";import{$n as Qe,At as R,Ct as $e,Dt as et,Jt as z,Ot as tt,St as B,Tt as nt,U as rt,Yn as it,a as at,at as V,bt as H,dr as ot,er as st,fr as ct,ft as lt,i as ut,it as dt,jt as ft,lr as pt,o as mt,ot as ht,rr as gt,s as _t,st as U,vt as W,wt as vt,xt as G,yt as K}from"./index-l7elBM2O.js";import{n as yt}from"./TimeRangePicker-CSLm7VwE.js";import{t as bt}from"./FilterBar-BgVXfm-6.js";import{t as xt}from"./AdvancedFilter-BmALfXnB.js";import{t as St}from"./DataTableShell-BYSvf6VZ.js";var Ct=f(`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`?l():n===`agent`?`${he()} - ${r}`:e}function Tt(){let e=E(P.me.getMe,{host:lt})?.role===`admin`,t=E(P.deliveryTiming.getDeliveryStatus,{}),n=v(P.deliveryTiming.startDeliveryRecord),r=v(P.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,c]=(0,q.useState)(!1),l=t?.recording??!1,u=async()=>{c(!0);try{l?await r({}):await n({})}finally{c(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:b()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:be()})]}),e?(0,J.jsx)(L,{variant:l?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void u(),children:l?Xe():s()}):null]}),l?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(z,{variant:`secondary`,children:pe()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:ae({time:ft(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?ue():h()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=E(P.deliveryTiming.listDeliverySessions,{}),n=v(P.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[o,s]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,f]=(0,q.useState)(null),{from:p,to:ee}=yt(c),h=c.to===`now`?1/0:ee,g=r.trim()!==``||o!==`all`||c!==Y,_=()=>{i(``),s(`all`),l(Y)},y=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=p&&t.startedAt<=h).map(e=>({...e,_id:e.sessionId}))},[t,r,o,p,h]),b=e=>{let t=new Set((y??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&f(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:i,searchPlaceholder:C(),timeRange:c,onTimeRangeChange:l,onReset:_,canReset:g,children:(0,J.jsxs)(W,{value:o,onValueChange:e=>s(e),children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(B,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:`all`,children:je()}),(0,J.jsx)(H,{value:`active`,children:a()}),(0,J.jsx)(H,{value:`stopped`,children:N()})]})]})}),(0,J.jsx)(St,{title:w(),rows:y,emptyHint:j(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(L,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?O():Je(),onClick:()=>f(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(st,{size:15,"aria-hidden":!0}):(0,J.jsx)(Qe,{size:15,"aria-hidden":!0})})},{header:T(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:R(e.startedAt)})},{header:d(),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:R(e.stoppedAt)})},{header:m(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:_e(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:Ke(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(z,{variant:`secondary`,children:a()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:N()})}],rowActions:e?e=>[{label:F(),variant:`destructive`,onSelect:()=>b([e.sessionId])}]:void 0,bulkActions:e?[{label:F(),variant:`destructive`,onSelect:e=>b(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=E(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(rt(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:We()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:x()});let i=e.segments,a=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,r()]}),(0,J.jsxs)(L,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(pt,{size:13,"aria-hidden":!0}):(0,J.jsx)(gt,{size:13,"aria-hidden":!0}),t?Ve():Pe()]})]}),(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:A()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:He()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Ne()})]})}),(0,J.jsxs)(`tbody`,{children:[a(k(),i.bridge),a(Be(),i.A),a(Fe(),i.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:D()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ke()})]})}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:Re()},{value:`principalType`,label:S()},{value:`direction`,label:`direction`},{value:`roleKey`,label:_()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=ct({from:`/settings/traces`}),t=ot({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,s=e.principalType??Q,l=e.direction??Q,d=e.roleKey??Q,f=e.q??``,m=e.correlationId,h=ut(e.from,e.to),_=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:v,to:b}=yt(h),[x,S]=(0,q.useState)(null),[ae,C]=(0,q.useState)(null),w=e=>void t({search:t=>({...t,limit:e})}),T=e=>void t({search:t=>({...t,kind:e})}),ue=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),pe=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),he=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),_e=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),be=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),Te=e=>void t({search:t=>({...t,...mt(e)})}),D=e=>void t({search:t=>({...t,adv:at(e)}),replace:!0}),O=E(P.observability.listEvents,{limit:n}),k=E(P.observability.listEvents,{limit:n,kind:r===Z?void 0:r,...m?{correlationId:m}:{},filter:{q:f||void 0,from:v,to:b,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:l===Q?void 0:l,roleKey:d===Q?void 0:d,advanced:_.length>0?_:void 0}}),A=(0,q.useMemo)(()=>{let e=new Set;for(let t of O??[])e.add(t.kind);return[...e].sort()},[O]),j=(0,q.useMemo)(()=>{let e=new Set;for(let t of O??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[O]),M=f!==``||a!==Q||s!==Q||l!==Q||d!==Q||_.length>0||h.kind!==`relative`||h.from!==Nt.from;function Oe(){t({search:{limit:100,kind:`all`},replace:!0})}let ke=x?O?.filter(e=>e.correlationId===x):k,je=e.section,N=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(dt,{value:je,onValueChange:e=>N(e),children:[(0,J.jsxs)(ht,{className:`w-full`,children:[(0,J.jsxs)(U,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(it,{size:13,"aria-hidden":!0}),Ie()]}),(0,J.jsxs)(U,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),De()]})]}),(0,J.jsx)(V,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(V,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[de(),(0,J.jsx)(`strong`,{children:we()}),Se(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:Ce()})]}),(0,J.jsxs)(bt,{q:f,onQChange:ue,searchPlaceholder:ne(),timeRange:h,onTimeRangeChange:Te,onReset:Oe,canReset:M,children:[(0,J.jsxs)(W,{value:a,onValueChange:pe,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{placeholder:Le()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:re()}),At.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(W,{value:s,onValueChange:he,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{placeholder:g()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:xe()}),jt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(W,{value:l,onValueChange:_e,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{placeholder:ve()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:y()}),Mt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(W,{value:d,onValueChange:be,children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(B,{placeholder:ye()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:o()}),j.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:r===Z?``:r,placeholder:I(),"aria-label":I(),onChange:e=>{let t=e.target.value.trim();T(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:A.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(W,{value:String(n),onValueChange:e=>w(Number(e)),children:[(0,J.jsx)(G,{size:`sm`,className:`w-28`,children:(0,J.jsx)(B,{})}),(0,J.jsx)(K,{children:kt.map(e=>(0,J.jsx)(H,{value:String(e),children:fe({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:_,onChange:D}),x?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>S(null),title:ie(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[te(),(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:ee()})]})}):null,(0,J.jsx)(St,{title:le(),rows:ke,emptyHint:x?se():oe(),columns:[{header:Ae(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:R(e.at)})},{header:i(),sort:e=>e.kind,cell:e=>(0,J.jsx)(z,{variant:`secondary`,children:e.kind})},{header:Me(),sort:e=>Lt(e)??null,cell:e=>{let t=Lt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":ce(),children:`✓`})}},{header:u(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(z,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:p(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(z,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:ge(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(z,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Ge(),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:c(),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:me(),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:qe(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:Ee(),onClick:()=>S(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Ye(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>C(e),children:Ue()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:ae,onClose:()=>C(null)})]})]})}function It(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Lt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Rt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)($e,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(vt,{className:`max-w-lg`,children:[(0,J.jsxs)(et,{children:[(0,J.jsxs)(tt,{className:`oc-traces__meta-title`,children:[Te(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(z,{variant:`outline`,children:M()})]}),(0,J.jsx)(nt,{children:Oe()})]}),(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{AE as r,CE as i,E as a,EE as o,FX as s,HX as c,SE as l,TE as u,UX as d,_E as f,bE as p,dE as m,fE as h,gE as g,hE as _,kE as v,mE as y,mj as b,pE as x,t as S,uE as C,vE as w,wE as T,xE as E,yE as D}from"./api--rqKQo-l.js";import{t as O}from"./use_paginated_query-BKOSBoa7.js";import{t as k}from"./button-HksxbiUF.js";import{An as A,At as j,F as M,Yt as N,ct as P,h as F}from"./index-l7elBM2O.js";import{n as I,t as L}from"./trashPage-DgXB4jOM.js";var R=a(`scan-search`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m16 16-1.9-1.9`,key:`1dq9hf`}]]),z=t(e(),1);function B(e,t){let n=e.find(e=>e.status===`running`&&!e.stale)??null,r=e.find(e=>e.mode===`dryRun`&&e.status===`done`)??null,i=e.find(e=>e.mode===`apply`&&(e.status===`done`||e.status===`refused`)&&(r===null||e.startedAt>r.startedAt))??null,a=null;return n===null?r===null||i!==null?a=`no_report`:r.applicableUntil===null||r.applicableUntil<=t?a=`expired`:r.mirrorMissing>0?a=`mirror`:r.orphans.count===0&&(a=`nothing`):a=`running`,{running:n,report:r,lastApply:i,applyBlock:a}}var V=n();function H(){let e=d(S.blobSweep.listBlobSweeps,{}),t=d(S.blobQuarantine.quarantineSettings,{}),n=c(S.blobSweep.startBlobSweep),r=P(),{toast:a}=N(),[v,O]=(0,z.useState)(!1),F=s(),I=e=>M(e,F),L=B(e??[],Date.now()),H=L.report,U=async e=>{O(!0);try{await e()}catch(e){a({title:C(),description:e.message,variant:`error`})}finally{O(!1)}},W=()=>U(()=>n({mode:`dryRun`})),G=async()=>{H!==null&&await r({title:y({count:H.orphans.count}),description:x({size:I(H.orphans.bytes)}),confirmLabel:_(),destructive:!0})&&await U(()=>n({mode:`apply`,confirms:H._id}))};return(0,V.jsxs)(`section`,{className:`oc-trash__body`,"aria-labelledby":`oc-blobsweep-title`,children:[(0,V.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,V.jsx)(`h3`,{id:`oc-blobsweep-title`,className:`oc-trash__heading`,children:o()}),(0,V.jsxs)(`div`,{className:`oc-trash__actions`,children:[(0,V.jsxs)(k,{variant:`outline`,size:`sm`,disabled:v||L.running!==null,onClick:()=>void W(),children:[(0,V.jsx)(R,{}),` `,T()]}),(0,V.jsxs)(k,{variant:`ghost`,size:`sm`,className:`text-destructive`,disabled:v||L.applyBlock!==null,onClick:()=>void G(),children:[(0,V.jsx)(A,{}),` `,_()]})]})]}),(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:u({days:H?.minAgeDays??7,quarantine:t?.days??7})}),e===void 0?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:b()}):null,L.running===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:i({scanned:L.running.blobsScanned})}),e!==void 0&&H===null&&L.running===null?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:l()}):null,H===null?null:(0,V.jsxs)(`div`,{className:`oc-trash__hint`,children:[(0,V.jsx)(`p`,{children:E({date:j(H.finishedAt??H.startedAt),count:H.orphans.count,size:I(H.orphans.bytes),scanned:H.blobsScanned})}),(0,V.jsxs)(`ul`,{children:[(0,V.jsx)(`li`,{children:p({count:H.byOrigin.upload?.count??0,size:I(H.byOrigin.upload?.bytes??0)})}),(0,V.jsx)(`li`,{children:D({count:H.byOrigin.unregistered?.count??0,size:I(H.byOrigin.unregistered?.bytes??0)})})]}),H.importing>0?(0,V.jsx)(`p`,{children:w({count:H.importing})}):null,H.mirrorMissing>0?(0,V.jsx)(`p`,{className:`text-destructive`,children:f({count:H.mirrorMissing})}):null,L.applyBlock===`expired`?(0,V.jsx)(`p`,{children:g()}):null]}),L.lastApply===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:L.lastApply.status===`refused`?m({date:j(L.lastApply.finishedAt??L.lastApply.startedAt)}):h({date:j(L.lastApply.finishedAt??L.lastApply.startedAt),count:L.lastApply.deleted.count,size:I(L.lastApply.deleted.bytes)})})]})}function U(){let{results:e,status:t,loadMore:n}=O(S.trash.adminListTrash,{},{initialNumItems:50}),i=F(),a=c(S.trash.adminRestoreChat),o=c(S.trash.adminPurgeChat);return(0,V.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:r({days:i})}),t===`LoadingFirstPage`?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:b()}):e.length===0?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:v()}):(0,V.jsx)(L,{items:e,onRestore:e=>a({chatId:e}),onPurge:e=>o({chatId:e})}),(0,V.jsx)(I,{status:t,loadMore:n}),(0,V.jsx)(H,{})]})}export{U as TrashTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AA as r,AI as i,BI as a,CI as o,DA as s,DI as c,EA as l,EI as u,FA as d,FI as f,GI as p,Gb as m,HI as ee,HX as h,IA as g,II as _,JI as v,KI as te,LI as ne,MA as y,MI as re,NA as b,NI as ie,OA as x,OI as ae,PA as S,PI as oe,RI as se,SI as ce,TA as C,TI as le,UI as ue,UX as w,Ub as T,VI as de,WI as fe,Wb as E,XI as D,YI as O,jA as k,jI as pe,kA as A,kI as me,qI as he,rI as ge,t as j,wA as M,wI as _e,zI as ve}from"./api--rqKQo-l.js";import{t as N}from"./button-HksxbiUF.js";import{Ct as P,Dt as F,J as I,Jt as L,Mt as R,Ot as ye,Pn as z,St as B,Tt as be,Yt as V,an as xe,bt as H,c as U,ct as Se,dr as Ce,en as W,fr as we,ft as Te,jn as G,l as Ee,lt as De,nn as Oe,rn as ke,tn as Ae,u as K,vt as q,wt as je,xt as J,yt as Y}from"./index-l7elBM2O.js";import{t as Me}from"./FilterBar-BgVXfm-6.js";import{t as Ne}from"./DataTableShell-BYSvf6VZ.js";import{t as Pe}from"./DetailChips-DUlvwews.js";var X=t(e(),1),Z=n();function Fe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=w(j.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=w(j.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}))],f=new Map;for(let e of u){let t=f.get(e.instanceName)??[];t.push(e),f.set(e.instanceName,t)}return(0,Z.jsx)(P,{open:n,onOpenChange:r,children:(0,Z.jsxs)(je,{className:`oc-access`,children:[(0,Z.jsxs)(F,{children:[(0,Z.jsx)(ye,{children:g({user:t})}),(0,Z.jsx)(be,{children:d()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?S():b()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:y()}):u.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:A()}):[...f.entries()].map(([t,n])=>(0,Z.jsx)(Ie,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:o,defaultKey:c},t))})]})})}function Ie({profileId:e,instanceName:t,kind:n,agents:i,assigned:a,defaultKey:o}){let c=h(j.agents.assignAgent),u=h(j.agents.removeAgent),d=h(j.agents.setDefaultAgent),f=V();if(!e)return null;async function p(n,r){try{r?await u({profileId:e,instanceName:t,agentId:n}):await c({profileId:e,instanceName:t,agentId:n})}catch(e){f.error(k(),I(e))}}async function m(n){try{await d({profileId:e,instanceName:t,agentId:n})}catch(e){f.error(r(),I(e))}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(z,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(L,{variant:`outline`,className:`oc-access__kind`,children:n})]}),i.map(e=>{let n=`${t}/${e.agentId}`,r=a.has(n),i=o===n,c=e.state===`deleted`,u=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${u?` is-disabled`:``}`,children:[(0,Z.jsx)(R,{checked:r,disabled:(c||u)&&!r,onCheckedChange:()=>void p(e.agentId,r),"aria-label":x({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,c?(0,Z.jsx)(L,{variant:`outline`,className:`oc-access__gone`,children:s()}):null,e.outOfPool?(0,Z.jsx)(L,{variant:`outline`,className:`oc-access__gone`,children:l()}):null,r?i?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":C(),title:C(),children:(0,Z.jsx)(G,{size:14,fill:`currentColor`})}):(0,Z.jsx)(N,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":M(),title:M(),disabled:u,onClick:()=>void m(e.agentId),children:(0,Z.jsx)(G,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return T();case`user`:return E();case`admin`:return m();default:return e}}function Le({granted:e,onToggle:t}){let n=new Set(e),r=U.filter(e=>n.has(K[e])).length;return(0,Z.jsxs)(W,{children:[(0,Z.jsx)(xe,{asChild:!0,children:(0,Z.jsx)(N,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?D():O({count:r})})}),(0,Z.jsxs)(Ae,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(ke,{children:v()}),U.map(e=>{let r=K[e];return(0,Z.jsxs)(Oe,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(R,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:Ee[e]()})]},e)})]})]})}function Re(){let e=we({from:`/settings/users`}),t=Ce({from:`/settings/users`}),n=e.q??``,r=e.role??Q,s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),d=w(j.admin.listUsers,{filter:{q:n||void 0,role:r===Q?void 0:r},withAgents:!0}),m=w(j.me.getMe,{host:Te}),g=h(j.admin.setRole),v=h(j.admin.setUserPermissions),y=h(j.admin.startImpersonation),b=h(j.admin.deleteUser),x=h(j.admin.setUserName),S=Se(),C=De(),T=V(),[E,D]=(0,X.useState)(null),O=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of d??[])e.add(t.role);return[...e]},[d]),k=n!==``||r!==Q;function A(){t({search:{},replace:!0})}async function M(e){try{await g(e)}catch(e){T.error(he(),e)}}async function N(e){try{await v(e)}catch(e){T.error(te(),e)}}async function P(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await S({title:ve(),description:se({user:t}),confirmWord:ne(),confirmLabel:_(),destructive:!0}))try{await b({profileId:e._id}),T.success(oe({user:t}))}catch(e){T.error(f(),e)}}async function F(e){let t=e.email||e.name||e.userId.slice(0,8),n=await C({title:re(),label:pe({user:t}),placeholder:i(),defaultValue:e.name??``,confirmLabel:ge()});if(n!==null)try{await x({profileId:e._id,name:n}),T.success(me())}catch(e){T.error(ae(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Me,{q:n,onQChange:s,searchPlaceholder:p(),onReset:A,canReset:k,children:(0,Z.jsxs)(q,{value:r,onValueChange:l,children:[(0,Z.jsx)(J,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(Y,{children:[(0,Z.jsx)(H,{value:Q,children:fe()}),O.map(e=>(0,Z.jsx)(H,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Ne,{title:ue(),rows:d,emptyHint:ee(),rowActions:e=>{let t=[{label:ce(),onSelect:()=>D({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:ie(),onSelect:()=>void F(e)}];return e.userId!==m?.userId&&t.push({label:de(),onSelect:()=>void y({profileId:e._id})},{label:a(),variant:`destructive`,onSelect:()=>void P(e)}),t},columns:[{header:c(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{children:t}),n?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:u(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(q,{value:e.role,onValueChange:t=>void M({profileId:e._id,role:t}),children:[(0,Z.jsx)(J,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(Y,{children:[(0,Z.jsx)(H,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(H,{value:`user`,children:$(`user`)}),(0,Z.jsx)(H,{value:`admin`,children:$(`admin`)})]})]})},{header:le(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:_e()}):(0,Z.jsx)(Le,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),N({profileId:e._id,permissions:[...n]})}})},{header:o(),cell:e=>(0,Z.jsx)(Pe,{icon:(0,Z.jsx)(z,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Fe,{profileId:E?.profileId??null,userLabel:E?.label??``,open:E!==null,onOpenChange:e=>{e||D(null)}})]})}export{Re as UsersTab};
|