@lacneu/atrium 0.102.1 → 0.103.1
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-DIDDsgPT.js +1 -0
- package/dist/assets/{AdminSettings-B8n1yLsD.js → AdminSettings-RN5-vhFB.js} +1 -1
- package/dist/assets/{AdvancedFilter-Bb66m5kb.js → AdvancedFilter-D14bDnZM.js} +1 -1
- package/dist/assets/AgentFilesTab-CzlG0CZI.js +3 -0
- package/dist/assets/AnomaliesTab-DI6_13hV.js +1 -0
- package/dist/assets/AuditTab-CtudlEKL.js +1 -0
- package/dist/assets/BridgeTab-D7vwrcIC.js +1 -0
- package/dist/assets/ChatDefaultsTab-C29wKwC9.js +1 -0
- package/dist/assets/{ConfirmDialog-BXcki0Ee.js → ConfirmDialog-DUn2vS3y.js} +1 -1
- package/dist/assets/{DataTableShell-DRFFBx_j.js → DataTableShell-DlkJe0in.js} +1 -1
- package/dist/assets/DeletedChatsTab-fwnKocED.js +1 -0
- package/dist/assets/{DetailChips-Cv1sxdhU.js → DetailChips-CYx7WQ4_.js} +1 -1
- package/dist/assets/{EntitySheet-B2B48bss.js → EntitySheet-BHlTwSgy.js} +1 -1
- package/dist/assets/FeedbacksTab-B6yZLeCu.js +1 -0
- package/dist/assets/{FieldLabel-Tea3wyVe.js → FieldLabel-rU6Ua6ki.js} +1 -1
- package/dist/assets/FilesTab-CX2DlSAl.js +1 -0
- package/dist/assets/{FilterBar-DTVwlDpF.js → FilterBar-1CED41DE.js} +1 -1
- package/dist/assets/GroupsTab-XqYgSNbn.js +1 -0
- package/dist/assets/InstancesTab-k_xDuLN5.js +1 -0
- package/dist/assets/IntegrationsTab-wQIr0NRQ.js +1 -0
- package/dist/assets/KnobRow-GQ-yjRd-.js +1 -0
- package/dist/assets/KpiTab-Bqw-Ktyf.js +1 -0
- package/dist/assets/PreferencesTab-B3IgHTIx.js +1 -0
- package/dist/assets/ProjectPage-3f1bBxNm.js +1 -0
- package/dist/assets/PromptInjectionsTab-C_NJLRVi.js +4 -0
- package/dist/assets/RolesTab-BH7cwUSl.js +1 -0
- package/dist/assets/ScheduledTab-DEPYdnlj.js +1 -0
- package/dist/assets/ServiceAccountsTab-BW_IZtpv.js +1 -0
- package/dist/assets/SubAgentReportsTab-tnmtmSGh.js +1 -0
- package/dist/assets/ThemeShowroom-CXAiw6jt.js +1 -0
- package/dist/assets/{TimeRangePicker-D3PJq1H8.js → TimeRangePicker-DGRmfXqe.js} +1 -1
- package/dist/assets/{TimezoneCombobox-CPTpWNQm.js → TimezoneCombobox-DAhFeIgd.js} +1 -1
- package/dist/assets/TracesTab-peFnZ-Tw.js +1 -0
- package/dist/assets/TrashTab-Hd_LRcrR.js +1 -0
- package/dist/assets/UsersTab-CYiw3R0P.js +1 -0
- package/dist/assets/VoiceTab-BIJNy57E.js +1 -0
- package/dist/assets/{alert-dialog-BoEv1f8g.js → alert-dialog-BdTFPzVf.js} +1 -1
- package/dist/assets/{api-DSJJn0d7.js → api-DNOgniXv.js} +5 -5
- package/dist/assets/{badge-C4po8DQ1.js → badge-D7TV9F5d.js} +1 -1
- package/dist/assets/{button-Dio0PVrp.js → button-2XjWVeWK.js} +1 -1
- package/dist/assets/capabilities-CASxhKEd.js +1 -0
- package/dist/assets/{card-CerX9wDn.js → card-CB4fBpkx.js} +1 -1
- package/dist/assets/check-ByAmVIRT.js +1 -0
- package/dist/assets/{checkbox-CsI4ggnp.js → checkbox-kFoJxcMJ.js} +1 -1
- package/dist/assets/chevron-left-SzhbAbEJ.js +1 -0
- package/dist/assets/chevron-right-9DjIYDNR.js +1 -0
- package/dist/assets/chevron-up-uykFYjFv.js +1 -0
- package/dist/assets/chevrons-up-down-C45M3ZYP.js +1 -0
- package/dist/assets/{compatView--1YlftIc.js → compatView-BsJMEfMH.js} +1 -1
- package/dist/assets/confTabs-BzReq467.css +1 -0
- package/dist/assets/convexApi-4XI9Ua6G.js +1 -0
- package/dist/assets/{copy-BaUCUMp2.js → copy-uA2kyeTq.js} +1 -1
- package/dist/assets/{cronDescribe-CAuRX7uW.js → cronDescribe-CWrWu4NY.js} +1 -1
- package/dist/assets/{deliveryRecorder-C7NQZrrH.js → deliveryRecorder-D2L37goZ.js} +1 -1
- package/dist/assets/{dialog-BfrsWZiD.js → dialog-Cw-buQuR.js} +1 -1
- package/dist/assets/dispatchErrorInfo-rA4PAW2w.js +1 -0
- package/dist/assets/{dist-ChrIV8UV.js → dist-BuPfsZqj.js} +1 -1
- package/dist/assets/{dist-CkbybbG7.js → dist-CjNu_N10.js} +1 -1
- package/dist/assets/{dist-D-RIDSJc.js → dist-s7OhF_Fl.js} +1 -1
- package/dist/assets/{dist-ClkJChBn.js → dist-vqdeesMI.js} +1 -1
- package/dist/assets/{dist-D7doQlva.js → dist-whjwthuB.js} +1 -1
- package/dist/assets/{dist-Cw3aN_jM.js → dist-yuq8NbqZ.js} +1 -1
- package/dist/assets/{download-DWgC7zCa.js → download-7V52FIS0.js} +1 -1
- package/dist/assets/{dropdown-menu-DHMOOlaP.js → dropdown-menu-BaUA_yBi.js} +1 -1
- package/dist/assets/{eye-B-ipuYEd.js → eye-Dj_nvUMH.js} +1 -1
- package/dist/assets/{format-DGKgJf2p.js → format-Dmvblmga.js} +1 -1
- package/dist/assets/{groupManageView-BMBqgRhV.js → groupManageView-B0Fd_T1s.js} +1 -1
- package/dist/assets/index-C5sCqQtj.js +158 -0
- package/dist/assets/index-D8Eob_Mc.css +1 -0
- package/dist/assets/{input-BSpTsBA6.js → input-BOl1ZpD6.js} +1 -1
- package/dist/assets/{list-eSch39T9.js → list-CgDCvRps.js} +1 -1
- package/dist/assets/loader-circle-D-oC88g9.js +1 -0
- package/dist/assets/{lock-0lxfSnTE.js → lock-BlAOODxr.js} +1 -1
- package/dist/assets/{pencil-aUWxuLhy.js → pencil-C9Bd090l.js} +1 -1
- package/dist/assets/plus-1T1-a2EN.js +1 -0
- package/dist/assets/{popover-DBaIbsBr.js → popover-BHbAt2S-.js} +1 -1
- package/dist/assets/roleDescriptions-DIDUvLuU.js +1 -0
- package/dist/assets/rotate-ccw-WHZ3xMbc.js +1 -0
- package/dist/assets/{search-BK6bzZNi.js → search-CU2PGfXc.js} +1 -1
- package/dist/assets/{select-qM3ZfTHx.js → select-CYo6IZR2.js} +1 -1
- package/dist/assets/{server-DLnWqkX-.js → server-BJJ3cVit.js} +1 -1
- package/dist/assets/speech-DCWd2QRW.js +1 -0
- package/dist/assets/{star-CM6J2w_J.js → star-DBwak3-9.js} +1 -1
- package/dist/assets/switch-B0io8PF7.js +1 -0
- package/dist/assets/{table-D2SJC960.js → table-C6NnEhxy.js} +1 -1
- package/dist/assets/{tabs-mZfLmn2f.js → tabs-DiirWTCN.js} +1 -1
- package/dist/assets/{toast-xNFwDnUy.js → toast-DN6P_at0.js} +1 -1
- package/dist/assets/{tooltip-v_AyOWn6.js → tooltip-6h3mm-V5.js} +1 -1
- package/dist/assets/{trash-2-B4WSfc7G.js → trash-2-BmifkPwA.js} +1 -1
- package/dist/assets/trashPage-DsBekB4q.js +1 -0
- package/dist/assets/trashView-Cd0pvgnM.js +1 -0
- package/dist/assets/{triangle-alert-BkDa-x8g.js → triangle-alert-DjNOW8SM.js} +1 -1
- package/dist/assets/{usageView-C9Y6E0Zu.js → usageView-DsAOFF89.js} +1 -1
- package/dist/assets/{useChart-CKFEN42T.js → useChart-CvUnULHg.js} +1 -1
- package/dist/assets/{useFontScale-ByBFat3y.js → useFontScale-T-slFQPF.js} +1 -1
- package/dist/assets/{useStartNewChat-BszDHUjD.js → useStartNewChat-Bg4hLp3d.js} +2 -2
- package/dist/assets/{use_paginated_query-CQj09xXv.js → use_paginated_query-CrHKVq5I.js} +1 -1
- package/dist/assets/{users-BJqaWlH1.js → users-4cOOjyOf.js} +1 -1
- package/dist/assets/x-xmpoCnTJ.js +1 -0
- package/dist/index.html +56 -56
- package/package.json +1 -1
- package/dist/assets/AccessTab-JmFp20Kp.js +0 -1
- package/dist/assets/AgentFilesTab-C3CUT4Ep.js +0 -3
- package/dist/assets/AnomaliesTab-CpiY8ZTC.js +0 -1
- package/dist/assets/AuditTab-D5YrLbTy.js +0 -1
- package/dist/assets/BridgeTab-D4RFq-Rb.js +0 -1
- package/dist/assets/ChatDefaultsTab-D0d9yEow.js +0 -1
- package/dist/assets/DeletedChatsTab-COYSFkNf.js +0 -1
- package/dist/assets/FeedbacksTab-6URuFdfg.js +0 -1
- package/dist/assets/FilesTab-esMtHJXt.js +0 -1
- package/dist/assets/GroupsTab-Io16XZHz.js +0 -1
- package/dist/assets/InstancesTab-BevtM68H.js +0 -1
- package/dist/assets/IntegrationsTab-DMY6VTUC.js +0 -1
- package/dist/assets/KnobRow-BsOT2O6U.js +0 -1
- package/dist/assets/KpiTab-DCfAwBfJ.js +0 -1
- package/dist/assets/PreferencesTab-DJ9p401L.js +0 -1
- package/dist/assets/ProjectPage-BxEF71jN.js +0 -1
- package/dist/assets/PromptInjectionsTab-Vdb1lF36.js +0 -4
- package/dist/assets/RolesTab-DU0g4d-R.js +0 -1
- package/dist/assets/ScheduledTab-B6gWc0HN.js +0 -1
- package/dist/assets/ServiceAccountsTab-Dmb_LH0V.js +0 -1
- package/dist/assets/SubAgentReportsTab-D9rclslo.js +0 -1
- package/dist/assets/ThemeShowroom-N4qzUtlq.js +0 -1
- package/dist/assets/TracesTab-DMdT_psj.js +0 -1
- package/dist/assets/TrashTab-BMSJ7ANC.js +0 -1
- package/dist/assets/UsersTab-BQaLsUCK.js +0 -1
- package/dist/assets/VoiceTab-BSh-05Ze.js +0 -1
- package/dist/assets/capabilities-BTqhMVxR.js +0 -1
- package/dist/assets/check-DmQzfrws.js +0 -1
- package/dist/assets/chevron-left-DQ9FCoo_.js +0 -1
- package/dist/assets/chevron-right-C_b_y922.js +0 -1
- package/dist/assets/chevron-up-Dsqj2Oaj.js +0 -1
- package/dist/assets/chevrons-up-down-Pva00Np5.js +0 -1
- package/dist/assets/confTabs-CCBW5ofF.css +0 -1
- package/dist/assets/convexApi-CyScjgcq.js +0 -1
- package/dist/assets/dispatchErrorInfo-Bb7JyJFO.js +0 -1
- package/dist/assets/index-CQk5TM8W.js +0 -158
- package/dist/assets/index-D6RuTaB7.css +0 -1
- package/dist/assets/loader-circle-BNhIFGdg.js +0 -1
- package/dist/assets/plus-Djbdyc2E.js +0 -1
- package/dist/assets/roleDescriptions-x3mUxTcX.js +0 -1
- package/dist/assets/rotate-ccw-BD-9XzMC.js +0 -1
- package/dist/assets/speech-CrNma2Ue.js +0 -1
- package/dist/assets/trashPage-WtAhGCt7.js +0 -1
- package/dist/assets/trashView-Ct0Xw-a9.js +0 -1
- package/dist/assets/x-CK8d5DC1.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,AA as i,A_ as a,Ak as o,As as s,Bk as c,CA as l,C_ as u,Ck as d,DA as f,D_ as p,Dk as m,E as h,EA as ee,E_ as g,Ek as _,Fk as te,Gk as ne,Hk as re,Ik as ie,Jk as ae,Kk as oe,Lk as v,Mk as y,Nk as se,O_ as ce,Ok as le,Pk as ue,QO as de,Rk as fe,SA as pe,S_ as me,Sk as he,Su as ge,TA as _e,T_ as ve,Tk as b,Uk as ye,Vk as be,Wk as xe,XO as Se,XX as x,YX as Ce,ZO as S,_A as we,_k as Te,_u as Ee,ak as De,bA as Oe,b_ as ke,bk as Ae,ck as je,dk as Me,ek as Ne,fk as Pe,gA as Fe,gk as Ie,gu as Le,hk as Re,hu as ze,ik as Be,j_ as Ve,jk as He,kA as Ue,k_ as We,kk as Ge,lk as Ke,mk as qe,nk as Je,ok as Ye,oo as Xe,p_ as Ze,pk as Qe,qX as $e,qk as et,rk as tt,sk as nt,t as C,tk as rt,uk as w,vk as it,vu as at,wA as ot,w_ as st,wk as ct,xA as lt,x_ as ut,xk as dt,y_ as ft,yk as pt,yu as mt,zk as ht}from"./api-DSJJn0d7.js";import{i as gt,n as T,o as _t,r as vt,s as yt}from"./FieldLabel-Tea3wyVe.js";import{n as bt,t as E}from"./useNavigate-D3GIoxyW.js";import{r as D}from"./dist-ClkJChBn.js";import{t as O}from"./chevron-right-C_b_y922.js";import{t as xt}from"./chevron-up-Dsqj2Oaj.js";import{t as St}from"./chevrons-up-down-Pva00Np5.js";import{n as Ct,t as wt}from"./usageView-C9Y6E0Zu.js";import{t as Tt}from"./loader-circle-BNhIFGdg.js";import{t as Et}from"./checkbox-CsI4ggnp.js";import{t as Dt}from"./server-DLnWqkX-.js";import{t as k}from"./triangle-alert-BkDa-x8g.js";import{a as A,i as j,n as M,r as N,t as P}from"./select-qM3ZfTHx.js";import{i as Ot,n as kt,r as At,t as jt}from"./tabs-mZfLmn2f.js";import{n as Mt,r as Nt,t as Pt}from"./popover-DBaIbsBr.js";import{t as Ft}from"./button-Dio0PVrp.js";import{t as F}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{r as It}from"./toast-xNFwDnUy.js";import{t as I}from"./badge-C4po8DQ1.js";import{a as L,n as R}from"./format-DGKgJf2p.js";import{a as Lt,n as Rt,o as zt,r as Bt,t as Vt}from"./dialog-BfrsWZiD.js";import{t as Ht}from"./appHost-CH3EGcJw.js";import{r as Ut}from"./locales-CPjguROj.js";import{a as z,i as B,n as V,o as H,r as U,t as Wt}from"./table-D2SJC960.js";import{t as Gt}from"./FilterBar-DTVwlDpF.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView--1YlftIc.js";import{t as W}from"./dispatchErrorInfo-Bb7JyJFO.js";var $t=h(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=h(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return ln(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`&&t.lastOkAt===null}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,i]=(0,G.useState)(dn),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(s),[s]),l=(0,G.useMemo)(()=>vn(s),[s]),u=(0,G.useMemo)(()=>yn(s),[s]),d=(0,G.useMemo)(()=>gn(pn(s,n),a),[s,n,a]);function f(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:Me(),onReset:()=>i(dn),canReset:fn(n),children:[(0,Z.jsxs)(P,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:Ke()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:w()}),c.map(e=>(0,Z.jsx)(N,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(P,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(A,{placeholder:je()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:w()}),l.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(P,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(A,{placeholder:nt()})}),(0,Z.jsxs)(M,{children:[(0,Z.jsx)(N,{value:J,children:w()}),u.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:De(),sortKey:`target`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:Be(),sortKey:`state`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:tt(),sortKey:`instance`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:Je(),sortKey:`host`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:rt(),sortKey:`version`,sort:a,onSort:f}),(0,Z.jsx)(B,{children:Ne()}),(0,Z.jsx)(Q,{label:r(),sortKey:`lastOk`,sort:a,onSort:f})]})}),(0,Z.jsx)(V,{children:d.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(B,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(xt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(St,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:Qe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:L(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${L(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Xe({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${L(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Pe({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${L(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?de():e===`error`?S():Se()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(I,{variant:`secondary`,children:de()}):e===`error`?(0,Z.jsx)(I,{variant:`destructive`,children:S()}):(0,Z.jsx)(I,{variant:`outline`,children:Se()})}function wn(){return x(C.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=x(C.compat.getBridgeCompat,{}),n=x(C.me.getMe,{host:Ht})?.role===`admin`,r=x(C.admin.listInstances,n?{}:`skip`),i=x(C.agents.usageForInstances,n?{}:`skip`),a=E(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=un(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=bt({from:`/settings/bridge`}),l=E({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:ue()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:se()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(z,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{children:mt()}),(0,Z.jsx)(B,{children:at()}),(0,Z.jsx)(B,{children:Ee()}),(0,Z.jsx)(B,{children:Le()}),(0,Z.jsx)(B,{children:ze()})]})}),(0,Z.jsx)(V,{children:i.flatMap(e=>{let t=wt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(I,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(jt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Z.jsx)(At,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(Ot,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Dt,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(kt,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:We(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ce({build:t.buildVersion??`?`})]}):null,` · `,p(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?g():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ct()});let o=tn(e.targets),s=!e.reachable,c=rn(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,f=R(e.checkedAt),m=e.startedAt==null?null:R(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Z.jsx)(Ct,{size:22}):s||c===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(k,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?d():c===`gateways_unreachable`?pt({count:l.length}):s?he():dt({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,Ae({time:f})]}),m?(0,Z.jsx)(`span`,{children:Te({time:m})}):null,a]}),c===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:it({names:l.join(`, `)})}):null,s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ie()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(Dt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(I,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Ve()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}),Re({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[y(),i.length>0?(0,Z.jsx)(I,{variant:`destructive`,children:o({count:i.length})}):a>0?(0,Z.jsx)(I,{variant:`destructive`,children:Ge()}):(0,Z.jsx)(I,{variant:`secondary`,children:He()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[le({version:e.vendoredVersion}),r?` · `+m({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:s({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}),_({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:o}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:st()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:ge({provider:o})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:u({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:g()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ft()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(I,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(Vt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Rt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Lt,{children:[(0,Z.jsx)(zt,{children:i({instance:e.displayName??e.name})}),(0,Z.jsx)(Bt,{children:Ue()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(Ct,{"aria-hidden":!0}):(0,Z.jsx)(k,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?fe():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,v()]}):null}function jn({instance:e,onClose:t}){let n=Ce(C.admin.upsertInstanceConfig),r=$e(C.bridge.validateMediaPaths),i=It(),a=Ut(e.config?.contentLocale,void 0),[o,s]=(0,G.useState)(()=>gt(e.config??{},a)),[u,d]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=o.inboundMediaMode===`shared-fs`,v=o.mediaMode===`shared-fs`,y=_||v;async function se(){m(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(re(),e)}finally{m(!1)}}async function ce(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(o,r,a)}),t()}catch(e){i.error(pe(),e)}finally{d(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:f(),help:lt()}),(0,Z.jsxs)(P,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(M,{children:yt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:ee(),help:Oe()}),(0,Z.jsxs)(P,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(M,{children:_t.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:_e(),help:we()}),(0,Z.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:ae(),help:et()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:oe(),help:ne()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Et,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Z.jsx)(T,{label:ot(),help:Fe()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(k,{"aria-hidden":!0}),te({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:c(),result:h.inbound}),(0,Z.jsx)($,{label:ht(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(k,{"aria-hidden":!0}),ie()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(Ft,{variant:`outline`,size:`sm`,onClick:()=>void se(),disabled:p,children:[p?(0,Z.jsx)(Tt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?ye():xe()]}),(0,Z.jsx)(Ft,{size:`sm`,onClick:()=>void ce(),disabled:u,children:l()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Pt,{children:[(0,Z.jsx)(Nt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?me():ut({count:e.length}),(0,Z.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Mt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:ke()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(I,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{At as r,BX as i,B_ as a,Bp as o,Bt as s,Ct as c,Dt as l,Et as u,F_ as d,Ft as f,Gp as p,Hp as m,Ht as h,I_ as g,It as _,Kp as v,L_ as y,Lt as b,M_ as x,Mt as ee,N_ as S,Nt as C,OA as te,Ot as ne,P_ as w,Pt as T,R_ as re,Rp as ie,Rt as ae,St as oe,Tt as se,Up as ce,Ut as le,Vp as ue,Vt as de,Wp as E,Wt as D,XX as O,Xv as fe,YX as k,Zv as pe,bt as me,gv as A,jt as he,kt as ge,qX as j,qp as _e,ry as M,t as N,ty as ve,wt as ye,xt as P,xu as be,yt as xe,z_ as F,zp as Se,zt as Ce}from"./api-DSJJn0d7.js";import{t as we}from"./use_paginated_query-CQj09xXv.js";import{t as I}from"./checkbox-CsI4ggnp.js";import{t as Te}from"./triangle-alert-BkDa-x8g.js";import{a as L,i as R,n as z,r as B,t as V}from"./select-qM3ZfTHx.js";import{t as H}from"./button-Dio0PVrp.js";import{t as U}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{a as Ee,t as W}from"./KnobRow-BsOT2O6U.js";import{n as De}from"./capabilities-BTqhMVxR.js";import{a as Oe}from"./compatView--1YlftIc.js";/* empty css */var G=t(e(),1),ke=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Ae(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var K=[`auto`,`hybrid`,`tool`,`off`];function je(e){switch(e){case`auto`:return de();case`hybrid`:return s();case`tool`:return Ce();default:return ae()}}function q(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function J(e){return typeof e==`string`&&K.includes(e)}function Y(e){return{injection:J(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function X(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function Me(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?C():Ne(e)?c():null:T(),i=Y(e),a=t.injection!==i.injection||!X(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),s=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:s,invalidReason:s?null:_()}}function Ne(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function Pe(e,t,n){let r=t.sources.includes(n)?t.sources.filter(e=>e!==n):[...t.sources,n];return{...t,sources:e.sources.map(e=>e.id).filter(e=>r.includes(e))}}function Z(e){return e.ok?null:e.code===`scope_refused`?C():e.code===`stale_default`?ee():e.code===`write_unknown`||e.code===`not_confirmed`?ge():e.code===`not_applied`?ne():e.code===`default_too_large`?P():e.code===`allowlist_too_large`?oe():e.code===`plugin_too_old`?c():e.code===`source_not_allowed`?ye():e.code===`plugin_config_lag`?se():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?f():he({code:e.code})}function Q(e,t){let n=q(e),r=q(t);if(n.injection!==r.injection||!X(n.defaultSources,r.defaultSources))return!0;let i=n.config,a=r.config;return i===void 0||a===void 0?i!==a:i.injection!==a.injection||!((e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>e===t[n]))(i.sources,a.sources)}var $=n();function Fe({instanceName:e,row:t,supported:n}){let i=j(N.knowledge.setAgentKnowledgeDefault),[a,o]=(0,G.useState)(t),[s,c]=(0,G.useState)(()=>Y(t)),[l,u]=(0,G.useState)(`idle`),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(!1),g=e=>{o(e),c(Y(e)),f(null)},_=Q(a,t);(0,G.useEffect)(()=>{p&&_&&(m(!1),g(t))},[p,_]);let v=Me(a,s,n),y=v.readOnlyReason===null;async function x(){u(`saving`),f(null);try{let n=Z(await i({instanceName:e,agentId:t.agentId,injection:s.injection,sources:s.sources,expected:q(a)}));f(n),u(n===null?`done`:`idle`),n===null&&m(!0)}catch(e){f(Z({ok:!1,code:String(e?.message??`error`).slice(0,60)})),u(`idle`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsxs)(V,{value:s.injection,onValueChange:e=>{J(e)&&c({...s,injection:e})},disabled:!y,children:[(0,$.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":h(),children:(0,$.jsx)(L,{})}),(0,$.jsx)(z,{children:K.map(e=>(0,$.jsx)(B,{value:e,children:je(e)},e))})]})}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()}),t.sources.map(e=>(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:y?`pointer`:`default`},title:e.description||void 0,children:[(0,$.jsx)(I,{checked:s.sources.includes(e.id),onCheckedChange:()=>c(Pe(t,s,e.id)),disabled:!y,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),_&&!p?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[me(),` `,(0,$.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>g(t),children:xe()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:r()}),y?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(H,{size:`sm`,disabled:!v.dirty||!v.valid||l===`saving`,onClick:()=>void x(),children:l===`saving`?M():w()})}):(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:v.readOnlyReason}),y&&v.dirty&&v.invalidReason!==null?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v.invalidReason}):null,l===`done`&&d===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):null,d===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d})]})]})}function Ie({instanceName:e}){let t=O(N.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=we(N.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,$.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":D(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:le()}),t.supported?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:T()}),n.map(n=>(0,$.jsx)(Fe,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:l({shown:n.length})}),(0,$.jsx)(H,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:u()})]}):null]})}function Le({instance:e}){let t=k(N.admin.upsertInstanceConfig),n=O(N.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,G.useState)(r),[o,s]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let c=`__none__`,l=i!==r;async function u(){s(`saving`);try{let n={...e.config??{}};i===``||i===c?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let d=n?.agents??[];return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(V,{value:i===``?c:i,onValueChange:e=>a(e===c?``:e),children:[(0,$.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":E(),children:(0,$.jsx)(L,{placeholder:m()})}),(0,$.jsxs)(z,{children:[(0,$.jsx)(B,{value:c,children:m()}),d.map(e=>(0,$.jsx)(B,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,$.jsx)(H,{size:`sm`,disabled:!l||o===`saving`,onClick:()=>void u(),children:o===`saving`?M():w()})]}),o===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):null,o===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x()}):null]})}function Re({instance:e}){let t=k(N.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,G.useState)(n),[s,c]=(0,G.useState)(r===null?``:String(r)),[l,u]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(n),c(r===null?``:String(r)),u(`idle`)},[e._id,n,r]);let d=s.trim(),f=d===``?null:/^\d+$/.test(d)?Number.parseInt(d,10):NaN,m=!i||f===null||Number.isInteger(f)&&f>=4e3&&f<=6e4,h=i!==n||(f??null)!==r;async function g(){u(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||f===null||Number.isNaN(f)?delete n.curationBudgetChars:n.curationBudgetChars=f,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,$.jsx)(I,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":p()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>c(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!m,"aria-label":ue(),disabled:!i}),(0,$.jsx)(H,{size:`sm`,disabled:!h||!m||l===`saving`,onClick:()=>void g(),children:l===`saving`?M():w()})]}),m?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}),l===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):null,l===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:Se()})]})}function ze({instance:e}){let t=k(N.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,G.useState)(n===null?``:String(n)),[a,o]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),c=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,l=c===null||Number.isInteger(c)&&c>=1e3&&c<=2e5,u=(c??null)!==n;async function d(){o(`saving`);try{let n={...e.config??{}};c===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=c,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:_e()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!l}),(0,$.jsx)(H,{size:`sm`,disabled:!u||!l||a===`saving`,onClick:()=>void d(),children:a===`saving`?M():w()})]}),l?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:ie()}),a===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):null,a===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:x()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:v()})]})}function Be(){let e=j(N.agentFiles.getChatDefaults),[t,n]=(0,G.useState)({status:`loading`}),r=O(N.admin.listInstances,{}),[o,s]=(0,G.useState)(null);(0,G.useEffect)(()=>{!r||r.length===0||(!o||!r.some(e=>e.name===o))&&s(r[0].name)},[r,o]);let c=(r?.length??0)>1,l=r!==void 0&&r.length===0,u=O(N.compat.forInstance,o?{instanceName:o}:`skip`),f=o?De(u,`configDefaults`):`loading`,p=f===`loading`?null:f.blocked,m=(0,G.useMemo)(()=>c&&o?{instanceName:o}:{},[c,o]),h=(0,G.useRef)(0),_=(0,G.useCallback)(async()=>{let t=++h.current;n({status:`loading`});try{let r=Ae(await e(m));if(h.current!==t)return;n({status:`done`,current:r})}catch{if(h.current!==t)return;n({status:`error`})}},[e,m]);(0,G.useEffect)(()=>{p===!1&&(c&&!o||_())},[_,p,c,o]);let v=t.status===`done`?t.current:null,b=(0,G.useMemo)(()=>ke.map(e=>({id:e,label:Ee(e)})),[]),x=(0,G.useMemo)(()=>[{id:`fast`,label:pe()},{id:`standard`,label:fe()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),c&&o?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()}),(0,$.jsxs)(V,{value:o,onValueChange:e=>s(e),children:[(0,$.jsx)(R,{size:`sm`,"aria-label":A(),children:(0,$.jsx)(L,{})}),(0,$.jsx)(z,{children:(r??[]).map(e=>(0,$.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,l?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:te()}):f===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):f.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(Te,{size:14,"aria-hidden":!0}),` `,Oe(f.gatewayVersion,f.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[d(),` `,(0,$.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:ve()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:F()}),(0,$.jsx)(W,{field:`thinkingLevel`,options:b,value:v?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:F()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:re()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()}),(0,$.jsx)(W,{field:`fastMode`,options:x,value:v===null||v.fastModeDefault===null?null:v.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:y()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:g()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:be()})]}),(()=>{let e=r?.find(e=>e.name===(o??r[0]?.name));return e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{instance:e}),(0,$.jsx)(Re,{instance:e}),(0,$.jsx)(Le,{instance:e}),(0,$.jsx)(Ie,{instanceName:e.name})]}):null})()]})}export{Be as ChatDefaultsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{BE as t,JE as n,VE as r,YE as i,YX as a,t as o,xj as s,zE as c}from"./api-DSJJn0d7.js";import{t as l}from"./use_paginated_query-CQj09xXv.js";import{t as u}from"./button-Dio0PVrp.js";import"./convexApi-CyScjgcq.js";import{n as d}from"./ConfirmDialog-BXcki0Ee.js";import{r as f}from"./trashView-Ct0Xw-a9.js";import{n as p,t as m}from"./trashPage-WtAhGCt7.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(o.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=a(o.trash.restoreChat),b=a(o.trash.purgeChat),x=a(o.trash.emptyTrash),S=d();return(0,h.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,h.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:i({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:t(),description:c(),confirmLabel:r(),destructive:!0})&&await x({})},children:r()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:s()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:n()}):(0,h.jsx)(m,{items:e,onRestore:e=>y({chatId:e}),onPurge:e=>b({chatId:e})}),(0,h.jsx)(p,{status:g,loadMore:_})]})}export{g as DeletedChatsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$L as r,AL as i,BL as a,CL as o,DL as s,EL as c,FL as l,GL as u,HL as d,IL as f,JL as p,KL as ee,LL as te,ML as ne,NL as m,OL as h,PL as g,QL as _,RL as re,SL as v,TL as y,UL as ie,VL as ae,WL as b,XL as x,XX as S,YL as C,YX as w,Yf as T,ZL as E,Zf as D,_L as O,aL as k,aR as A,bL as j,cL as M,dL as N,eR as P,fL as F,gL as I,hL as L,iL as R,iR as z,jL as B,kL as V,lL as H,mL as U,nR as oe,oL as W,oR as G,pL as K,qL as q,rR as se,sL as ce,t as J,tR as le,uL as ue,vL as de,wL as fe,xL as pe,yL as me,zL as he}from"./api-DSJJn0d7.js";import{t as ge}from"./button-Dio0PVrp.js";import"./convexApi-CyScjgcq.js";import{n as _e}from"./format-DGKgJf2p.js";import{n as Y}from"./ConfirmDialog-BXcki0Ee.js";import{t as ve}from"./DataTableShell-DRFFBx_j.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>G(),incorrect:()=>A(),incoherence:()=>z(),formatting:()=>se(),latency:()=>oe(),api_error:()=>le(),other:()=>P()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:_()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:E()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:r()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,o=w(J.feedback.respondToFeedback),[s,c]=(0,X.useState)(e.thread),[h,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(!1);async function S(){let t=h.trim();if(!(!t||v)){y(!0);try{await o({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),_(``)}finally{y(!1)}}}let T=[];try{T=r.contextJson?JSON.parse(r.contextJson):[]}catch{T=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${x()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:fe(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ue()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:p()}),s.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:s.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?q():e.authorRole===`agent`?e.authorLabel??D():ee()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:u()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:b(),value:h,maxLength:2e3,rows:3,onChange:e=>_(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void S(),disabled:!h.trim()||v,children:v?ie():d()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||a()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:he()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||a()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,T.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:te({count:r.contextCount??T.length,truncated:r.contextTruncated?f():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:T.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:l()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:g()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:m()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?ne({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[B(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,i()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=S(J.feedback.listForAdmin,{}),t=w(J.feedback.readSnapshot),n=w(J.feedback.deleteFeedback),r=Y(),[i,a]=(0,X.useState)(null),[l,u]=(0,X.useState)({});async function d(e){if(i===e._id){a(null);return}if(!l[e._id]){let n=await t({feedbackId:e._id});u(t=>({...t,[e._id]:n}))}a(e._id)}async function f(e){await r({title:W(),description:k(),confirmLabel:R(),destructive:!0})&&(await n({feedbackId:e._id}),i===e._id&&a(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[V(),` `,(0,Z.jsx)(`strong`,{children:h()}),` `,s()]}),(0,Z.jsx)(ve,{title:c(),rows:e,emptyHint:y(),isExpanded:e=>i===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Z.jsx)(be,{data:l[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:o(),cell:e=>_e(e.at),sort:e=>e.at},{header:v(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:pe(),cell:e=>e.messageRole===`user`?j():me(),sort:e=>e.messageRole},{header:de(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${O({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:I(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:L(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:U(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:K()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:F()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:T()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:N()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:i===e._id?H():M(),onSelect:()=>void d(e)},{label:ce(),onSelect:()=>void f(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$Y as ee,AY as r,BX as i,BY as te,DY as ne,EY as re,FY as ie,GY as a,HX as o,HY as s,IY as c,JY as l,KY as u,LY as d,MY as f,NY as ae,OY as oe,PY as p,QY as se,RY as ce,UY as le,VY as ue,WY as m,XX as de,XY as h,YX as fe,YY as g,ZV as pe,ZY as me,aX as he,eX as ge,ep as _e,iX as _,jY as ve,kY as ye,nX as be,oX as xe,qY as v,rX as y,sX as b,t as x,tX as S,tp as C,zY as w}from"./api-DSJJn0d7.js";import{c as T,g as E,n as D,r as O,t as k}from"./dropdown-menu-DHMOOlaP.js";import{t as A}from"./download-DWgC7zCa.js";import{t as j}from"./checkbox-CsI4ggnp.js";import{t as M}from"./rotate-ccw-BD-9XzMC.js";import{t as Se}from"./trash-2-B4WSfc7G.js";import{a as N,i as P,n as F,r as I,t as L}from"./select-qM3ZfTHx.js";import{a as Ce,c as we,i as Te,n as Ee,o as De,r as Oe,s as ke,t as Ae}from"./alert-dialog-BoEv1f8g.js";import{t as R}from"./button-Dio0PVrp.js";import"./convexApi-CyScjgcq.js";import{r as je}from"./toast-xNFwDnUy.js";import{t as z}from"./badge-C4po8DQ1.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-D2SJC960.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return h();case`audio`:return g();case`video`:return l();case`pdf`:return v();case`document`:return u();case`archive`:return a();default:return m()}}function q(){let[e,t]=(0,U.useState)(G),[n,a]=(0,U.useState)(G),[l,u]=(0,U.useState)(G),[m,h]=(0,U.useState)(G),[g,v]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=fe(x.files.softDelete),Y=je();function Ie(){t(G),a(G),u(G),h(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(ae())}catch(e){Y.error(f(),e)}}let X=de(x.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:l===G?void 0:l,category:m===G?void 0:m,includeAutoGenerated:g||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(o(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:i()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||l!==G||m!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(L,{value:e,onValueChange:t,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":xe(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:he()}),(0,W.jsx)(I,{value:`inbound`,children:_()}),(0,W.jsx)(I,{value:`outbound`,children:y()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:a,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":be(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:S()}),Q.chats.map(e=>(0,W.jsx)(I,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(L,{value:l,onValueChange:u,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":ge(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:ee()}),Q.instances.map(e=>(0,W.jsx)(I,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(L,{value:m,onValueChange:h,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":se(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:me()}),Q.categories.map(e=>(0,W.jsx)(I,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(j,{checked:g,onCheckedChange:e=>v(e===!0),"aria-label":C()}),(0,W.jsx)(`span`,{children:C()})]}),$?(0,W.jsxs)(R,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(M,{size:14,"aria-hidden":!0}),c()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?ne():oe()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:le()}),(0,W.jsx)(B,{children:s()}),(0,W.jsx)(B,{children:ue()}),(0,W.jsx)(B,{children:te()}),(0,W.jsx)(B,{children:w()}),(0,W.jsx)(B,{className:`text-right`,children:ce()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(z,{variant:`outline`,style:{marginLeft:6},children:_e()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(z,{variant:`secondary`,children:e.direction===`inbound`?_():y()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(k,{children:[(0,W.jsx)(T,{asChild:!0,children:(0,W.jsx)(R,{variant:`ghost`,size:`icon`,"aria-label":ie(),children:(0,W.jsx)(E,{size:16})})}),(0,W.jsxs)(D,{align:`end`,children:[e.url?(0,W.jsx)(O,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(A,{size:14}),d()]})}):(0,W.jsxs)(O,{disabled:!0,children:[(0,W.jsx)(A,{size:14}),ye()]}),(0,W.jsxs)(O,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Se,{size:14}),p()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:re({cap:Be})}):null]}),(0,W.jsx)(Ae,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Te,{children:[(0,W.jsxs)(ke,{children:[(0,W.jsx)(we,{children:ve()}),(0,W.jsx)(Ce,{children:r()})]}),(0,W.jsxs)(De,{children:[(0,W.jsx)(Oe,{children:pe()}),(0,W.jsx)(Ee,{onClick:()=>void Le(),children:p()})]})]})})]})}export{q as FilesTab};
|
|
@@ -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,Ax as o,Ay as s,Bb as c,By as l,Cb as u,Cx as d,Db as f,Dx as p,Dy as m,E as h,Eb as g,Ex as _,Fb as v,Fy as y,Gb as b,Gy as x,Hb as S,Hy as ee,Ib as C,Iy as w,Jb as T,Jy as E,Kb as D,Ky as te,Lb as O,Ly as k,Mb as A,My as j,Nb as M,Ny as N,Ob as ne,Ox as P,Oy as F,Pb as I,Py as re,Qy as ie,Rb as ae,Ry as oe,Sb as se,Sx as ce,Tb as le,Tx as ue,Ub as de,Uy as fe,Vb as pe,Vy as me,Wb as he,Wy as ge,XX as L,Xy as _e,YX as R,Yb as ve,Yy as ye,Zy as be,_b as xe,_x as Se,ab as Ce,ax as we,bb as Te,bx as Ee,by as De,cb as Oe,cx as ke,dx as Ae,eb as je,ex as Me,fx as Ne,gb as Pe,gx as Fe,hb as Ie,hx as Le,ib as Re,ix as ze,jb as Be,jx as Ve,jy as He,kb as Ue,kx as We,ky as Ge,lb as Ke,lx as qe,mb as Je,mx as Ye,nb as Xe,nx as z,ob as Ze,ox as Qe,px as $e,qb as B,qy as et,rb as tt,rx as nt,sb as rt,sx as it,t as V,tb as at,tx as ot,ub as H,ux as st,vb as ct,vx as lt,vy as ut,wb as dt,wx as ft,xb as pt,xx as mt,xy as ht,yb as gt,yx as _t,yy as vt,zb as yt,zy as bt}from"./api-DSJJn0d7.js";import{t as xt}from"./chevron-left-DQ9FCoo_.js";import{t as St}from"./chevron-right-C_b_y922.js";import{t as U}from"./checkbox-CsI4ggnp.js";import{t as Ct}from"./server-DLnWqkX-.js";import{i as wt,n as Tt,r as Et,t as Dt}from"./users-BJqaWlH1.js";import{t as W}from"./star-CM6J2w_J.js";import{t as Ot}from"./x-CK8d5DC1.js";import{a as kt,i as At,n as jt,r as Mt,t as Nt}from"./select-qM3ZfTHx.js";import{i as Pt,n as Ft,r as It,t as Lt}from"./tabs-mZfLmn2f.js";import{t as G}from"./button-Dio0PVrp.js";import{t as K}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{r as q}from"./toast-xNFwDnUy.js";import{t as J}from"./badge-C4po8DQ1.js";import{a as Rt,n as zt,o as Bt,r as Vt,t as Ht}from"./dialog-BfrsWZiD.js";import{t as Ut}from"./appHost-CH3EGcJw.js";import{n as Wt}from"./ConfirmDialog-BXcki0Ee.js";import{t as Gt}from"./EntitySheet-B2B48bss.js";import{a as Y,c as Kt,d as qt,f as Jt,i as Yt,l as Xt,n as Zt,o as Qt,r as $t,t as X,u as en}from"./groupManageView-BMBqgRhV.js";import{t as tn}from"./FilterBar-DTVwlDpF.js";import{t as nn}from"./DataTableShell-DRFFBx_j.js";import{t as Z}from"./DetailChips-Cv1sxdhU.js";var rn=h(`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`}]]),Q=t(e(),1),$=n(),an={name:``,description:``};function on(){let e=L(V.groups.listGroups,{}),t=L(V.me.getMe,{host:Ut})?.role===`admin`,n=R(V.groups.createGroup),r=R(V.groups.updateGroup),i=R(V.groups.deleteGroup),a=Wt(),s=q(),[c,l]=(0,Q.useState)(!1),[u,f]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(an),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(``),S=(0,Q.useMemo)(()=>{if(!e)return e;let t=b.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,b]);function ee(){f(null),h(an),l(!0)}function C(e){f(e),h({name:e.name,description:e.description??``}),l(!0)}async function w(){try{u?await r({groupId:u._id,name:m.name,description:m.description}):await n({name:m.name,description:m.description||void 0}),h(an),f(null),l(!1)}catch(e){s.error(g(),e)}}async function T(e){if(await a({title:Ne({name:e.name}),description:Ae(),confirmWord:e.name,confirmLabel:st(),cancelLabel:lt(),destructive:!0}))try{await i({groupId:e._id})}catch(e){s.error(le(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),t?(0,$.jsx)(pn,{}):null,(0,$.jsx)(tn,{q:b,onQChange:x,onReset:()=>x(``),canReset:b!==``,searchPlaceholder:d()}),(0,$.jsx)(nn,{title:Ve(),rows:S,addLabel:We(),onAdd:t?ee:void 0,emptyHint:P(),columns:[{header:p(),cell:e=>e.name,sort:e=>e.name},{header:_(),cell:e=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{icon:(0,$.jsx)(Dt,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(wt,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),e.pendingInviteCount>0?(0,$.jsx)(J,{variant:`secondary`,children:Je({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:ue(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(Ct,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ft(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(rn,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:ce(),onSelect:()=>y({groupId:e._id,name:e.name})},...t?[{label:mt(),onSelect:()=>C(e)},{label:Ee(),variant:`destructive`,onSelect:()=>void T(e)}]:[]]}),(0,$.jsx)(Gt,{open:c,onOpenChange:l,title:u?Fe():Se(),description:Le(),canSubmit:!!m.name.trim(),onSubmit:w,submitLabel:_t(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:Ye()}),(0,$.jsx)(K,{value:m.name,onChange:e=>h({...m,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:$e()}),(0,$.jsx)(K,{value:m.description,onChange:e=>h({...m,description:e.target.value})})]})]})}),(0,$.jsx)(ln,{groupId:v?.groupId??null,groupName:v?.name??``,open:v!==null,onOpenChange:e=>{e||y(null)}})]})}var sn=8;function cn({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(xt,{size:14,"aria-hidden":!0}),ot()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":r({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[Me(),(0,$.jsx)(St,{size:14,"aria-hidden":!0})]})]})}function ln({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=L(V.groups.getGroup,n&&e?{groupId:e}:`skip`),o=i?.viewerIsAdmin===!0,s=L(V.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),c=L(V.groups.listAssignableUsers,n&&o?{}:`skip`),l=R(V.groups.addMember),u=R(V.groups.removeMember),d=R(V.groups.bulkSetMembers),f=R(V.groups.setGroupManager),p=q(),[m,h]=(0,Q.useState)(``),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(`members`),[x,S]=(0,Q.useState)(1),[ee,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(new Set),E=(0,Q.useRef)(null),D=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),te=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),O=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[i]),k=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>X(e.instanceName,e.agentId))),[i]),A=(0,Q.useMemo)(()=>{let e=(i?.agents??[]).find(e=>e.isDefault);return e?X(e.instanceName,e.agentId):null},[i]);(0,Q.useEffect)(()=>{h(``),_(``),y(`members`),S(1),C(null),E.current=null},[n,e]),(0,Q.useEffect)(()=>{S(1)},[m]),(0,Q.useEffect)(()=>{n&&i&&e&&E.current!==e&&(E.current=e,T(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let j=(0,Q.useMemo)(()=>c?Yt(c,m,w):[],[c,m,w]);async function M(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){p.error(dt(),Y(e))}}async function N(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(ne(),e)}}let P=qt(j,e=>D.has(e.userId)),F=j.filter(e=>D.has(e.userId)).length,I=Xt(j,x,sn);async function re(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:P!==`all`})}catch(e){p.error(dt(),Y(e))}}let ie=(e,t)=>(0,$.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":Ce({user:t}),title:Ce({user:t}),onClick:()=>C({userId:e,label:t}),children:[(0,$.jsx)(Et,{size:13,"aria-hidden":!0}),Ze()]});return(0,$.jsx)(Ht,{open:n,onOpenChange:r,children:(0,$.jsxs)(zt,{className:`oc-access`,children:[(0,$.jsxs)(Rt,{children:[(0,$.jsx)(Bt,{children:qe({name:t})}),(0,$.jsx)(Vt,{children:i&&!o?se():ke()})]}),(0,$.jsxs)(Lt,{value:v,onValueChange:y,className:`oc-access__tabs`,children:[(0,$.jsxs)(It,{className:`w-full`,children:[(0,$.jsxs)(Pt,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Dt,{size:13,"aria-hidden":!0}),it(),i?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:D.size}):null]}),(0,$.jsxs)(Pt,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ct,{size:13,"aria-hidden":!0}),we(),i?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,$.jsxs)(Pt,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(rn,{size:13,"aria-hidden":!0}),yt(),i?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(Ft,{value:`members`,children:i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):o?c===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:b()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:m,onChange:e=>h(e.target.value),placeholder:Qe(),className:`oc-access__search`}),j.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:nt()}):(0,$.jsxs)($.Fragment,{children:[j.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(U,{checked:P===`all`||P===`some`&&`indeterminate`,onCheckedChange:()=>void re(),"aria-label":z()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:z()}),(0,$.jsxs)(J,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,j.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=D.has(e.userId),n=Jt(e),r=te.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(U,{checked:t,onCheckedChange:()=>void M(e.userId,t),"aria-label":ve({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),t&&O.has(e.userId)?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:Re()}):null,(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:en(e.role)}),t?ie(e.userId,n.primary):null,(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t?(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?Ue():a(),title:r?Ue():a(),onClick:()=>void N(e.userId,r),children:(0,$.jsx)(wt,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(cn,{page:I.page,pageCount:I.pageCount,onPage:S})]})]}):e?(0,$.jsx)(un,{groupId:e,members:i.members,agentsButton:ie}):null}),(0,$.jsxs)(Ft,{value:`agents`,children:[i&&!o?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ye()}):null,s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:he()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:g,onChange:e=>_(e.target.value),placeholder:ze(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,$.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,defaultKey:A,viewerIsAdmin:o,query:g},`${e}-${t._id}`))})]})]}),(0,$.jsx)(Ft,{value:`charts`,children:(0,$.jsx)(mn,{groupId:e})})]}),(0,$.jsx)(dn,{groupId:e,member:ee,onOpenChange:e=>{e||C(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=L(V.groupInvites.listGroupInviteRequests,{groupId:e}),i=R(V.groupInvites.requestGroupInvite),a=R(V.groups.removeMember),o=Wt(),s=q(),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(1),f=Xt(t,u,sn);async function p(t){t.preventDefault();let n=c.trim();if(n)try{await i({groupId:e,email:n}),l(``),s.success(xe())}catch(e){s.error(Pe(),e)}}async function h(t,n){if(await o({title:H({user:n}),description:Oe({user:n}),confirmLabel:rt(),cancelLabel:lt(),destructive:!0}))try{await a({groupId:e,userId:t})}catch(e){s.error(dt(),Y(e))}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`form`,{className:`oc-access__invite`,onSubmit:e=>void p(e),children:[(0,$.jsx)(K,{type:`email`,value:c,onChange:e=>l(e.target.value),placeholder:gt(),"aria-label":pt()}),(0,$.jsxs)(G,{type:`submit`,size:`sm`,disabled:!c.trim(),children:[(0,$.jsx)(Tt,{size:14,"aria-hidden":!0}),ct()]})]}),(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Te()}),t.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:tt()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:f.pageItems.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.label,children:e.label}),e.restricted?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:Re()}):null,n(e.userId,e.label),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:e.manager?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":Be(),title:Be(),children:(0,$.jsx)(wt,{size:15,"aria-hidden":!0})}):null}),(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:e.manager||e.lastGroup,"aria-label":H({user:e.label}),title:e.manager?Ke():e.lastGroup?m():H({user:e.label}),onClick:()=>void h(e.userId,e.label),children:(0,$.jsx)(Ot,{size:14,"aria-hidden":!0})})]},e.userId))}),(0,$.jsx)(cn,{page:f.page,pageCount:f.pageCount,onPage:d})]}),r!==void 0&&r.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-access__subhead`,children:Ie()}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:r.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,$.jsx)(J,{variant:e.status===`pending`?`secondary`:`outline`,className:`oc-access__role`,children:Qt(e.status)})]},e._id))})]}):null]})}function dn({groupId:e,member:t,onOpenChange:n}){let r=L(V.groups.getMemberAgentSettings,e&&t?{groupId:e,userId:t.userId}:`skip`),i=R(V.groups.setMemberAgents),a=R(V.groups.setMemberDefaultAgent),o=q();async function l(e){try{await e()}catch(e){o.error(F(),e)}}let u=r?.agents??[],d=new Map(u.map(e=>[X(e.instanceName,e.agentId),e])),f=[...d.keys()],p=new Set(u.filter(e=>e.allowed).map(e=>X(e.instanceName,e.agentId)));function m(n){if(!e||!t||!r)return;let a=Kt(f,p,r.restricted,n).map(e=>{let t=d.get(e);return{instanceName:t.instanceName,agentId:t.agentId}});l(()=>i({groupId:e,userId:t.userId,agents:a}))}return(0,$.jsx)(Ht,{open:t!==null,onOpenChange:n,children:(0,$.jsxs)(zt,{className:`oc-access`,children:[(0,$.jsxs)(Rt,{children:[(0,$.jsx)(Bt,{children:k({user:t?.label??``})}),(0,$.jsx)(Vt,{children:w()})]}),r===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):r===null||u.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Ge()}):(0,$.jsxs)($.Fragment,{children:[r.settable?null:(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ut()}),r.adminNarrowed?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ht()}):null,r.restrictedByAdmin&&!r.viewerIsAdmin?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:vt()}):null,(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,children:r.restricted?re():y()}),r.restricted?(0,$.jsx)(G,{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:N()}):null]}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:u.map(n=>{let i=X(n.instanceName,n.agentId),o=n.displayName??n.agentId;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(U,{checked:n.allowed,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>m(i),"aria-label":j({name:o})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:o,children:o}),n.limitedByAdmin?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:De()}):null,n.state===`deleted`?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:c()}):null,n.allowed?n.isMemberDefault?(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,disabled:!r.settable,"aria-label":He(),title:He(),onClick:()=>e&&t?void l(()=>a({groupId:e,userId:t.userId,agent:null})):void 0,children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,disabled:!r.settable,"aria-label":s(),title:s(),onClick:()=>e&&t?void l(()=>a({groupId:e,userId:t.userId,agent:{instanceName:n.instanceName,agentId:n.agentId}})):void 0,children:(0,$.jsx)(W,{size:14})}):null]},i)})})]})]})})}function fn({groupId:e,instanceName:t,kind:n,assigned:r,defaultKey:i,viewerIsAdmin:a,query:o}){let s=L(V.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),d=R(V.groups.assignAgentToGroup),f=R(V.groups.removeAgentFromGroup),p=R(V.groups.bulkSetGroupAgents),m=R(V.groups.claimAgentForGroup),h=R(V.groups.setGroupDefaultAgent),g=q(),[_,v]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{v(1)},[o]),!e)return null;let y=$t(s?.agents??[],o),b=s?.discovery&&!s.discovery.lastPollOk,C=e=>Zt({assigned:r.has(X(t,e.agentId)),claimable:e.claimable,reservedForGroup:e.reservedForGroup,enabled:e.enabled,present:e.presentInLastOk!==!1},a),w=y.filter(e=>C(e)!==`claim`),O=y.filter(e=>C(e)===`claim`);if(o.trim()&&y.length===0)return null;let k=w.filter(e=>C(e)===`toggle`&&e.presentInLastOk!==!1&&e.enabled!==!1),A=qt(k,e=>r.has(X(t,e.agentId))),j=Xt(w,_,sn);async function M(n,r){try{r?await f({groupId:e,instanceName:t,agentId:n}):await d({groupId:e,instanceName:t,agentId:n})}catch(e){g.error(u(),Y(e))}}async function N(){if(k.length===0)return;let n=k.map(e=>e.agentId);try{await p({groupId:e,instanceName:t,agentIds:n,assigned:A!==`all`})}catch(e){g.error(u(),Y(e))}}async function ne(n){try{await m({groupId:e,instanceName:t,agentId:n})}catch(e){g.error(ge(),e)}}async function P(n){try{await h({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){g.error(oe(),e)}}let F=e=>e.reservedForGroup?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:fe()}):e.reserved?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?me():ee({group:e.reservedGroupName})}):null;return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(Ct,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(J,{variant:`outline`,className:`oc-access__kind`,children:n}),b?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__stale`,children:pe()}):null]}),s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:D()}):y.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:b?S():de()}):(0,$.jsxs)($.Fragment,{children:[k.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(U,{checked:A===`all`||A===`some`&&`indeterminate`,onCheckedChange:()=>void N(),"aria-label":z()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:z()})]}):null,j.pageItems.map(e=>{let n=X(t,e.agentId),a=r.has(n),o=e.presentInLastOk===!1,s=C(e)===`locked`;return(0,$.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,$.jsx)(U,{checked:a,disabled:s&&!a,onCheckedChange:()=>void M(e.agentId,a),"aria-label":T({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,F(e),o?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:c()}):null,a?i===n?(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":l(),title:l(),onClick:()=>void P(null),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":bt(),title:bt(),onClick:()=>void P(e.agentId),children:(0,$.jsx)(W,{size:14})}):null]},e.agentId)}),(0,$.jsx)(cn,{page:j.page,pageCount:j.pageCount,onPage:v}),O.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-access__subhead`,children:E()}),(0,$.jsx)(`p`,{className:`oc-access__hint`,children:et()}),O.map(e=>{let t=e.displayName??e.agentId;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsxs)(`span`,{className:`oc-access__label`,title:t,children:[e.emoji?`${e.emoji} `:``,t]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,"aria-label":x({name:t}),onClick:()=>void ne(e.agentId),children:te()})]},e.agentId)})]}):null]})]})}function pn(){let e=L(V.groupInvites.listPendingInviteRequests,{}),t=R(V.groupInvites.decideGroupInvite),n=q();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(_e(),e)}}return(0,$.jsxs)(`section`,{className:`oc-invites`,"aria-label":Xe(),children:[(0,$.jsxs)(`h3`,{className:`oc-invites__title`,children:[(0,$.jsx)(Tt,{size:14,"aria-hidden":!0}),Xe(),(0,$.jsx)(J,{variant:`secondary`,children:e.length})]}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:e.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,$.jsxs)(`span`,{className:`oc-access__sub`,children:[e.groupName??`?`,` ·`,` `,at({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?ie():be()}),(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:je()}),(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:i()})]},e._id))})]})}function mn({groupId:e}){let t=L(V.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=R(V.charts.assignChartToGroup),r=R(V.charts.removeChartFromGroup),i=R(V.charts.setGroupDefaultChart),a=R(V.charts.addChartToGroupPool),o=R(V.charts.removeChartFromGroupPool),s=q();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ae()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(f(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(f(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(f(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(f(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(U,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":I({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":M(),title:M(),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:A()}):null,u?(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":v({name:e.name}),title:v({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,$.jsx)(Ot,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,$.jsxs)(Nt,{value:``,onValueChange:e=>void m(e),children:[(0,$.jsx)(At,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(kt,{placeholder:C()})}),(0,$.jsx)(jt,{children:l.map(e=>(0,$.jsx)(Mt,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:O()}):null:null]})}export{on 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,AI as s,An as c,Ao as l,BF as u,BP as d,CF as f,CI as p,Co as m,DF as h,DI as g,Dn as _,Do as v,EF as y,EI as b,En as ee,Eo as x,Eu as te,FF as S,FP as C,Fn as ne,Fo as re,GF as w,GP as T,GU as E,HF as D,HP as ie,IF as O,IP as k,J as ae,JF as oe,JP as se,K as ce,KF as le,KP as ue,KU as de,LF as fe,LP as pe,MF as me,Mn as he,Mo as ge,NF as _e,Nn as ve,No as ye,OF as be,OI as xe,On as Se,Oo as Ce,PF as we,Pn as Te,Po as Ee,Q as De,QF as Oe,QP as ke,RF as Ae,RP as je,SF as Me,SI as Ne,So as Pe,TF as Fe,TI as Ie,To as Le,Tu as Re,UF as ze,UP as Be,VF as Ve,VP as He,WF as Ue,WP as We,X as Ge,XF as Ke,XP as qe,XX as A,Y as Je,YF as Ye,YP as Xe,YX as j,Z as Ze,ZF as Qe,ZP as $e,_F as et,_I as tt,_y as nt,aF as rt,aI as it,bF as at,bI as ot,bo as st,cF as ct,cI as lt,cm as ut,dF as M,dI as dt,dm as ft,eF as pt,eI as mt,et as ht,fF as gt,fI as _t,gF as N,gI as P,gy as vt,hF as yt,hI as bt,hy as xt,iF as St,iI as Ct,jF as wt,jn as Tt,jo as Et,kF as Dt,kI as Ot,kn as kt,ko as At,lF as jt,lI as Mt,lm as Nt,mF as F,mI as Pt,nF as Ft,nI as It,oF as Lt,oI as Rt,pF as zt,pI as Bt,q as Vt,qF as I,qP as Ht,qX as L,rF as Ut,rI as Wt,sF as Gt,sI as Kt,t as R,tF as qt,tI as Jt,uI as Yt,um as Xt,vA as Zt,vF as Qt,vI as $t,wF as en,wI as tn,wo as nn,wu as rn,xF as an,xI as on,xo as sn,yA as cn,yF as ln,yI as un,yo as dn,zF as fn,zP as pn}from"./api-DSJJn0d7.js";import{a as mn,c as hn}from"./FieldLabel-Tea3wyVe.js";import{t as gn}from"./checkbox-CsI4ggnp.js";import{a as z,i as B,n as V,r as H,t as U}from"./select-qM3ZfTHx.js";import{n as _n,r as vn,t as yn}from"./popover-DBaIbsBr.js";import{t as W}from"./button-Dio0PVrp.js";import{t as G}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{r as K}from"./toast-xNFwDnUy.js";import{t as q}from"./badge-C4po8DQ1.js";import{a as bn,n as xn,o as Sn,r as Cn,t as wn}from"./dialog-BfrsWZiD.js";import{n as Tn}from"./ConfirmDialog-BXcki0Ee.js";import{t as En}from"./EntitySheet-B2B48bss.js";import{a as J}from"./groupManageView-BMBqgRhV.js";import{t as Dn}from"./DataTableShell-DRFFBx_j.js";import{InstanceConfigDialog as On}from"./BridgeTab-D4RFq-Rb.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:mn,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=A(R.admin.listInstances,{}),t=A(R.agents.listAllInstanceAgents,{}),n=j(R.admin.upsertInstance),a=j(R.widgets.setInstanceWidgets),o=j(R.admin.deleteInstance),u=K(),[d,f]=(0,Y.useState)(!1),[h,y]=(0,Y.useState)(Q),[S,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null),[E,D]=(0,Y.useState)(null),[O,k]=(0,Y.useState)(null);async function oe(){try{let t=await n({instanceId:O??void 0,name:h.name,gatewayUrl:h.gatewayUrl,bridgeUrl:h.bridgeUrl||void 0,displayName:h.displayName||void 0,kind:h.kind,transport:h.kind===`hermes`?h.transport:void 0,gatewayVersion:h.gatewayVersion||void 0,gatewayHttpUrl:h.gatewayHttpUrl||void 0,...h.kind===`openclaw`?{authMode:h.authMode,personScopes:h.personScopes,identitySource:h.identitySource,participantIdentity:h.participantIdentity,managePermissionModes:h.managePermissionModes,systemIdentity:h.systemIdentity||void 0}:{},streamTransport:h.streamTransport}),r=O===null?null:e?.find(e=>e._id===O),i=r?.config?.widgetsEnabled!==!1,o=r?.config?.widgetPromptConfirm===!0;h.kind===`openclaw`&&(h.widgetsEnabled!==i||h.widgetPromptConfirm!==o)&&await a({instanceId:t,enabled:h.widgetsEnabled,promptConfirm:h.widgetPromptConfirm}),y(Q),k(null),f(!1)}catch(e){u.error(xe(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),(0,Z.jsx)(`strong`,{children:b()}),Ie()]}),(0,Z.jsx)(Dn,{title:tn(),rows:e,addLabel:p(),onAdd:()=>{k(null),y(Q),f(!0)},emptyHint:Ne(),columns:[{header:on(),cell:e=>e.name,sort:e=>e.name},{header:ot(),cell:e=>(0,Z.jsx)(q,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:un(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:$t(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:s(),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)(q,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?ie():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Pt(),onSelect:()=>{k(e._id),y(Nn(e)),f(!0)}},{label:Ot(),onSelect:()=>C(e.name)},{label:i(),onSelect:()=>D(e)},{label:tt(),onSelect:()=>T(e)},{label:P(),variant:`destructive`,onSelect:()=>void o({instanceId:e._id})}],bulkActions:[{label:P(),variant:`destructive`,onSelect:e=>e.forEach(e=>void o({instanceId:e}))}]}),(0,Z.jsx)(En,{open:d,onOpenChange:f,title:O?Bt():bt(),description:dt(),canSubmit:!!(h.name&&h.gatewayUrl),onSubmit:oe,submitLabel:Yt(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Mt(),children:[(0,Z.jsx)(G,{value:h.name,disabled:O!==null,onChange:e=>y({...h,name:e.target.value})}),O?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_t()}):null]}),(0,Z.jsx)($,{label:lt(),children:(0,Z.jsxs)(U,{value:h.kind,onValueChange:e=>y({...h,kind:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(H,{value:`hermes`,children:`Hermes`})]})]})}),h.kind===`hermes`?(0,Z.jsx)($,{label:te(),children:(0,Z.jsxs)(U,{value:h.transport,onValueChange:e=>y({...h,transport:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`ws`,children:Re()}),(0,Z.jsx)(H,{value:`rest`,children:rn()})]})]})}):null,(0,Z.jsx)($,{label:Kt(),children:(0,Z.jsx)(G,{value:h.gatewayUrl,onChange:e=>y({...h,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:Rt(),children:(0,Z.jsx)(G,{value:h.bridgeUrl,placeholder:it(),onChange:e=>y({...h,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Ct(),children:(0,Z.jsx)(G,{value:h.displayName,onChange:e=>y({...h,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:cn(),children:[(0,Z.jsxs)(U,{value:h.streamTransport,onValueChange:e=>y({...h,streamTransport:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsx)(V,{children:hn.map(e=>(0,Z.jsx)(H,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Zt()})]}),(0,Z.jsx)($,{label:Wt(),children:(0,Z.jsx)(G,{value:h.gatewayVersion,placeholder:It(),onChange:e=>y({...h,gatewayVersion:e.target.value})})}),h.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:Le(),children:[(0,Z.jsxs)(U,{value:h.authMode,onValueChange:e=>y({...h,authMode:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`token`,children:nn()}),(0,Z.jsx)(H,{value:`trusted-proxy`,children:m()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.authMode===`trusted-proxy`?sn():Pe()})]}),h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:re(),children:[(0,Z.jsxs)(U,{value:h.personScopes,onValueChange:e=>y({...h,personScopes:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`capped`,children:Ee()}),(0,Z.jsx)(H,{value:`full`,children:ye()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.personScopes===`full`?Et():ge()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:l(),children:[(0,Z.jsxs)(U,{value:h.identitySource,onValueChange:e=>y({...h,identitySource:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`canonical`,children:At()}),(0,Z.jsx)(H,{value:`email`,children:Ce()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.identitySource===`email`?x():v()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:ne(),children:[(0,Z.jsxs)(U,{value:h.participantIdentity,onValueChange:e=>y({...h,participantIdentity:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`owner`,children:Te()}),(0,Z.jsx)(H,{value:`self`,children:ve()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.participantIdentity===`self`?ee():he()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:Tt(),children:[(0,Z.jsxs)(U,{value:h.managePermissionModes?`on`:`off`,onValueChange:e=>y({...h,managePermissionModes:e===`on`}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`off`,children:c()}),(0,Z.jsx)(H,{value:`on`,children:kt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.managePermissionModes?_():Se()})]}):null,h.kind===`openclaw`?(0,Z.jsxs)($,{label:ht(),children:[(0,Z.jsxs)(U,{value:h.widgetsEnabled?`on`:`off`,onValueChange:e=>y({...h,widgetsEnabled:e===`on`}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`on`,children:r()}),(0,Z.jsx)(H,{value:`off`,children:De()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:h.widgetsEnabled?Ze():Ge()})]}):null,h.kind===`openclaw`&&h.widgetsEnabled?(0,Z.jsxs)($,{label:Je(),children:[(0,Z.jsxs)(U,{value:h.widgetPromptConfirm?`on`:`off`,onValueChange:e=>y({...h,widgetPromptConfirm:e===`on`}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`off`,children:ae()}),(0,Z.jsx)(H,{value:`on`,children:Vt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:ce()})]}):null,h.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:st(),children:(0,Z.jsx)(G,{value:h.systemIdentity,placeholder:dn(),onChange:e=>y({...h,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:Jt(),children:(0,Z.jsx)(G,{value:h.gatewayHttpUrl,placeholder:mt(),onChange:e=>y({...h,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wn,{instanceName:S,open:S!==null,onOpenChange:e=>{e||C(null)}}),w?(0,Z.jsx)(On,{instance:w,onClose:()=>T(null)},w._id):null,E?(0,Z.jsx)(Fn,{instance:E,onClose:()=>D(null)},E._id):null]})}function Fn({instance:e,onClose:t}){let n=A(R.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)(wn,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(xn,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(Sn,{children:Oe({instance:e.displayName??e.name})}),(0,Z.jsx)(Cn,{children:Qe()})]}),(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=L(R.instanceSync.forceInstanceSync),n=K(),[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(wt());break;case`no_agents`:n.success(Dt());break;case`no_bridge_url`:n.error(be());break;case`deploy_misconfigured`:n.error(h());break;case`unauthorized`:n.error(Fe());break;case`not_served`:n.error(en());break;default:n.error(y());break}}catch(e){n.error(o(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?me():_e()})})]})}function Ln({instance:e}){let t=A(R.bridgeAuth.listBridgeAuthStatus,{}),n=L(R.bridgeAuth.mintBridgeSecret),r=j(R.bridgeAuth.revokeBridgeSecret),i=K(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{let t=await n({instanceId:e._id});c(t.plaintext),u(!1)}catch(e){i.error(N(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(et())}catch(e){i.error(N(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:Me(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:an()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(q,{variant:f?`outline`:`secondary`,children:f?`${I()} · ${d.prefix}…${d.lastFour}`:le()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(W,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?ln():at()}),f?(0,Z.jsx)(W,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:Qt()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:yt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?de():E()})]}),(0,Z.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:F()})]}):null]})}function Rn({instanceId:e,field:t,updatedAt:n}){let r=L(R.instanceSecrets.setInstanceSecret),i=j(R.instanceSecrets.clearInstanceSecret),a=L(R.deviceIdentity.generateDeviceIdentity),o=K(),[s,c]=(0,Y.useState)(``),[l,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?Ke():t===`deviceIdentity`?Ye():oe();async function y(){if(!(!s.trim()||l)){d(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),p(null),h(!1),o.success(Ve())}catch(e){o.error(u(),e)}finally{d(!1)}}}async function b(){if(!l){d(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(fn())}catch(e){o.error(u(),e)}finally{d(!1)}}}async function ee(){if(!l){d(!0);try{let t=await a({instanceId:e});p(t),h(!1),o.success(O())}catch(e){o.error(we(),e)}finally{d(!1)}}}let x=f?`openclaw devices approve ${f.id}`:``;async function te(){if(x)try{await navigator.clipboard.writeText(x),h(!0)}catch{}}return(0,Z.jsxs)($,{label:v,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(q,{variant:g?`outline`:`secondary`,children:g?I():le()}),(0,Z.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?Ue():w(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(W,{size:`sm`,onClick:()=>void y(),disabled:l||s.trim().length===0,children:ze()}),_?(0,Z.jsx)(W,{size:`sm`,variant:`outline`,onClick:()=>void ee(),disabled:l,children:Ae()}):null,g?(0,Z.jsx)(W,{size:`sm`,variant:`destructive`,onClick:()=>void b(),disabled:l,children:D()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:O()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:x}),(0,Z.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:m?de():E()})]}),(0,Z.jsx)(W,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:F()})]}):null]})}var zn={conversational:Ut,documentary:qt,summarizer:ft,curator:Nt},Bn={conversational:Ft,documentary:pt,summarizer:Xt,curator:ut},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:Gt()}),t.map(e=>(0,Z.jsx)(q,{variant:`secondary`,className:`oc-agenttype__chip`,title:Hn(e),children:Vn(e)},e)),(0,Z.jsxs)(yn,{children:[(0,Z.jsx)(vn,{asChild:!0,children:(0,Z.jsx)(W,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Lt()})}),(0,Z.jsxs)(_n,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:rt()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:St()}),(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)(gn,{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=A(R.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=j(R.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=j(R.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=j(R.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jn(r);e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=j(R.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(R.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(R.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=j(R.agents.removeInstanceAgent),u=j(R.agents.setAgentReservation),f=A(R.groups.listGroupLabels,t?{}:`skip`),p=Tn(),m=K();async function h(t,n){if(e&&await p({title:je({name:n}),description:pe(),confirmLabel:pn()}))try{await u({instanceName:e,agentId:t,groupId:null})}catch(e){m.error(M(),J(e))}}async function g(t,n,r){if(!e)return;let i=(f??[]).find(e=>e._id===r)?.name??`?`;if(await p({title:nt({name:n,group:i}),description:vt({group:i}),confirmLabel:xt()}))try{await u({instanceName:e,agentId:t,groupId:r})}catch(e){m.error(M(),J(e))}}async function _(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){m.error(M(),e)}}async function v(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){m.error(M(),e)}}async function y(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){m.error(M(),e)}}async function b(t,n){if(e&&await p({title:$e({name:n}),description:qe(),confirmLabel:Xe(),destructive:!0}))try{await l({instanceName:e,agentId:t}),m.success(se())}catch(e){m.error(M(),e)}}return(0,Z.jsx)(wn,{open:t,onOpenChange:n,children:(0,Z.jsxs)(xn,{className:`oc-access`,children:[(0,Z.jsxs)(bn,{children:[(0,Z.jsx)(Sn,{children:zt({name:e??``})}),(0,Z.jsx)(Cn,{children:gt()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ht()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ue():r.discovery.lastPollOk?T():We({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Be()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,o=t.displayName??t.agentId,s=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)(gn,{checked:t.enabled,disabled:n,"aria-label":o,onCheckedChange:e=>void _(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:o,children:[t.emoji?`${t.emoji} `:``,o]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,t.reserved?(0,Z.jsx)(q,{variant:`outline`,children:t.reserved.groupName===null?d():He({group:t.reserved.groupName})}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{variant:`outline`,className:`oc-access__gone`,children:C()}),(0,Z.jsx)(W,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void b(t.agentId,o),children:ke()})]}):i?(0,Z.jsx)(q,{variant:`default`,children:ie()}):(0,Z.jsx)(W,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void v(t.agentId),children:a()})]}),t.reserved?(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(W,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void h(t.agentId,o),children:pn()}),(0,Z.jsxs)(U,{value:``,onValueChange:e=>void g(t.agentId,o,e),children:[(0,Z.jsx)(B,{size:`sm`,className:`h-7`,children:(0,Z.jsx)(z,{placeholder:k()})}),(0,Z.jsx)(V,{children:(f??[]).filter(e=>e._id!==t.reserved?.groupId).map(e=>(0,Z.jsx)(H,{value:e._id,children:e.name},e._id))})]})]}):null,t.enabled?(0,Z.jsx)(Un,{agentId:t.agentId,types:s,onToggle:e=>void y(t.agentId,e,s)}):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(M(),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)(G,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:jt(),"aria-label":ct(),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,Dh as i,Eh as a,Mh as o,Oh as s,Th as c,XX as l,YX as u,_R as d,bR as f,cR as p,dR as m,fR as h,gR as g,hR as _,jh as v,kh as y,lR as b,mR as x,pR as S,qX as C,t as w,uR as T,vR as E,wh as D,xR as O,yR as k}from"./api-DSJJn0d7.js";import{t as A}from"./checkbox-CsI4ggnp.js";import"./select-qM3ZfTHx.js";import{t as j}from"./button-Dio0PVrp.js";import{t as M}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{t as N}from"./badge-C4po8DQ1.js";var P=t(e(),1),F=n();function I(){let e=l(w.integrations.status.status,{}),t=u(w.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:O()});let a=n,s=(e,t,n)=>i({...a,[e]:{...a[e],[t]:n}}),c=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,F.jsx)(`strong`,{children:k()}),` `,E()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:d()}):(0,F.jsx)(N,{variant:`outline`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:_()}),note:x(),children:[(0,F.jsx)(R,{label:h(),children:(0,F.jsx)(M,{value:a.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>s(`langfuse`,`host`,e.target.value),onBlur:()=>c(`langfuse`,{host:a.langfuse.host??``})})}),(0,F.jsx)(z,{label:p(),checked:a.langfuse.enabled??!0,onChange:e=>{s(`langfuse`,`enabled`,e),c(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:d()}):(0,F.jsx)(N,{variant:`outline`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:_()}),note:S(),children:[(0,F.jsx)(R,{label:m(),children:(0,F.jsx)(M,{value:a.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>s(`opik`,`baseUrl`,e.target.value),onBlur:()=>c(`opik`,{baseUrl:a.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:T(),children:(0,F.jsx)(M,{value:a.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||b(),onChange:e=>s(`opik`,`workspace`,e.target.value),onBlur:()=>c(`opik`,{workspace:a.opik.workspace??``})})}),(0,F.jsx)(z,{label:p(),checked:a.opik.enabled??!0,onChange:e=>{s(`opik`,`enabled`,e),c(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:d()}):(0,F.jsx)(N,{variant:`outline`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:o()}),note:v(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(M,{value:a.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>s(`otlp`,`endpoint`,e.target.value),onBlur:()=>c(`otlp`,{endpoint:a.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:p(),checked:a.otlp.enabled??!0,onChange:e=>{s(`otlp`,`enabled`,e),c(`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)(A,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=C(w.integrations.otlpSecret.setOtlpHeaders),n=u(w.integrations.otlpSecret.clearOtlpHeaders),[r,o]=(0,P.useState)(``),[l,d]=(0,P.useState)(null),[f,p]=(0,P.useState)(!1),m=async()=>{p(!0),d(null);try{await t({headersJson:r}),o(``)}catch(e){d(e instanceof Error?e.message:String(e))}finally{p(!1)}};return(0,F.jsxs)(R,{label:y(),children:[(0,F.jsx)(M,{value:r,placeholder:e?s():i(),onChange:e=>o(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(j,{size:`sm`,disabled:f||r.trim().length===0,onClick:()=>void m(),children:a()}),e?(0,F.jsx)(j,{variant:`ghost`,size:`sm`,disabled:f,onClick:()=>void n({}),children:c()}):null]}),l?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:l}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:D()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Av as i,Fv as a,Lv as o,Mv as s,Qv as c,XX as l,Xv as u,YX as d,Zv as f,ay as p,ey as m,iy as h,jv as g,ny as _,ry as v,t as y,ty as b,yU as x}from"./api-DSJJn0d7.js";import{t as S}from"./loader-circle-BNhIFGdg.js";import{t as ee}from"./rotate-ccw-BD-9XzMC.js";import"./convexApi-CyScjgcq.js";import{r as C,t as w}from"./capabilities-BTqhMVxR.js";var T=t(e(),1),E={thinkingLevel:`segmented`,model:`list`,fastMode:`segmented`};function D(e,t){return E[e]===`segmented`&&t<=5?`segmented`:`list`}function O(e,t){return e!=null&&e[t]!==void 0}var k=[`inherit`,`fast`,`standard`];function A(e){return e==null||e.fastMode===void 0?`inherit`:e.fastMode?`fast`:`standard`}function j(e){return e===`inherit`?c():e===`fast`?f():u()}function M(e){return e===`inherit`?null:e===`fast`}function N(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function P(e){return e.length?e[0].toUpperCase()+e.slice(1):e}var F={off:`Off`,minimal:`Min`,low:`Low`,medium:`Med`,high:`High`,xhigh:`XHigh`};function I(e,t){return F[e]??t}function L(e){return R(e).used}function R(e){if(!e)return{used:null,source:`unknown`};let t=e.contextTokens,n=e=>e==null||t&&e>t?null:e;if(e.estimatedPromptTokens!=null)return{used:e.estimatedPromptTokens,source:`budget_estimate`};let r=n(e.activeTokens);if(r!=null)return{used:r,source:`last_call_usage`};if(e.totalTokensFresh===!1)return{used:null,source:`unknown`};let i=n(e.totalTokens);return i==null?{used:null,source:`unknown`}:{used:i,source:`last_call_usage`}}function z(e){return e?e.promptBudgetBeforeReserve!=null&&e.promptBudgetBeforeReserve>0?e.promptBudgetBeforeReserve:e.contextTokens!=null&&e.contextTokens>0?e.contextTokens:null:null}function B(e){if(!e)return null;if(e.sessionOverfull===!0)return`compaction_failed`;let t=L(e),n=z(e);return t!=null&&n!=null&&t>n?`estimate_exceeds_budget`:null}function V(e){return R(e).source}function H(e,t){return e==null||!t||t<=0?null:Math.round(e/t*100)}function U(e,t){let n=H(e,t);return n===null?null:o({pct:n,used:N(e),total:N(t)})}function W(e){return a({level:e??`full`})}function G(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?s({cost:e.toFixed(2),tokens:N(t)}):n?g({cost:e.toFixed(2)}):r?i({tokens:N(t)}):null}function K(e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` · `):null}function q(e,t=5){let n=e?.contextPercent;if(typeof n!=`number`||!Number.isFinite(n))return null;let r=L(e),i=z(e);if(r===null||i===null)return null;let a=H(r,i);if(a===null)return null;let o=Math.abs(n-a);return o<=t?null:{gateway:n,derived:a,delta:o}}function J(e,t){let n=l(y.compat.forChat,e===null?`skip`:{chatId:e,...t?{routedAgent:t}:{}}),r=n==null?null:n.capabilities;return{can:(0,T.useCallback)(e=>w(r,e),[r]),resolved:r!==null,loading:n===void 0,gatewayVersion:n?.gatewayVersion??null,provider:n?.provider??null,beyondValidated:n?.versionBeyondValidated===!0}}var Y=n();function X(e){let t=d(y.chats.setSessionKnob),[n,r]=(0,T.useState)(null),[i,a]=(0,T.useState)(null);return{apply:(0,T.useCallback)(async(n,i)=>{r(n),a(null);let o={chatId:e};n===`fastMode`?o.fastMode=i:o[n]=i;try{await t(o)}catch{a({field:n,value:i})}finally{r(null)}},[e,t]),pending:n,error:i}}function Z({label:e,overridden:t,onReset:n,pending:r,error:i,onRetry:a,help:o,children:s,resettable:c=!0}){return(0,Y.jsxs)(`div`,{className:`oc-spanel__row${t?` is-overridden`:``}`,children:[(0,Y.jsxs)(`div`,{className:`oc-spanel__rowhead`,children:[(0,Y.jsx)(`span`,{className:`oc-spanel__label`,children:e}),r?(0,Y.jsx)(S,{size:13,className:`oc-spanel__spin`,"aria-label":v()}):t?c?(0,Y.jsx)(`button`,{type:`button`,className:`oc-spanel__reset`,title:h(),"aria-label":h(),onClick:n,children:(0,Y.jsx)(ee,{size:12,"aria-hidden":!0})}):null:(0,Y.jsx)(`span`,{className:`oc-spanel__badge`,children:p()})]}),(0,Y.jsx)(`div`,{className:`oc-spanel__ctl`,children:s}),o?(0,Y.jsx)(`p`,{className:`oc-spanel__help`,children:o}):null,i?(0,Y.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[_(),(0,Y.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:a,children:b()})]}):null]})}function Q({options:e,value:t,onChange:n,ariaLabel:r,disabled:i}){return(0,Y.jsx)(`div`,{className:`oc-spanel__seg`,role:`group`,"aria-label":r,children:e.map(e=>(0,Y.jsx)(`button`,{type:`button`,className:`oc-spanel__seg-btn${t===e.id?` is-active`:``}`,"aria-pressed":t===e.id,title:e.title??e.label,"aria-label":e.title??e.label,disabled:i,onClick:()=>{e.id!==t&&n(e.id)},children:e.label},e.id))})}function te({options:e,value:t,onChange:n,disabled:r,ariaLabel:i}){let a=t===null||e.some(e=>e.id===t);return(0,Y.jsxs)(`select`,{className:`oc-spanel__select`,value:t??``,disabled:r,"aria-label":i,onChange:e=>{e.target.value&&e.target.value!==t&&n(e.target.value)},children:[t===null?(0,Y.jsx)(`option`,{value:``,disabled:!0,children:`—`}):null,a?null:(0,Y.jsx)(`option`,{value:t,children:t}),e.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function $({field:e,options:t,value:n,onChange:r,disabled:i,ariaLabel:a}){return D(e,t.length)===`list`?(0,Y.jsx)(te,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a}):(0,Y.jsx)(Q,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a})}function ne({chatId:e,sm:t,settings:n}){let{apply:i,pending:a,error:o}=X(e),{can:s}=J(e),c=a!==null,l=(0,T.useCallback)(()=>{o&&i(o.field,o.value)},[i,o]),u=t.thinkingLevels??[],d=t.availableModels??[],f=A(n),p=C(s,{hasModels:d.length>0,hasLevels:u.length>0});return(0,Y.jsxs)(Y.Fragment,{children:[p.model?(0,Y.jsx)(Z,{label:x(),overridden:O(n,`model`),onReset:()=>void i(`model`,null),pending:a===`model`,error:o?.field===`model`,onRetry:l,resettable:p.reset,children:(0,Y.jsx)($,{field:`model`,options:d,value:t.model??null,onChange:e=>void i(`model`,e),disabled:c,ariaLabel:x()})}):null,p.thinking?(0,Y.jsx)(Z,{label:m(),overridden:O(n,`thinkingLevel`),onReset:()=>void i(`thinkingLevel`,null),pending:a===`thinkingLevel`,error:o?.field===`thinkingLevel`,onRetry:l,resettable:p.reset,children:(0,Y.jsx)($,{field:`thinkingLevel`,ariaLabel:m(),options:u.map(e=>({id:e.id,label:I(e.id,P(e.label)),title:P(e.label)})),value:t.thinkingLevel??null,onChange:e=>void i(`thinkingLevel`,e),disabled:c})}):null,p.speed?(0,Y.jsx)(Z,{label:r(),overridden:O(n,`fastMode`),onReset:()=>void i(`fastMode`,null),pending:a===`fastMode`,error:o?.field===`fastMode`,onRetry:l,resettable:p.reset,children:(0,Y.jsx)($,{field:`fastMode`,ariaLabel:r(),options:k.map(e=>({id:e,label:j(e)})),value:f,onChange:e=>void i(`fastMode`,M(e)),disabled:c})}):null]})}export{P as a,H as c,G as d,L as f,W as g,O as h,K as i,q as l,N as m,ne as n,U as o,z as p,J as r,B as s,$ as t,V as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AO as r,CO as i,Cz as a,DO as o,EO as s,FO as c,IO as l,MO as u,NO as d,OO as f,PO as p,SO as m,Sz as h,TO as g,XX as _,Yz as v,jO as ee,kO as te,mz as y,pz as b,t as x,wO as S,wz as C,xz as w}from"./api-DSJJn0d7.js";import{n as T,t as E}from"./useNavigate-D3GIoxyW.js";import"./convexApi-CyScjgcq.js";import{c as D,n as O,o as ne}from"./searchSchemas-Dm-Qg010.js";import{t as re}from"./appHost-CH3EGcJw.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-CerX9wDn.js";import{n as P,t as F}from"./TimeRangePicker-D3PJq1H8.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=_(x.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=_(x.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:v()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:C()}),(0,z.jsx)(M,{children:h()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):(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),o=e=>74-e*68/r,s=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${o(e).toFixed(1)}`).join(` `),c=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:[b(),` p50 `,V(c.cP50),` `,a()]}),(0,z.jsxs)(`span`,{children:[y(),` p50 `,V(c.aP50),` `,a()]})]}),(0,z.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":C(),children:[(0,z.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,z.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var W=[{metric:`api.calls`,label:l(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:c(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:p(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:d(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:u(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:ee(),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=T({from:`/settings/kpi`}),t=E({from:`/settings/kpi`}),n=ne(e.from,e.to,O,`now`),r=e=>void t({search:t=>({...t,...D(e)})}),{from:i,to:a}=P(n),{rowLimit:c,buckets:l}=Y(i,a),u=_(x.kpi.listKpis,{limit:c,filter:{from:i,to:a}}),d=(0,I.useMemo)(()=>{let e=new Map;for(let t of u??[]){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>l&&e.set(t,n.slice(n.length-l));return e},[u,l]),p=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[te(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:f()})]}),(0,z.jsx)(ae,{value:n,onChange:r})]});return u===void 0?(0,z.jsxs)(z.Fragment,{children:[p,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}):u.length===0?(0,z.jsxs)(z.Fragment,{children:[p,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}):(0,z.jsxs)(z.Fragment,{children:[p,(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:g({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:S()}),(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:i({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":m({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{AG as r,AX as i,BG as a,BX as o,Bc as s,CG as c,CX as l,Cc as u,DG as d,DX as f,EG as p,EX as m,Ec as h,FG as g,FX as _,HG as v,IG as ee,LG as te,MG as ne,MX as re,NG as ie,OG as ae,OX as oe,PG as se,Pc as ce,RG as le,SG as ue,SX as de,Sc as fe,TG as pe,TX as me,Tc as he,UG as ge,VG as y,XX as b,YX as x,_G as S,_X as C,aG as w,bG as T,bX as E,bc as D,cG as O,dG as k,dX as A,fG as j,fX as M,gG as N,gX as P,hG as F,hX as I,iG as L,jG as _e,jX as ve,kG as ye,kX as be,lG as xe,lX as Se,mG as Ce,mX as we,oG as Te,pG as R,pX as Ee,r as z,sG as De,t as B,uG as Oe,uI as ke,uX as Ae,vG as je,vX as Me,wG as Ne,wX as Pe,wc as Fe,xG as Ie,xX as Le,xc as Re,yG as ze,yX as Be,yc as Ve,zG as He,zc as Ue}from"./api-DSJJn0d7.js";import{t as V}from"./checkbox-CsI4ggnp.js";import{a as We,i as Ge,n as Ke,r as H,t as qe}from"./select-qM3ZfTHx.js";import{t as U}from"./button-Dio0PVrp.js";import{t as W}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{c as Je,d as Ye,r as Xe,t as Ze,u as Qe}from"./useFontScale-ByBFat3y.js";import{r as $e}from"./toast-xNFwDnUy.js";import{t as G}from"./badge-C4po8DQ1.js";import{t as K}from"./appHost-CH3EGcJw.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-CPTpWNQm.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:z(`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:z(`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:()=>ge()},{id:`composer`,label:()=>v()},{id:`sidebar`,label:()=>y()},{id:`notifications`,label:()=>Ne()},{id:`other`,label:()=>a()}],X={showSource:{category:`messages`,label:()=>He(),help:()=>le()},showReport:{category:`messages`,label:()=>te(),help:()=>ee()},copyAssistant:{category:`messages`,label:()=>g()},copyUser:{category:`messages`,label:()=>se()},showDelete:{category:`messages`,label:()=>ie()},showTools:{category:`messages`,label:()=>ne(),help:()=>_e()},voiceInput:{category:`composer`,label:()=>r(),help:()=>ye()},showUsage:{category:`composer`,label:()=>ae(),help:()=>d()},autoReadAloud:{category:`composer`,label:()=>s(),help:()=>Ue()},showChatAge:{category:`sidebar`,label:()=>p(),help:()=>pe()},notifSound:{category:`notifications`,label:()=>c(),help:()=>ue()},notifSystem:{category:`notifications`,label:()=>Ie(),help:()=>T()},replySound:{category:`notifications`,label:()=>ze(),help:()=>je()}};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`||e!==`off`&&null}function ct(e){return at(e)?it[e]:void 0}var lt={voiceInput:()=>O()};function ut({prefKey:e,ui:t}){let n=x(B.admin.setUiPrefDefault),r=x(B.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:j()}),(0,J.jsxs)(qe,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(Ge,{size:`sm`,className:`w-36`,children:(0,J.jsx)(We,{})}),(0,J.jsxs)(Ke,{children:[(0,J.jsx)(H,{value:`on`,children:Te()}),(0,J.jsx)(H,{value:`off`,children:w()}),(0,J.jsx)(H,{value:`inherit`,children:L()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(V,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":k()}),k()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=x(B.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[h(),e?(0,J.jsx)(G,{variant:`secondary`,children:Ye(e,Je())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?u():r?Fe():he()})]}),(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:Ve()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?D():e?Re():fe()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=b(B.me.getMe,{host:K}),a=i?.ui,s=$(i?.role)&&n,c=x(B.me.setUiPref).withOptimisticUpdate(Xe),l=(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)(V,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":R()}),R()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:Oe()}),(0,J.jsx)(`p`,{children:xe()}),(0,J.jsx)(`p`,{children:De()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:S(),"aria-label":S(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:N()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],o=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)(G,{variant:`outline`,children:F()}):l?(0,J.jsx)(G,{variant:`secondary`,children:ce()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:Ce()}):null,(0,J.jsx)(nt,{checked:o,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,J.jsx)(ut,{prefKey:e,ui: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:o()})}var pt={sm:()=>E(),md:()=>Be(),lg:()=>Me(),xl:()=>C(),"2xl":()=>P(),"3xl":()=>I()};function mt(){let e=b(B.me.getMe,{host:K}),t=x(B.me.setLocale),n=x(B.me.setTimezone),r=x(B.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(B.me.getMe,{host:K});n&&e.setQuery(B.me.getMe,{host:K},{...n,fontScale:t,resolvedFontScale:t??`md`})}),a=x(B.me.setMyName),o=$e(),s=e?.locale??`default`,c=e?.name??``,[u,d]=(0,q.useState)(null),p=u??c,h=p.trim()!==c.trim();async function g(){try{await a({name:p}),d(null),o.success(oe())}catch(e){o.error(f(),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:re()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:p,maxLength:120,placeholder:i(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h&&(e.preventDefault(),g())}}),(0,J.jsx)(U,{size:`sm`,disabled:!h,onClick:()=>void g(),children:ke()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:be()})]}),(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:m()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(U,{variant:s===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(U,{variant:s==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:_()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Pe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:we()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(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)(U,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:M()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:A()})]}),(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:l()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:Ze.map(t=>(0,J.jsx)(U,{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:Le()})]}),(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:Ae()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(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{$D as r,$E as i,AD as a,BD as o,BX as s,CD as c,DD as l,E as u,ED as d,FD as f,ID as p,KC as m,KD as h,Ko as ee,LD as g,MD as _,OD as te,PD as v,QD as y,QE as ne,RD as b,SD as re,TD as x,UD as ie,WD as ae,XD as oe,XE as se,XX as S,YD as ce,YX as C,ZE as le,_D as ue,aD as w,aO as de,bD as fe,dD as pe,eD as me,fD as T,gD as he,gE as ge,iO as _e,jD as ve,kD as E,mD as D,nD as O,pD as ye,qo as be,rD as k,rO as xe,sD as Se,t as A,tD as j,vD as M,wD as Ce,xD as we,yD as Te}from"./api-DSJJn0d7.js";import{n as Ee,t as N}from"./useNavigate-D3GIoxyW.js";import{A as De,B as Oe,C as P,D as ke,E as F,F as Ae,G as je,H as Me,I,J as Ne,K as L,R as Pe,S as R,T as Fe,U as Ie,V as Le,W as z,_ as Re,a as B,f as V,h as ze,i as Be,j as Ve,m as He,n as H,o as U,p as W,r as Ue,s as G,t as We,u as Ge,w as Ke,x as qe,y as Je,z as Ye}from"./useStartNewChat-BszDHUjD.js";import{r as Xe}from"./dist-ClkJChBn.js";import{t as Ze}from"./chevron-right-C_b_y922.js";import{c as Qe,g as $e,i as et,n as tt,r as K,s as nt,t as rt}from"./dropdown-menu-DHMOOlaP.js";import{n as it,t as at}from"./eye-B-ipuYEd.js";import{t as ot}from"./list-eSch39T9.js";import{t as st}from"./pencil-aUWxuLhy.js";import{t as ct}from"./trash-2-B4WSfc7G.js";import{t as q}from"./button-Dio0PVrp.js";import{t as lt}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{r as ut}from"./toast-xNFwDnUy.js";import{n as dt,r as ft}from"./ConfirmDialog-BXcki0Ee.js";import{t as pt}from"./EntitySheet-B2B48bss.js";import{r as mt,t as ht}from"./trashView-Ct0Xw-a9.js";var gt=u(`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`}]]),_t=u(`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`}]]),vt=u(`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`}]]),J=u(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Y=t(e(),1),X=n();function yt({className:e}){return(0,X.jsx)(Qe,{asChild:!0,children:(0,X.jsx)(q,{variant:`ghost`,size:`icon-xs`,"aria-label":k(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,X.jsx)($e,{})})})}function Z({folderId:e,name:t,color:n,currentParentId:r,className:a,onOpen:s}){let c=C(A.projects.renameProject),l=C(A.projects.setProjectColor),u=C(A.projects.moveProject),d=C(A.projects.deleteProject),f=C(A.projects.createProject),p=dt(),m=mt(),h=ft(),[ee,g]=(0,Y.useState)(!1),[_,te]=(0,Y.useState)(t),[v,y]=(0,Y.useState)(!1),[b,re]=(0,Y.useState)(!1),x=S(A.projects.projectTreeCount,b?{projectId:e}:`skip`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(rt,{onOpenChange:e=>e&&re(!0),children:[(0,X.jsx)(yt,{className:a}),(0,X.jsxs)(tt,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(K,{onSelect:()=>s(),children:[(0,X.jsx)(L,{}),` `,o()]}),(0,X.jsxs)(K,{onSelect:()=>{te(t),g(!0)},children:[(0,X.jsx)(st,{}),` `,O()]}),(0,X.jsxs)(K,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await h({title:ve(),label:de(),placeholder:_e(),confirmLabel:xe()});t&&await f({name:t,parentId:e})})},children:[(0,X.jsx)(je,{}),` `,ve()]}),(0,X.jsxs)(K,{onSelect:()=>y(!0),children:[(0,X.jsx)(_t,{}),` `,ye()]}),(0,X.jsx)(et,{children:i()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void l({projectId:e,color:null}),"aria-label":ne(),children:`✕`}),Be.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void l({projectId:e,color:t.value})},t.value))]}),(0,X.jsx)(nt,{}),(0,X.jsxs)(K,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=x?.folders??0,r=x?.chats??0;await p({title:ie({name:t}),description:ht({folders:n,chats:r,days:m}),confirmWord:w(),confirmLabel:ae(),destructive:!0})&&await d({projectId:e})})},children:[(0,X.jsx)(ct,{}),` `,w()]})]})]}),(0,X.jsx)(pt,{open:ee,onOpenChange:g,title:ce(),canSubmit:_.trim().length>0,onSubmit:async()=>{await c({projectId:e,name:_.trim()}),g(!1)},submitLabel:O(),children:(0,X.jsx)(lt,{value:_,onChange:e=>te(e.target.value),autoFocus:!0})}),v?(0,X.jsx)(Ue,{open:v,onOpenChange:y,title:pe(),movingFolderId:e,currentId:r,onPick:t=>void u({projectId:e,parentId:t})}):null]})}function Q({chat:e,currentFolderId:t,className:n}){let r=C(A.chats.pinChat),i=C(A.chats.deleteChat),a=C(A.chats.renameChat),o=C(A.chats.setChatSidebar),s=C(A.chats.moveChatToProject),c=dt(),l=mt(),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(e.title??``),[m,h]=(0,Y.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(rt,{children:[(0,X.jsx)(yt,{className:n}),(0,X.jsxs)(tt,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(K,{onSelect:()=>{p(e.title??``),d(!0)},children:[(0,X.jsx)(st,{}),` `,O()]}),(0,X.jsxs)(K,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,X.jsx)(Ye,{}):(0,X.jsx)(Oe,{}),e.pinned?j():me()]}),(0,X.jsxs)(K,{onSelect:()=>h(!0),children:[(0,X.jsx)(_t,{}),` `,D()]}),e.pinned&&e.inSidebar?null:(0,X.jsxs)(K,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,X.jsx)(Le,{}):(0,X.jsx)(J,{}),e.inSidebar?g():b()]}),(0,X.jsx)(nt,{}),(0,X.jsxs)(K,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await c({title:le(),description:se({days:l}),confirmLabel:w(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,X.jsx)(ct,{}),` `,w()]})]})]}),(0,X.jsx)(pt,{open:u,onOpenChange:d,title:ge(),canSubmit:f.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:f.trim()}),d(!1)},submitLabel:O(),children:(0,X.jsx)(lt,{value:f,onChange:e=>p(e.target.value),autoFocus:!0})}),m?(0,X.jsx)(Ue,{open:m,onOpenChange:h,title:T(),currentId:t,onPick:t=>void s({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}=Ne({from:`/project/$projectId`}),t=N(),n=S(A.projects.projectPage,{projectId:e});return(0,X.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:s()}):n===null?(0,X.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,X.jsx)(`h2`,{children:Te()}),(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:M()}),(0,X.jsx)(q,{variant:`outline`,onClick:()=>void t({to:`/`}),children:ue()})]}):(0,X.jsx)(kt,{page:n})})}function kt({page:e}){let t=N(),n=dt(),a=mt(),o=ft(),s=ut(),u=C(A.projects.renameProject),h=C(A.projects.setProjectColor),g=C(A.projects.deleteProject),y=C(A.projects.createProject),b=C(A.projects.moveProject),x=C(A.projects.setProjectSidebar),se=C(A.chats.moveChatToProject),le=C(A.chats.reorderChat),ue=C(A.projects.reorderProject),me=S(A.projects.projectTreeCount,{projectId:e.project._id}),[T,ge]=(0,Y.useState)(wt),E=e=>{localStorage.setItem(Ct,e),ge(e)},D=S(A.projects.folderColumns,T===`columns`?{projectId:e.project._id}:`skip`),k=S(A.projects.projectTreeList,T===`list`?{projectId:e.project._id}:`skip`),{c:j}=Ee({from:`/project/$projectId`}),M=S(A.projects.listProjects,{}),Ce=S(A.chatReads.myBusyChats,{}),Te=(0,Y.useMemo)(()=>new Set(Ce??[]),[Ce]),{byChat:Oe}=Pe(Ce??null),P=S(A.chatReads.myChatReads,{}),F=(0,Y.useMemo)(()=>St(e.chats,P??[]),[e.chats,P]),{startNewChat:I,picker:Ne}=We(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[L,Le]=(0,Y.useState)(``),[B,V]=(0,Y.useState)(!1),[H,Ye]=(0,Y.useState)(e.project.name),[Xe,Ze]=(0,Y.useState)(!1),[J,yt]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{let e=setTimeout(()=>yt(L.trim()),180);return()=>clearTimeout(e)},[L]);let Z=S(A.search.searchConversations,J.length>=2?{query:J,projectId:e.project._id}:`skip`),Q=Fe(Ke(Re,{activationConstraint:{distance:4}}),Ke(Je,{activationConstraint:{delay:250,tolerance:8}})),$=(0,Y.useRef)(!1),Tt=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Et,Ot]=(0,Y.useState)(null),kt=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),i=e.chats.find(e=>e._id===n),a=D?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(i??a)?.title||r()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(M??[]).find(t=>t._id===e)?.name??``}}return null},Mt=e=>Ot(kt(String(e.active.id))),Pt=(0,Y.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=R(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=R(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=R(n(`crumb:`));if(a.length>0)return a;let o=R(n(`col:`));return o.length>0?o:qe(n(t?`folder:`:`chat:`))},[]),It=t=>{if(T===`columns`){for(let e of D?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(T===`list`){let e=k?.chats.find(e=>e._id===t);return e?{list:k.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(T===`columns`){for(let e of D?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(T===`list`){let e=k?.folders.find(e=>e._id===t);if(!e||!k)return null;let n=e.parentId??k.rootId;return{list:Ve(k.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){let t=i.slice(5);await se({chatId:t,projectId:e})}else{let t=i.slice(7);if(t===e)return;if(!De(M??[],t,e)){s.error(_());return}await b({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 se({chatId:e,projectId:n.folderId});let a=xt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await le({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(!De(M??[],e,n.parentId)){s.error(_());return}await b({projectId:e,parentId:n.parentId})}let a=xt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await ue({projectId:e,...a});return}}catch{s.error(_())}},[,Bt]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{let e=window.setInterval(()=>Bt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Vt=Date.now(),Ht=U(e.project),Ut=bt(e.chats,L),Wt=e.breadcrumb.slice(0,-1),Gt=e=>()=>{$.current||e()};return(0,X.jsx)(Ae.Provider,{value:Oe,children:(0,X.jsxs)(He,{sensors:Q,collisionDetection:Pt,onDragStart:Mt,onDragEnd:zt,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":Ht},children:[(0,X.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":he(),children:[Wt.map(e=>(0,X.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,X.jsx)(At,{folderId:e._id,children:(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Gt(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,X.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,X.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,X.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,X.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,X.jsxs)(q,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:be(),onClick:()=>{x({projectId:e.project._id,hidden:!1})},children:[(0,X.jsx)(it,{"aria-hidden":!0}),(0,X.jsx)(`span`,{children:ee()}),(0,X.jsx)(at,{"aria-hidden":!0})]}):null,(0,X.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":p(),children:[(0,X.jsx)(q,{variant:T===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":p(),title:p(),"aria-pressed":T===`cards`,onClick:()=>E(`cards`),children:(0,X.jsx)(vt,{})}),(0,X.jsx)(q,{variant:T===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":f(),title:f(),"aria-pressed":T===`columns`,onClick:()=>E(`columns`),children:(0,X.jsx)(gt,{})}),(0,X.jsx)(q,{variant:T===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":v(),title:v(),"aria-pressed":T===`list`,onClick:()=>E(`list`),children:(0,X.jsx)(ot,{})})]}),(0,X.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>void I({projectId:e.project._id}),children:[(0,X.jsx)(Ie,{}),d()]}),(0,X.jsxs)(q,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await o({title:ve(),label:de(),placeholder:_e(),confirmLabel:xe()});t&&await y({name:t,parentId:e.project._id})},children:[(0,X.jsx)(je,{}),ve()]}),(0,X.jsxs)(rt,{children:[(0,X.jsx)(Qe,{asChild:!0,children:(0,X.jsx)(q,{variant:`ghost`,size:`icon-sm`,"aria-label":oe(),children:(0,X.jsx)($e,{})})}),(0,X.jsxs)(tt,{align:`end`,className:`w-48`,children:[(0,X.jsxs)(K,{onSelect:()=>{Ye(e.project.name),V(!0)},children:[(0,X.jsx)(st,{}),` `,O()]}),(0,X.jsxs)(K,{onSelect:()=>Ze(!0),children:[(0,X.jsx)(_t,{}),` `,ye()]}),(0,X.jsx)(et,{children:i()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void h({projectId:e.project._id,color:null}),"aria-label":ne(),children:`✕`}),Be.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void h({projectId:e.project._id,color:t.value})},t.value))]}),(0,X.jsx)(nt,{}),(0,X.jsxs)(K,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=me?.folders??0,o=me?.chats??0;await n({title:ie({name:e.project.name}),description:ht({folders:i,chats:o,days:a}),confirmWord:w(),confirmLabel:ae(),destructive:!0})&&(await g({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,X.jsx)(ct,{}),` `,w()]})]})]})]})]}),T===`columns`?(0,X.jsx)(Rt,{data:D,currentId:e.project._id,busyIds:Te,suppressClick:$,locateChatId:j??null}):T===`list`?(0,X.jsx)(Ft,{data:k,busyIds:Te,suppressClick:$,locateChatId:j??null}):(0,X.jsxs)(X.Fragment,{children:[e.children.length>0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:te()}),(0,X.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,X.jsx)(G,{items:e.children.map(e=>`folder:${e._id}`),strategy:Ge,children:e.children.map(t=>(0,X.jsx)(jt,{child:t,parentId:e.project._id,now:Vt,suppressClick:$},t._id))})})]}):null,(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:l()}),e.chats.length>0?(0,X.jsx)(lt,{value:L,onChange:e=>Le(e.target.value),placeholder:c(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?we():fe()}):Ut.length===0&&(Z??[]).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:re({term:L.trim()})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,X.jsx)(G,{items:Ut.map(e=>`chat:${e._id}`),strategy:W,children:Ut.map(t=>(0,X.jsx)(Nt,{chat:t,currentFolderId:e.project._id,now:Vt,busy:Te.has(t._id),unread:F.has(t._id),locate:t._id===j,suppressClick:$},t._id))})})]}),J.length>=2&&Z!==void 0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:Se()}),Z.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:re({term:J})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:Z.map(e=>(0,X.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&J&&ke(e.messageId,J),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,X.jsx)(Me,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,X.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||m()}),e.projectPath&&e.projectPath.length>1?(0,X.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,X.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,X.jsx)(pt,{open:B,onOpenChange:V,title:ce(),canSubmit:H.trim().length>0,onSubmit:async()=>{await u({projectId:e.project._id,name:H.trim()}),V(!1)},submitLabel:O(),children:(0,X.jsx)(lt,{value:H,onChange:e=>Ye(e.target.value),autoFocus:!0})}),Xe?(0,X.jsx)(Ue,{open:Xe,onOpenChange:Ze,title:pe(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void b({projectId:e.project._id,parentId:t})}):null,Ne]}),(0,X.jsx)(ze,{children:Et?(0,X.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Et.kind===`folder`?(0,X.jsx)(z,{size:13,"aria-hidden":!0}):(0,X.jsx)(Me,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:Et.label})]}):null})]})})}function At({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=P({id:Et(e)});return(0,X.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=N(),a=V({id:`folder:${e._id}`}),o=P({id:$(e._id)});return(0,X.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":U(e),transform:F.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,X.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,X.jsx)(z,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,X.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,X.jsx)(Z,{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,X.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?x({count:e.folderCount})+` · `:``,Ce({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,X.jsx)(`span`,{className:`oc-projpage__cardage`,children:H(e.lastActivityAt,n)})]})}function Mt({chat:e}){let t=C(A.chats.setChatSidebar),n=e.inSidebar?g():b();return(0,X.jsx)(q,{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,X.jsx)(Le,{}):(0,X.jsx)(J,{})})}function Nt({chat:e,currentFolderId:t,now:n,busy:i,unread:a,locate:o,suppressClick:s}){let c=(0,Y.useContext)(Ae).get(e._id),l=N(),u=B(e.color),d=V({id:`chat:${e._id}`}),f=Pt(o);return(0,X.jsxs)(`li`,{ref:e=>{d.setNodeRef(e),f.current=e},className:`oc-projpage__chatrow`+(d.isDragging?` is-dragging`:``)+(o?` is-locate`:``),style:{transform:F.Transform.toString(d.transform),transition:d.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{s.current||l({to:`/chat/$chatId`,params:{chatId:e._id}})},...d.listeners,...d.attributes,children:[u?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:u}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||r()}),e.pinned?(0,X.jsx)(Oe,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,X.jsx)(`span`,{className:`oc-projpage__chatage`,children:H(e.updatedAt,n)}),i?(0,X.jsx)(`span`,{className:I(c,y()).className,title:I(c,y()).label,"aria-label":I(c,y()).label}):null,a&&!i?(0,X.jsx)(`span`,{className:`oc-chatitem__unread`,title:h(),"aria-label":h()}):null]}),(0,X.jsx)(Mt,{chat:e}),(0,X.jsx)(Q,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function Pt(e){let t=(0,Y.useRef)(null);return(0,Y.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,Y.useState)(new Set),o=(0,Y.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,X.jsx)(`p`,{className:`oc-projpage__hint`,children:s()});if(e===null)return null;let c=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),l=(a,s)=>{let u=o.get(a??e.rootId)??[],d=Ve(e.folders,a);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(G,{items:u.map(e=>`chat:${e._id}`),strategy:W,children:u.map(e=>(0,X.jsx)(Lt,{chat:e,depth:s,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,X.jsx)(G,{items:d.map(e=>`folder:${e._id}`),strategy:W,children:d.map(t=>(0,X.jsx)(It,{folder:t,parentId:a??e.rootId,depth:s,folded:i.has(t._id),onToggle:()=>c(t._id),suppressClick:n,children:i.has(t._id)?null:l(t._id,s+1)},t._id))})]})};return(0,X.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&Ve(e.folders,null).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:we()}):l(null,0)})}function It({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:o,children:s}){let c=N(),l=V({id:`folder:${e._id}`}),u=P({id:$(e._id)});return(0,X.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,X.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":U(e),transform:F.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,X.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?a():E(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!o.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,X.jsx)(Ze,{size:13}):(0,X.jsx)(Xe,{size:13})}),(0,X.jsx)(z,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(Z,{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:i,suppressClick:a}){let o=(0,Y.useContext)(Ae).get(e._id),s=N(),c=V({id:`chat:${e._id}`}),l=Pt(i),u=B(e.color);return(0,X.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(c.isDragging?` is-dragging`:``)+(i?` is-locate`:``),style:{"--tree-depth":t,transform:F.Transform.toString(c.transform),transition:c.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{a.current||s({to:`/chat/$chatId`,params:{chatId:e._id}})},...c.listeners,...c.attributes,children:[u?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:u}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||r()}),n?(0,X.jsx)(`span`,{className:I(o,``).className,"aria-hidden":!0}):null]}),(0,X.jsx)(Q,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,X.jsx)(Mt,{chat:e})]})}function Rt({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:s()}):(0,X.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,X.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=N(),s=P({id:Tt(e.folderId)});return(0,X.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,X.jsx)(G,{items:e.folders.map(e=>`folder:${e._id}`),strategy:W,children:e.folders.map(t=>(0,X.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,X.jsx)(G,{items:e.chats.map(e=>`chat:${e._id}`),strategy:W,children:e.chats.map(t=>(0,X.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,X.jsx)(`p`,{className:`oc-projpage__colempty`,children:fe()}):null]})}function Bt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=V({id:`folder:${e._id}`}),o=P({id:$(e._id)});return(0,X.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":U(e),transform:F.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,X.jsx)(z,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,X.jsx)(Z,{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:i,suppressClick:a,onOpen:o}){let s=(0,Y.useContext)(Ae).get(e._id),c=V({id:`chat:${e._id}`}),l=Pt(i),u=B(e.color);return(0,X.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(c.isDragging?` is-dragging`:``)+(i?` is-locate`:``),style:{transform:F.Transform.toString(c.transform),transition:c.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{a.current||o()},...c.listeners,...c.attributes,children:[u?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:u}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||r()}),n?(0,X.jsx)(`span`,{className:I(s,``).className,"aria-hidden":!0}):null]}),(0,X.jsx)(Q,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,X.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,CA as i,Cf as a,Du as o,Ou as s,Qk as c,SA as l,Sf as u,Uo as d,XX as f,Xk as p,YX as m,Zk as h,aA as g,cA as _,dA as v,df as y,eA as b,fA as x,ff as ee,fm as te,gm as S,hA as C,hm as w,iA as T,ku as E,lA as D,mA as ne,mf as re,mm as ie,nA as ae,oA as oe,pA as se,pf as ce,pm as O,rA as k,sA as A,t as j,tA as M,uA as N,uf as P,wf as F,xf as I}from"./api-DSJJn0d7.js";import{i as L,n as R,r as z,t as B}from"./FieldLabel-Tea3wyVe.js";import{t as V}from"./checkbox-CsI4ggnp.js";import{a as H,c as le,o as U,s as W}from"./tooltip-v_AyOWn6.js";import{a as G,i as K,n as q,r as J,t as Y}from"./select-qM3ZfTHx.js";import{t as X}from"./button-Dio0PVrp.js";import{r as ue}from"./toast-xNFwDnUy.js";import{t as de}from"./appHost-CH3EGcJw.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:N,help:D},documentary_fetch:{label:_,help:A},inbound_files:{label:oe,help:g},history_summary:{label:S,help:w},file_curation:{label:F,help:re},quote_reply:{label:a,help:u}},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:c,references:h,files:p,previous_summary:ie,new_messages:O,max_chars:te,file_name:ce,budget_chars:ee,feedback:y,content:P,excerpt:I};function _e(){let e=f(j.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:k()})});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)(R,{label:C(),help:ne()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:T()}),(0,$.jsxs)(Y,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(K,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(G,{})}),(0,$.jsx)(q,{children:e.map(e=>(0,$.jsx)(J,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=m(j.admin.upsertInstanceConfig),n=ue(),r=f(j.me.getMe,{host:de}),a=e.config??{},c=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[u,d]=(0,Q.useState)(()=>L(a,c));(0,Q.useEffect)(()=>{d(L(a,c))},[c,e._id]);let[p,h]=(0,Q.useState)(!1),g=u.promptInjections,_=(e,t)=>d({...u,promptInjections:{...g,[e]:{...g[e],...t}}});async function v(){h(!0);try{await t({instanceId:e._id,config:z(u,a,c)})}catch(e){n.error(l(),e)}finally{h(!1)}}async function y(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(l(),e)}}let b=e.config?.contentLocale??`default`,x=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:E()}),(0,$.jsxs)(Y,{value:b,onValueChange:e=>void y(e),children:[(0,$.jsx)(K,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(G,{})}),(0,$.jsxs)(q,{children:[(0,$.jsx)(J,{value:`default`,children:o({locale:x})}),pe().map(e=>(0,$.jsx)(J,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}),U.map(e=>(0,$.jsx)(ye,{injKey:e,def:H[e],i18n:me[e],row:g[e]??{enabled:!0,template:H[e].defaultTemplate[c]},contentLocale:c,onChange:t=>_(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(X,{size:`sm`,onClick:()=>void v(),disabled:p,children:i()})})]})}function ye({injKey:e,def:t,i18n:n,row:i,contentLocale:a,onChange:o}){let[s,c]=(0,Q.useState)(!1),l=i.template.trim()!==t.defaultTemplate[a],u=t.togglable&&!i.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),p=W(e,i,a),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)(V,{checked:i.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(R,{label:n.label(),help:n.help()})]}):(0,$.jsx)(R,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:x()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>o({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:v()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(B,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?M():ae()}),l&&(0,$.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:se()})]})]}),s&&(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:b()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:d()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:r()})})]})}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 ee,FN as te,GN as i,IN as a,JN as ne,Jf as o,KN as s,LN as re,MN as c,NN as ie,PN as ae,QN as l,UN as u,WN as d,XN as f,XX as p,YN as m,YX as h,ZN as g,_P as _,aP as v,cP as y,dP as b,eP as oe,fP as x,gP as S,hP as C,iP as w,jN as T,kN as E,lP as D,mP as O,nP as k,oP as A,pP as j,qN as M,rP as N,sP as P,t as F,tP as I,uP as L,vP as R,yP as z}from"./api-DSJJn0d7.js";import{t as B}from"./lock-0lxfSnTE.js";import{t as V}from"./checkbox-CsI4ggnp.js";import{t as H}from"./button-Dio0PVrp.js";import{t as U}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{r as W}from"./toast-xNFwDnUy.js";import{t as G}from"./badge-C4po8DQ1.js";import{n as K}from"./ConfirmDialog-BXcki0Ee.js";import{t as q}from"./EntitySheet-B2B48bss.js";import{t as J}from"./roleDescriptions-x3mUxTcX.js";var Y=t(e(),1),X=n(),Z=[{group:()=>z(),keys:[{key:`traces.read`,label:()=>O()},{key:`traces.read.content`,label:()=>j(),phi:!0},{key:`traces.write`,label:()=>x()}]},{group:()=>R(),keys:[{key:`kpi.read`,label:()=>O()},{key:`kpi.write`,label:()=>x()}]},{group:()=>_(),keys:[{key:`openclaw.query`,label:()=>b()},{key:`anomalies.read`,label:()=>L()},{key:`anomalies.report`,label:()=>D()}]},{group:()=>S(),keys:[{key:`chats.read`,label:()=>O()},{key:`selfheal`,label:()=>P()},{key:`media.repair`,label:()=>A()},{key:`feedback.respond`,label:()=>o()}]},{group:()=>C(),keys:[{key:`admin.manage`,label:()=>y()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=p(F.apiKeys.listRoles,{}),t=h(F.apiKeys.createRole),n=h(F.apiKeys.ensureRolesSeeded),o=h(F.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(F.apiKeys.listRoles,{});r&&e.setQuery(F.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),_=K(),y=W(),[b,x]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)($),[D,O]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{y.error(w(),e)})},[n,y]);let A=e??[];async function j(e,t){if(Q(e.permissions))return;if(e.builtin){await _({title:N({name:e.name}),description:k(),confirmLabel:I()});return}if(D.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];O(t=>new Set(t).add(e._id));try{await o({roleId:e._id,permissions:n})}catch(e){y.error(oe(),e)}finally{O(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function P(){try{await t({key:S.key,name:S.name,description:S.description||void 0,permissions:[]}),C($),x(!1)}catch(e){y.error(r(),e)}}let L=e===void 0,R=!L&&A.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`}),` `,g(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,f()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:m()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(H,{size:`sm`,onClick:()=>{C($),x(!0)},children:ne()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(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:i()}),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?v({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:A.map(e=>{let t=Q(e.permissions),n=D.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)(G,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(B,{}),` `,d()]}):(0,X.jsx)(G,{variant:`secondary`,children:u()})]}),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)(V,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?re():n?a():r,onCheckedChange:()=>void j(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(q,{open:b,onOpenChange:x,title:te(),description:ae(),canSubmit:!!(S.key&&S.name),onSubmit:P,submitLabel:ie(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:c()}),(0,X.jsx)(U,{value:S.key,placeholder:T(),onChange:e=>C({...S,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ee()}),(0,X.jsx)(U,{value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:E()}),(0,X.jsx)(U,{value:S.description,onChange:e=>C({...S,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,BJ as o,BX as s,CJ as c,CY as l,Cq as u,Dq as ee,E as d,EJ as f,Eq as p,FJ as te,Fq as m,HJ as ne,HX as h,IJ as re,Iq as ie,LJ as g,Lq as ae,MJ as oe,Mq as se,NJ as ce,Nq as le,Oq as ue,PJ as de,Pq as fe,Qq as pe,Rq as me,SJ as he,SY as ge,Sq as _e,Tq as ve,UJ as ye,VJ as be,WJ as xe,XX as Se,Xq as _,Yq as Ce,Zq as we,_J as Te,_Y as Ee,aJ as v,bJ as De,bY as Oe,cJ as ke,dY as Ae,eJ as je,fY as Me,gJ as Ne,gY as Pe,gq as Fe,hJ as Ie,hY as Le,iJ as Re,jJ as ze,jq as Be,kJ as Ve,kq as He,lJ as Ue,lY as We,mY as Ge,nJ as Ke,oJ as y,pY as qe,qX as b,rJ as Je,sJ as Ye,t as x,tJ as S,uJ as Xe,uY as Ze,vJ as Qe,vY as $e,wJ as et,wY as tt,wq as nt,xJ as rt,xY as it,yJ as at,yY as ot,zJ as st,zq as ct}from"./api-DSJJn0d7.js";import{t as C}from"./chevron-left-DQ9FCoo_.js";import{t as w}from"./chevron-right-C_b_y922.js";import{t as lt}from"./list-eSch39T9.js";import{t as ut}from"./loader-circle-BNhIFGdg.js";import{a as dt,i as ft,n as pt,r as mt,t as ht}from"./cronDescribe-CAuRX7uW.js";import{t as gt}from"./pencil-aUWxuLhy.js";import{t as _t}from"./rotate-ccw-BD-9XzMC.js";import{t as vt}from"./trash-2-B4WSfc7G.js";import{a as T,i as E,n as D,r as O,t as k}from"./select-qM3ZfTHx.js";import{a as yt,c as bt,i as xt,n as St,o as Ct,r as wt,s as Tt,t as Et}from"./alert-dialog-BoEv1f8g.js";import{n as A,r as j,t as M}from"./popover-DBaIbsBr.js";import{t as N}from"./button-Dio0PVrp.js";import{t as Dt}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{r as Ot}from"./toast-xNFwDnUy.js";import{t as P}from"./badge-C4po8DQ1.js";import{a as kt,i as At,n as jt,o as Mt,r as Nt,t as Pt}from"./dialog-BfrsWZiD.js";import{t as Ft}from"./appHost-CH3EGcJw.js";import{a as It,i as F,n as Lt,o as Rt,r as I,t as zt}from"./table-D2SJC960.js";import{t as Bt}from"./FilterBar-DTVwlDpF.js";/* empty css */import{a as Vt,c as L,i as R,l as Ht,n as Ut,o as z,r as Wt,s as Gt,t as Kt,u as B}from"./TimezoneCombobox-CPTpWNQm.js";var qt=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`}]]),Jt=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`}]]),V=t(e(),1),H=n();function U(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Yt({value:e,onChange:t}){let n=Ht(e),r=(0,V.useMemo)(()=>new Date,[]),[i,a]=(0,V.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,V.useState)(!1),c=(0,V.useMemo)(()=>U(h()),[]),l=(0,V.useMemo)(()=>new Intl.DateTimeFormat(h(),{month:`long`,year:`numeric`}),[]),u=(0,V.useMemo)(()=>new Intl.DateTimeFormat(h(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=L(i.year,i.month),d=n?.hour??9,f=n?.minute??0,p=(e,n,r,i,a)=>t(B(e,n,r,i,a)),te=(e,t,n)=>{a({year:e,month:t}),p(e,t,n,d,f)},m=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},ne=n===null?Ue():u.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,H.jsxs)(M,{modal:!0,open:o,onOpenChange:s,children:[(0,H.jsx)(j,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":Xe(),children:[(0,H.jsx)(qt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,H.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:ne})]})}),(0,H.jsxs)(A,{align:`start`,className:`oc-dtp__pop`,children:[(0,H.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":ke(),onClick:()=>m(-1),children:(0,H.jsx)(C,{size:15,"aria-hidden":!0})}),(0,H.jsx)(`span`,{className:`oc-dtp__month`,children:l.format(new Date(i.year,i.month,1))}),(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":Ye(),onClick:()=>m(1),children:(0,H.jsx)(w,{size:15,"aria-hidden":!0})})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>te(e.year,e.month,e.day),children:e.day},t)})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,H.jsxs)(k,{value:String(d),onValueChange:e=>p(i.year,i.month,n?.day??r.getDate(),Number(e),f),children:[(0,H.jsx)(E,{size:`sm`,"aria-label":y(),children:(0,H.jsx)(T,{})}),(0,H.jsx)(D,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,H.jsx)(O,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,H.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,H.jsxs)(k,{value:String(f),onValueChange:e=>p(i.year,i.month,n?.day??r.getDate(),d,Number(e)),children:[(0,H.jsx)(E,{size:`sm`,"aria-label":v(),children:(0,H.jsx)(T,{})}),(0,H.jsx)(D,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,H.jsx)(O,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function W(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Xt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Zt(e){let t=new Map;for(let n of e){let e=W(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function Qt(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get(Xt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function $t(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function en(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function tn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var G=3;function nn({events:e,mode:t,cursor:n,onModeChange:i,onCursorChange:a,onEventClick:o,footnote:s}){let c=h(),l=(0,V.useMemo)(()=>Zt(e),[e]),u=(0,V.useMemo)(()=>$t(c),[c]),ee=(0,V.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`,year:`numeric`}),[c]),d=(0,V.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`}),[c]),f=(0,V.useMemo)(()=>new Intl.DateTimeFormat(c,{hour:`2-digit`,minute:`2-digit`}),[c]),p=new Date,te=e=>{if(t===`year`){a({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);a({year:r.getFullYear(),month:r.getMonth()})},m=t===`year`?String(n.year):ee.format(new Date(n.year,n.month,1));return(0,H.jsxs)(`div`,{className:`oc-cal`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,H.jsx)(N,{variant:`ghost`,size:`icon-sm`,"aria-label":pe(),onClick:()=>te(-1),children:(0,H.jsx)(C,{})}),(0,H.jsx)(N,{variant:`ghost`,size:`icon-sm`,"aria-label":we(),onClick:()=>te(1),children:(0,H.jsx)(w,{})}),(0,H.jsx)(N,{variant:`ghost`,size:`sm`,onClick:()=>a({year:p.getFullYear(),month:p.getMonth()}),children:r()})]}),(0,H.jsx)(`span`,{className:`oc-cal__title`,children:m}),(0,H.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,H.jsx)(N,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>i(`month`),children:S()}),(0,H.jsx)(N,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>i(`year`),children:je()})]})]}),t===`month`?(0,H.jsx)(rn,{cursor:n,byDay:l,weekdays:u,timeFmt:f,now:p,onEventClick:o}):(0,H.jsx)(an,{year:n.year,byDay:l,monthShortFmt:d,now:p,onOpenMonth:e=>{a({year:n.year,month:e}),i(`month`)}}),s?(0,H.jsx)(`p`,{className:`oc-cal__footnote`,children:s}):null]})}function rn({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=L(e.year,e.month);return(0,H.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Xt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,H.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,H.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,G).map(e=>(0,H.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,H.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,H.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>G?(0,H.jsx)(`span`,{className:`oc-cal__more`,children:_({count:o.length-G})}):null]},n)})]})}function an({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,H.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=Qt(t,e,o),c=L(e,o);return(0,H.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,H.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,H.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,H.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var on={h:36e5,min:6e4,s:1e3,ms:1};function sn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*on[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function K(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function q(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=K(t[0],0,59),r=K(t[1],0,23),i=K(t[2],1,31),a=K(t[3],1,12),o=K(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var cn=new Map;function J(e){let t=cn.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return cn.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=q(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=z(e)!==`active`,c=Z(s?null:sn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Gt(e)){case`ok`:return(0,H.jsx)(P,{variant:`secondary`,children:c()});case`error`:return(0,H.jsx)(P,{variant:`destructive`,children:rt()});case`running`:return(0,H.jsx)(P,{variant:`outline`,children:De()});case`other`:return(0,H.jsx)(P,{variant:`outline`,children:e});case`none`:return(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=b(x.scheduled.listMyCrons),t=b(x.scheduled.getCronDetail),n=b(x.scheduled.listCronRuns),r=b(x.scheduled.updateCron),d=b(x.scheduled.removeCron),pe=b(x.scheduled.runCronNow),_=Ot(),we=Se(x.me.getMe,{host:Ft})?.timezone,[v,ke]=(0,V.useState)(null),[je,Ue]=(0,V.useState)(!1),[y,Ye]=(0,V.useState)(!1),[S,Xe]=(0,V.useState)(null),[C,w]=(0,V.useState)(null),[A,j]=(0,V.useState)(null),[M,L]=(0,V.useState)(null),[Ht,Gt]=(0,V.useState)(!1),[B,U]=(0,V.useState)(Ut),[W,Xt]=(0,V.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Zt=e=>{localStorage.setItem(`oc.sched.view`,e),Xt(e)},[Qt,$t]=(0,V.useState)(`month`),[G,rn]=(0,V.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),an=(0,V.useMemo)(()=>{let e=[];for(let t of v??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Vt(r,B)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[v,B]),on=(0,V.useMemo)(()=>Qt===`year`?tn(G.year):en(G.year,G.month),[Qt,G]),sn=(0,V.useMemo)(()=>un(an,on.startMs,on.endMs),[an,on]),K=e=>{let t=sn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},q=(0,V.useCallback)(async()=>{Ue(!0),Ye(!1);try{ke(await e({}))}catch{Ye(!0)}finally{Ue(!1)}},[e]);(0,V.useEffect)(()=>{q()},[q]);let cn=(0,V.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,V.useRef)(null);(0,V.useEffect)(()=>{v!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[v]);let Y=(0,V.useMemo)(()=>new Intl.DateTimeFormat(h(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{Xe(e);try{await t(),_.success(n),await q()}catch(e){_.toast({variant:`error`,title:g({code:dn(e)})})}finally{Xe(null)}},Z=(0,V.useRef)(0),Q=(0,V.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;j({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;j({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;j(null),_.toast({variant:`error`,title:g({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;L({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;L(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Q.current)return;L(null),_.toast({variant:`error`,title:g({code:dn(e)})})}},mn=async()=>{if(M===null)return;let e={};if(M.nameDirty&&M.name.trim()===``||M.messageDirty&&M.hasMessage&&M.message.trim()===``){_.toast({variant:`error`,title:_e()});return}if(M.nameDirty&&M.name.trim()!==``&&(e.name=M.name.trim()),M.scheduleDirty){if(M.scheduleKind===`cron`&&M.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:M.cronExpr.trim(),...M.tz.trim()===``?{}:{tz:M.tz.trim()}};else if(M.scheduleKind===`every`){let t=Number(M.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[M.everyUnit])})}else if(M.scheduleKind===`at`&&M.at!==``){let t=Date.parse(M.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(M.scheduleDirty&&e.schedule===void 0){_.toast({variant:`error`,title:u()});return}if(M.messageDirty&&M.hasMessage&&M.message.trim()!==``&&(e.message=M.message.trim()),Object.keys(e).length===0){L(null);return}let t=Q.current;Gt(!0);try{await r({instanceName:M.instanceName,jobId:M.jobId,patch:e}),_.success(ie()),t===Q.current&&L(null),await q()}catch(e){_.toast({variant:`error`,title:g({code:dn(e)})})}finally{Gt(!1)}},hn=v?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:tt()}),(0,H.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":Re(),children:[(0,H.jsx)(N,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Je(),title:Je(),"aria-pressed":W===`list`,onClick:()=>Zt(`list`),children:(0,H.jsx)(lt,{})}),(0,H.jsx)(N,{variant:W===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ke(),title:Ke(),"aria-pressed":W===`calendar`,onClick:()=>Zt(`calendar`),children:(0,H.jsx)(qt,{})})]}),(0,H.jsxs)(N,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:je,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,H.jsx)(_t,{size:14,"aria-hidden":!0}),l()]})]}),v!==null&&hn>0?(0,H.jsxs)(Bt,{q:B.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:Qe(),onReset:()=>U(Ut),canReset:Wt(B),children:[(0,H.jsxs)(k,{value:B.state,onValueChange:e=>U(t=>({...t,state:e})),children:[(0,H.jsx)(E,{size:`sm`,className:`w-40`,children:(0,H.jsx)(T,{})}),(0,H.jsxs)(D,{children:[(0,H.jsx)(O,{value:`all`,children:Te()}),(0,H.jsx)(O,{value:`active`,children:Ze()}),(0,H.jsx)(O,{value:`paused`,children:Ae()}),(0,H.jsx)(O,{value:`auto-disabled`,children:We()})]})]}),(0,H.jsxs)(k,{value:B.result,onValueChange:e=>U(t=>({...t,result:e})),children:[(0,H.jsx)(E,{size:`sm`,className:`w-40`,children:(0,H.jsx)(T,{})}),(0,H.jsxs)(D,{children:[(0,H.jsx)(O,{value:`all`,children:Ne()}),(0,H.jsx)(O,{value:`ok`,children:c()}),(0,H.jsx)(O,{value:`error`,children:rt()}),(0,H.jsx)(O,{value:`running`,children:De()}),(0,H.jsx)(O,{value:`none`,children:at()})]})]})]}):null,v===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":je,children:y?ge():s()}):W===`calendar`?(0,H.jsxs)(H.Fragment,{children:[y?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):null,v.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:it()}):(0,H.jsx)(nn,{events:sn.events,mode:Qt,cursor:G,onModeChange:$t,onCursorChange:rn,onEventClick:K,footnote:Ce()})]}):(0,H.jsxs)(H.Fragment,{children:[y?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):null,v.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:it()}):null,v.map(e=>{let t=e.jobs.filter(e=>Vt(e,B)),n=Wt(B)&&e.jobs.length>0&&t.length===0;return(0,H.jsxs)(`section`,{style:{marginBottom:20},children:[v.length>1||e.error||!e.supported?(0,H.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,H.jsx)(P,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ot({code:e.error})}):e.jobs.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}):n?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ie()}):(0,H.jsxs)(zt,{children:[(0,H.jsx)(It,{children:(0,H.jsxs)(Rt,{children:[(0,H.jsx)(F,{children:Ee()}),(0,H.jsx)(F,{children:Pe()}),(0,H.jsx)(F,{children:Le()}),(0,H.jsx)(F,{children:Ge()}),(0,H.jsx)(F,{children:qe()}),(0,H.jsx)(F,{children:et()}),(0,H.jsx)(F,{children:ct()})]})}),(0,H.jsx)(Lt,{children:t.map((t,n)=>{let i=`${e.instanceName}:${t.id??n}`,a=S===i,s=e.manageSupported,c=e.kind===`openclaw`&&s;return(0,H.jsxs)(Rt,{ref:t.id!==null&&t.id===cn?J:void 0,"data-state":t.id!==null&&t.id===cn?`selected`:void 0,children:[(0,H.jsx)(I,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??Me()}),(0,H.jsx)(I,{children:(0,H.jsx)(P,{variant:`secondary`,children:t.agentId})}),(0,H.jsxs)(I,{className:`whitespace-nowrap`,children:[(0,H.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=ht(t.schedule),n=e===null?null:pt(e);return n===null?null:(0,H.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,H.jsx)(I,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,H.jsx)(I,{children:z(t)===`auto-disabled`?(0,H.jsx)(P,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:We()}):z(t)===`active`?(0,H.jsx)(P,{variant:`secondary`,children:Ze()}):z(t)===`paused`?(0,H.jsx)(P,{variant:`outline`,children:Ae()}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,H.jsxs)(I,{children:[(0,H.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,H.jsx)(P,{variant:`destructive`,title:t.lastDeliveryError??xe(),children:he()}):null]}),(0,H.jsx)(I,{className:`whitespace-nowrap`,children:t.id===null?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,H.jsx)(ut,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,H.jsxs)(`span`,{className:`oc-cronactions`,children:[c?(0,H.jsx)(N,{variant:`ghost`,size:`icon-sm`,title:ne(),"aria-label":ne(),disabled:S!==null,onClick:()=>void X(i,async()=>{let n=await pe({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},re()),children:(0,H.jsx)(mt,{size:14,"aria-hidden":!0})}):null,c&&t.enabled!==null?(0,H.jsx)(N,{variant:`ghost`,size:`icon-sm`,title:R(t)===`pause`?be():o(),"aria-label":R(t)===`pause`?be():o(),disabled:S!==null,onClick:()=>void X(i,()=>r({instanceName:e.instanceName,jobId:t.id,patch:{enabled:R(t)===`resume`}}),R(t)===`pause`?te():de()),children:R(t)===`pause`?(0,H.jsx)(dt,{size:14,"aria-hidden":!0}):(0,H.jsx)(ft,{size:14,"aria-hidden":!0})}):null,c?(0,H.jsx)(N,{variant:`ghost`,size:`icon-sm`,title:me(),"aria-label":me(),disabled:S!==null,onClick:()=>void pn(e.instanceName,t),children:(0,H.jsx)(gt,{size:14,"aria-hidden":!0})}):null,c?(0,H.jsx)(N,{variant:`ghost`,size:`icon-sm`,title:ae(),"aria-label":ae(),disabled:S!==null,onClick:()=>void ln(e.instanceName,t),children:(0,H.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,s?(0,H.jsx)(N,{variant:`ghost`,size:`icon-sm`,title:st(),"aria-label":st(),disabled:S!==null,onClick:()=>w({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,H.jsx)(vt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()})]},e.instanceName)}),hn>0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:Fe()}):null]}),(0,H.jsx)(Et,{open:C!==null,onOpenChange:e=>{e||w(null)},children:(0,H.jsxs)(xt,{children:[(0,H.jsxs)(Tt,{children:[(0,H.jsx)(bt,{children:oe()}),(0,H.jsx)(yt,{children:ze({name:C?.name??``})})]}),(0,H.jsxs)(Ct,{children:[(0,H.jsx)(wt,{children:i()}),(0,H.jsx)(St,{onClick:()=>{let e=C;w(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>d({instanceName:e.instanceName,jobId:e.jobId}),ce())},children:Ve()})]})]})}),(0,H.jsx)(Pt,{open:A!==null,onOpenChange:e=>{e||(Z.current++,j(null))},children:(0,H.jsxs)(jt,{style:{maxWidth:640},children:[(0,H.jsx)(kt,{children:(0,H.jsx)(Mt,{children:m({name:A?.name??``})})}),A?.entries===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):A!==null&&A.entries.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):A===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:A.entries.map((e,t)=>(0,H.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,H.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,H.jsx)(fn,{status:e.status}),(0,H.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,H.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,H.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[f({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,H.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,H.jsx)(Pt,{open:M!==null,onOpenChange:e=>{e||(Q.current++,L(null))},children:(0,H.jsxs)(jt,{className:`oc-cronedit`,children:[(0,H.jsxs)(kt,{children:[(0,H.jsx)(Mt,{children:le()}),(0,H.jsx)(Nt,{children:se()})]}),M===null?null:M.loading?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,H.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Ee()}),(0,H.jsx)(Dt,{value:M.name,maxLength:200,onChange:e=>L({...M,name:e.target.value,nameDirty:!0})})]}),(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Be()}),(0,H.jsxs)(k,{value:M.scheduleKind,onValueChange:e=>L({...M,scheduleKind:e,scheduleDirty:!0}),children:[(0,H.jsx)(E,{children:(0,H.jsx)(T,{})}),(0,H.jsxs)(D,{children:[(0,H.jsx)(O,{value:`cron`,children:a()}),(0,H.jsx)(O,{value:`every`,children:He()}),(0,H.jsx)(O,{value:`at`,children:ue()})]})]}),M.scheduleKind===`cron`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(Dt,{value:M.cronExpr,onChange:e=>L({...M,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,H.jsx)(Kt,{value:M.tz,onChange:e=>L({...M,tz:e,scheduleDirty:!0}),fallbackTz:we??void 0})]}):M.scheduleKind===`every`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(Dt,{type:`number`,min:1,value:M.everyValue,onChange:e=>L({...M,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,H.jsxs)(k,{value:M.everyUnit,onValueChange:e=>L({...M,everyUnit:e,scheduleDirty:!0}),children:[(0,H.jsx)(E,{style:{maxWidth:160},children:(0,H.jsx)(T,{})}),(0,H.jsxs)(D,{children:[(0,H.jsx)(O,{value:`minutes`,children:ee()}),(0,H.jsx)(O,{value:`hours`,children:p()}),(0,H.jsx)(O,{value:`days`,children:ve()})]})]})]}):(0,H.jsx)(Yt,{value:M.at,onChange:e=>L({...M,at:e,scheduleDirty:!0})})]}),M.hasMessage?(0,H.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ye()}),(0,H.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:M.message,onChange:e=>L({...M,message:e.target.value,messageDirty:!0})})]}):null]}),(0,H.jsxs)(At,{children:[(0,H.jsx)(N,{variant:`ghost`,onClick:()=>L(null),children:i()}),(0,H.jsxs)(N,{onClick:()=>void mn(),disabled:M===null||M.loading||Ht,children:[Ht?(0,H.jsx)(ut,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,nt()]})]})]})})]})}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,$W as i,AW as ee,BU as a,BW as te,CW as ne,DW as re,EW as ie,FW as ae,GU as o,GW as oe,HU as se,HW as ce,IW as le,JU as ue,JW as de,KU as fe,KW as pe,LU as s,LW as me,MW as he,NW as ge,OW as _e,PW as ve,QU as c,QW as l,RU as u,RW as ye,SW as be,TW as xe,UU as d,UW as Se,VU as f,VW as Ce,WU as p,WW as we,XU as m,XW as Te,XX as h,YU as g,YW as Ee,YX as _,ZU as v,ZW as y,_W as De,aW as b,bW as Oe,cW as ke,dW as Ae,eG as je,eW as x,fW as Me,gW as Ne,hW as Pe,iW as S,jW as Fe,kW as Ie,lW as Le,mW as Re,nG as ze,nW as C,oW as w,pW as Be,qU as T,qW as Ve,qX as He,rG as Ue,rW as E,sW as We,t as D,tG as Ge,tW as O,uW as Ke,vW as qe,wW as Je,xW as Ye,yW as Xe,zU as k,zW as Ze}from"./api-DSJJn0d7.js";import{n as Qe,t as $e}from"./useNavigate-D3GIoxyW.js";import{t as A}from"./check-DmQzfrws.js";import{r as et}from"./dist-ClkJChBn.js";import{t as tt}from"./chevron-right-C_b_y922.js";import{t as j}from"./copy-BaUCUMp2.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-qM3ZfTHx.js";import{t as L}from"./button-Dio0PVrp.js";import{t as R}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{r as nt}from"./toast-xNFwDnUy.js";import{t as z}from"./badge-C4po8DQ1.js";import{n as B,t as V}from"./format-DGKgJf2p.js";import{a as H,i as U,n as W,o as G,r as K,t as q}from"./dialog-BfrsWZiD.js";import{n as rt}from"./ConfirmDialog-BXcki0Ee.js";import{t as it}from"./EntitySheet-B2B48bss.js";import{t as at}from"./FilterBar-DTVwlDpF.js";import{t as ot}from"./DataTableShell-DRFFBx_j.js";import{t as st}from"./roleDescriptions-x3mUxTcX.js";var J=t(e(),1),Y=n(),ct=[{value:`never`,label:()=>d(),days:null},{value:`30`,label:()=>se(),days:30},{value:`90`,label:()=>f(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=Qe({from:`/settings/serviceAccounts`}),t=$e({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??Z,[a,o]=(0,J.useState)(Z),se=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),ue=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),fe=h(D.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:r===Z?void 0:r===`disabled`}}),s=h(D.apiKeys.listKeys,{}),c=h(D.apiKeys.listRoles,{}),u=_(D.apiKeys.createServiceAccount),d=_(D.apiKeys.updateServiceAccount),f=_(D.apiKeys.deleteServiceAccount),p=He(D.apiKeys.mintApiKey),m=_(D.apiKeys.revokeApiKey),g=rt(),v=nt(),b=n!==``||a!==Z||r!==Z;function x(){o(Z),t({search:{},replace:!0})}let[S,C]=(0,J.useState)(!1),[w,T]=(0,J.useState)(Q),[E,O]=(0,J.useState)(null),[k,A]=(0,J.useState)(new Set),[j,B]=(0,J.useState)(null),V=(0,J.useRef)(!1),[H,U]=(0,J.useState)(new Set),[W,G]=(0,J.useState)({}),[K,q]=(0,J.useState)(null),X=(0,J.useMemo)(()=>{let e=new Map;for(let t of s??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[s]);function $(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{E?(await d({serviceAccountId:E,name:w.name,roleKey:w.roleKey,description:w.description}),v.success(Ye())):await u({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Q),O(null),C(!1)}catch(e){v.error(E?be():ne(),e)}}function ft(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function pt(e){if(V.current)return;V.current=!0;let t=W[e._id]??`never`,n=ct.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;B(e._id);try{let t=await p({serviceAccountId:e._id,expiresAt:r});q({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(Oe(),e)}finally{V.current=!1,B(null)}}async function mt(e){if(await g({title:Xe(),description:(0,Y.jsxs)(Y.Fragment,{children:[qe(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,De(),` `,(0,Y.jsx)(`strong`,{children:Ne()}),` `,Pe()]}),confirmWord:e.name,confirmLabel:Re(),destructive:!0}))try{await f({serviceAccountId:e._id}),v.success(Be(),e.name)}catch(e){v.error(Me(),e)}}async function ht(e){if(await g({title:Ae(),description:(0,Y.jsxs)(Y.Fragment,{children:[Ke(),` `,(0,Y.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Le()]}),confirmLabel:ke(),destructive:!0})&&!H.has(e._id)){U(t=>new Set(t).add(e._id));try{await m({keyId:e._id})}catch(e){v.error(We(),e)}finally{U(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}),(0,Y.jsxs)(at,{q:n,onQChange:se,searchPlaceholder:ze(),onReset:x,canReset:b,children:[(0,Y.jsxs)(I,{value:a,onValueChange:o,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Y.jsx)(M,{placeholder:Ge()})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:Z,children:je()}),(c??[]).map(e=>(0,Y.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,Y.jsxs)(I,{value:r,onValueChange:ue,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(M,{})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:Z,children:i()}),(0,Y.jsx)(F,{value:`active`,children:l()}),(0,Y.jsx)(F,{value:`disabled`,children:y()})]})]})]}),(0,Y.jsx)(ot,{title:Te(),rows:fe,addLabel:Ee(),onAdd:()=>{T(Q),O(null),C(!0)},emptyHint:de(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,Y.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:H}),rowActions:e=>[...(e.managedBy??null)===null?[{label:we(),onSelect:()=>ft(e)},{label:Ve(),onSelect:()=>void pt(e)}]:[],{label:k.has(e._id)?pe():oe(),onSelect:()=>$(e._id)},...(e.managedBy??null)===null?[{label:Se(),variant:`destructive`,onSelect:()=>void mt(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(L,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?ce():Ce(),onClick:()=>$(e._id),children:k.has(e._id)?(0,Y.jsx)(et,{}):(0,Y.jsx)(tt,{})})},{header:te(),sort:e=>e.name,cell:e=>(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ze(),sort:e=>e.roleKey,cell:e=>(0,Y.jsx)(z,{variant:`secondary`,children:e.roleKey})},{header:ye(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,Y.jsx)(z,{variant:`destructive`,children:y()}):(0,Y.jsx)(z,{variant:`outline`,children:l()})},{header:me(),cell:e=>(0,Y.jsxs)(I,{value:W[e._id]??`never`,onValueChange:t=>G(n=>({...n,[e._id]:t})),children:[(0,Y.jsx)(N,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(M,{})}),(0,Y.jsx)(P,{children:ct.map(e=>(0,Y.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:le(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,Y.jsx)(`span`,{className:`oc-sa__keycount`,children:j===e._id?ae():ve({count:t})})}}]}),(0,Y.jsx)(it,{open:S,onOpenChange:e=>{C(e),e||O(null)},title:E?ge():ee(),description:E?he():Ie(),canSubmit:!!(w.name&&w.roleKey),onSubmit:dt,submitLabel:E?Fe():_e(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:re()}),(0,Y.jsx)(R,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:ie()}),(0,Y.jsxs)(I,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,Y.jsx)(N,{className:`w-full`,children:(0,Y.jsx)(M,{placeholder:xe()})}),(0,Y.jsx)(P,{children:(c??[]).map(e=>(0,Y.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(c??[]).find(e=>e.key===w.roleKey),t=e?st(e):null;return t?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:Je()}),(0,Y.jsx)(R,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,Y.jsx)(ut,{minted:K,onClose:()=>q(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:i}){return(0,Y.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,Y.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[w(),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,Y.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{children:S()}),(0,Y.jsx)(`th`,{children:E()}),(0,Y.jsx)(`th`,{children:C()}),(0,Y.jsx)(`th`,{children:O()}),(0,Y.jsx)(`th`,{children:x()}),(0,Y.jsx)(`th`,{children:r()}),(0,Y.jsx)(`th`,{})]})}),(0,Y.jsx)(`tbody`,{children:t.map(t=>(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`td`,{children:(0,Y.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,Y.jsx)(`td`,{children:(0,Y.jsx)(z,{variant:`secondary`,children:e.roleKey})}),(0,Y.jsx)(`td`,{children:B(t.createdAt)}),(0,Y.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,Y.jsx)(`td`,{children:pt(t.expiresAt)}),(0,Y.jsx)(`td`,{children:mt(t)}),(0,Y.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,Y.jsx)(L,{variant:`destructive`,size:`sm`,disabled:i.has(t._id),onClick:()=>n(t),children:i.has(t._id)?c():v()}):null})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,J.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,Y.jsx)(q,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,Y.jsxs)(W,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,Y.jsxs)(H,{children:[(0,Y.jsx)(G,{children:m()}),(0,Y.jsx)(K,{children:g({name:e.accountName})})]}),(0,Y.jsx)(`div`,{className:`oc-sa__minted-warning`,children:ue()}),(0,Y.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Y.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,Y.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":T(),children:[n?(0,Y.jsx)(A,{}):(0,Y.jsx)(j,{}),n?fe():o()]})]}),(0,Y.jsx)(U,{children:(0,Y.jsx)(L,{onClick:()=>{r(!1),t()},children:p()})})]}):null})}function dt(e){return e!==null&&Date.now()-e>X}function ft(e){return e===null?a():B(e)}function pt(e){return e===null?`—`:V(e)}function mt(e){return e.disabled?(0,Y.jsx)(z,{variant:`destructive`,children:k()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,Y.jsx)(z,{variant:`outline`,children:u()}):(0,Y.jsx)(z,{variant:`outline`,children:s()})}export{$ 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,Hm as d,Im as f,Jm as p,Km as m,Lm as h,Mm as g,Nm as _,Om as v,Pm as y,Qm as b,Rm as x,Sm as S,Tm as C,Um as w,Vm as T,Wm as E,XX as D,Xm as O,YX 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-DSJJn0d7.js";import{t as W}from"./button-Dio0PVrp.js";import"./convexApi-CyScjgcq.js";import{n as G}from"./format-DGKgJf2p.js";import{n as K}from"./ConfirmDialog-BXcki0Ee.js";import{t as q}from"./DataTableShell-DRFFBx_j.js";var J=t(e(),1),Y=n(),X={hung:()=>d(),wrong_result:()=>T(),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=k(z.subAgentReports.respondToReport),[r,a]=(0,J.useState)(e.thread),[o,u]=(0,J.useState)(``),[d,p]=(0,J.useState)(!1);async function m(){let t=o.trim();if(!(!t||d)){p(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{p(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,x({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:h()}),(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:f()}),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():y()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:_()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:g(),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 m(),disabled:!o.trim()||d,children:d?i():F()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[I({count:t.children.length}),t.childrenTruncated?` ${v()}`:``,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:C()}),(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=D(z.subAgentReports.listForAdmin,{}),t=k(z.subAgentReports.readReport),n=k(z.subAgentReports.deleteReport),i=K(),[a,s]=(0,J.useState)(null),[c,l]=(0,J.useState)({});async function d(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 f(e){await i({title:o(),description:S(),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:b(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:j(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${p({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:O(),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:m()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?E():u(),onSelect:()=>void d(e)},{label:w(),onSelect:()=>void f(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|